Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (isset($_POST['submit'])){
- $username = $_POST['username'];
- $password = $_POST['password'];
- $q = $handler->prepare('SELECT * FROM users WHERE username = ?');
- $result = $q->execute(array($username));
- if ($q->rowCount() > 0){
- $result = $q -> fetch(PDO::FETCH_ASSOC);
- $hash_pwd = $result['password'];
- $hash = password_verify($password, $hash_pwd);
- if ($hash == 0) {
- error_log("hashwrong");
- echo '<p class="error-message3">'.'<br>'.'<br>'."You have ented an incorrect login! <br>Please try again.".'</p>';
- }
- else {
- $_SESSION['username'] = $username;
- error_log("loggedin");
- header("location: index.php");return;
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement