NEW FEATURE: Participant Registration Type

Open - Anyone can register.

	Single password - Same password for all schools, they tell the 
		students that will register what the password is.

	School password - One password per school, they tell the students
		that will register what the password is.  School is 
		pre-selected based on their school password.  This will allow
		eventually the ability to restrict participation numbers on
		a per school basis

	Invite - The teachers at the schools must 'invite' the students 
		to register by logging in as the school and creating
		accounts for each student.  The student then logs in and
		finishes entering all of their information.  This will allow
		eventually the ability to restrict participation numbers on
		a per school basis

Bump version number (0.9.3-svn)
This commit is contained in:
james 2005-11-24 20:21:55 +00:00
parent 3362e14b4e
commit 860175ae79
6 changed files with 232 additions and 23 deletions

View File

@ -53,6 +53,7 @@
"sciencehead='".mysql_escape_string(stripslashes($_POST['sciencehead']))."', ".
"scienceheadphone='".mysql_escape_string(stripslashes($_POST['scienceheadphone']))."', ".
"scienceheademail='".mysql_escape_string(stripslashes($_POST['scienceheademail']))."', ".
"registration_password='".mysql_escape_string(stripslashes($_POST['registration_password']))."', ".
"accesscode='".mysql_escape_string(stripslashes($_POST['accesscode']))."' ".
"WHERE id='$id'";
mysql_query($exec);
@ -109,6 +110,13 @@
echo "<tr><td>".i18n("Name")."</td><td><input type=\"text\" name=\"sciencehead\" value=\"".htmlspecialchars($r->sciencehead)."\" size=\"60\" maxlength=\"64\" /></td></tr>\n";
echo "<tr><td>".i18n("Phone")."</td><td><input type=\"text\" name=\"scienceheadphone\" value=\"".htmlspecialchars($r->scienceheadphone)."\" size=\"16\" maxlength=\"16\" /></td></tr>\n";
echo "<tr><td>".i18n("Email")."</td><td><input type=\"text\" name=\"scienceheademail\" value=\"".htmlspecialchars($r->scienceheademail)."\" size=\"60\" maxlength=\"128\" /></td></tr>\n";
if($config['participant_registration_type']=="schoolpassword")
{
echo "<tr><td colspan=2><br /><b>".i18n("Participant Registration Password")."</b></td></tr>";
echo "<tr><td>".i18n("Password")."</td><td><input type=\"text\" name=\"registration_password\" value=\"".htmlspecialchars($r->registration_password)."\" size=\"32\" maxlength=\"32\" /></td></tr>\n";
}
echo "<tr><td colspan=\"2\">&nbsp;</td></tr>";
echo "<tr><td colspan=\"2\" align=\"center\"><input type=\"submit\" value=\"$buttontext\" /></td></tr>\n";
echo "</table>\n";
@ -130,6 +138,8 @@
echo " <th>Address</th>";
echo " <th>Phone</th>";
echo " <th>Contact</th>";
if($config['participant_registration_type']=="schoolpassword")
echo " <th>Reg Pass</th>";
echo " <th>Action</th>";
echo "</tr>\n";
@ -141,6 +151,8 @@
echo " <td>$r->address, $r->city, $r->postalcode</td>\n";
echo " <td>$r->phone</td>\n";
echo " <td>$r->sciencehead</td>\n";
if($config['participant_registration_type']=="schoolpassword")
echo " <td>$r->registration_password</td>\n";
echo " <td align=\"center\">";
echo "<a href=\"schools.php?action=edit&edit=$r->id\"><img border=\"0\" src=\"".$config['SFIABDIRECTORY']."/images/16/edit.".$config['icon_extension']."\"></a>";

View File

@ -1 +1 @@
8
9

7
db/db.update.9.sql Normal file
View File

@ -0,0 +1,7 @@
ALTER TABLE `config` ADD UNIQUE (`var`,`year`);
INSERT INTO `config` ( `var` , `val` , `description` , `year` ) VALUES ( 'participant_registration_type', 'open', 'The type of Participant Registration to use: open | singlepassword | schoolpassword | invite', '-1');
INSERT INTO `config` ( `var` , `val` , `description` , `year` ) VALUES ( 'judge_registration_type', 'open', 'The type of Judge Registration to use: open | singlepassword | invite', '-1');
INSERT INTO `config` ( `var` , `val` , `description` , `year` ) VALUES ( 'participant_registration_singlepassword', '', 'The single password to use for participant registraiton if participant_registration_type is singlepassword. Leave blank if not using singlepassword participant registration','-1');
INSERT INTO `config` ( `var` , `val` , `description` , `year` ) VALUES ( 'judge_registration_singlepassword', '', 'The single password to use for judge registration if judge_registration_type is singlepassword. Leave blank if not using singlepassword judge registraiton', '-1');
ALTER TABLE `schools` ADD `registration_password` VARCHAR( 32 ) NOT NULL;

View File

@ -78,14 +78,41 @@
}
else if($_GET['action']=="resend" && $_SESSION['email'])
{
$q=mysql_query("SELECT registrations.num FROM registrations, students WHERE students.email='".$_SESSION['email']."' AND students.registrations_id=registrations.id");
//first see if the email matches directly from the registrations table
$q=mysql_query("SELECT registrations.num FROM
registrations
WHERE
registrations.email='".$_SESSION['email']."'
AND registrations.year='".$config['FAIRYEAR']."'");
if(mysql_num_rows($q))
$r=mysql_fetch_object($q);
else
{
//no match from registrations, so lets see if it matches from the students table
$q=mysql_query("SELECT registrations.num FROM
registrations,
students
WHERE
students.email='".$_SESSION['email']."'
AND students.registrations_id=registrations.id
AND registrations.year='".$config['FAIRYEAR']."'");
$r=mysql_fetch_object($q);
email_send("register_participants_resend_regnum",$_SESSION['email'],array("FAIRNAME"=>i18n($config['fairname'])),array("REGNUM"=>$r->num));
}
if($r)
{
email_send("register_participants_resend_regnum",$_SESSION['email'],array("FAIRNAME"=>i18n($config['fairname'])),array("REGNUM"=>$r->num));
send_header("Participant Registration");
echo notice(i18n("Your registration number has been resent to your email addess <b>%1</b>",array($_SESSION['email'])));
}
else
{
send_header("Participant Registration");
echo error(i18n("Could not find a registration for your email address"));
}
}
else if($_GET['action']=="logout")
{
unset($_SESSION['email']);
@ -113,8 +140,11 @@
echo "<form method=\"post\" action=\"register_participants.php\">";
$allownew=true;
$showform=true;
//first, check if they have any registrations waiting to be opened
$q=mysql_query("SELECT * FROM registrations WHERE email='".$_SESSION['email']."' AND status='new' AND year=".$config['FAIRYEAR']);
$q=mysql_query("SELECT * FROM registrations WHERE email='".$_SESSION['email']."' AND status='new' AND year='".$config['FAIRYEAR']."'");
if(mysql_num_rows($q)>0)
{
echo i18n("Please enter your <b>registration number</b> that you received in your email, in order to begin your new registration");
@ -123,24 +153,143 @@
}
else
{
$q=mysql_query("SELECT students.email,
registrations.status
FROM students,
//check if they have an already open registration
$q=mysql_query("SELECT
students.email,
registrations.status,
registrations.id
FROM
students,
registrations
WHERE
students.email='".$_SESSION['email']."'
AND students.year=".$config['FAIRYEAR']."
AND registrations.year=".$config['FAIRYEAR']."
AND registrations.status='open'");
AND registrations.status='open'
AND students.registrations_id=registrations.id");
if(mysql_num_rows($q)>0)
{
$r=mysql_fetch_object($q);
print_r($r);
echo i18n("Please enter your <b>registration number</b> in order to continue your registration");
echo "<input type=\"hidden\" name=\"action\" value=\"continue\">";
$allownew=false;
echo "<br />";
}
else
{
//they dont have a 'new' and they dont have an 'open' so that means that they want to create a new one... BUT...
if($config['participant_registration_type']=="invite")
{
$allownew=false;
$showform=false;
echo i18n("Participant registration is by invite only. You can not create a new account. If you have been invited by your school/region, you need to use the same email address that you were invited with.");
echo "<br />";
echo "<br />";
echo "<a href=\"register_participants.php\">Back to Participant Registration</a>";
}
else if($config['participant_registration_type']=="singlepassword")
{
$showsinglepasswordform=true;
if($_POST['singlepassword'])
{
if($_POST['singlepassword']==$config['participant_registration_singlepassword'])
{
$allownew=true;
$showform=true;
$showsinglepasswordform=false;
}
else
{
echo error(i18n("Invalid registration password, please try again"));
$allownew=false;
$showform=false;
}
}
if($showsinglepasswordform)
{
echo i18n("Participant registration is protected by a password. You must know the <b>registration password</b> in order to create an account.");
echo "<br />";
echo "<br />";
echo "<input type=\"hidden\" name=\"action\" value=\"login\">";
echo i18n("Email Address:")." ".$_SESSION['email']."<br />";
echo i18n("Registration Password:");
echo "<input type=\"text\" size=\"10\" name=\"singlepassword\">";
echo "<br />";
echo "<br />";
echo "<input type=\"submit\" value=\"Submit\">";
echo "</form>";
$allownew=false;
$showform=false;
}
}
else if($config['participant_registration_type']=="schoolpassword")
{
$showschoolpasswordform=true;
if($_POST['schoolpassword'] && $_POST['schoolid'])
{
$q=mysql_query("SELECT registration_password FROM schools WHERE id='".$_POST['schoolid']."' AND year='".$config['FAIRYEAR']."'");
$r=mysql_fetch_object($q);
if($_POST['schoolpassword']==$r->registration_password)
{
$allownew=true;
$showform=true;
$showschoolpasswordform=false;
}
else
{
echo error(i18n("Invalid school registration password, please try again"));
$allownew=false;
$showform=false;
}
}
if($showschoolpasswordform)
{
echo i18n("Participant registration is protected by a password for each school. You must know your <b>school registration password</b> in order to create an account.");
echo "<br />";
echo "<br />";
echo "<input type=\"hidden\" name=\"action\" value=\"login\">";
echo i18n("Email Address:")." ".$_SESSION['email']."<br />";
echo i18n("School: ");
$q=mysql_query("SELECT id,school FROM schools WHERE year='".$config['FAIRYEAR']."'");
echo "<select name=\"schoolid\">";
echo "<option value=\"\">".i18n("Choose your school")."</option>\n";
while($r=mysql_fetch_object($q))
echo "<option value=\"$r->id\">$r->school</option>\n";
echo "</select>";
echo "<br />";
echo i18n("School Registration Password: ");
echo "<input type=\"text\" size=\"10\" name=\"schoolpassword\">";
echo "<br />";
echo "<br />";
echo "<input type=\"submit\" value=\"Submit\">";
echo "</form>";
$allownew=false;
$showform=false;
}
}
else if($config['participant_registration_type']=="open")
{
//thats fine, continue on and create them the account.
}
else
{
echo error(i18n("There is an error with the SFIAB configuration. participant_registration_type is not defined. Contact the fair organizers to get this fixed."));
$allownew=false;
$showform=false;
}
}
}
if($allownew)
{
@ -189,9 +338,12 @@
}
if($showform)
{
echo "<br />";
echo "<br />";
echo i18n("Registration Number:");
echo "<input type=\"text\" size=\"10\" name=\"regnum\">";
echo "<br />";
echo "<br />";
echo "<input type=\"submit\" value=\"Submit\">";
echo "</form>";
echo "<br />";
@ -215,9 +367,22 @@
else
{
if($config['participant_registration_type']=="invite")
{
echo i18n("Registration is by invitation only. In order to register you must have your account created for you by your school or the science fair committee. Once your account is created you'll be invited via email to login and complete your registration information");
echo "<br />";
echo "<br />";
echo i18n("Please enter your email address to :");
echo "<ul>";
}
else
{
echo i18n("Please enter your email address to :");
echo "<ul>";
echo "<li>".i18n("Begin a new registration")."</li>";
}
echo "<li>".i18n("Continue a previously started registration")."</li>";
echo "<li>".i18n("Modify an existing registration")."</li>";
echo "</ul>";

View File

@ -94,6 +94,7 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode'])
echo "<input type=hidden name=action value=\"save\">";
echo "<table border=0 cellspacing=0 cellpadding=3>";
echo "<tr><td>School Name</td><td><input value=\"$school->school\" type=text name=school size=40></td></tr>";
// echo "<tr><td>Registration Password</td><td><input value=\"$school->registration_password\" type=text name=\"registration_password\" size=\"20\"></td></tr>";
echo "<tr><td>Address</td><td><input value=\"$school->address\" type=text name=address size=40></td></tr>";
echo "<tr><td>City</td><td><input value=\"$school->city\" type=text name=city size=30></td></tr>";
echo "<tr><td>".i18n("Province")."</td><td>";
@ -110,6 +111,18 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode'])
echo "</form>";
echo "<br>";
if($config['participant_registration_type']=="schoolpassword")
{
echo "<h4>".i18n("Participant Registration Password")."</h4>";
echo i18n("In order for your school's students to register for the fair, they will need to know your specific school registration password");
echo "<br />";
echo "<br />";
echo i18n("Registration Password: <b>%1</b>",array($school->registration_password));
echo "<br />";
echo "<br />";
}
/*
//the participation section needs to be updated to handle the age categories as specified
//in the categories table and the numbers from configuration, for now, lets just not do it.
@ -187,17 +200,29 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode'])
else
{
if($errormsg) echo "<font color=red><b>$errormsg</b></font>";
?>
<form method=POST action="schoolaccess.php">
Welcome to the School Access Page. This page allows your school to provide several key pieces of information for the fair, as well as feedback about the schools experience with/at the fair.
<br><br>
Please login below using the <b>School ID</b> and <b>Access Code</b> that you received in your package.
echo " <form method=POST action=\"schoolaccess.php\">\n";
echo i18n("Welcome to the School Access Page. This page allows your school to provide several key pieces of information for the fair, as well as feedback about the schools experience with/at the fair.");
echo " <br><br>\n";
echo i18n("Please login below by selecting your school and entering your school <b>Access Code</b> that you received in your package");
?>
<br><br>
<table border=0 cellspacing=0 cellpadding=5>
<tr><td>School ID</td><td><input type=text name=schoolid></td></tr>
<tr><td>Access Code</td><td><input type=text name=accesscode></td></tr>
<tr><td>School:</td><td>
<select name="schoolid">
<?
$q=mysql_query("SELECT id,school FROM schools WHERE year='".$config['FAIRYEAR']."'");
while($r=mysql_fetch_object($q))
{
echo "<option value=\"$r->id\">$r->school</option>\n";
}
?>
</select>
</td></tr>
<tr><td>Access Code:</td><td><input type=text name=accesscode></td></tr>
<tr><td align=center><input type=submit value="Login"></td></tr>
</table>

View File

@ -1 +1 @@
0.9.2
0.9.3-svn