Advertisement
Guest User

Untitled

a guest
Nov 20th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. $(document).ready(function(){
  2. $('#Submit').click(function() {
  3. $.ajax({
  4. type : 'POST',
  5. url : './helpers/checkuser.php',
  6. data: {
  7. action: "checklogin",
  8. user : $('#username').val(),
  9. pass : $('#password').val()
  10. },
  11. success:function (data) {
  12. if (data == "Valid Login")
  13. window.location.replace("../login.php");
  14. else
  15. alert(data);
  16. }
  17. });
  18. });
  19. });
  20.  
  21. // QUERY THE DB
  22. $stmt = $link->prepare('SELECT * FROM users WHERE username = '$username' AND password = '$password'');
  23. $stmt->bind_param('s', $search);
  24. $stmt->execute();
  25. $result = $stmt->get_result();
  26.  
  27. if(mysqli_num_rows($result) > 0)
  28. {
  29. echo "Valid Login";
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement