Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2019
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. <?php
  2. include "conn.php";
  3. error_reporting(0);
  4. $conn = mysqli_connect(HOST, USER, PASS, DB);
  5.  
  6. $user = $_REQUEST['user'];
  7. $pass = $_REQUEST['pass'];
  8.  
  9. if ($user!='' and $pass!='') {
  10. $sql = "select * from user where username = '$user' and password='$pass'";
  11.  
  12. $tmp = array();
  13. $result = mysqli_query($conn, $sql);
  14. if (mysqli_num_rows($result)==1) {
  15. $tmp["status"] = "success";
  16. $tmp["message"] = "User/pass valid";
  17. } else {
  18. $tmp["status"] = "failed";
  19. $tmp["message"] = "incorrect user/pass";
  20. }
  21.  
  22. header('Content-Type: application/json');
  23. echo json_encode($tmp);
  24. }
  25.  
  26. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement