diff --git a/register_participants.php b/register_participants.php
index eae27ed..3bffc02 100644
--- a/register_participants.php
+++ b/register_participants.php
@@ -24,6 +24,9 @@
require("common.inc.php");
+ $q=mysql_query("SELECT (NOW()>'".$config['dates']['regopen']."' AND NOW()<'".$config['dates']['regclose']."') AS datecheck");
+ $datecheck=mysql_fetch_object($q);
+
if($_POST['action']=="new")
{
$q=mysql_query("SELECT email,num,id FROM registrations WHERE email='".$_SESSION['email']."' AND num='".$_POST['regnum']."' AND year=".$config['FAIRYEAR']);
@@ -137,59 +140,79 @@
echo "
";
}
}
+ $showform=true;
if($allownew)
{
- $regnum=0;
- //now create the new registration record, and assign a random/unique registration number to then.
- do
+ if($datecheck->datecheck==0)
{
- //random number between
- //100000 and 999999 (six digit integer)
- $regnum=rand(100000,999999);
- $q=mysql_query("SELECT * FROM registrations WHERE num='$regnum' AND year=".$config['FAIRYEAR']);
- }while(mysql_num_rows($q)>0);
+ echo error(i18n("Registration is closed. You can not create a new account"));
+ $showform=false;
+ echo "Back to Participant Registration Login Page";
- //actually insert it
- mysql_query("INSERT INTO registrations (num,email,start,status,year) VALUES (".
- "'$regnum',".
- "'".$_SESSION['email']."',".
- "NOW(),".
- "'new',".
- $config['FAIRYEAR'].
- ")");
+ }
+ else
+ {
+ $regnum=0;
+ //now create the new registration record, and assign a random/unique registration number to then.
+ do
+ {
+ //random number between
+ //100000 and 999999 (six digit integer)
+ $regnum=rand(100000,999999);
+ $q=mysql_query("SELECT * FROM registrations WHERE num='$regnum' AND year=".$config['FAIRYEAR']);
+ }while(mysql_num_rows($q)>0);
+
+ //actually insert it
+ mysql_query("INSERT INTO registrations (num,email,start,status,year) VALUES (".
+ "'$regnum',".
+ "'".$_SESSION['email']."',".
+ "NOW(),".
+ "'new',".
+ $config['FAIRYEAR'].
+ ")");
- $mailbody= "A new registration account has been created for you.\n".
- "To access your registration account, please enter\n".
- "enter the following registration number into the\n".
- "registration website:\n".
- "\n".
- "Registration Number: $regnum\n".
- "\n";
- mail($_SESSION['email'],i18n("Registration for %1",array(i18n($config['fairname']))),$mailbody);
+ $mailbody= "A new registration account has been created for you.\n".
+ "To access your registration account, please enter\n".
+ "enter the following registration number into the\n".
+ "registration website:\n".
+ "\n".
+ "Registration Number: $regnum\n".
+ "\n";
+ mail($_SESSION['email'],i18n("Registration for %1",array(i18n($config['fairname']))),$mailbody);
- echo i18n("You have been identified as a new registrant. An email has been sent to %1 which contains your new registration number. Please check your email to obtain your registration number and then enter it below:",array($_SESSION['email']));
- echo "";
+ echo i18n("You have been identified as a new registrant. An email has been sent to %1 which contains your new registration number. Please check your email to obtain your registration number and then enter it below:",array($_SESSION['email']));
+ echo "";
+ }
}
- echo "
";
- echo i18n("Registration Number:");
- echo "";
- echo "";
- echo "";
- echo "
";
- echo i18n("If you have lost or forgotten your registration number, please click here to resend it to your email address");
+ if($showform)
+ {
+ echo "
";
+ echo i18n("Registration Number:");
+ echo "";
+ echo "";
+ echo "";
+ echo "
";
+ echo i18n("If you have lost or forgotten your registration number, please click here to resend it to your email address");
+ }
}
else
{
//Lets check the date - if we are AFTER 'regopen' and BEFORE 'regclose' then we can login
//otherwise, registration is closed - no logins!
- $q=mysql_query("SELECT (NOW()>'".$config['dates']['regopen']."' AND NOW()<'".$config['dates']['regclose']."') AS datecheck");
- $r=mysql_fetch_object($q);
//this will return 1 if its between the dates, 0 otherwise.
- if($r->datecheck==1)
+ if($datecheck->datecheck==0)
+ {
+ echo notice(i18n("Registration for the %1 %2 is now closed. Existing registrants can login and view (read only) their information, as well as apply for special awards (if applicable).",array($config['FAIRYEAR'],$config['fairname'])));
+ echo i18n("Please enter your email address to login");
+ echo "
";
+ echo "
";
+ $buttontext=i18n("Login");
+ }
+ else
{
echo i18n("Please enter your email address to :");
@@ -198,22 +221,19 @@
echo "
";
{
echo "
"; echo " "; + echo notice(i18n("Special award self-nomination is only available from %1 to %2. Please make sure you complete your nominations between these dates. You may apply to a maximum of %3 special awards.",array($config['dates']['specawardregopen'],$config['dates']['specawardregclose'],$config['maxspecialawardsperproject']))); + +$q=mysql_query("SELECT (NOW()>'".$config['dates']['specawardregopen']."' AND NOW()<'".$config['dates']['specawardregclose']."') AS datecheck"); +$r=mysql_fetch_object($q); +//this will return 1 if its between the dates, 0 otherwise. +if($r->datecheck==1) + $readonly=false; +else + $readonly=true; + if($_POST['action']=="save") { - //FIXME: check the date when they have to have this in by and dont let them submit after that date -// if(registrationFormsReceived()) -// { -// echo error(i18n("Cannot make changes to forms once they have been received by the fair")); -// } -// else -// { - //first we will delete all their old answer, its easier to delete and re-insert in this case then it would be to find the corresponding answers and update them - mysql_query("DELETE FROM project_specialawards_link WHERE projects_id='$project->id' AND year='".$config['FAIRYEAR']."'"); - $count=0; - foreach($_POST['spaward'] AS $spaward) + //this will return 1 if its between the dates, 0 otherwise. + if(!$readonly) + { + $num=count($_POST['spaward']); + if($num>$config['maxspecialawardsperproject']) { - mysql_query("INSERT INTO project_specialawards_link (award_awards_id,projects_id,year) VALUES (". - "'$spaward', ". - "'$project->id', ". - "'".$config['FAIRYEAR']."')"); - echo mysql_error(); - $count++; + echo error(i18n("You can only apply to %1 special awards. You have selected %2",array($config['maxspecialawardsperproject'],$num))); } - echo happy(i18n("Successfully registered for %1 special awards",array($count))); -// } + else + { + mysql_query("DELETE FROM project_specialawards_link WHERE projects_id='$project->id' AND year='".$config['FAIRYEAR']."'"); + + foreach($_POST['spaward'] AS $spaward) + { + mysql_query("INSERT INTO project_specialawards_link (award_awards_id,projects_id,year) VALUES (". + "'$spaward', ". + "'$project->id', ". + "'".$config['FAIRYEAR']."')"); + echo mysql_error(); + } + if($num) + echo happy(i18n("Successfully registered for %1 special awards",array($num))); + } + } + else + { + echo error(i18n("Special award self-nomination is only available from %1 to %2",array($config['dates']['specawardregopen'],$config['dates']['specawardregclose']))); + + } } @@ -99,11 +141,11 @@ if($newstatus!="complete") } else if($newstatus=="complete") { - echo happy(i18n("Safety Awards Self-Nomination Complete")); + echo happy(i18n("Special Awards Self-Nomination Complete")); } - echo " |