Advertisement
Guest User

Untitled

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