session_start(); include("config.inc.php"); include("functions.inc.php"); $success = 0; if($_POST["register"]==1) { $error = 0; if($_POST["group"]=="") { $error_group = 1; $error = 1;} if($_POST["city"]=="") { $error_city = 1; $error = 1;} if($_POST["country"]=="") { $error_country = 1; $error = 1;} if($_POST["dob_month"]== 1 || $_POST["dob_month"]==3 || $_POST["dob_month"]==5 || $_POST["dob_month"]==7 || $_POST["dob_month"]==10 || $_POST["dob_month"]==12) { if($_POST["dob_day"] < 1 || $_POST["dob_day"] > 31) { $error_dob_day = 1; $error = 1;} } if($_POST["dob_month"]==4 || $_POST["dob_month"]==6 || $_POST["dob_month"]==8 || $_POST["dob_month"]==9 || $_POST["dob_month"]==11) { if($_POST["dob_day"] < 1 || $_POST["dob_day"] > 30) { $error_dob_day = 1; $error = 1;} } if($_POST["dob_month"]==2) { if(date('L', strtotime($_POST["dob_year"]."-01-01")) == 1) { if($_POST["dob_day"] < 1 || $_POST["dob_day"] > 29) { $error_dob_day = 1; $error = 1;} } else { if($_POST["dob_day"] < 1 || $_POST["dob_day"] > 28) { $error_dob_day = 1; $error = 1;} } } if($_POST["dob_day"]=="") { $error_dob_day = 1; $error = 1;} if($_POST["dob_month"]=="") { $error_dob_month = 1; $error = 1;} if($_POST["dob_year"]=="") { $error_dob_year = 1; $error = 1;} if($_POST["email"]=="") { $error_email = 1; $error = 1;} if($_POST["phone"]=="") { $error_phone = 1; $error = 1;} if($_POST["first_name"]=="") { $error_first_name = 1; $error = 1;} if($_POST["last_name"]=="") { $error_last_name = 1; $error = 1;} if($_POST["postcode"]=="") { $error_postcode = 1; $error = 1;} if($_POST["sex"]=="") { $error_sex = 1; $error = 1;} if($_POST["street"]=="") { $error_street = 1; $error = 1;} if($_POST["insurance"]=="") { $error_insurance = 1; $error = 1;} if($_POST["brand"]=="") { $error_brand = 1; $error = 1;} if($_POST["model"]=="") { $error_model = 1; $error = 1;} //if($_POST["registration"]=="") { $error_registration = 1; $error = 1;} if($_POST["ccm"]=="") { $error_ccm = 1; $error = 1;} if($_POST["disclaimer"]=="") { $error_disclaimer = 1; $error = 1;} if($_POST["privacy"]=="") { $error_privacy = 1; $error = 1;} if($_POST["payment"]=="") { $error_payment = 1; $error = 1;} if($error==0) { $query = mysql_query("SELECT * FROM ".$prefix."participations where session_id = '".session_id()."'"); if(mysql_num_rows($query) == 0) { $query2 = mysql_query("SELECT * FROM ".$prefix."events where id_event = '".$_GET["event"]."'"); $fee = mysql_result($query2, 0, "fee"); $success_session = session_id(); $insert1 = mysql_query("INSERT INTO ".$prefix."persons (lastname, firstname, sex, birthday, street, postcode, city, country, email, phone, insurance) values ( '".$_POST["last_name"]."', '".$_POST["first_name"]."', '".$_POST["sex"]."', '".$_POST["dob_day"].".".$_POST["dob_month"].".".$_POST["dob_year"]."', '".$_POST["street"]."', '".$_POST["postcode"]."', '".$_POST["city"]."', '".$_POST["country"]."', '".$_POST["email"]."', '".$_POST["phone"]."', '".$_POST["insurance"]."'); ")or die(mysql_error()); $last_id_person = mysql_insert_id(); $insert2 = mysql_query("INSERT INTO ".$prefix."bikes (brand, model, registration, ccm) values ( '".$_POST["brand"]."', '".$_POST["model"]."', '".$_POST["registration"]."', '".$_POST["ccm"]."'); ")or die(mysql_error()); $last_id_bike = mysql_insert_id(); $insert3 = mysql_query("INSERT INTO ".$prefix."participations (id_person, id_event, id_bike, id_group, calc_fee, payment_type, record_created, session_id) values ( '".$last_id_person."', '".$_GET["event"]."', '".$last_id_bike."', '".$_POST["group"]."', '".$fee."', 'unknown', '".time()."', '".session_id()."'); ")or die(mysql_error()); $last_id_participant = mysql_insert_id(); // include("email.php5"); session_regenerate_id(true); //header("location: confirm.html?event=".$_GET["event"]."&b=".$last_id_participant); header("location: confirm.html?w=".md5($success_session)); } else { $success = 2; } } else { } } $chosen_event = $_GET["event"]; if($chosen_event==""){ header("location: index.html"); } $query=mysql_query("select * from ".$prefix."events where id_event='$chosen_event'"); if($query){ if(mysql_num_rows($query)==1){ $title = mysql_result($query, 0, "title"); $description = mysql_result($query, 0, "description"); $date = date("d.m.Y",mysql_result($query, 0, "date")); $place = mysql_result($query, 0, "place"); $registration_end_date = mysql_result($query, 0, "registration_end_date"); $fee = mysql_result($query, 0, "fee"); } else { header("location: index.html"); } } else { header("location: index.html"); } include("header.inc.php"); ?>