Hello Everyone,
Im trying to allow a user to login to my website. I want to check and see if the user is in the database, then proceed to the main page, if not have the user register and then login. Can anyone tell me what the problem is here? Thank you so much in advance. ~MADLADY37~
Here is my code:
// checking the user if(isset($_POST["submit"])){ $email = trim($_POST["email"]); $email = strip_tags($email); $email = htmlspecialchars($email);
$email = mysqli_real_escape_string($con,$_POST["email"]); $password = mysqli_real_escape_string($con,$_POST["password"]); if(email_exist($email, $con)) { header("Location: test5.php"); } else { $error = "Email Does Not Exist!, Please Register, in order to login!"; } } ?>
HERE IS MY FUNCTIONS CODE:
<?php function email_exist($email,$con) { $result = mysqli_query($conn,"SELECT * FROM userstbl WHERE email = '$email'"); if(mysqli_num_rows($result) == 1) { return true; } else { return false; } } ?>