Update signature page to properly pull student info from users instead of students

This commit is contained in:
james 2011-03-02 14:41:32 +00:00
parent 5dba209aae
commit 5f289a6761

View File

@ -31,25 +31,17 @@
$registration_number=12345; $registration_number=12345;
$registration_id=0; $registration_id=0;
} else { } else {
//authenticate based on email address and registration number from the SESSION //they must be a participant
if(!$_SESSION['email']) { user_auth_required('participant');
header("Location: register_participants.php"); $u=user_load($_SESSION['users_id']);
exit;
}
if(!$_SESSION['registration_number']) {
header("Location: register_participants.php");
exit;
}
$q=mysql_query("SELECT registrations.id AS regid $q=mysql_query("SELECT registrations.id AS regid,
registrations.num AS regnum
FROM registrations FROM registrations
WHERE registrations.num='{$_SESSION['registration_number']}' WHERE
AND registrations.id='{$_SESSION['registration_id']}' registrations.id='{$u['registration_id']}'
AND registrations.conferences_id={$conference['id']}"); AND registrations.conferences_id={$conference['id']}");
$registration_number=$_SESSION['registration_number'];
$registration_id=$_SESSION['registration_id'];
echo mysql_error(); echo mysql_error();
if(mysql_num_rows($q)==0) { if(mysql_num_rows($q)==0) {
@ -58,6 +50,8 @@
} }
$authinfo=mysql_fetch_object($q); $authinfo=mysql_fetch_object($q);
$registration_number=$authinfo->regnum;
$registration_id=$authinfo->regid;
} }
//END OF AUTH, now lets try to generate a PDF using only PHP :) this should be fun! //END OF AUTH, now lets try to generate a PDF using only PHP :) this should be fun!
@ -88,14 +82,21 @@ $pdf->AddPage();
FROM projects FROM projects
JOIN projectdivisions ON projects.projectdivisions_id=projectdivisions.id JOIN projectdivisions ON projects.projectdivisions_id=projectdivisions.id
JOIN projectcategories ON projects.projectcategories_id=projectcategories.id JOIN projectcategories ON projects.projectcategories_id=projectcategories.id
WHERE registrations_id='".$_SESSION['registration_id']."' WHERE registrations_id='".$registration_id."'
AND projects.conferences_id='".$conference['id']."' AND projects.conferences_id='".$conference['id']."'
AND projectdivisions.conferences_id='".$conference['id']."' AND projectdivisions.conferences_id='".$conference['id']."'
AND projectcategories.conferences_id='".$conference['id']."' AND projectcategories.conferences_id='".$conference['id']."'
"); ");
$projectinfo=mysql_fetch_object($q); $projectinfo=mysql_fetch_object($q);
$q=mysql_query("SELECT * FROM students WHERE registrations_id='".$_SESSION['registration_id']."' AND conferences_id='".$conference['id']."'"); $q=mysql_query("SELECT firstname, lastname, grade, schools_id
FROM users
JOIN user_roles ON users.id=user_roles.id
JOIN roles ON user_roles.roles_id=roles.id
WHERE registrations_id='".$registration_id."'
AND conferences_id='".$conference['id']."'
AND roles.type='participant'");
while($si=mysql_fetch_object($q)) while($si=mysql_fetch_object($q))
$studentinfoarray[]=$si; $studentinfoarray[]=$si;
} }