science-ation/register_judges_personal.php
james 1b393c1bb0 Commit all work from the weekend:
- judges registration
 - small changes to participant registraiton
2004-12-19 23:16:46 +00:00

114 lines
4.9 KiB
PHP

<?
require("common.inc.php");
include "register_judges.inc.php";
//authenticate based on email address and registration number from the SESSION
if(! ($_SESSION['email'] && $_SESSION['judges_id']) )
{
header("Location: register_judges.php");
exit;
}
$q=mysql_query("SELECT id FROM judges WHERE email='".$_SESSION['email']."' AND id='".$_SESSION['judges_id']."'");
echo mysql_error();
if(mysql_num_rows($q)==0)
{
header("Location: register_judges.php?action=logout");
exit;
}
//send the header
send_header("Judges Registration - Personal Information");
echo "<a href=\"register_judges_main.php\">&lt;&lt; ".i18n("Back to Judges Registration Summary")."</a><br />";
echo "<br />";
if($_POST['action']=="save")
{
$dob=$_POST['year']."-".$_POST['month']."-".$_POST['day'];
mysql_query("UPDATE judges SET ".
"firstname='".mysql_escape_string(stripslashes($_POST['firstname']))."', ".
"lastname='".mysql_escape_string(stripslashes($_POST['lastname']))."', ".
"email='".mysql_escape_string(stripslashes($_POST['email']))."', ".
"address='".mysql_escape_string(stripslashes($_POST['address']))."', ".
"city='".mysql_escape_string(stripslashes($_POST['city']))."', ".
"province='".mysql_escape_string(stripslashes($_POST['province']))."', ".
"postalcode='".mysql_escape_string(stripslashes($_POST['postalcode']))."', ".
"phone='".mysql_escape_string(stripslashes($_POST['phone']))."', ".
"organization='".mysql_escape_string(stripslashes($_POST['organization']))."', ".
"years_school='".mysql_escape_string(stripslashes($_POST['years_school']))."', ".
"years_regional='".mysql_escape_string(stripslashes($_POST['years_regional']))."', ".
"years_national='".mysql_escape_string(stripslashes($_POST['years_national']))."', ".
"dateofbirth='$dob' ".
"WHERE id='".$_SESSION['judges_id']."'");
echo mysql_error();
echo notice(i18n("%1 %2 successfully updated",array($_POST['firstname'],$_POST['lastname'])));
}
$q=mysql_query("SELECT * FROM judges WHERE email='".$_SESSION['email']."' AND id='".$_SESSION['judges_id']."'");
$judgeinfo=mysql_fetch_object($q);
//output the current status
$newstatus=personalStatus();
if($newstatus!="complete")
{
echo error(i18n("Personal Information Incomplete"));
}
else
{
echo happy(i18n("Personal Information Complete"));
}
echo "<form name=\"personalform\" method=\"post\" action=\"register_judges_personal.php\">\n";
echo "<input type=\"hidden\" name=\"action\" value=\"save\">\n";
echo "<table>\n";
echo "<tr>\n";
echo " <td>".i18n("First Name")."</td><td><input type=\"text\" name=\"firstname\" value=\"$judgeinfo->firstname\" /></td>\n";
echo " <td>".i18n("Last Name")."</td><td><input type=\"text\" name=\"lastname\" value=\"$judgeinfo->lastname\" /></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td>".i18n("Email Address")."</td><td><input type=\"text\" name=\"email\" value=\"$judgeinfo->email\" /></td>\n";
echo " <td>".i18n("City")."</td><td><input type=\"text\" name=\"city\" value=\"$judgeinfo->city\" /></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td>".i18n("Address")."</td><td><input type=\"text\" name=\"address\" value=\"$judgeinfo->address\" /></td>\n";
echo " <td>".i18n("Province")."</td><td><input type=\"text\" name=\"province\" value=\"$judgeinfo->province\" /></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td>".i18n("Postal Code")."</td><td><input type=\"text\" name=\"postalcode\" value=\"$judgeinfo->postalcode\" /></td>\n";
echo " <td>".i18n("Phone")."</td><td><input type=\"text\" name=\"phone\" value=\"$judgeinfo->phone\" /></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td>".i18n("Date of Birth")."</td><td>\n";
list($year,$month,$day)=split("-",$judgeinfo->dateofbirth);
echo "<table><tr><td>";
emit_day_selector("day",$day);
echo "</td><td>\n";
emit_month_selector("month",$month);
echo "</td><td>\n";
emit_year_selector("year",$year,date("Y")-$config['maxjudgeage'],date("Y")-$config['minjudgeage']);
echo "</td></tr></table>\n";
echo " </td>\n";
echo " <td>".i18n("Organization")."</td><td><input type=\"text\" name=\"organization\" value=\"$judgeinfo->organization\" /></td>\n";
echo "</tr>";
echo "<tr><td colspan=\"4\"><hr /></td></tr>";
echo "<tr>\n";
echo " <td colspan=\"3\">".i18n("Years of judging experience at school/local level")."</td><td><input type=\"text\" name=\"years_school\" value=\"$judgeinfo->years_school\" size=\"3\" ></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td colspan=\"3\">".i18n("Years of judging experience at regional level")."</td><td><input type=\"text\" name=\"years_regional\" value=\"$judgeinfo->years_regional\" size=\"3\" ></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td colspan=\"3\">".i18n("Years of judging experience at national level")."</td><td><input type=\"text\" name=\"years_national\" value=\"$judgeinfo->years_national\" size=\"3\" ></td>\n";
echo "</tr>\n";
echo "</table>";
echo "<input type=\"submit\" value=\"".i18n("Save Personal Information")."\" />\n";
echo "</form>";
send_footer();
?>