From d059f348352e9cc20ac0c36b274dc990dc5e7d99 Mon Sep 17 00:00:00 2001 From: james Date: Tue, 29 Mar 2005 19:21:14 +0000 Subject: [PATCH] Implement date checking for both participant and judge registration --- admin/award_prizes.php | 1 + common.inc.php | 7 ++++++ db/db.code.version.txt | 2 +- db/db.update.3.sql | 4 ++++ db/db_update.3.sql | 1 + register_judges.php | 39 ++++++++++++++++++++++----------- register_participants.php | 45 +++++++++++++++++++++++++-------------- 7 files changed, 70 insertions(+), 29 deletions(-) create mode 100644 db/db.update.3.sql create mode 100644 db/db_update.3.sql diff --git a/admin/award_prizes.php b/admin/award_prizes.php index e31c3b8..c81eff9 100644 --- a/admin/award_prizes.php +++ b/admin/award_prizes.php @@ -130,6 +130,7 @@ else { + echo "
"; echo "
"; echo "".i18n("Add New Prize to %1",array($award->name))."\n"; echo "
"; diff --git a/common.inc.php b/common.inc.php index da2b798..5648b44 100644 --- a/common.inc.php +++ b/common.inc.php @@ -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")) diff --git a/db/db.code.version.txt b/db/db.code.version.txt index 0cfbf08..00750ed 100644 --- a/db/db.code.version.txt +++ b/db/db.code.version.txt @@ -1 +1 @@ -2 +3 diff --git a/db/db.update.3.sql b/db/db.update.3.sql new file mode 100644 index 0000000..4a49116 --- /dev/null +++ b/db/db.update.3.sql @@ -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'); + diff --git a/db/db_update.3.sql b/db/db_update.3.sql new file mode 100644 index 0000000..c1a2bf7 --- /dev/null +++ b/db/db_update.3.sql @@ -0,0 +1 @@ +ALTER TABLE `dates` CHANGE `date` `date` DATETIME DEFAULT '0000-00-00' NOT NULL; diff --git a/register_judges.php b/register_judges.php index 9884967..1153f3f 100644 --- a/register_judges.php +++ b/register_judges.php @@ -156,19 +156,34 @@ } else { - echo i18n("Please enter your email address to :"); - echo ""; + //Lets check the date - if we are AFTER 'judgeregopen' and BEFORE 'judgeregclose' then we can login + //otherwise, registration is closed - no logins! - ?> -
- - : - -
-'".$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 ""; + + ?> +
+ + : + +
+ diff --git a/register_participants.php b/register_participants.php index ba708c2..eae27ed 100644 --- a/register_participants.php +++ b/register_participants.php @@ -183,24 +183,37 @@ } 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 :"); - echo ""; - echo i18n("Please enter a valid email address. We will be emailing you information which you will need to complete the registration process!"); - echo "
"; - echo "
"; + $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("Begin a new registration")."
  • "; + echo "
  • ".i18n("Continue a previously started registration")."
  • "; + echo "
  • ".i18n("Modify an existing registration")."
  • "; + echo ""; + echo i18n("Please enter a valid email address. We will be emailing you information which you will need to complete the registration process!"); + echo "
    "; + echo "
    "; + + ?> +
    + + : + +
    +