-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdash.php
156 lines (141 loc) · 4.9 KB
/
dash.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
<!-- Includes -->
<?php include('include/dbConfig.php'); ?>
<?php //include('./component/helper/helper.php'); ?>
<?php include('include/session.php'); ?>
<?php include('include/header.php'); ?>
<?php include('function.php'); ?>
<!-- topbar -->
<div class="wrap">
<div id="header">
<div id="top">
<div class="left">
<p>Welcome, <strong><?php echo $_SESSION["username"] ?></strong> [ <a href="log_out.php">logout</a> ]</p>
</div>
<div class="right">
<div class="align-right">
</div>
</div>
</div>
<div id="nav">
<ul>
<li class="upp"><a href="#">Main control</a>
<ul>
<li>› <a href="">Visit site</a></li>
<li>› <a href="">Reports</a></li>
<li>› <a href="">Add new page</a></li>
<li>› <a href="">Site config</a></li>
</ul>
</li>
<li class="upp"><a href="#">Manage content</a>
<ul>
<li>› <a href="">Show all pages</a></li>
<li>› <a href="">Add new page</a></li>
<li>› <a href="">Add new gallery</a></li>
<li>› <a href="">Categories</a></li>
</ul>
</li>
<!-- <li class="upp"><a href="#">Settings</a>
<ul>
<li>› <a href="">Site configuration</a></li>
<li>› <a href="">Contact Form</a></li>
</ul> -->
</li>
</ul>
</div>
</div>
<!-- sidebar -->
<div id="content">
<div id="sidebar">
<div class="box">
<div class="h_title">› Main control</div>
<ul id="home">
<li class="b1"><a class="icon view_page" href="dash.php">Home</a></li>
<!-- <li class="b2"><a class="icon report" href="">Reports</a></li>
<li class="b1"><a class="icon add_page" href="">Add new page</a></li>
<li class="b2"><a class="icon config" href="">Site config</a></li> -->
</ul>
</div>
<div class="box">
<div class="h_title">› Manage Library</div>
<ul>
<li class="b1"><a class="icon page" href="?view_books">View Library</a></li>
<?php if(check_user_role()){ ?>
<li class="b2"><a class="icon add_page" href="?add_books">Add New Book</a></li>
<?php } ?>
<li class="b1"><a class="icon page" href="?my_books=<?php echo $_SESSION["user_id"]; ?>">My Books</a></li>
<!-- <li class="b1"><a class="icon photo" href="">Add new gallery</a></li>
<li class="b2"><a class="icon category" href="">Categories</a></li> -->
</ul>
</div>
<?php if(check_user_role()){ ?>
<div class="box">
<div class="h_title">› Manage Users</div>
<ul>
<li class="b1"><a class="icon users" href="?view_users">Show all users</a></li>
<li class="b2"><a class="icon add_user" href="?add_users">Add new user</a></li>
<!-- <li class="b1"><a class="icon block_users" href="">Lock users</a></li> -->
</ul>
</div>
<?php } ?>
<div class="box">
<div class="h_title">› Settings</div>
<ul>
<li class="b1"><a class="icon config" href="">Site configuration</a></li>
<li class="b2"><a class="icon contact" href="">Contact Form</a></li>
</ul>
</div>
</div>
<!-- Slides -->
<?php
$sql = "SELECT
user_books.tran_id,
books.Book_Name,
books.Author,
books.Cover,
user_books.user_id,
user_books.Book_ID
FROM
books
INNER JOIN user_books ON user_books.Book_ID = books.Book_ID
Where user_id={$_SESSION["user_id"]}"
;
$result = $con->query($sql);
if(empty($_GET)) {
?>
<div class="accordian">
<ul>
<?php while($row = $result->fetch_assoc()){ ?>
<li>
<div class="image_title">
<a href="dash.php?book_template=<?php echo $row['Book_ID']?>"><?php echo $row["Book_Name"]?></a>
</div>
<a href="dash.php?book_template=<?php echo $row['Book_ID']?>">
<img src="uploads/<?php echo $row['Cover']?>">
</a>
</li>
<?php } ?>
</ul>
</div>
<!-- Links -->
<?php
}
if(isset($_GET['add_books']) || isset($_GET['update']) && check_user_role()){
include('view/add_book.php');
}
if(isset($_GET['view_books']) || isset($_GET['delete'])){
include('view/view_books.php');
}
if(isset($_GET['add_users']) || isset($_GET['update_user']) && check_user_role()){
include('user options/add_users.php');
}
if(isset($_GET['view_users']) || isset($_GET['delete_user']) && check_user_role()){
include('user options/view_users.php');
}
if(isset($_GET['book_template'])){
include('view/book_template.php');
}
if(isset($_GET['my_books'])){
include('user options/my_books.php');
}
?>
<?php include('include/footer.php'); ?>