forked from science-ation/science-ation
83 lines
2.8 KiB
PHP
83 lines
2.8 KiB
PHP
<?
|
|
require("common.inc.php");
|
|
|
|
//authenticate based on email address and registration number from the SESSION
|
|
if(!$_SESSION['email'])
|
|
{
|
|
header("Location: register_participants.php");
|
|
exit;
|
|
}
|
|
if(! ($_SESSION['registration_number'] && $_SESSION['registration_id']))
|
|
{
|
|
header("Location: register_participants.php");
|
|
exit;
|
|
}
|
|
|
|
$q=mysql_query("SELECT registrations.id AS regid, students.id AS studentid, students.name FROM registrations,students ".
|
|
"WHERE students.email='".$_SESSION['email']."' ".
|
|
"AND registrations.num='".$_SESSION['registration_number']."' ".
|
|
"AND registrations.id='".$_SESSION['registration_id']."' ".
|
|
"AND students.registrations_id=registrations.id ".
|
|
"AND registrations.year=".$config['FAIRYEAR']." ".
|
|
"AND students.year=".$config['FAIRYEAR']);
|
|
echo mysql_error();
|
|
|
|
if(mysql_num_rows($q)==0)
|
|
{
|
|
header("Location: register_participants.php");
|
|
exit;
|
|
|
|
}
|
|
$r=mysql_fetch_object($q);
|
|
|
|
send_header("Participant Registration - Student Information");
|
|
echo "<a href=\"register_participants_main.php\"><< ".i18n("Back to Participant Registration Summary")."</a><br />";
|
|
echo "<br />";
|
|
|
|
$q=mysql_query("SELECT * FROM students WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'");
|
|
|
|
if(mysql_num_rows($q)==0)
|
|
{
|
|
//uhh oh, we didnt find any, this isnt possible! lets insert one using the logged in persons email address
|
|
//although... this can never really happen, since the above queries only allow the page to view if the student
|
|
//is found in the students table... soo... well, lets leave it here as a fallback anyways, just incase
|
|
mysql_query("INSERT INTO students (registrations_id,email,year) VALUES ('".$_SESSION['registration_id']."','".mysql_escape_string($_SESSION['email'])."','".$config['FAIRYEAR']."')");
|
|
}
|
|
else if(mysql_num_rows($q)==1)
|
|
{
|
|
$numstudents1="checked=\"checked\"";
|
|
$numstudents2="";
|
|
|
|
}
|
|
else if(mysql_num_rows($q)==2)
|
|
{
|
|
$numstudents1="";
|
|
$numstudents2="checked=\"checked\"";
|
|
|
|
}
|
|
else
|
|
{
|
|
//this should never happen
|
|
//we cant have more than two on a project
|
|
echo error(i18n("More than two students associated with this registration"));
|
|
//FIXME: eventually provide a solution to fix this if it ever happens.. like say....
|
|
// "click here" to remove all students and start again.. or something
|
|
}
|
|
|
|
echo "<form name=\"numstudentsform\" method=\"post\" action=\"register_participants_students.php\">";
|
|
echo "<input $numstudents1 type=\"radio\" name=\"numstudents\" value=\"1\"> ".i18n("I worked on the project by myself")."<br />";
|
|
echo "<input $numstudents2 type=\"radio\" name=\"numstudents\" value=\"2\"> ".i18n("I worked on the project with a partner")."<br />";
|
|
echo "</form>";
|
|
|
|
|
|
for($x=1;$x<=2;$x++)
|
|
{
|
|
$studentinfo=mysql_fetch_object($q);
|
|
echo "<div id=\"student$x\">\n";
|
|
echo "<h3>Student Details</h3>";
|
|
echo "</div>\n\n";
|
|
}
|
|
|
|
send_footer();
|
|
?>
|