/
process_login.php
39 lines (31 loc) · 1.05 KB
/
process_login.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
include_once 'includes/db_connect.php';
include_once 'includes/functions.php';
sec_session_start(); // Our custom secure way of starting a PHP session.
if (isset($_POST['email'], $_POST['p'])) {
$email = $_POST['email'];
$password = $_POST['p']; // The hashed password.
if (login($email, $password, $mysqli) == true) {
// Login success
header('Location: admin/protected_page.php');
}
elseif (login1($email, $password, $mysqli) == true) {
// Login success
header('Location: user1/protected_page.php');
}
elseif (login2($email, $password, $mysqli) == true) {
// Login success
header('Location: user2/protected_page.php');
}
elseif (login3($email, $password, $mysqli) == true) {
// Login success
header('Location: user3/protected_page.php.php');
}else {
// Login failed
header('Location: index.php?error=1');
}
} else {
// The correct POST variables were not sent to this page.
echo 'Invalid Request';
}
?>