Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- ob_start();
- session_start();
- try {
- $dbh = new PDO('mysql:host=localhost;dbname=petrzilk_test', 'petrzilk_dbAdmin', '');
- } catch(PDOException $e) {
- echo $e->getMessage();
- }
- $query = "SELECT * FROM users WHERE LOWER(email) = :email";
- $stmt = $dbh->prepare($query);
- $stmt->bindValue(':email', strtolower($_POST['email']));
- $stmt->execute();
- if ($stmt->rowCount() == 1) {
- $row = $stmt->fetch(PDO::FETCH_ASSOC);
- require('blowfish.class.php');
- $bcrypt = new Bcrypt(4);
- if ($bcrypt->verify($_POST['password'], $row['password'])){
- session_regenerate_id();
- $_SESSION['sess_user_id'] = $row['uid'];
- $_SESSION['sess_email'] = $row['email'];
- $_SESSION['sess_name'] = $row['fname'] . " " . $row['lname'];
- session_write_close();
- header("Location: index.php");
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement