Advertisement
Guest User

Untitled

a guest
Jul 14th, 2016
66
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. require("password.php");
  3.  
  4. $connect = mysqli_connect("84.200.122.139", "root", "admin", "app");
  5.  
  6. $username = $_POST["username"];
  7. $password = $_POST["password"];
  8.  
  9. $statement = mysqli_prepare($con, "SELECT * FROM user WHERE username = ?");
  10. mysqli_stmt_bind_param($statement, "s", $username);
  11. mysqli_stmt_execute($statement);
  12. mysqli_stmt_store_result($statement);
  13. mysqli_stmt_bind_result($statement, $colUserID, $colName, $colUsername, $colAge, $colPassword);
  14.  
  15. $response = array();
  16. $response["success"] = false;
  17.  
  18. while(mysqli_stmt_fetch($statement)){
  19. if (password_verify($password, $colPassword)) {
  20. $response["success"] = true;
  21. $response["name"] = $colName;
  22. $response["age"] = $colAge;
  23. }
  24. }
  25. echo json_encode($response);
  26. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement