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 "<< ".i18n("Back to Judges Registration Summary")."
";
echo "
";
if($_POST['action']=="save")
{
$dob=$_POST['year']."-".$_POST['month']."-".$_POST['day'];
if($_POST['catpref']) $catpref="'".$_POST['catpref']."'";
else $catpref="null";
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']))."', ".
"phonehome='".mysql_escape_string(stripslashes($_POST['phonehome']))."', ".
"phonework='".mysql_escape_string(stripslashes($_POST['phonework']))."', ".
"phonecell='".mysql_escape_string(stripslashes($_POST['phonecell']))."', ".
"organization='".mysql_escape_string(stripslashes($_POST['organization']))."', ".
"catpref=$catpref, ".
"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']))."', ".
"willing_chair='".mysql_escape_string(stripslashes($_POST['willing_chair']))."', ".
"attending_lunch='".mysql_escape_string(stripslashes($_POST['attending_lunch']))."', ".
"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 "