Advertisement
Guest User

Untitled

a guest
Mar 30th, 2018
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. <?php
  2.  
  3. include('db.php');
  4.  
  5. $action = $_GET['action'];
  6.  
  7. $username = $con->real_escape_string($_GET['username']);
  8. $password = $con->real_escape_string($_GET['password']));
  9.  
  10. if(!$action)
  11. {
  12. echo "Please enter an action.";
  13. }
  14. else
  15. {
  16. if($action == "register")
  17. {
  18. if($query = $con->query("INSERT INTO toolusers (username,password) VALUES ('$username','$password')"))
  19. {
  20. echo "1";
  21. }
  22. else
  23. {
  24. echo "0";
  25. }
  26. }
  27. else if($action == "login")
  28. {
  29. $query = $con->query("SELECT * FROM toolusers WHERE username = '$username' and password = '$password'");
  30. $cnt = $query->num_rows;
  31.  
  32. if($cnt > 0)
  33. {
  34. echo "1";
  35. }
  36. else
  37. {
  38. echo "1";
  39. }
  40. }
  41. else
  42. {
  43. echo "Invalid action.";
  44. }
  45. }
  46.  
  47. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement