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 - Areas of Expertise Information");
echo "<< ".i18n("Back to Judges Registration Summary")."
";
echo "
";
if($_POST['action']=="save")
{
//first delete all their old associations for this year..
mysql_query("DELETE FROM judges_expertise WHERE judges_id='".$_SESSION['judges_id']."' AND year='".$config['FAIRYEAR']."'");
if(!is_array($_POST['division']))
$_POST['division']=array();
if(!is_array($_POST['subdivision']))
$_POST['subdivision']=array();
foreach($_POST['division'] AS $key=>$val)
{
mysql_query("INSERT INTO judges_expertise (judges_id, projectdivisions_id, val, year) VALUES ('".$_SESSION['judges_id']."','$key','$val','".$config['FAIRYEAR']."')");
}
foreach($_POST['subdivision'] AS $key=>$val)
{
mysql_query("INSERT INTO judges_expertise (judges_id, projectsubdivisions_id, val, year) VALUES ('".$_SESSION['judges_id']."','$key','$val','".$config['FAIRYEAR']."')");
}
echo notice(i18n("Areas of Expertise successfully saved"));
}
$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=expertiseStatus();
if($newstatus!="complete")
{
echo error(i18n("Areas of Expertise Information Incomplete"));
}
else
{
echo happy(i18n("Areas of Expertise Information Complete"));
}
echo "