Advertisement
Guest User

Untitled

a guest
Feb 8th, 2017
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. <?php
  2. $con = mysqli_connect("", "", "", "");
  3.  
  4. $username = $_POST["username"];
  5. $password = $_POST["password"];
  6.  
  7. $statement = mysqli_prepare($con, "SELECT * FROM user WHERE username = ? AND password = ?");
  8. mysqli_stmt_bind_param($statement, "ss", $username, $password);
  9. mysqli_stmt_execute($statement);
  10.  
  11. mysqli_stmt_store_result($statement);
  12. mysqli_stmt_bind_result($statement, $userID, $name, $age, $username, $password);
  13.  
  14. $response = array();
  15. $response["success"] = false;
  16.  
  17. while(mysqli_stmt_fetch($statement)){
  18. $response["success"] = true;
  19. $response["name"] = $name;
  20. $response["age"] = $age;
  21. $response["username"] = $username;
  22. $response["password"] = $password;
  23. }
  24.  
  25. echo json_encode($response);
  26. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement