Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $email=$_POST['email'];
- $password=md5$_POST['password'];
- $result = mysqli_query($con, "SELECT * FROM User WHERE email= '$email' AND password = '$password'");
- //var_dump($result);
- $count = mysqli_num_rows($result);
- //var_dump($count);
- if($count == 1)
- {
- echo ("Exists");
- }
- else
- {
- echo ("Error");
- }
- ?>
- $(document).ready(function() {
- $("#submit").click(function() {
- var email = document.getElementById("email").value;
- var password = document.getElementById("password").value;
- var xhttp = new XMLHttpRequest();
- xhttp.onreadystatechange = function()
- {
- if(this.readyState == 4 && this.status == 200)
- {
- var response = this.responseText;
- if(response == "Exists")
- {
- window.location="content.html"
- }
- else if(response == "Error")
- {
- alert("Wrong email or password");
- }
- }
- }
- xhttp.open("POST", "checkDetails.php", true);
- xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
- xhttp.send("email="+email+"password="+password);
- return false;
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement