try { $email = swwat_parse_string(html_entity_decode($_POST[PARAM_EMAIL]), true); $password = swwat_parse_string(html_entity_decode($_POST[PARAM_PASSWORD]), true); if (is_null($email)) { throw new LoginException('username required'); } if (is_null($password)) { throw new LoginException('password required'); } // else try { WorkerLogin::password_authenticate($email, $password); $password = NULL; $worker = getWorkerAuthenticated(); // see if any invites $invitations = Invitation::selectWorker($worker->workerid); // look for explicit-only foreach ($invitations as $invite) { if ($invite->workerid == $worker->workerid) { // default to Registation page header('Location: WorkerRegistrationPage.php'); include 'WorkerRegistrationPage.php'; return; } } // $invite //Go to the proper page $expo = Expo::selectActive($worker->workerid); if ($worker->isOrganizer()) { // maybe the organizer is not assigned to anything! if (!is_null($expo) && $expo->isRunning()) {
<meta http-equiv="expires" content="31 Dec 2011 12:00:00 GMT"/> <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> <title><?php echo SITE_NAME; ?> - Worker Registration Page</title> <link href="css/site.css" rel="stylesheet" type="text/css"> </head> <body> <div id="container"> <?php $author = getWorkerAuthenticated(); $invitationList = Invitation::selectWorker($author->workerid); $expoList = array(); foreach ($invitationList as $invitation) { if (!is_null($invitation->expoid)) { $expoList[] = Expo::selectID($invitation->expoid); } } $_SESSION[PARAM_LIST] = $expoList; //setExpoCurrent(NULL); $invitationList = NULL; // gc hint // ok, start the html include 'section/header.php'; ?>
} try { $worker = $worker->insert(); } catch (PDOException $ex) { logMessage("RegistrationAction", $ex->getMessage()); $_SESSION[PARAM_MESSAGE] = "Registration was unsuccessful due to a database error. Please try again in a few minutes."; header('Location: RegistrationPage.php'); include 'RegistrationPage.php'; return; } unset($_SESSION[PARAM_MESSAGE]); unset($_SESSION[PARAM_WITHCODE]); // default ACCEPT on all invitations $registrationArray = array(); try { $registrationArray = Invitation::selectWorker($worker->workerid); } catch (PDOException $ex) { logMessage("RegistrationAction", "selecting worker:{$worker->workerid} " . $ex->getMessage()); // but ignore and continue } foreach ($registrationArray as $registration) { try { $worker->assignToExpo($registration->expoid); // $registration->delete(); // accepted, so don't keep around } catch (PDOException $ex) { logMessage("RegistrationAction", "assign worker:{$worker->workerid} to expo:{$expo->expoid} failure " . $ex->getMessage()); // but ignore and continue } } // $registration foreach ($registrationArray as $registration) {