Implement date checking for both participant and judge registration

This commit is contained in:
james 2005-03-29 19:21:14 +00:00
parent 58ce32ccf5
commit d059f34835
7 changed files with 70 additions and 29 deletions

View File

@ -130,6 +130,7 @@
else
{
echo "<br />";
echo "<br />";
echo "<a href=\"award_prizes.php?award_awards_id=$award_awards_id&action=add\">".i18n("Add New Prize to %1",array($award->name))."</a>\n";
echo "<br />";

View File

@ -67,6 +67,13 @@ while($r=mysql_fetch_object($q))
$config[$r->var]=$r->val;
}
//now pull the dates
$q=mysql_query("SELECT * FROM dates WHERE year='".$config['FAIRYEAR']."'");
while($r=mysql_fetch_object($q))
{
$config['dates'][$r->name]=$r->date;
}
//detect the browser first, so we know what icons to use - we store this in the config array as well
//even though its not configurable by the fair
if(stristr($_SERVER['HTTP_USER_AGENT'],"MSIE"))

View File

@ -1 +1 @@
2
3

4
db/db.update.3.sql Normal file
View File

@ -0,0 +1,4 @@
ALTER TABLE `dates` CHANGE `date` `date` DATETIME DEFAULT '0000-00-00' NOT NULL;
INSERT INTO `dates` ( `id` , `date` , `name` , `description` , `year` ) VALUES ( '', '2005-01-01 00:00:00', 'judgeregopen', 'Judges registration opens', '2005');
INSERT INTO `dates` ( `id` , `date` , `name` , `description` , `year` ) VALUES ( '', '2005-03-31 00:00:00', 'judgeregclose', 'Judges registration closes', '2005');

1
db/db_update.3.sql Normal file
View File

@ -0,0 +1 @@
ALTER TABLE `dates` CHANGE `date` `date` DATETIME DEFAULT '0000-00-00' NOT NULL;

View File

@ -156,6 +156,15 @@
}
else
{
//Lets check the date - if we are AFTER 'judgeregopen' and BEFORE 'judgeregclose' then we can login
//otherwise, registration is closed - no logins!
$q=mysql_query("SELECT (NOW()>'".$config['dates']['judgeregopen']."' AND NOW()<'".$config['dates']['judgeregclose']."') AS datecheck");
$r=mysql_fetch_object($q);
//this will return 1 if its between the dates, 0 otherwise.
if($r->datecheck==1)
{
echo i18n("Please enter your email address to :");
echo "<ul>";
echo "<li>".i18n("Begin a new registration")."</li>";
@ -169,6 +178,12 @@
<input type="submit" value="Begin" />
</form>
<?
}
else
{
echo i18n("Judges registration for the %1 %2 is now closed",array($config['FAIRYEAR'],$config['fairname']));
}
}
send_footer();
?>

View File

@ -182,6 +182,14 @@
echo i18n("If you have lost or forgotten your <b>registration number</b>, please <a href=\"register_participants.php?action=resend\">click here to resend</a> 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)
{
echo i18n("Please enter your email address to :");
@ -202,5 +210,10 @@
</form>
<?
}
else
{
echo i18n("Registration for the %1 %2 is now closed",array($config['FAIRYEAR'],$config['fairname']));
}
}
send_footer();
?>