-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
35 lines (31 loc) · 1.07 KB
/
index.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
<?php
/*
----------------------------------------------------------------------
file: index.php
project: mybrary
summary:
This file is to be called first. If the user is logged in, with
an active session, he or she will be redirected to the dashboard.
If the user is not logged in, he or she will be redirected to the
login form.
----------------------------------------------------------------------
*/
//Import all user settings
include_once( 'lib/user-functions.php' );
//Declare user variables - even if they are not set (will be empty)
//This generates a warning, but even if not elegant, it's 100% to plan
$tmpUsername = $_POST['username'];
$tmpPassword = $_POST['password'];
//Is the user logged in on do we have valid credentials?
if ( checkSessionStatus( $tmpUsername, $tmpPassword ) ) {
//YES : Goto dashboard
header("Location: dashboard.php");
//Stop script (not neccessary but recommended)
exit();
} else {
//NO : Go back to the login form
header("Location: login.php");
//Stop script (not neccessary but recommended)
exit();
}
?>