Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2016
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. <?php
  2. $key = $_POST["key"];
  3.  
  4. if ($key == "API_KEY") {
  5. $con = mysqli_connect("localhost","u5004881_fitrah","whoami123-.","u5004881_report_garena");
  6. if (mysqli_connect_errno()) {
  7. echo "Connect failed";
  8. exit();
  9. }
  10. $data = array();
  11.  
  12. $username = $_POST["username"];
  13. $password = $_POST["password"];
  14.  
  15. $kueri = "SELECT id, name, username, photo, position FROM users WHERE (username='$username' || email='$username' || phone_number='$username') AND password='$password'" ;
  16. $result = mysqli_query($con, $kueri);
  17. $num_user = mysqli_num_rows($result);
  18. if ($num_user==1) {
  19. $data["user"] = $result->fetch_assoc();
  20. $data["result"] = "success";
  21. }
  22. else {
  23. $data["result"] = "Username and Password not match";
  24. }
  25.  
  26. header('Content-Type: application/json');
  27. echo json_encode($data);
  28. mysqli_close($con);
  29. }
  30. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement