Advertisement
Guest User

Untitled

a guest
Mar 29th, 2018
403
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.77 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. include 'config.php';
  5.  
  6. // Creating connection.
  7.  $con = new mysqli($dbhost, $dbusername, $dbpassword, $dbname);
  8.  
  9.  $json = file_get_contents('php://input');
  10.  
  11.  
  12.  $obj = json_decode($json,true);
  13.  
  14. $email =  $obj['email'];
  15.  
  16.  
  17. $password = $obj['password'];
  18.  
  19.  
  20. $Sql_Query = "select * from users where email = '$email' and password = '$password' ";
  21.  
  22. // Executing SQL Query.
  23. $check = mysqli_fetch_array(mysqli_query($con,$Sql_Query));
  24.  
  25.  
  26. if(isset($check)){
  27.  
  28.  $SuccessLoginMsg = 'Data Matched';
  29. $SuccessLoginJson = json_encode($SuccessLoginMsg);
  30.  echo $SuccessLoginJson ;
  31.  
  32.  }
  33.  
  34.  else{
  35.  
  36.  
  37. $InvalidMSG = 'Invalid Username or Password Please Try Again' ;
  38. $InvalidMSGJSon = json_encode($InvalidMSG);
  39.  echo $InvalidMSGJSon ;
  40.  
  41.  }
  42.  
  43.  mysqli_close($con);
  44. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement