$message = "";
$emailclass = "basictext";
$nameclass = "basictext";
$capclass = "basictext";
$genderclass = "basictext";
$ageclass = "basictext";
$countryclass = "basictext";
$other_countryclass = "basictext";
$first_timeclass = "basictext";
$f1nclass = "basictext";
$f1eclass = "basictext";
$f2nclass = "basictext";
$f2eclass = "basictext";
$commentsclass = "basictext";
function jtime() {
$b = time () + 57600;
$fixed_time = date("D, F jS G:i a",$b);
return $fixed_time;
}
$f_time = jtime();
if ($_POST['process'] == 1) {
$pattern = '/.*@.*\..*/';
if(get_magic_quotes_gpc()) {
$email = stripslashes($_POST['email']);
$name = stripslashes($_POST['name']);
$cap = stripslashes($_POST['cap']);
$gender = stripslashes($_POST['gender']);
$age = stripslashes($_POST['age']);
$country = stripslashes($_POST['country']);
$other_country = stripslashes($_POST['other_country']);
$first_time = stripslashes($_POST['first_time']);
$f1n = stripslashes($_POST['f1n']);
$f1e = stripslashes($_POST['f1e']);
$f2n = stripslashes($_POST['f2n']);
$f2e = stripslashes($_POST['f2e']);
$comments = stripslashes($_POST['comments']);
} else {
$email = $_POST['email'];
$name = $_POST['name'];
$gender = $_POST['gender'];
$age = $_POST['age'];
$country = $_POST['country'];
$other_country = $_POST['other_country'];
$first_time = $_POST['first_time'];
$f1n = $_POST['f1n'];
$f1e = $_POST['f1e'];
$f2n = $_POST['f2n'];
$f2e = $_POST['f2e'];
$comments = $_POST['comments'];
}
$c_name = mysql_real_escape_string($name);
$c_other_country = mysql_real_escape_string($other_country);
$c_f1n = mysql_real_escape_string($f1n);
$c_f2n = mysql_real_escape_string($f2n);
$c_comments = mysql_real_escape_string($comments);
if (preg_match($pattern, $_POST['email']) == 0) {
$message = "Cannot insert email. The data is invalid.";
$emailclass = "errortext"; }
else if(preg_match("/[^a-zA-Z0-9\.\-\AÅN\aÅN\OÅN\oÅN\UÅN\uÅN\
]+$/s",$gender)) {
$message = "Cannot insert gender. The data is invalid.";
$genderclass = "errortext"; }
else if(!is_numeric($age)) {
$message = "Cannot insert age. The data is invalid.";
$ageclass = "errortext"; }
else if(preg_match("/[^a-zA-Z0-9\.\-\AÅN\aÅN\OÅN\oÅN\UÅN\uÅN\
]+$/s",$country)) {
$message = "Cannot insert gender. The data is invalid.";
$countryclass = "errortext"; }
else if(preg_match("/[^a-zA-Z0-9\.\-\AÅN\aÅN\OÅN\oÅN\UÅN\uÅN\
]+$/s",$first_time)) {
$message = "Cannot insert country. The data is invalid.";
$other_countryclass = "errortext"; }
else if(preg_match($pattern, $_POST['f1e']) == 0 and strlen($_POST['f1e'])) {
$message = "Cannot insert 1st friend email. The data is invalid.";
$f1eclass = "errortext"; }
else if(preg_match($pattern, $_POST['f2e']) == 0 and strlen($_POST['f2e'])) {
$message = "Cannot insert 2nd friend email. The data is invalid.";
$f2eclass = "errortext"; }
else if (($_POST['cap']) != "105") {
$message = "You answered the skill testing question wrong!";
$capclass = "errortext"; }
else {
$query = "Insert into res (email,name,gender,age,country,other_country,first_time,f1n,f1e,f2n,f2e,comments,t_stamp) values ('$email', '$c_name', '$gender', '$age', '$country', '$c_other_country', '$first_time', '$c_f1n', '$f1e', '$c_f2n', '$f2e', '$c_comments', '$f_time')";
$result = mysql_query($query) or die("Insert failed");
function getMaxOrderNumber($db)
{
$result = $db->execute(”SELECT MAX(`r_id`) FROM `” . res . “`”);
return $result->fields['MAX(`r_id`)'];
}
$orderNumber = getMaxOrderNumber($db);
$tr_id = $orderNumber;
$urlname = urlencode($tr_id);
header(”location: thankyou.php?&tr_id=$urlname”); }
}
?>
All information from this reservation form will be used to make our parties better. Your email will ONLY be used to notify you of future NGO Friends events. Thank you for registering, we look forward to seeing you at the party!


English
日本語

