Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include_once 'assets\config\database.php';
- include_once 'assets\resource\session.php';
- include_once 'assets\resource\utilities.php';
- if (isset($_POST['loginBtn'])) {
- $user = $_POST['username'];
- $password = $_POST['password'];
- $sqlQuery = "SELECT * FROM users WHERE username = :username"
- $statement = $db->prepare($sqlQuery);
- $statement->execute(array('username' => $user));
- while($row = $statement->fetch()){
- $id = $row['id'];
- $hashed_password = $row['password'];
- $username = $row['username']
- if(password_verify($password, $hashed_password)){
- $_SESSION['id'] = $id;
- $_SESSION['username'] = $username;
- header('Location: dashboard.php')
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement