fetch($_SESSION['user_id']); } $jm = new JudgesModel(); $judge = null; if(array_key_exists('judge_id', $_SESSION)) { $judge = $jm->fetch($_SESSION['judge_id']); } $info = array(); function show_login_form() { global $user, $info; if(array_key_exists('user_id', $_SESSION)) { $link = null; if('Organization' == $user['type']) { $link = 'org'; } else if('Teacher' == $user['type']) { $link = 'teacher'; } else if('Young Artist (18-25)' == $user['type']) { $link = 'young-artist'; } ?>
'Email Address', 'login_password' => 'Password' ); $missing = array(); foreach($required as $k => $v) { if(!array_key_exists($k, $_POST) or ('' == $_POST[$k])) { $missing[$k] = $v; } } if(0 != count($missing)) { $success = false; $messages[] = 'Missing required fields: ' . implode(', ', $missing) . '.'; } // Additional Form Field Validation if(!array_key_exists('login_email', $missing) and !filter_var($_POST['login_email'], FILTER_VALIDATE_EMAIL)) { $success = false; $messages[] = '"' . $_POST['login_email'] . '" is not a valid email address'; } if(!$success) { $info['login'] = '' . implode('
', $messages) . '
Invalid Email Address or Password
'; return false; } $_SESSION['user_id'] = $id; $user = $um->fetch($id); return true; } function show_forgot_form() { global $info; ?> 'Email Address' ); $missing = array(); foreach($required as $k => $v) { if(!array_key_exists($k, $_POST) or ('' == $_POST[$k])) { $missing[$k] = $v; } } if(0 != count($missing)) { $success = false; $messages[] = 'Missing required fields: ' . implode(', ', $missing) . '.'; } // Additional Form Field Validation if(!array_key_exists('forgot', $missing) and !filter_var($_POST['forgot'], FILTER_VALIDATE_EMAIL)) { $success = false; $messages[] = '"' . $_POST['forgot'] . '" is not a valid email address'; } if(!$success) { $info['forgot'] = '' . implode('
', $messages) . '
Your Musicians West user account password has been reset. Your new temporary password is: $password. Please login and update your account password.
HTML; $headers = 'MIME-Version: 1.0' . "\r\n" . 'Content-Type: text/html; charset=utf-8' . "\r\n" . 'From: Musicians WestIf found in our records, a password reminder email has been sent to
'Email Address', 'judge_password' => 'Password' ); $missing = array(); foreach($required as $k => $v) { if(!array_key_exists($k, $_POST) or ('' == $_POST[$k])) { $missing[$k] = $v; } } if(0 != count($missing)) { $success = false; $messages[] = 'Missing required fields: ' . implode(', ', $missing) . '.'; } // Additional Form Field Validation if(!array_key_exists('judge_email', $missing) and !filter_var($_POST['judge_email'], FILTER_VALIDATE_EMAIL)) { $success = false; $messages[] = '"' . $_POST['judge_email'] . '" is not a valid email address'; } if(!$success) { $info['judge_login'] = '' . implode('
', $messages) . '
Invalid Email Address or Password
'; return false; } $_SESSION['judge_id'] = $id; $judge = $jm->fetch($id); return true; } function show_judge_forgot_form() { global $info; ?> 'Email Address' ); $missing = array(); foreach($required as $k => $v) { if(!array_key_exists($k, $_POST) or ('' == $_POST[$k])) { $missing[$k] = $v; } } if(0 != count($missing)) { $success = false; $messages[] = 'Missing required fields: ' . implode(', ', $missing) . '.'; } // Additional Form Field Validation if(!array_key_exists('judge_forgot', $missing) and !filter_var($_POST['judge_forgot'], FILTER_VALIDATE_EMAIL)) { $success = false; $messages[] = '"' . $_POST['judge_forgot'] . '" is not a valid email address'; } if(!$success) { $info['judge_forgot'] = '' . implode('
', $messages) . '
Your Musicians West judge account password has been reset. Your new temporary password is: $password. Please login and update your account password.
HTML; $headers = 'MIME-Version: 1.0' . "\r\n" . 'Content-Type: text/html; charset=utf-8' . "\r\n" . 'From: Musicians WestIf found in our records, a password reminder email has been sent to
'Account Type', 'name' => 'Name', 'email' => 'Email Address', 'password' => 'Password' ); if( array_key_exists('type', $_POST) and in_array($_POST['type'], array('Teacher', 'Young Artist (18-25)')) ) { $required += array( 'phone' => 'Phone Number', 'address' => 'Address', 'city' => 'City', 'state' => 'State', 'zip' => 'Zip Code' ); } else { $_POST['phone'] = null; $_POST['address'] = null; $_POST['city'] = null; $_POST['state'] = null; $_POST['zip'] = null; } $missing = array(); foreach($required as $k => $v) { if(!array_key_exists($k, $_POST) or ('' == $_POST[$k])) { $missing[$k] = $v; } } if(0 != count($missing)) { $success = false; $messages[] = 'Missing required fields: ' . implode(', ', $missing) . '.'; } // Additional Form Field Validation if((!array_key_exists('canary', $_POST) or ('barium' != $_POST['canary'])) or (!array_key_exists('ssn', $_POST) or ('' != $_POST['ssn']))) { return false; } $types = Model::getEnumValues('Users', 'type'); if(!array_key_exists('type', $_POST) or !in_array($_POST['type'], $types)) { $success = false; $messages[] = 'Please select an option from the Account Type list'; } if(!array_key_exists('email', $missing) and !filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) { $success = false; $messages[] = '"' . $_POST['email'] . '" is not a valid email address'; } if(!\HMD\google\recaptcha\check_answer('captcha')) { $success = false; $messages[] = \HMD\google\recaptcha\get_error('captcha'); } if(!$success) { $info['register'] = '' . implode('
', $messages) . '
The Email Address "' . $_POST['email'] . '" is already in use. Please choose a different Email Address.
'; } else { report_error($e); } return false; } $to = $_POST['email']; $subject = 'Musicians West Account'; $message = <<Thank you for creating your account on www.musicianswestregister.com. Please save this email for future reference.
Account Type | {$_POST['type']} |
Name | {$_POST['name']} |
Username | {$_POST['email']} |
Password | {$_POST['password']} |
Thank you for creating your account! Please use the login form on the left to proceed.
If you do not yet have an account, please use this form to register.