-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
32 lines (27 loc) · 998 Bytes
/
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
<?php
session_name("brickus_session_id");
session_start();
// This will only echo the first time, when a session is created by the server
if(SID){
error_log("Creating new session: " . SID);
error_log("Session cookie name: " . session_name());
}
// Check if the user is already logged in
if(isset($_SESSION['logged_in']) && $_SESSION['logged_in'] == true) {
echo "Welcome to the member's area, " . $_SESSION['username'] . "!<br>";
// Go to the dashboard
// See http://stackoverflow.com/a/9539996
readFile("views/dashboard.html");
} else {
// echo "Please log in first to see this page.";
// Output login html
readFile("views/login.html");
}
if( isset( $_SESSION['counter'] ) ) {
$_SESSION['counter'] += 1;
}else {
$_SESSION['counter'] = 1;
}
echo "You have visited this page ". $_SESSION['counter'] . " times in this session.";
session_commit();
?>