From d30468326eda326e8b4eca387d9f7b291405bbf3 Mon Sep 17 00:00:00 2001 From: james Date: Mon, 27 Feb 2012 20:31:48 +0000 Subject: [PATCH] Fix a typo bug on a variable name which prevented the system from cutting off registrations when the maximum is reached --- schoolinvite.php | 55 +++++++++++++++++------------------------------- 1 file changed, 19 insertions(+), 36 deletions(-) diff --git a/schoolinvite.php b/schoolinvite.php index e65d0ee..3491849 100644 --- a/schoolinvite.php +++ b/schoolinvite.php @@ -117,33 +117,25 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode']) echo "
"; echo "
"; $okaygrades=array(); - if($config['participant_registration_type']=="invite") - { - if($school->projectlimitper=="total") - { - if($school->projectlimit) - { + if($config['participant_registration_type']=="invite") { + if($school->projectlimitper=="total") { + if($school->projectlimit) { echo i18n("You have invited %1 of %2 total projects for your school",array($currentinvited,$school->projectlimit)); - if($currenteinvited<$school->projectlimit) - { + if($currentinvited<$school->projectlimit) { for($a=$config['mingrade'];$a<=$config['maxgrade'];$a++) $okaygrades[]=$a; } } - else - { + else { echo i18n("You have invited %1 project(s) for your school",array($currentinvited,$school->projectlimit)); for($a=$config['mingrade'];$a<=$config['maxgrade'];$a++) $okaygrades[]=$a; - } } - else if($school->projectlimitper=="agecategory") - { + else if($school->projectlimitper=="agecategory") { echo "
"; $catq=mysql_query("SELECT * FROM projectcategories WHERE year='".$config['FAIRYEAR']."' ORDER BY id"); - while($catr=mysql_fetch_object($catq)) - { + while($catr=mysql_fetch_object($catq)) { $q2=mysql_query("SELECT COUNT(students.id) AS num FROM @@ -160,8 +152,7 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode']) $r2=mysql_fetch_object($q2); $currentinvited=$r2->num; - if($currentinvited<$school->projectlimit || $school->projectlimit==0) - { + if($currentinvited<$school->projectlimit || $school->projectlimit==0) { for($a=$catr->mingrade;$a<=$catr->maxgrade;$a++) $okaygrades[]=$a; } @@ -171,16 +162,14 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode']) } } - else - { + else { //hmm projectlimitper has not been set //so we have no limits, anyone can register or they can add as many as they want. for($x=$config['mingrade']; $x<=$config['maxgrade']; $x++) $okaygrades[]=$x; } } - else - { + else { // this could be an else if $config['participant_registration_type']=="openorinvite" ) //because openorinvite is the only other option @@ -194,8 +183,7 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode']) } echo "
"; - if(count($okaygrades)) - { + if(count($okaygrades)) { echo "
"; echo ""; @@ -210,8 +198,7 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode']) echo ""; echo "
"; } - else - { + else { echo notice(i18n("You have invited the maximum number of participants for your school")); } @@ -230,16 +216,14 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode']) echo "
"; echo "

".i18n("Invited participants from your school")."

"; - if(mysql_num_rows($q)) - { + if(mysql_num_rows($q)) { echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; - while($r=mysql_fetch_object($q)) - { + while($r=mysql_fetch_object($q)) { echo ""; echo "
".i18n("Last Name")."".i18n("First Name")."".i18n("Email Address")."".i18n("Grade")."".i18n("Registration Number")."".i18n("Actions")."
$r->lastname$r->firstname$r->email"; if($r->emailcontact) @@ -262,21 +246,20 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode']) } echo "
"; } - else + else { echo i18n("You have not yet invited any participants from your school"); + } } } - else - { + else { echo error(i18n("Invalid School ID or Access Code")); echo "
"; echo "".i18n("Perhaps you should login first").""; } send_footer(); } -else -{ +else { header("Location: schoolaccess.php"); exit; }