jeudi 24 janvier 2019

Bootstrap modal from login in php using ajax

I'm trying to create login through php its working in a static page but not in bootstrap modal form .. if i am entering any data it is showing successful with alert and not verifying my data ! I have also implemented verification system in login mean login should be only possible after email verification but its also not working with ajax. pls help ! How to write ajax for this php login code?

What i have tried is just given in code.

login.php

'

if (isset($_POST['login_button'])) {
        $con = new mysqli('localhost', 'root', '', 'research');

    $email = $con->real_escape_string($_POST['email']);
    $password = $con->real_escape_string($_POST['password']);

    if ($email == "" || $password == "")
        $msg = "Please check your inputs!";
    else {
        $sql = $con->query("SELECT id, password, isEmailConfirmed FROM users WHERE email='$email'");
        if ($sql->num_rows > 0) {
            $data = $sql->fetch_array();
            if (password_verify($password, $data['password'])) {
                if ($data['isEmailConfirmed'] == 0)
                    $msg = "Please verify your email!";
                else {
                    $msg = "You have been logged in";

                }
            } else
                $msg = "Please check your inputs!";
        } else {
            $msg = "Please check your inputs!";
        }
    }
}

?>'




Aucun commentaire:

Enregistrer un commentaire