about 9 years ago
Hi friends, If you are using PDO in php , Now you can Authenticate user using simple code.
include 'conn.php'; try { $username = $_POST['user']; $password = $_POST['pass']; $smt=$conn->prepare("SELECT * FROM signup WHERE username = '".$username."'"); $smt->execute(); $result=$smt->fetch(PDO::FETCH_OBJ); $prev=$result->Password; $usr=$result->Username; if(password_verify($password,$prev)& $username===$usr) { // Set username session variable $_SESSION['user'] = $username; // Jump to secured page header('location:index.php'); exit; } else { $_SESSION['login-error']="Incorrect username or password"; header('location:signin.php'); exit; } }
Starting with Chrome version 45, NPAPI is no longer supported for Google Chrome. For more information, see Chrome and NPAPI (blog.chromium.org).
Firefox and Microsoft Internet Explorer are recommended browsers for websites using java applets.
Chrome Version Support
Are you sure, you want to delete this comment?
Sign up using
0 Comment(s)