0 ) { // store basic user data in variables while( $row = mysqli_fetch_assoc($result) ) { $user = $row['username']; $email = $row['email']; $hashedPass = $row['password']; } // verify hashed password with the typed password if( password_verify( $formPass, $hashedPass ) ) { // correct login details! // start the session session_start(); // store data in SESSION variables $_SESSION['loggedInUser'] = $user; $_SESSION['loggedInEmail'] = $email; header("Location: profile.php"); } else { // hashed password didn't verify // error message $loginError = "
Wrong username / password combination. Try again.
"; } } else { // there are no results in database $loginError = "
No such user in database. Please try again. ×
"; } // close the mysql connection mysqli_close($connection); } ?> Login

Login

Use this form to log into your account