$msg = $msg . "<br /><b>Please fill the Email field.</b>"; $fields = false; } if ($pwre != "*") { $msg = $msg . "<br /><b>Please fill the Password field.</b>"; $fields = false; } if ($sre != "*") { $msg = $msg . "<br /><b>Please fill the School field.</b>"; $fields = false; } if ($ere != "*") { $msg = $msg . "<br /><b>Please fill the Education field.</b>"; $fields = false; } else { if (!pwdValidate($pw)) { $msg = $msg . "<br /><b>Your Password must be at least 10 characters in length and contain both numbers and letters.</b>"; $fields = false; } } if ($are != "*") { $msg = $msg . "<br /><b>Please agree to the terms and conditions.</b>"; $fields = false; } else { if (!$emMatch) { $msg = $msg . "<br /><b>Please enter matching emails.</b>"; $fields = false; } else { if (!$pwMatch) { $msg = $msg . "<br /><b>Please enter matching passwords.</b>"; $fields = false;
$passFields = false; } //Checks to ensure the email is of a valid format if (!filter_input(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL)) { $msg = $msg . '<b>Please enter a valid email.</b><br/><br/>'; $passFields = false; } else { $em = trim($_POST['email']); } if (isset($_POST['oldpw'])) { $opw = trim($_POST['oldpw']); } if (isset($_POST['newpw'])) { $npw = trim($_POST['newpw']); } if (!pwdValidate($npw)) { $msg = $msg . "<b>Your new Password must be at least 10 characters in length and contain\n both numbers and letters.</b><br /><br/>"; $passFields = false; } if ($pwMatch == false) { $msg = $msg . '<b>Please enter matching passwords.</b><br/><br/>'; } //If all fields pass the formatting validation, then continue. if ($passFields == true) { //Authentication $em = mysqli_real_escape_string($con, $em); $opw = mysqli_real_escape_string($con, $opw); $npw = mysqli_real_escape_string($con, $npw); $sql = "select Password from K12_TEACHER where Email = '" . $em . "'"; //print $sql. ' ' . $_SESSION['email']; $result = mysqli_query($con, $sql) or die(mysqli_error($con));