Updates to old participant pages to work with new user system

This commit is contained in:
james 2011-03-03 21:55:05 +00:00
parent 4aced55922
commit 056d4d23bb
5 changed files with 25 additions and 57 deletions

View File

@ -219,6 +219,7 @@ function safetyStatus($reg_id="")
//grab all of their answers //grab all of their answers
$q=mysql_query("SELECT * FROM safety WHERE registrations_id='$rid'"); $q=mysql_query("SELECT * FROM safety WHERE registrations_id='$rid'");
$safetyanswers=array();
while($r=mysql_fetch_object($q)) { while($r=mysql_fetch_object($q)) {
$safetyanswers[$r->safetyquestions_id]=$r->answer; $safetyanswers[$r->safetyquestions_id]=$r->answer;
} }
@ -231,7 +232,6 @@ function safetyStatus($reg_id="")
} }
} }
return "complete"; return "complete";
} }
function spawardStatus($reg_id="") function spawardStatus($reg_id="")

View File

@ -23,15 +23,11 @@
?> ?>
<? <?
require("common.inc.php"); require("common.inc.php");
include "register_participants.inc.php"; require_once("register_participants.inc.php");
include "user.inc.php"; require_once("user.inc.php");
$edit_id = isset($_GET['users_id']) ? intval($_GET['users_id']) : $_SESSION['users_id'];
if($edit_id != $_SESSION['users_id'])
user_auth_required('admin');
else
user_auth_required();
user_auth_required("participant");
$u=user_load($_SESSION['users_id']);
if(array_key_exists('action', $_POST)){ if(array_key_exists('action', $_POST)){
switch($_POST['action']){ switch($_POST['action']){
@ -46,26 +42,22 @@ send_header("Participant Registration - Emergency Contact Information");
echo "<a href=\"register_participants_main.php\">&lt;&lt; ".i18n("Back to Participant Registration Summary")."</a><br />"; echo "<a href=\"register_participants_main.php\">&lt;&lt; ".i18n("Back to Participant Registration Summary")."</a><br />";
echo "<br />"; echo "<br />";
$studentstatus=studentStatus(); $studentstatus=studentIndividualStatus($u['id']);
if($studentstatus!="complete") if($studentstatus!="complete") {
{ echo error(i18n("Please complete the <a href=\"user_edit.php?tab=personal\">Student Information Page</a> first"));
echo error(i18n("Please complete the <a href=\"register_participants_students.php\">Student Information Page</a> first"));
send_footer(); send_footer();
exit; exit;
} }
//output the current status //output the current status
$newstatus=emergencycontactStatus(); $newstatus=emergencycontactStatus($u['registrations_id']);
if($newstatus!="complete") if($newstatus!="complete") {
{
echo error(i18n("Emergency Contact Information Incomplete")); echo error(i18n("Emergency Contact Information Incomplete"));
} }
else if($newstatus=="complete") else if($newstatus=="complete") {
{
echo happy(i18n("Emergency Contact Information Complete")); echo happy(i18n("Emergency Contact Information Complete"));
} }
$user = user_load($_SESSION['users_id']); $registrations_id = $u['registrations_id'];
$registrations_id = $user['registrations_id'];
$sq=mysql_query("SELECT id,firstname,lastname FROM users WHERE registrations_id='$registrations_id' AND conferences_id='".$conference['id']."'"); $sq=mysql_query("SELECT id,firstname,lastname FROM users WHERE registrations_id='$registrations_id' AND conferences_id='".$conference['id']."'");
$numstudents=mysql_num_rows($sq); $numstudents=mysql_num_rows($sq);

View File

@ -71,7 +71,7 @@ echo "<table><tr><td>";
//participant information //participant information
echo "<tr><td>"; echo "<tr><td>";
echo "<a href=\"register_participants_students.php\">"; echo "<a href=\"user_edit.php?tab=personal\">";
echo i18n("Student Information"); echo i18n("Student Information");
echo "</a>"; echo "</a>";
echo "</td><td>"; echo "</td><td>";

View File

@ -25,14 +25,14 @@
<? <?
require("common.inc.php"); require("common.inc.php");
require_once("user.inc.php"); require_once("user.inc.php");
include "register_participants.inc.php"; require_once("register_participants.inc.php");
/* Ensure they're logged in as a participant */ /* Ensure they're logged in as a participant */
user_auth_required('participant'); user_auth_required('participant');
$u = user_load($_SESSION['users_id']); $u = user_load($_SESSION['users_id']);
if(!array_key_exists('registrations_id', $u) || $u['registrations_id'] == null){ if(!array_key_exists('registrations_id', $u) || $u['registrations_id'] == null){
header("Location: register_participants.php"); header("Location: register_participants_main.php");
exit; exit;
} }
$q = mysql_query("SELECT firstname, lastname FROM users WHERE registrations_id='{$u['registrations_id']}'"); $q = mysql_query("SELECT firstname, lastname FROM users WHERE registrations_id='{$u['registrations_id']}'");
@ -43,8 +43,6 @@ if(!array_key_exists('registrations_id', $u) || $u['registrations_id'] == null){
$student_display_name[]="{$s->firstname} {$s->lastname}"; $student_display_name[]="{$s->firstname} {$s->lastname}";
} }
//send the header //send the header
send_header("Participant Registration - Check Your Name"); send_header("Participant Registration - Check Your Name");
@ -61,15 +59,15 @@ if(!array_key_exists('registrations_id', $u) || $u['registrations_id'] == null){
$pu = ($_POST['punc'] == 'yes') ? true : false; $pu = ($_POST['punc'] == 'yes') ? true : false;
if($sp && $ca && $pu) { if($sp && $ca && $pu) {
$q=mysql_query("UPDATE users SET namecheck_complete='yes' WHERE registrations_id='{$_SESSION['registration_id']}'"); $q=mysql_query("UPDATE users SET namecheck_complete='yes' WHERE registrations_id='{$u['registrations_id']}'");
} else if($s->namecheck_complete!='no') { } else if($s->namecheck_complete!='no') {
$q=mysql_query("UPDATE users SET namecheck_complete='no' WHERE registrations_id='{$_SESSION['registration_id']}'"); $q=mysql_query("UPDATE users SET namecheck_complete='no' WHERE registrations_id='{$u['registrations_id']}'");
} }
} }
} }
//output the current status //output the current status
$newstatus=namecheckStatus($_SESSION['registration_id']); $newstatus=namecheckStatus($u['registrations_id']);
if($newstatus!="complete") { if($newstatus!="complete") {
echo error(i18n("Name Check Incomplete. Please check your name and check all the boxes below")); echo error(i18n("Name Check Incomplete. Please check your name and check all the boxes below"));
} }

View File

@ -24,34 +24,12 @@
<? <?
require("common.inc.php"); require("common.inc.php");
include "register_participants.inc.php"; include "register_participants.inc.php";
user_auth_required("participant");
//authenticate based on email address and registration number from the SESSION
if(!$_SESSION['email']) {
header("Location: register_participants.php");
exit;
}
if(!$_SESSION['registration_number']) {
header("Location: register_participants.php");
exit;
}
$q=mysql_query("SELECT registrations.id AS regid, students.id AS studentid, students.firstname FROM registrations,students ".
"WHERE students.email='".$_SESSION['email']."' ".
"AND registrations.num='".$_SESSION['registration_number']."' ".
"AND registrations.id='".$_SESSION['registration_id']."' ".
"AND students.registrations_id=registrations.id ".
"AND registrations.conferences_id=".$conference['id']." ".
"AND students.conferences_id=".$conference['id']);
echo mysql_error();
if(mysql_num_rows($q)==0) {
header("Location: register_participants.php");
exit;
}
$authinfo=mysql_fetch_object($q);
//send the header //send the header
send_header("Participant Registration - Safety Information"); send_header("Participant Registration - Safety Information");
$u=user_load($_SESSION['users_id']);
echo "<a href=\"register_participants_main.php\">&lt;&lt; ".i18n("Back to Participant Registration Summary")."</a><br />"; echo "<a href=\"register_participants_main.php\">&lt;&lt; ".i18n("Back to Participant Registration Summary")."</a><br />";
echo "<br />"; echo "<br />";
@ -65,12 +43,12 @@ echo mysql_error();
} }
else { else {
//first we will delete all their old answer, its easier to delete and re-insert in this case then it would be to find the corresponding answers and update them //first we will delete all their old answer, its easier to delete and re-insert in this case then it would be to find the corresponding answers and update them
mysql_query("DELETE FROM safety WHERE registrations_id='".$_SESSION['registration_id']."' AND conferences_id='".$conference['id']."'"); mysql_query("DELETE FROM safety WHERE registrations_id='".$u['registrations_id']."' AND conferences_id='".$conference['id']."'");
if(is_array($_POST['safety'])) { if(is_array($_POST['safety'])) {
$safetyids=array_keys($_POST['safety']); $safetyids=array_keys($_POST['safety']);
foreach($safetyids AS $key=>$val) { foreach($safetyids AS $key=>$val) {
mysql_query("INSERT INTO safety (registrations_id,safetyquestions_id,conferences_id,answer) VALUES (". mysql_query("INSERT INTO safety (registrations_id,safetyquestions_id,conferences_id,answer) VALUES (".
"'".$_SESSION['registration_id']."', ". "'".$u['registrations_id']."', ".
"'$val', ". "'$val', ".
"'".$conference['id']."', ". "'".$conference['id']."', ".
"'".mysql_escape_string(stripslashes($_POST['safety'][$val]))."')"); "'".mysql_escape_string(stripslashes($_POST['safety'][$val]))."')");
@ -81,7 +59,7 @@ echo mysql_error();
} }
//output the current status //output the current status
$newstatus=safetyStatus(); $newstatus=safetyStatus($u['registrations_id']);
if($newstatus!="complete") { if($newstatus!="complete") {
echo error(i18n("Safety Information Incomplete. You must agree to / answer all required safety questions!")); echo error(i18n("Safety Information Incomplete. You must agree to / answer all required safety questions!"));
} }
@ -89,7 +67,7 @@ else if($newstatus=="complete") {
echo happy(i18n("Safety Information Complete")); echo happy(i18n("Safety Information Complete"));
} }
$q=mysql_query("SELECT * FROM safety WHERE registrations_id='".$_SESSION['registration_id']."'"); $q=mysql_query("SELECT * FROM safety WHERE registrations_id='".$u['registrations_id']."'");
while($r=mysql_fetch_object($q)) { while($r=mysql_fetch_object($q)) {
$safetyanswers[$r->safetyquestions_id]=$r->answer; $safetyanswers[$r->safetyquestions_id]=$r->answer;
} }