-
Notifications
You must be signed in to change notification settings - Fork 21
/
index.php
44 lines (34 loc) · 938 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
33
34
35
36
37
38
39
40
41
42
43
44
<?php
require_once 'core/init.php';
$user = DB::getInstance()->get('tms_users', array('username', '=', 'adam'));
if(!$user->count()) {
echo 'NO User';
} else {
echo $user->first()->username;
}
// flash a message if exists //
if(Session::exists('home')) {
echo '<p>'.Session::flash('home').'</p>';
}
$user = new User();
// echo '<pre>';
// print_r($user);
// echo '</pre>';
if($user->isLoggedIn()) {
echo 'Logged In';
?>
<p>Hello <a href="profile.php?user=<?php echo escape($user->data()->username); ?>">
<?php echo escape($user->data()->username); ?></a>!</p>
<ul>
<li><a href="logout.php">Logout</a></li>
<li><a href="update.php">Update</a></li>
<li><a href="changepassword.php">Change Password</a></li>
</ul>
<?php
if($user->hasPermission('admin')) {
echo '<p>You are an admin.</p>';
}
} else {
echo '<p>You need to <a href="login.php">login</a> or <a href="register.php">register</a>.</p>';
}
?>