= 1) { echo '
This e-mail address is already registered, please click on the forgot password link.
Please try again!

'; include_once ('footer.php'); exit(); } } # this function verifies that a username doesn't already exist in the database function validateUsername($uname) { $con = mysqli_connect(DATABASE_HOST, DATABASE_USER, DATABASE_PASS, DATABASE_NAME); $sqlunamecheck = "SELECT username FROM userinfo WHERE userinfo.username = '" . $uname . "'"; $results = mysqli_query($con, $sqlunamecheck); if (mysqli_num_rows($results) >= 1) { echo '
This username has already been taken, please choose another one
Please try again!
'; include_once ('footer.php'); exit(); } } #################### # verifying the username doesn't already exist in the database if (!empty($_POST['username'])) { $username = mysqli_real_escape_string($con, $_POST['username']); validateUsername($username); } #################### # verifying the e-mail address is in a valid format if (!empty($_POST['useremail'])) { $verifyemail = validateEmail($_POST['useremail']); if (empty($verifyemail)) { echo '
This address: ' . $_POST['useremail'] . ' is not a valid e-mail address!
Please verify and type it again.
'; include_once ('footer.php'); exit(); } usedEmail($_POST['useremail']); } #################### # verifying passwords match each other if (!empty($_POST['userpass1'] && $_POST['userpass2'])) { if (($_POST['userpass1']) != ($_POST['userpass2'])) { echo '
The passwords don\'t match!
Please try again!'; include_once ('footer.php'); exit(); } } ?>