break; case 'Invigilator': $tmp_roles = 'Invigilator'; break; case 'Staff External Examiner': $tmp_roles = 'External Examiner'; break; default: $tmp_roles = 'Student'; break; } $new_password = trim($_POST['new_password']); $new_surname = UserUtils::my_ucwords(trim($_POST['new_surname'])); $new_username = trim($_POST['new_username']); $new_email = trim($_POST['new_email']); $new_first_names = UserUtils::my_ucwords(trim($_POST['new_first_names'])); $new_grade = $_POST['new_grade']; $new_year = isset($_POST['new_year']) ? $_POST['new_year'] : 1; } if (isset($_POST['submit']) and $unique_username == true) { if ($new_username == '' or strpos($new_username, '_') !== false or $new_surname == '' or $new_email == '' or $new_first_names == '' or $new_grade == '') { $problem = true; } else { $new_userID = UserUtils::create_user($new_username, $new_password, $_POST['new_users_title'], $new_first_names, $new_surname, $new_email, $new_grade, $_POST['new_gender'], $new_year, $tmp_roles, $_POST['new_sid'], $mysqli); // Send out email welcome. if (isset($_POST['new_welcome']) and $_POST['new_welcome'] != '') { $result = $mysqli->prepare("SELECT email FROM users WHERE username = ?"); $result->bind_param('s', $userObject->get_username()); $result->execute(); $result->bind_result($tmp_email); $result->fetch();