Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace App\Http\Controllers;
- use Illuminate\Support\Facades\Hash;
- use Illuminate\Http\Request;
- use App\Http\Controllers\Controller;
- use Hash;
- use App\User;
- use App\Http\Controllers\Auth;
- use App\Hash;
- $email = 'xxxx';
- $password = 'xxxx';
- $token = $_POST["token"];
- $con=mysqli_connect("localhost", "xxxx", "xxxx", "xxxx");
- $sql = "SELECT * FROM users WHERE email = '$email'";
- $result = mysqli_query($con, $sql);
- if($result) {
- if (mysqli_num_rows($result) >= 1 ) {
- $row = mysqli_fetch_assoc($result);
- $hashPassword = '$row["password"]';
- if (Hash::check($password, $hashPassword))
- {
- $response = array("success" => "1", "user_details" => $row, "message"=>"You have been logged in successfully");
- }
- } else {
- $response = array("success" => "0", "message"=>"Please enter valid email and password");
- }
- } else {
- $response = array("success" => "0", "message"=>"Server error");
- }
- header('Content-type: application/json');
- echo json_encode($response);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement