Advertisement
omur00

Untitled

Jul 30th, 2021
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. <?php
  2. namespace App\Http\Controllers;
  3. use Illuminate\Support\Facades\Hash;
  4. use Illuminate\Http\Request;
  5. use App\Http\Controllers\Controller;
  6. use Hash;
  7. use App\User;
  8. use App\Http\Controllers\Auth;
  9. use App\Hash;
  10.  
  11.  
  12. $email = 'xxxx';
  13. $password = 'xxxx';
  14. $token = $_POST["token"];
  15.  
  16. $con=mysqli_connect("localhost", "xxxx", "xxxx", "xxxx");
  17.  
  18. $sql = "SELECT * FROM users WHERE email = '$email'";
  19. $result = mysqli_query($con, $sql);
  20. if($result) {
  21.  
  22. if (mysqli_num_rows($result) >= 1 ) {
  23.  
  24. $row = mysqli_fetch_assoc($result);
  25. $hashPassword = '$row["password"]';
  26.  
  27. if (Hash::check($password, $hashPassword))
  28. {
  29. $response = array("success" => "1", "user_details" => $row, "message"=>"You have been logged in successfully");
  30. }
  31.  
  32.  
  33. } else {
  34. $response = array("success" => "0", "message"=>"Please enter valid email and password");
  35. }
  36.  
  37. } else {
  38. $response = array("success" => "0", "message"=>"Server error");
  39. }
  40.  
  41. header('Content-type: application/json');
  42. echo json_encode($response);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement