125 lines
4.7 KiB
PHP
125 lines
4.7 KiB
PHP
<?
|
|
//echo var_dump($_SERVER);
|
|
$base_url = $_SERVER['HTTP_HOST'];
|
|
if(isset($_POST['race'])) $race_to_write = $_POST['race'];else header("Location: http://$base_url");
|
|
$email_check = md5($_POST['email']);
|
|
include './lib/get_races.php'; //contains list of races, and checks if the email has already is present in DB
|
|
foreach($races as $race){
|
|
$race_blob[$race['ID']] = $race['NAME'];
|
|
}
|
|
if(isset($_POST['fname']) && strlen($_POST['fname']) > 0){ $fname = $_POST['fname'];} else header("Location: http://$base_url/?write_success=false&reason=Jmeno_je_potreba_vyplnit");
|
|
if(isset($_POST['lname']) && strlen($_POST['lname']) > 0){ $lname = $_POST['lname'];} else header("Location: http://$base_url/?write_success=false&reason=Prijmeni_taky");
|
|
if(isset($_POST['email']) && strlen($_POST['email']) > 0){ $email = $_POST['email'];} else header("Location: http://$base_url/?write_success=false&reason=Bez_mailu_to_nepude");
|
|
if(isset($_POST['phone']) && strlen($_POST['phone']) > 0){ $phone = $_POST['phone'];} else header("Location: http://$base_url/?write_success=false&reason=Telefon_potrebuji");
|
|
if(isset($_POST['nick']) && strlen($_POST['nick']) > 0){ $nick = $_POST['nick'];} else header("Location: http://$base_url/?write_success=false&reason=Nejak_se_jemnovat_musite");
|
|
|
|
|
|
if(isset($_POST['confirm'])){
|
|
if($_POST['confirm'] == "true"){
|
|
include "./lib/write_registered.php";
|
|
//if($write_success['result']){
|
|
// header("Location: http://$base_url/?write_success=true&reason=".$write_success['reason']."");
|
|
//}
|
|
//else{
|
|
// header("Location: http://$base_url/?write_success=false&reason=".$write_success['reason']."");
|
|
// //echo "Error: " . $stm . "<br>" . $conn->error;
|
|
//}
|
|
//die();
|
|
}
|
|
else {
|
|
echo "Oops.";
|
|
}
|
|
}
|
|
|
|
?>
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="cs">
|
|
<head>
|
|
<title>Kolské Borec - Registrace</title>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
|
|
<link rel="stylesheet" href="https://www.w3schools.com/lib/w3-theme-black.css">
|
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto">
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.3.0/css/font-awesome.min.css">
|
|
</head>
|
|
|
|
<body class="w3-black w3-center">
|
|
<div class="w3-content w3-padding">
|
|
<h1>Rekapitulace Registrace</h1>
|
|
<?
|
|
if(isset($_POST['confirm'])){
|
|
if($write_success['result']){
|
|
echo "<h2 class=\"w3-green\">".$write_success['reason']."</h2>";
|
|
?>
|
|
<table class="w3-table w3-striped w3-bordered w3-border w3-white">
|
|
<tr>
|
|
<th>ID</th>
|
|
<th>Jméno</th>
|
|
<th>Email</th>
|
|
<th>Telefon</th>
|
|
<th>Přezdívka / Team</th>
|
|
<th>Závod</th>
|
|
</tr>
|
|
<tr>
|
|
<td><? echo $logged_racer['ID']; ?></td>
|
|
<td><? echo $logged_racer['NAME'].' '.$logged_racer['SURNAME']; ?></td>
|
|
<td><? echo $logged_racer['EMAIL']; ?></td>
|
|
<td><? echo $logged_racer['PHONE']; ?></td>
|
|
<td><? echo $logged_racer['NICK']; ?></td>
|
|
<td><? echo $race_blob[$logged_racer['RACE']]; ?></td>
|
|
</tr>
|
|
</table>
|
|
<h3><a href="../">Zpátky na hlavní stránku</a></h3>
|
|
<?
|
|
}
|
|
else{
|
|
echo "<h2 class=\"w3-red\">".$write_success['reason']."</h2>";
|
|
echo "<h3><a href=\"../\">Zpátky na hlavní stránku</a></h3>";
|
|
}
|
|
}
|
|
else{
|
|
if(!$unique_email){
|
|
echo "<h2 class=\"w3-red\">Email existuje</h2>";
|
|
}
|
|
?>
|
|
<table class="w3-table w3-striped w3-bordered w3-border w3-white">
|
|
<tr>
|
|
<th>Jméno</th>
|
|
<th>Email</th>
|
|
<th>Telefon</th>
|
|
<th>Přezdívka / Team</th>
|
|
<th>Závod</th>
|
|
</tr>
|
|
<tr>
|
|
<td><? echo $_POST['fname'].' '.$_POST['lname']; ?></td>
|
|
<td><? echo $_POST['email']; ?></td>
|
|
<td><? echo $_POST['phone']; ?></td>
|
|
<td><? echo $_POST['nick']; ?></td>
|
|
<td><? echo $race_blob[$race_to_write]; ?></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
<div class="w3-padding">
|
|
<form method="post" action="./register.php">
|
|
<input type="hidden" name="confirm" value="true">
|
|
<input type="hidden" name="fname" value="<? echo $_POST['fname']; ?>">
|
|
<input type="hidden" name="lname" value="<? echo $_POST['lname']; ?>">
|
|
<input type="hidden" name="email" value="<? echo $_POST['email']; ?>">
|
|
<input type="hidden" name="phone" value="<? echo $_POST['phone']; ?>">
|
|
<input type="hidden" name="nick" value="<? echo $_POST['nick']; ?>">
|
|
<input type="hidden" name="race" value="<? echo $race_to_write; ?>">
|
|
<input type="hidden" name="email_check" value="<? echo $rnd_link; ?>">
|
|
<input type="submit" class="w3-button w3-green w3-round-large" value="Jo, to vypadá dobře, Potvrzuji účast">
|
|
</form>
|
|
</div>
|
|
<?
|
|
// konec predregistracni casti
|
|
}
|
|
?>
|
|
|
|
</body>
|
|
</html>
|
|
|