-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdashboard.php
179 lines (158 loc) · 6.8 KB
/
dashboard.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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<?php
session_start();
if(!isset($_SESSION["user"]))
header("Location:index.php");
include 'count.php'; //shows badge notification
?>
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="shortcut icon" type="image/png" href="Images/favicon.png">
<title>Dashboard</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="CSS/style.css">
</head>
<body>
<div class="container-fluid">
<div class="row"><!--start of row-->
<div class="col-md-3">
<div class="row"><!--nested row starts-->
<div class="col-md-3" align="center" style="background-color:#1A1927;position:fixed"><!--libromate logo-->
<a href="dashboard.php"><img src="Images/logo.png" style="height:100px;"></a>
</div>
<div id="dashboard_left_col" style="padding-top:100px"><!--start of vertical navbar-->
<ul>
<br>
<p>MENU</p>
<li><a class="active" href="dashboard.php">
<span class="glyphicon glyphicon-home"></span> Dashboard</a>
</li>
<li><a href="profile.php">
<span class="glyphicon glyphicon-user"></span> Profile</a>
</li>
<br>
<p>BOOKS</p>
<li><a href="add.php">
<span class="glyphicon glyphicon-plus"></span> Add</a>
</li>
<li><a href="modify.php">
<span class="glyphicon glyphicon-edit"></span> Modify</a>
</li>
<li><a href="browse.php">
<span class="glyphicon glyphicon-eye-open"></span> Browse all</a>
</li>
<br>
<p>STATUS</p>
<li><a href="borrow.php">
<span class="glyphicon glyphicon-hourglass"></span> Borrowed
<?php
if($borrow!=0) {
echo "<span class='badge'>$borrow</span>";
}
?>
</a>
</li>
<li><a href="lent.php">
<span class="glyphicon glyphicon-book"></span> Lent
<?php
if($lent!=0) {
echo "<span class='badge'>$lent</span>";
}
?>
</a>
</li>
<br>
<p>SESSION</p>
<li><a href="logout.php">
<span class="glyphicon glyphicon-log-out"></span> Logout</a>
</li>
<li><a href="trash.php">
<span class="glyphicon glyphicon-trash"></span> Trash</a>
</li>
</ul>
</div><!--end of vertical navbar-->
</div><!--end of nested row-->
</div><!--end of col-md-3-->
<div class="col-md-9"><!--col-md-9 start-->
<div class="row">
<div class="container-fluid" style="background-color: #3498DB;height: 100px">
<div class="col-md-1"></div>
<div class="topnav col-md-9">
<div class="search-container">
<form action="search.php" method="post">
<input type="text" placeholder=" Search book name or author name ..." name="search_input" size="55%">
<button type="submit" name="search"><i class="glyphicon glyphicon-search"></i></button>
</form>
</div>
</div>
<div class="col-md-2" id="nav_image">
<div class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" style="text-decoration: none">
<img src="Images/geek_pic.png" alt="My Pic" style="width:35%;" >
<span class="caret" style="color: black"></span>
</a>
<ul class="dropdown-menu">
<li><p>Signed in as <br><b><?php echo $_SESSION['user'];?></b></p></li>
<li class="divider"></li>
<li><a href="profile.php">Your Profile</a></li>
<li><a href="logout.php">Logout</a></li>
</ul>
</div>
</div>
</div>
<div class="container-fluid">
<br>
<div style="font-size:30px;padding-left: 70px">Hello <?php echo htmlentities($_SESSION["user"]); ?>,</div>
<div style="font-size:15px;padding-left: 70px">
<?php
require_once('db_connect.php'); //connect with database
$query = "select * from books b where b.trash='0' AND b.owner='".$_SESSION['user_id']."'";
$result = mysqli_query($link,$query);
if(mysqli_num_rows($result)==0)
echo nl2br("\nOops !! you have not added any books recently");
else {
echo nl2br("\nFollowing is the list of books you have added:");
}
echo nl2br("\n\n");
?>
</div>
<div class="table-responsive" style="padding-left:70px;padding-right:50px;max-height:400px">
<table class="table">
<thead id="thead"><!--table header start-->
<tr>
<th>S.No.</th>
<th>Book Id</th>
<th>Book Name</th>
<th>Author</th>
</tr>
</thead><!--table header close-->
<tbody>
<!--fetch and display data from MySQL-->
<?php
$i=1;
while($row = mysqli_fetch_array($result)) {
echo "<tr>";
echo "<td>" . $i . "</td>";
echo "<td>" . $row["bid"] . "</td>";
echo "<td>" . $row["bname"] . "</td>";
echo "<td>" . $row["author"] . "</td>";
echo "</tr>";
++$i;
}
?>
</tbody>
</table>
</div><!--end of responsive table-->
</div>
</div>
</div><!--end of col-md-9-->
</div><!--end of row-->
</div><!--end of container fluid-->
</body>
</html>