Add counter

Fix CSS
fix XHTML
start of code for student info
This commit is contained in:
james 2004-12-02 23:15:42 +00:00
parent 7810a14532
commit 0111d59bdf
6 changed files with 75 additions and 16 deletions

View File

@ -120,13 +120,13 @@ function i18n($str,$args=array())
function error($str)
{
return $str."<br />";
return "<div class=\"error\">$str</div><br />";
}
function notice($str)
{
return $str."<br />";
return "<div class=\"notice\">$str</div><br />";
}
$HEADER_SENT=false;
@ -188,7 +188,11 @@ if(count($config['languages'])>1)
?>
<a href="http://www.sfiab.ca/"><?=i18n("Return to SFIAB Development Page")?></a>
<br />
<br />
<? include "http://counter.lightbox.org/?user=sfiab&name=testsite&addr=".$_SERVER['REMOTE_ADDR']; ?>
</div>
</div>

View File

@ -1,9 +1,10 @@
<?
function studentStatus()
{
global $config;
$required_fields=array("name","address","city","postalcode","phone","email","grade","age");
$q=mysql_query("SELECT * FROM students WHERE registrations_id='".$_SESSION['registration_id']."'");
$q=mysql_query("SELECT * FROM students WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'");
while($r=mysql_fetch_object($q))
{

View File

@ -10,9 +10,7 @@
$_SESSION['registration_number']=$r->num;
$_SESSION['registration_id']=$r->id;
mysql_query("INSERT INTO students (registrations_id,email,year) VALUES ('$r->id','".mysql_escape_string($_SESSION['email'])."','".$config['FAIRYEAR']."')");
echo mysql_error();
mysql_query("UPDATE registrations SET status='open' WHERE id='$r->id'");
echo mysql_error();
header("Location: register_participants_main.php");
exit;
@ -44,6 +42,12 @@
header("Location: register_participants_main.php");
exit;
}
else
{
send_header("Participant Registration");
echo error(i18n("Invalid registration number (%1) for email address %2",array($_POST['regnum'],$_SESSION['email'])));
$_POST['action']="login";
}
}
else if($_GET['action']=="resend" && $_SESSION['email'])
@ -62,7 +66,14 @@
send_header("Participant Registration");
echo notice(i18n("Your registration number has been resent to your email addess <b>%1</b>",array($_SESSION['email'])));
echo "<br />";
}
else if($_GET['action']=="logout")
{
unset($_SESSION['email']);
unset($_SESSION['registration_number']);
unset($_SESSION['registration_id']);
send_header("Participant Registration");
echo notice(i18n("You have been successfully logged out"));
}
@ -102,7 +113,6 @@
AND students.year=".$config['FAIRYEAR']."
AND registrations.year=".$config['FAIRYEAR']."
AND registrations.status='open'");
echo mysql_error();
if(mysql_num_rows($q)>0)
{
echo i18n("Please enter your <b>registration number</b> in order to continue your registration");

View File

@ -8,7 +8,7 @@
header("Location: register_participants.php");
exit;
}
if(!$_SESSION['registration_number'])
if(! ($_SESSION['registration_number'] && $_SESSION['registration_id']))
{
header("Location: register_participants.php");
exit;
@ -91,9 +91,10 @@ echo "</td></tr>";
echo "</table>";
echo "<br /><br />";
echo "<a href=\"register_participants.php?action=logout\">".i18n("Logout")."</a>";
send_footer();
?>

View File

@ -7,7 +7,7 @@
header("Location: register_participants.php");
exit;
}
if(!$_SESSION['registration_number'])
if(! ($_SESSION['registration_number'] && $_SESSION['registration_id']))
{
header("Location: register_participants.php");
exit;
@ -31,9 +31,52 @@ echo mysql_error();
$r=mysql_fetch_object($q);
send_header("Participant Registration - Student Information");
echo "<a href=\"register_participants_main.php\">&lt;&lt; ".i18n("Back to Participant Registration Summary")."</a><br />";
echo "<br /><br />";
echo "<a href=\"register_participants_main.php\">&lt;&lt; ".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();
?>

View File

@ -1,6 +1,6 @@
body
{
font-family: Verdana, Arial;
font-family: Verdana, Arial, Sans-Serif;
font-size: 11px;
margin: 0;
padding: 0;
@ -27,7 +27,7 @@ body
left: 10px;
width: 175px;
background: #EEEEFF;
border: 2px solid silver;
border: 2px solid Silver;
padding: 5px;
}
@ -38,7 +38,7 @@ body
margin-top: 10px;
margin-right: 10px;
padding: 5px;
border: 2px solid silver;
border: 2px solid Silver;
min-height: 400px;
}
@ -149,6 +149,6 @@ a {
.notice {
font-weight: bold;
border: 1px solid silver;
border: 1px solid Silver;
background: #E0E0FF;
}