Projekt

Obecné

Profil

Stáhnout (639 Bajtů) Statistiky
| Větev: | Revize:
1
<?php
2
require "../model/DB.php";
3
session_start();
4
$DB = new DB();
5
var_dump($_POST);
6
$result = $DB->getUser($_POST['username']);
7

    
8
if (count($result) == 1) {
9
    $user = $result[0];
10
    if (password_verify($_POST['password'], $user['password'])) {
11
        session_regenerate_id();
12
        $_SESSION['loggedIn'] = true;
13
        $_SESSION['username'] = $_POST['username'];
14
        $_SESSION['id'] = $user['id'];
15
        $_SESSION['role'] = $user['role'];
16
    } else {
17
        // Incorrect password
18
        echo 'Incorrect username and/or password!';
19
    }
20
} else {
21
    // Incorrect username
22
    echo 'Incorrect username and/or password!';
23
}
24

    
25

    
(3-3/10)