process_registration

[insert_php]
session_start();
$firstname = $_POST[‘firstname’];
$surname = $_POST[‘surname’];
$title = $_POST[‘title’];
$address = $_POST[‘address’];
$arrival = $_POST[‘arrival’];
$departure = $_POST[‘departure’];
$email = $_POST[’email’];
$phone = $_POST[‘phone’];
$diet = $_POST[‘diet’];
$accompany = $_POST[‘accompany’];

echo ““;
echo “Name: “. “” . ucfirst($firstname) . ” ” . strtoupper($surname) . ” (” . $title . “)” . “
“;
echo “
“;
echo “E-mail: “. ““. $email . “
“;
echo “Phone: “. ““. $phone . “
“;
echo “Address: “. ““. $address . “
“;
echo “Accompanying persons: “. ““. $accompany . “
“;
echo “
“;
echo “Date of arrival: “. “” . $arrival . “
“;
echo “Date of departure: ” . ““. $departure . “
“;
echo “
“;
echo “Dietary requirements: “. ““. $diet . “
“;
echo “
“;
echo “
“;

$error_msg=”;

if(empty($_SESSION[‘6_letters_code’]) ||
strcasecmp($_SESSION[‘6_letters_code’], $_POST[‘6_letters_code’]) != 0)
{
//Note: the captcha code is compared case insensitively.
//if you want case sensitive match, update the check above to
// strcmp()

echo “Captcha code: “. $_SESSION[‘6_letters_code’] .”
“;
echo “Entered code: “. $_POST[‘6_letters_code’] .”
“;

$error_msg.= “The captcha code does not match!”;
}

if(trim($_POST[“firstname”])==”) {
$error_msg.=”First name, “;
}
if(trim($_POST[“surname”])==”) {
$error_msg.=”Surname, “;
}
if(trim($_POST[“email”])==”) {
$error_msg.=”E-mail, “;
}
if(trim($_POST[“phone”])==”) {
$error_msg.=”Phone No., “;
}
if(trim($_POST[“address”])==”) {
$error_msg.=”Address, “;
}
if(trim($_POST[“arrival”])==”) {
$error_msg.=”Date of arrival, “;
}
if(trim($_POST[“departure”])==”) {
$error_msg.=”Date of departure, “;
}
/*
if(trim($_POST[“title”])==”) {
$error_msg.=”Title, “;
}
*/
/*
if(trim($_POST[“room”])==”) {
$error_msg.=”Prefered type of room, “;
}
*/
// display error message if any, if not, proceed to other processing
if($error_msg==”){
$data=”

\n”;
$data .=”

“.$title.”

\n”;
$data .=”

“.ucfirst($firstname).”

\n”;
$data .=”

“.ucfirst($surname).”

\n”;
$data .=”

“.$email.”

\n”;
$data .=”

“.$phone.”

\n”;
$data .=”

“.$accompany.”

\n”;
$data .=”

“.$diet.”

\n”;
$data .=”

“.$arrival.”

\n”;
$data .=”

“.$departure.”

\n”;
$data .=”

\n”;

$style =”” .
“table, td, th{border:thin solid gray; font-family:sans-serif;border-collapse:collapse;font-size: 11px;}”.
“th{background-color:#CBE3F1;color:gray;font-weight:normal;}”.
“”;

$tableh =”

\n”;
$tableh .=”

\n”;
$tableh .=”

\n”;
$tableh .=”

\n”;
$tableh .=”

\n”;
$tableh .=”

\n”;
$tableh .=”

\n”;
$tableh .=”

\n”;
$tableh .=”

\n”;
$tableh .=”

\n”;
$tableh .=”

\n”;
$tableh .=”

\n”;

/*
echo $style . $tableh . $data . “

Title First name Surname E-mail Phone Accompany Dietary requirements Arival Departure

” . “\n”;
$filename=’data_registeration.txt’;
$current = file_get_contents($filename);
$current .= $data;
file_put_contents($filename, $current);
$table .=”\n” . $style . $tableh . $current . “

\n” . “\n”;
$filename=’list_registration.html’;
file_put_contents($filename, $table);
*/

$to=”sig33@mech.kth.se”;
$subject=”Registration for SIG33 Workshop ” . $firstname . ” ” . $surname;
$body=”\n” . $style . $tableh . $data . “

\n” . “\n”;

$mailheader = “From: Registration@SIG33\r\n”;
$mailheader .= “Reply-To: sig33@mech.kth.se\r\n”;
$mailheader .= “MIME-Version: 1.0\r\n”;
$mailheader .= “Content-Type: text/html; charset=\”utf-8\”\n”;
$mailheader .= “Content-Transfer-Encoding: 8bit\n\n” ;

if (mail($to, $subject, $body, $mailheader)) {
echo(“

Thank you for your registration!

“);
} else {
echo(“

Rgeistration did not succeed!
“);
echo(“Please copy the text above and e-mail to sig33@mech.kth.se

“);

}
} else {
echo “ The following necessary information are missing: $error_msg“;
}
[/insert_php]