Signup page php syntax updates for 2025

This commit is contained in:
Expo on server 2024-11-08 03:16:37 +00:00
parent eff0d61f54
commit 93871f0a86

View File

@ -54,32 +54,32 @@ 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]);
$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)
@ -100,31 +100,31 @@ function securityChecks ()
$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 ($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 "<title>Expo 2024 Application Form Error -- Cambridge University Caving Club</title>";
echo "<title>Loser Expo 2025 Application Form Error</title>";
echo "</head>";
echo "<FORM ACTION=\"http://expo.survex.com/signup/submit.php?action=commit\" METHOD=\"POST\">";
printHidden ();
echo <<<END
<h1>Expo 2004 Application Form Error</h1>
<h1>Expo 2025 Application Form Error</h1>
<p><b>Sorry, but you have made a mistake on your form:</b><center>
$error
</center>
@ -144,14 +144,14 @@ function showForm ()
global $vars;
echo <<<END
<title>Expo 2024 Application Form -- Cambridge University Caving Club</title>
<title>Loser Expo 2025 Application Form</title>
</head>
END;
echo <<<END
<h1>Expo 2024 Signup Form</h1>
<h1>Expo 2025 Signup Form</h1>
<p>This is the official signup form for Expo 2024, which runs from 6th July until 17th August.
<p>This is the official signup form for Expo 2024, which runs from ? until ?.
<p>This form is not secure and by submitting
this form you consent to its contents being used for Expo purposes and
@ -182,7 +182,7 @@ END;
<tr>
<td align=right>Phone:</td><td><input name="phone" tabindex=2 value="$vars[phone]"></td>
<td align=right>Phone:</td><td><input name="kinphone" tabindex=6 value="$vars[kinphone]"></td>
<td align=right>Phone:</td><td><input name="kinphone" tabindex=6 value="$vars[kinphone2]"></td>
</tr>
<tr>
@ -202,24 +202,24 @@ END;
<td><b>Are you a student/unwaged?</b></td></tr>
<tr><td><INPUT TYPE="radio" NAME="veggie" VALUE="yes" tabindex=9
END;
if ($vars[veggie] == "yes") echo " checked";
if ($vars["veggie"] == "yes") echo " checked";
echo <<<END
>Yes</td><td><INPUT TYPE="radio" NAME="student" VALUE="yes" tabindex=12
END;
if ($vars[student] == "yes") echo " checked";
if ($vars["student"] == "yes") echo " checked";
echo <<<END
>Yes</td></tr>
<tr><td><INPUT TYPE="radio" NAME="veggie" VALUE="mostly" tabindex=10
END;
if ($vars[veggie] == "mostly") echo " checked";
if ($vars["veggie"] == "mostly") echo " checked";
echo <<<END
>Mostly</td><td><INPUT TYPE="radio" NAME="student" VALUE="no" tabindex=13
END;
if ($vars[student] <> "yes") echo " checked";
if ($vars["student"] <> "yes") echo " checked";
echo <<<END
>No</td></tr><tr><td><INPUT TYPE="radio" NAME="veggie" VALUE="no" tabindex=11
END;
if ($vars[veggie] <> "yes" && $vars[veggie] <> "mostly") echo " checked";
if ($vars["veggie"] <> "yes" && $vars["veggie"] <> "mostly") echo " checked";
echo <<<END
>No</td><td></td></tr></table>
@ -229,13 +229,13 @@ END;
<p><input type="radio" name="transport_ok" value="yes" tabindex=38
END;
if ($vars[transport_ok] == "yes") echo " checked";
if ($vars["transport_ok"] == "yes") echo " checked";
echo <<<END
>The transport page shows my arrangements correctly.</input>
<br><input type="radio" name="transport_ok" value="no" tabindex=39
END;
if ($vars[transport_ok] == "no") echo " checked";
if ($vars["transport_ok"] == "no") echo " checked";
echo <<<END
>The transport page does not show my arrangements correctly.</input>
@ -247,32 +247,30 @@ END;
<h3>Tents</h3>
<p>There will be two high camps in 2024:
<p>There will be two high camps in 2025:
<ul><li>the stone bridge bivvy site;
<li>the old Top Camp site, to be used for exploration of
Eisl&uuml;fth&ouml;hle.
<li>Garlic Cave.
</ul>
<p>There is space for three people in a Club tent at Base Camp.
There is space for five or six people in a Club tent at Top Camp.
At the stone bridge, a bivvy bag is not essential but useful if
you have one.
<p>Will you be taking any of the following (please tick/complete as appropriate):<BR>
<INPUT TYPE="checkbox" NAME="bivvy" VALUE="yes" tabindex=53
END;
if ($vars[bivvy] == "yes") echo " checked";
if ($vars["bivvy"] == "yes") echo " checked";
echo <<<END
> A bivvy bag suitable for the stone bridge.<br>
<INPUT TYPE="checkbox" NAME="tent" VALUE="yes" tabindex=50
END;
if ($vars[tent] == "yes") echo " checked";
if ($vars["tent"] == "yes") echo " checked";
echo <<<END
> A <INPUT NAME="top_tent_cap" SIZE=1 MAXSIZE=1 value="$vars[top_tent_cap]" tabindex=51> person
tent for the Top Camp site.<BR>
<INPUT TYPE="checkbox" NAME="btent" VALUE="yes" tabindex=52
END;
if ($vars[btent] == "yes") echo " checked";
if ($vars["btent"] == "yes") echo " checked";
echo <<<END
> A <INPUT NAME="base_tent_cap" SIZE=1 MAXSIZE=1 value="$vars[base_tent_cap]" tabindex=53> person
tent for Base Camp.<br>
@ -327,7 +325,7 @@ END;
<hr>
<p>Please report any problems with this form to the
<a href="mailto:Mark.Shinwell@cl.cam.ac.uk">webmaster</a>.</p>
<a href="mailto:wookey-expo@wookware.org">webmaster</a>.</p>
END;
}
@ -347,11 +345,11 @@ function previewForm ()
global $vars;
echo <<<END
<title>Expo 2024 Application Form Preview -- Cambridge University Caving Club</title>
<title>Loser Expo 2025 Application Form Preview</title>
</head>
END;
echo <<<END
<h1>Expo 2024 Application Form Preview</h1>
<h1>Loser Expo 2025 Application Form Preview</h1>
<p><b>Please check the details below and then select one of the options at the
bottom of the page.</b>
<hr>
@ -363,63 +361,63 @@ END;
printHidden ();
$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.,");
$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.,");
echo "<b>Full name: </b>$vars[name]. <br><b>Address: </b> $address1.<br>";
echo "<b>Phone: </b> $vars[phone].<br><b>Email: </b> ";
if ($vars[email] == "") echo "none"; else echo $vars[email];
if ($vars["email"] == "") echo "none"; else echo $vars["email"];
echo "<h3>Details for your $vars[relation]</h3><p>";
echo "<b>Full name: </b>$vars[kinname]. <br><b>Address: </b> $kinaddress1.<br>";
echo "<b>Phone: </b> $vars[kinphone].<br><b>Email: </b> ";
if ($vars[kinemail] == "") echo "none"; else echo $vars[kinemail];
if ($vars["kinemail"] == "") echo "none"; else echo $vars["kinemail"];
echo "<h2>Miscellany</h2> <p><ul><li>";
echo "You are";
switch ($vars[veggie]) {
switch ($vars["veggie"]) {
case "no": echo "n't"; break;
case "mostly": echo " mostly"; break;
default: break;
}
echo " a vegetarian.<li>You are";
if ($vars[student] == "no") echo "n't";
if ($vars["student"] == "no") echo "n't";
echo " a student/unwaged person.";
if ($vars[bivvy] == "yes")
if ($vars["bivvy"] == "yes")
echo "<li>You're taking a bivvy bag suitable for the stone bridge.";
if ($vars[tent] == "yes")
if ($vars["tent"] == "yes")
echo "<li>You're taking a $vars[top_tent_cap] person tent suitable for Top Camp.";
if ($vars[btent] == "yes")
if ($vars["btent"] == "yes")
echo "<li>You're taking a $vars[base_tent_cap] person tent suitable for Base Camp.";
echo "</ul><h2>Medical conditions</h2><ul>";
echo "<li>Allergies: ";
if ($vars[allergies] == "")
if ($vars["allergies"] == "")
echo "None.";
else
echo nl2br($vars[allergies]);
echo nl2br($vars["allergies"]);
echo "<li>Medication to be taken in Austria: ";
if ($vars[medication] == "")
if ($vars["medication"] == "")
echo "None.";
else
echo nl2br($vars[medication]);
echo nl2br($vars["medication"]);
echo "<li>Other medical conditions: ";
if ($vars[medic_info] == "")
if ($vars["medic_info"] == "")
echo "None.";
else
echo nl2br($vars[medic_info]);
echo nl2br($vars["medic_info"]);
echo "</ul>";
if ($vars[aims] != "") {
echo "<h2>Your aims for Expo</h3><p>";
echo nl2br($vars[aims]);
echo nl2br($vars["aims"]);
}
echo <<<END
@ -470,8 +468,8 @@ function updateDatabase ()
$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.,");
$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";
@ -487,14 +485,14 @@ function updateDatabase ()
$temp = $temp . " $kinaddress1\n";
$temp = $temp . " Phone: $vars[kinphone]\n";
$temp = $temp . " Email: ";
if ($vars[kinemail] == "") $temp = $temp . "none";
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") {
if ($vars["transport_ok"] == "yes") {
$temp = $temp . "Transport arrangements page is correct for this person.\n";
}
else {
@ -505,11 +503,11 @@ function updateDatabase ()
$temp = $temp . "\nTaking a bivvy bag? $vars[bivvy]\n";
$temp = $temp . "\nTaking a Top Camp tent? $vars[tent]";
if ($vars[tent] == "yes")
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")
if ($vars["btent"] == "yes")
$temp = $temp . " (capacity $vars[base_tent_cap])\n";
else $temp = $temp . "\n";
@ -521,16 +519,16 @@ function updateDatabase ()
$temp = $temp . "Other information: $vars[extra_info]\n";
mail ("David Loeffler <dl267@cam.ac.uk>\n",
mail ("Wookey <wookey@wookware.org>\n",
"Expo form from $vars[name]", $temp,
"From: Expo forms <mark@three-tuns.net>\n");
"From: Expo forms <expo@wookware.org>\n");
if ($vars[transport_ok] == "no") {
if ($vars["transport_ok"] == "no") {
$temp = "Transport page needs updating for $vars[name]:\n\n";
$temp = $temp . $vars[transport_info] . "\n";
mail ("Mark Shinwell <mark@three-tuns.net>",
mail ("Test Mail <wookey-expo@wookware.org>",
"Transport update from $vars[name]", $temp,
"From: Expo forms <mark@three-tuns.net>\n");
"From: Expo forms <expo@wookware.org>\n");
}
}
@ -546,12 +544,12 @@ echo <<<END
</head>
END;
echo <<<END
<h1>Expo 2024 Application</h1>
<h1>Loser Expo 2025 Application</h1>
<p><b>Submission successful!</b>
<p>Thank you for your application. Please address any questions
to the Expo Leader, <a href="mailto:jonathanlester88&#64hotmail.co.uk">Jono Lester</a>.
to the Expo Leader, <a href="mailto:harrykettle&#64gmail.com">Harry Kettle</a>.
<p><a href="http://expo.survex.com/">Return to the main Expo page</a>.
END;
@ -579,7 +577,7 @@ switch ($_GET["action"]) {
break;
case "commit":
switch ($_POST[submit]) {
switch ($_POST["submit"]) {
case "I confirm that all details are correct.":
fillVars ();
if (securityChecks ()) {