diff --git a/index.htm b/index.htm index 85e59eddd..dc914a8f8 100644 --- a/index.htm +++ b/index.htm @@ -6,11 +6,14 @@
-Welcome to the website of the Cambridge University Caving Club expeditions to Austria.
+ +New: Expo 2004 sign-up form now available. +
diff --git a/signup/main.css b/signup/main.css new file mode 100644 index 000000000..5332d9b9d --- /dev/null +++ b/signup/main.css @@ -0,0 +1,37 @@ + + diff --git a/signup/submit.php b/signup/submit.php new file mode 100644 index 000000000..49ccf4f50 --- /dev/null +++ b/signup/submit.php @@ -0,0 +1,602 @@ +
+ "", + "address" => "", + "kinname" => "", + "kinaddress" => "", + "phone" => "", + "kinphone" => "", + "email" => "", + "kinemail" => "", + "relation" => "", + "veggie" => "no", + "student" => "yes", + "insurance" => "BCRA", + "bcranum" => "", + "leave_uk" => "", + "length_of_stay" => "", + "transport_ok" => "yes", + "transport_out" => "need", + "transport_back" => "need", + "from_uk" => "", + "returning_uk" => "", + "tent" => "no", + "top_tent_cap" => "", + "btent" => "no", + "base_tent_cap" => "", + "tent_share" => "yes", + "share_condition" => "", + "medic_info" => "", + "extra_info" => "", + "aims" => "", + "lifts_out" => "yes", + "lifts_back" => "yes", + "no_out" => "2", + "no_back" => "2", + "take_out" => "", + "take_back" => "", + "transport_info" => "", + "medication" => "", + "allergies" => "", + "bivvy" => "" + ); +} + +function fillVars () +{ + initVars (); + + global $vars; + $vars[name] = stripslashes($_POST[name]); + $vars[address] = stripslashes($_POST[address]); + $vars[phone] = stripslashes($_POST[phone]); + $vars[kinname] = stripslashes($_POST[kinname]); + $vars[kinaddress] = stripslashes($_POST[kinaddress]); + $vars[phone] = stripslashes($_POST[phone]); + $vars[kinphone] = stripslashes($_POST[kinphone]); + $vars[email] = stripslashes($_POST[email]); + $vars[kinemail] = stripslashes($_POST[kinemail]); + $vars[relation] = stripslashes($_POST[relation]); + $vars[veggie] = stripslashes($_POST[veggie]); + $vars[student] = stripslashes($_POST[student]); + $vars[transport_ok] = stripslashes($_POST[transport_ok]); + $vars[from_uk] = stripslashes($_POST[from_uk]); + $vars[returning_uk] = stripslashes($_POST[returning_uk]); + $vars[tent] = stripslashes($_POST[tent]); + $vars[top_tent_cap] = stripslashes($_POST[top_tent_cap]); + $vars[btent] = stripslashes($_POST[btent]); + $vars[base_tent_cap] = stripslashes($_POST[base_tent_cap]); + $vars[medic_info] = stripslashes($_POST[medic_info]); + $vars[extra_info] = stripslashes($_POST[extra_info]); + $vars[aims] = stripslashes($_POST[aims]); + $vars[transport_info] = stripslashes($_POST[transport_info]); + $vars[medication] = stripslashes($_POST[medication]); + $vars[allergies] = stripslashes($_POST[allergies]); + $vars[bivvy] = stripslashes($_POST[bivvy]); +} + +function errorPage ($err) +{ + echo <<$err +END; +} + +function securityChecks () +{ + global $vars; + + $error = ""; + + if ($vars[name] == "") $error = "You must specify your full name."; + elseif ($vars[address] == "") $error = "You must specify your address."; + elseif ($vars[kinname] == "") $error = "You must specify the name of your next-of-kin."; + elseif ($vars[kinaddress] == "") $error = "You must specify your next-of-kin's address."; + elseif ($vars[kinphone] == "") $error = "You must specify your next-of-kin's phone number."; + elseif ($vars[email] != "" && !ereg( '^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+'. '@'. '[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.' . '[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$', $vars[email])) $error = "Invalid email address (leave blank if you don't have one)."; + elseif ($vars[kinemail] != "" && !ereg( '^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+'. '@'. '[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.' . '[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$', $vars[kinemail])) $error = "Invalid next-of-kin email address (leave blank if they don't have one)."; + elseif ($vars[veggie] != "yes" && $vars[veggie] != "no" && $vars[veggie] != "mostly") $error = "Invalid veggie specification."; + elseif ($vars[student] != "yes" && $vars[student] != "no") $error = "Invalid student specification."; + elseif ($vars[transport_ok] != "yes" && $vars[transport_ok] != "no") $error = "Invalid transport specification given."; + elseif ($vars[bivvy] != "" && $vars[bivvy] != "yes") $error = "Invalid bivvy specification."; + elseif ($vars[tent] != "" && $vars[tent] != "yes") $error = "Invalid Top Camp tent specification."; + elseif ($vars[btent] != "" && $vars[btent] != "yes") $error = "Invalid Base Camp tent specification."; + elseif ($vars[tent] == "yes" && ($vars[top_tent_cap] < 1 || $vars[top_tent_cap] > 9)) $error = "Invalid Top Camp tent capacity given."; + elseif ($vars[btent] == "yes" && ($vars[base_tent_cap] < 1 || $vars[base_tent_cap] > 9)) $error = "Invalid Base Camp tent capacity given."; + + if ($error != "") { + echo "
This is the application form for Expo 2004, which runs from 10th July until 14th August. + +
This form is not secure and by submitting + this form you consent to its contents being used for Expo purposes and + being included in the Bier Book on Expo.
+ +Please report any problems with this form to the + webmaster.
+END; +} + +function insertSlashes () +{ +} + +function printHidden () +{ + global $vars; + while (list ($key, $value) = each($vars)) + echo ""; +} + +function previewForm () +{ + global $vars; + + echo <<Please check the details below and then select one of the options at the + bottom of the page. +
+
+END; +} + +function updateDatabase () +{ + global $vars; + + $temp = ""; + + $address1 = rtrim(ereg_replace(",,", ",", ereg_replace("(\r\n|\n|\r)", ", ", $vars[address])), " \t\n\r\0\x0b.,"); + $kinaddress1 = rtrim(ereg_replace(",,", ",", ereg_replace("(\r\n|\n|\r)", ", ", $vars[kinaddress])), " \t\n\r\0\x0b.,"); + + $temp = $temp . "Form submission from:\n"; + $temp = $temp . " $vars[name]\n"; + $temp = $temp . " $address1\n"; + $temp = $temp . " Phone: $vars[phone]\n"; + $temp = $temp . " Email: "; + if ($vars[email] == "") $temp = $temp . "none"; + else $temp = $temp . "$vars[email]"; + + $temp = $temp . "\n\n"; + $temp = $temp . "Next of kin:\n"; + $temp = $temp . " $vars[kinname]\n"; + $temp = $temp . " $kinaddress1\n"; + $temp = $temp . " Phone: $vars[kinphone]\n"; + $temp = $temp . " Email: "; + if ($vars[kinemail] == "") $temp = $temp . "none"; + else $temp = $temp . "$vars[kinemail]"; + + $temp = $temp . "\n\n"; + $temp = $temp . "Vegetarian? $vars[veggie]\n"; + $temp = $temp . "Student/unwaged? $vars[student]\n\n"; + + if ($vars[transport_ok] == "yes") { + $temp = $temp . "Transport arrangements page is correct for this person.\n"; + } + else { + $temp = $temp . "Transport arrangements need changing to:\n"; + $temp = $temp . "$vars[transport_info]\n"; + $temp = $temp . "(Mark has been emailed and will update the page.)\n"; + } + + $temp = $temp . "\nTaking a bivvy bag? $vars[bivvy]\n"; + $temp = $temp . "\nTaking a Top Camp tent? $vars[tent]"; + if ($vars[tent] == "yes") + $temp = $temp . " (capacity $vars[top_tent_cap])\n"; + else $temp = $temp . "\n"; + $temp = $temp . "\nTaking a Base Camp tent? $vars[btent]"; + if ($vars[btent] == "yes") + $temp = $temp . " (capacity $vars[base_tent_cap])\n"; + else $temp = $temp . "\n"; + + $temp = $temp . "\nAllergies: $vars[allergies]\n"; + $temp = $temp . "Medication to be taken in Austria: $vars[medication]\n"; + $temp = $temp . "Other medical conditions: $vars[medic_info]\n\n"; + + $temp = $temp . "Aims for Expo: $vars[aims]\n\n"; + + $temp = $temp . "Other information: $vars[extra_info]\n"; + + mail ("David LoefflerSubmission successful! + +
Thank you for your application. Please address any questions + to the Expo Leader, Olly Madge. + +
Return to the main Expo page. +END; +} + +virtual("main.css"); + +switch ($_GET[action]) { + case "blank": + initVars (); + showForm (); + break; + + case "edit": + fillVars (); + showForm (); + break; + + case "preview": + fillVars (); + if (securityChecks ()) { + previewForm (); + } + break; + + case "commit": + switch ($_POST[submit]) { + case "I confirm that all details are correct.": + fillVars (); + if (securityChecks ()) { + insertSlashes (); + submitForm (); + } + break; + + case "Modify form."; + fillVars (); + showForm (); + break; + + default: + errorPage ("Invalid script action."); + } + break; + + default: + errorPage ("Invalid script action."); + break; +} + +?> + +