-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
63 lines (45 loc) · 1.38 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
require_once 'core/init.php';
if (Session::exists('success')){
echo Session::flash('success');
}
$user=new User(); // get logged in user
if ($user->isLoggedIn()){
echo "Hello ,<a href='profile.php?username=".$user->data()->username."'>{$user->data()->username}</a>";
?>
<ul>
<li><a href="update-profile.php">Update Profile</a></li>
<li><a href="change-password.php">Change Password</a></li>
<li><a href="logout.php">Logout</a></li>
</ul>
<?php
}
else{
echo "<a href='login.php'>Login</a> or <a href='register.php'>Register</a>";
}
if ($user->hasPermission('admin')){
echo '<h2>You are administrator</h2>';
}
//var_dump(Config::get('mysql.host'));
//$users = DB::getInstance()->query("Select * from users WHERE id=?",["1"]);
//$users = DB::getInstance()->get("users",["name","=","Taghreed M. KAmel"]);
//if ($users->count()){
// foreach ($users->results() as $user){
// echo $user->username."<br>";
// }
//}
//$users = DB::getInstance()->delete("users",["username","=","Ahmed"]);
//
//
//DB::getInstance()->insert('users',[
// 'username' => 'Ahmed',
// 'email' =>'[email protected]',
// 'name' =>'Ahmed Kamel',
// 'password' =>md5('123'),
// 'salt' => 'salt',
// 'joined_at' => date('Y-m-d H:i:s'),
// 'group_id' => 1
//]);
DB::getInstance()->update('users',3, [
'username' => 'Taghreeeeeed'
]);