Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require("password.php");
- $con = mysqli_connect("my_host", "my_user", "my_password", "my_database");
- $username = $_POST["username"];
- $password = $_POST["password"];
- $statement = mysqli_prepare($con, "SELECT * FROM user WHERE username = ?");
- mysqli_stmt_bind_param($statement, "s", $username);
- mysqli_stmt_execute($statement);
- mysqli_stmt_store_result($statement);
- mysqli_stmt_bind_result($statement, $colUserID, $colName, $colUsername, $colAge, $colPassword);
- $response = array();
- $response["success"] = false;
- while(mysqli_stmt_fetch($statement)){
- if (password_verify($password, $colPassword)) {
- $response["success"] = true;
- $response["name"] = $colName;
- $response["age"] = $colAge;
- }
- }
- echo json_encode($response);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement