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_id=0;
} else {
//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;
}
//they must be a participant
user_auth_required('participant');
$u=user_load($_SESSION['users_id']);
$q=mysql_query("SELECT registrations.id AS regid
$q=mysql_query("SELECT registrations.id AS regid,
registrations.num AS regnum
FROM registrations
WHERE registrations.num='{$_SESSION['registration_number']}'
AND registrations.id='{$_SESSION['registration_id']}'
WHERE
registrations.id='{$u['registration_id']}'
AND registrations.conferences_id={$conference['id']}");
$registration_number=$_SESSION['registration_number'];
$registration_id=$_SESSION['registration_id'];
echo mysql_error();
if(mysql_num_rows($q)==0) {
@ -58,6 +50,8 @@
}
$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!
@ -88,14 +82,21 @@ $pdf->AddPage();
FROM projects
JOIN projectdivisions ON projects.projectdivisions_id=projectdivisions.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 projectdivisions.conferences_id='".$conference['id']."'
AND projectcategories.conferences_id='".$conference['id']."'
");
$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))
$studentinfoarray[]=$si;
}