diff --git a/common.inc.php b/common.inc.php
index b0a245f..8063193 100644
--- a/common.inc.php
+++ b/common.inc.php
@@ -735,7 +735,7 @@ function email_send($val,$to,$sub_subject=array(),$sub_body=array())
*/
- mail($to,$subject,$body,"From: $r->from\r\nReply-To: $r->from");
+ mail($to,$subject,$body,"From: $r->from\r\nReply-To: $r->from\r\nReturn-Path: $r->from");
}
else
{
diff --git a/db/db.update.9.sql b/db/db.update.9.sql
index 05b10e5..7131d24 100644
--- a/db/db.update.9.sql
+++ b/db/db.update.9.sql
@@ -4,4 +4,6 @@ INSERT INTO `config` ( `var` , `val` , `description` , `year` ) VALUES ( 'judge_
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;
+INSERT INTO `emails` VALUES ('', 'register_participants_resend_regnum', 'Participant Registration - Resend Registration Number', 'Resend the password to the participant if they submit a ''forgot regnum'' request', 'website@sfiab.ca', 'Registration for [FAIRNAME]', 'We have received a request for the retrieval if your registration number from this email address. Please find your existing registration number below\r\n\r\nRegistration Number: [REGNUM]\r\n', 'system');
+INSERT INTO `emails` VALUES ('', 'new_participant', 'New Participant', 'Email that new participants receive when they are added to the system', 'website@sfiab.ca', 'Registration for [FAIRNAME]', 'A new registration account has been created for you. To access your registration account, please enter enter the following registration number into the registration website:\r\n\r\nRegistration Number: [REGNUM]\r\n', 'system');
diff --git a/register_participants.php b/register_participants.php
index a78d1eb..a50771a 100644
--- a/register_participants.php
+++ b/register_participants.php
@@ -321,15 +321,7 @@
$config['FAIRYEAR'].
")");
-
- $mailbody= "A new registration account has been created for you.\n".
- "To access your registration account, please enter\n".
- "enter the following registration number into the\n".
- "registration website:\n".
- "\n".
- "Registration Number: $regnum\n".
- "\n";
- mail($_SESSION['email'],i18n("Registration for %1",array(i18n($config['fairname']))),$mailbody);
+ email_send("new_participant",$_SESSION['email'],array("FAIRNAME"=>i18n($config['fairname'])),array("REGNUM"=>$regnum));
echo i18n("You have been identified as a new registrant. An email has been sent to %1 which contains your new registration number. Please check your email to obtain your registration number and then enter it below:",array($_SESSION['email']));
echo "";
diff --git a/schoolaccess.php b/schoolaccess.php
index ac7d257..439c98e 100644
--- a/schoolaccess.php
+++ b/schoolaccess.php
@@ -87,6 +87,45 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode'])
}
+ if($_POST['action']=="invite")
+ {
+ if($_POST['firstname'] && $_POST['lastname'] && $_POST['email'])
+ {
+ $regnum=0;
+ //now create the new registration record, and assign a random/unique registration number to then.
+ do
+ {
+ //random number between
+ //100000 and 999999 (six digit integer)
+ $regnum=rand(100000,999999);
+ $q=mysql_query("SELECT * FROM registrations WHERE num='$regnum' AND year=".$config['FAIRYEAR']);
+ }while(mysql_num_rows($q)>0);
+
+ //actually insert it
+ mysql_query("INSERT INTO registrations (num,email,start,status,year) VALUES (".
+ "'$regnum',".
+ "'".$_POST['email']."',".
+ "NOW(),".
+ "'open',".
+ $config['FAIRYEAR'].
+ ")");
+ $regid=mysql_insert_id();
+
+ mysql_query("INSERT INTO students (registrations_id,email,firstname,lastname,schools_id,year) VALUES (
+ '$regid',
+ '".mysql_escape_string($_POST['email'])."',
+ '".mysql_escape_string($_POST['firstname'])."',
+ '".mysql_escape_string($_POST['lastname'])."',
+ '".mysql_escape_string($_SESSION['schoolid'])."',
+ '".$config['FAIRYEAR']."')");
+
+ email_send("new_participant",$_POST['email'],array("FAIRNAME"=>i18n($config['fairname'])),array("REGNUM"=>"$regnum"));
+ echo happy(i18n("The participant has been successfully invited"));
+ }
+ }
+
+
+
echo "
$school->school
";
echo "
School Information
";
echo "Please make sure your school contact information is correct, make any necessary changes:";
@@ -122,6 +161,43 @@ if($_SESSION['schoolid'] && $_SESSION['schoolaccesscode'])
echo " ";
echo " ";
}
+ else if($config['participant_registration_type']=="invite")
+ {
+ $q=mysql_query("SELECT (NOW()>'".$config['dates']['regopen']."' AND NOW()<'".$config['dates']['regclose']."') AS datecheck");
+ $datecheck=mysql_fetch_object($q);
+ if($datecheck!=0)
+ {
+ echo "
".i18n("Participant Registration Invitations")."
";
+
+ echo i18n("In order for your school's students to register for the fair, you will need to invite them to register. Simply enter their email address below to invite them to register. Important: for group projects, only add one of the participants, that participant will then add the other group member(s) to the project");
+ echo " ";
+ echo " ";
+
+ echo "";
+ }
+ echo " ";
+
+ echo "
".i18n("Invited participants from your school")."
";
+ $q=mysql_query("SELECT * FROM students WHERE schools_id='".$school->id."' AND year='".$config['FAIRYEAR']."' ORDER BY lastname,firstname");
+ echo "