Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- header("Access-Control-Allow-Origin: http://localhost:3000");
- header('Content-type:application/json;charset=utf-8');
- $host = 'localhost';
- $user = 'root';
- $pass = '';
- $db = 'users';
- $conn = mysqli_connect($host, $user, $pass, $db);
- $values = json_encode($test);
- $data = json_decode(file_get_contents('php://input'), true);
- $user =($data["user"]);
- $password = ($data["password"]);
- $test = [
- 'user' => $user,
- 'password' => $password
- ];
- if($data == null){}else{
- $checkuser = "SELECT * FROM Users WHERE username = $user";
- $checkpass = "SELECT * FROM Users WHERE password = $password";
- mysqli_query($conn,$checkuser);
- mysqli_query($conn,$checkpass);
- }
- if($checkuser !== false && $checkpass !== false){
- } else {
- $alert = '<script>alert("Pass or user not correct");</script>'
- echo $alert;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement