1, 'travel' => 1, 'presentation' => 1, 'accom' => 1, 'rf' => 1, 'confirm' => 1); // messages $messages = array('file'); $messages['presentation'] = array(); $messages['presentation'][0] = 'There was a problem uploading the file. Please try again. If the problem persists and/or you require assistance, please contact the site administrator.'; $messages['presentation'][1] = 'Your file was successfully uploaded.'; $messages['presentation'][2] = 'You did not specify a file to upload.'; $authm[0] = 'You were successfully logged out.'; $authm[1] = 'The username and/or password entered were incorrect. Please re-enter them and try logging-in again.'; $authm[2] = 'Sorry, but there was an error logging you out. The problem should only be temporary. If it persists, please contact us.'; $authm[3] = 'Please enter a username and password.'; if(!isset($_GET['a'])) { $_GET['a'] = ''; } // display pre-defined authorization message if so required if(isset($_GET['am'])) { $mno = $_GET['am']; if(!isset($authm[$mno])) { //do nothing } else { $message = $authm[$mno]; } } // end display pre-defined authorization message // if registration form is requested if($_GET['a'] == 'regform') { $page = 'regform'; } // end if registration form is requested // check the authentication and determine the page to show the user if($sess = check()) { // if logged-in, display page depending on what function was specified // if update was specified if($_GET['a'] == 'update') { // check to make sure that it is a valid type $url = '?a=edit&i=' . $_GET['i']; if(!isset($_GET['i']) OR !$types[$_GET['i']]) { $message = 'Invalid item specified.'; $page = 'loggedin'; } elseif(!isset($_POST)) { $message = 'Error: no data were submitted. Please try again.'; } else { $data = $_POST; $status = validate($_GET['i'], $data); if($status == 1) { $data = process($data); if(updateinfo($_GET['i'], $data, $sess)) { // redirect or display message depending on flag // if flag set, redirect if(isset($data['flag']) AND $data['flag'] == 1) { header('Location: register.php?a=edit&i=confirm'); } // otherwise display message else { $message = 'Your information was successfully saved.'; } // end otherwise display message } // end if information successfully saved. else { $message = 'Error: there was a problem saving your information.'; } $page = 'loggedin'; $_GET['a'] = ''; } // end if status is 1 else { $message = $status; $page = 'edit'; } // end else for status } // end else } // end if update // ##################################################################################################### // if edit was requested elseif($_GET['a'] == 'edit') { // check to make sure that it is a valid type if(!isset($_GET['i']) OR !$types[$_GET['i']]) { $message = 'Invalid item specified.'; $page = 'loggedin'; } else { // see if a message was set if(isset($_GET['m'])) { $num = $_GET['m']; $message = $messages[$_GET['i']][$num]; } $page = 'edit'; } // end else } // end if edit // ##################################################################################################### else { // otherwise show the logged-in page $page = 'loggedin'; } } // end if authentication succeeded else { // destroy remnants of previous sessions logout(); // check to see if a page has already been set if(isset($page)) { // } else { $page = 'main'; } // if user attempted an update but the session timed out if($_GET['a'] == 'update') { $message = 'For security reasons, you have been automatically logged out because of inactivity. To update your registration, please login again. We apologize for any inconvenience that this may have caused.'; } // if user attempted edit if($_GET['a'] == 'edit') { $message = 'For security reasons, you have been automatically logged out because of inactivity. To update your registration, please login again. We apologize for any inconvenience that this may have caused.'; } } // end else (if authorization failed) // page top $pagetop = ' Participant Site - Biocomplexity 9 '; } else { $pagetop2 = ''; } switch($page) { // registration form case 'regform': echo $pagetop; include('cfg/header.php'); echo $pagetop2; include('forms/regform.php'); break; // edit case 'edit': echo $pagetop; include('cfg/header.php'); echo $pagetop2; include('forms/header.php'); if(isset($_GET['f']) AND $_GET['f'] == 1) { $flag = 1; } else { $flag = 0; } $data = getinfo($_GET['i'], $sess); $content = getform($_GET['i'], $data, $flag); echo $content; break; // update case 'update': include('cfg/header.php'); echo $pagetop2; include('forms/header.php'); $data = getinfo($_GET['i'], $sess); $content = getform($_GET['i'], $data, 0); echo $content; break; // logged in page which displays the forms that the user must complete case 'loggedin': // other data included in the form include('forms/loggedin.php'); break; // main page default: echo $pagetop; include('cfg/header.php'); echo $pagetop2; include('forms/main.php'); break; } echo ' '; include('cfg/footer.php'); ?>