forked from science-ation/science-ation
global $conference in joinproject
This commit is contained in:
parent
81f6702412
commit
9a33f52e15
@ -607,6 +607,8 @@ function addProject($registrations_id){
|
||||
// return 'ok' on success, error message on failure
|
||||
function joinProject($registration_number, $email){
|
||||
global $config;
|
||||
global $conference;
|
||||
|
||||
$uid = $_SESSION['users_id'];
|
||||
if(getRegistrationsId($uid) !== null){
|
||||
return 'register_participants.inc.php::joinProject -> you are already registered for a project';
|
||||
@ -616,16 +618,32 @@ function joinProject($registration_number, $email){
|
||||
$email = mysql_real_escape_string($email);
|
||||
$registration_number = intval($registration_number);
|
||||
|
||||
$query = mysql_query("SELECT id FROM registrations WHERE email = '$email' AND num = $registration_number");
|
||||
$query = mysql_query("SELECT id FROM registrations WHERE num = '$registration_number' AND conferences_id='{$confererence['id']}'");
|
||||
|
||||
if(mysql_error()){
|
||||
return "register_participants.inc.php::joinProject -> " . mysql_error();
|
||||
}
|
||||
$result = mysql_fetch_assoc($query);
|
||||
if(!$result){
|
||||
return "register_participants.inc.php::joinProject -> invalid email or registration id";
|
||||
return "register_participants.inc.php::joinProject -> invalid registration number";
|
||||
}
|
||||
$registration_id = $result['id'];
|
||||
//okay the registration number matches, but now does it match the user/account tied to it?
|
||||
|
||||
$q=mysql_query("SELECT users.id,accounts.id,accounts.email,accounts.pendingemail
|
||||
FROM users
|
||||
JOIN accounts ON users.accounts_id=accounts.id
|
||||
WHERE
|
||||
users.registrations_id='$registration_id'
|
||||
AND ( accounts.username='$email'
|
||||
OR accounts.email='$email'
|
||||
OR accounts.pendingemail='$email'
|
||||
)");
|
||||
|
||||
if(!$r=mysql_fetch_object($q)) {
|
||||
return "register_participants.inc.php::joinProject -> email address doesnt match registration";
|
||||
}
|
||||
|
||||
$registration_id = $result['id'];
|
||||
|
||||
// let's see if this project already has the maximum number of students on it
|
||||
$ucount = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM users WHERE registrations_id = $registration_id"));
|
||||
|
Loading…
Reference in New Issue
Block a user