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 else
{ {
echo "<br />";
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 "<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 />"; echo "<br />";

View File

@ -67,6 +67,13 @@ while($r=mysql_fetch_object($q))
$config[$r->var]=$r->val; $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 //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 //even though its not configurable by the fair
if(stristr($_SERVER['HTTP_USER_AGENT'],"MSIE")) 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,19 +156,34 @@
} }
else else
{ {
echo i18n("Please enter your email address to :"); //Lets check the date - if we are AFTER 'judgeregopen' and BEFORE 'judgeregclose' then we can login
echo "<ul>"; //otherwise, registration is closed - no logins!
echo "<li>".i18n("Begin a new registration")."</li>";
echo "<li>".i18n("Login to your account")."</li>";
echo "</ul>";
?> $q=mysql_query("SELECT (NOW()>'".$config['dates']['judgeregopen']."' AND NOW()<'".$config['dates']['judgeregclose']."') AS datecheck");
<form method="post" action="register_judges.php"> $r=mysql_fetch_object($q);
<input type="hidden" name="action" value="login" /> //this will return 1 if its between the dates, 0 otherwise.
<?=i18n("Email")?>: <input type="text" name="email" size="30" /> if($r->datecheck==1)
<input type="submit" value="Begin" /> {
</form>
<? echo i18n("Please enter your email address to :");
echo "<ul>";
echo "<li>".i18n("Begin a new registration")."</li>";
echo "<li>".i18n("Login to your account")."</li>";
echo "</ul>";
?>
<form method="post" action="register_judges.php">
<input type="hidden" name="action" value="login" />
<?=i18n("Email")?>: <input type="text" name="email" size="30" />
<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(); send_footer();
?> ?>

View File

@ -183,24 +183,37 @@
} }
else else
{ {
//Lets check the date - if we are AFTER 'regopen' and BEFORE 'regclose' then we can login
//otherwise, registration is closed - no logins!
echo i18n("Please enter your email address to :"); $q=mysql_query("SELECT (NOW()>'".$config['dates']['regopen']."' AND NOW()<'".$config['dates']['regclose']."') AS datecheck");
echo "<ul>"; $r=mysql_fetch_object($q);
echo "<li>".i18n("Begin a new registration")."</li>"; //this will return 1 if its between the dates, 0 otherwise.
echo "<li>".i18n("Continue a previously started registration")."</li>"; if($r->datecheck==1)
echo "<li>".i18n("Modify an existing registration")."</li>"; {
echo "</ul>";
echo i18n("Please enter a valid email address. We will be emailing you information which you will need to complete the registration process!");
echo "<br />";
echo "<br />";
?> echo i18n("Please enter your email address to :");
<form method="post" action="register_participants.php"> echo "<ul>";
<input type="hidden" name="action" value="login" /> echo "<li>".i18n("Begin a new registration")."</li>";
<?=i18n("Email")?>: <input type="text" name="email" size="30" /> echo "<li>".i18n("Continue a previously started registration")."</li>";
<input type="submit" value="Begin" /> echo "<li>".i18n("Modify an existing registration")."</li>";
</form> echo "</ul>";
<? echo i18n("Please enter a valid email address. We will be emailing you information which you will need to complete the registration process!");
echo "<br />";
echo "<br />";
?>
<form method="post" action="register_participants.php">
<input type="hidden" name="action" value="login" />
<?=i18n("Email")?>: <input type="text" name="email" size="30" />
<input type="submit" value="Begin" />
</form>
<?
}
else
{
echo i18n("Registration for the %1 %2 is now closed",array($config['FAIRYEAR'],$config['fairname']));
}
} }
send_footer(); send_footer();
?> ?>