Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- header('Content-type: application/json');
- header('Accept: application/json');
- $servername = "localhost";
- $username = "root";
- $password = "8357NOse";
- $dbname = "loginsystem";
- $conn = new mysqli($servername,$username,$password,$dbname);
- if($conn -> connect_error){
- header("HTTP/1.1 500 SHET IS BROKEN YOOOWWW (Bad connection, portal down)");
- die("Mother fucker (Ther server is down, we couldnt stablish the database connection)");
- }else{
- $uName = $_POST["uName"];
- $uPassword = $_POST["uPassword"];
- $sql = "SELECT * FROM Users WHERE '$uName' = username AND passwrd = '$uPassword'";
- $result = $conn -> query($sql);
- if($result->num_rows>0){
- while($row = $result->fetch_assoc()){
- $response = array("Firstname"=>$row["fName"],"Lastname"=>$row["lName"],"username"=>$row["username"],"Firstname"=>$row["passwrd"]);
- }
- echo json_encode($response);
- }else{
- header("HTTP/1.1 406 User not found.");
- die("Type your shit right son (Wrong credentials provided)");
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement