-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadmin_book.php
65 lines (62 loc) · 2.1 KB
/
admin_book.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
<?php
session_start();
if((!isset($_SESSION['manager']) && !isset($_SESSION['expert']))){
header("Location:index.php");
}
$title = "List book";
require_once "./template/header.php";
require_once "./functions/database_functions.php";
$conn = db_connect();
$result = getAll($conn);
?>
<div>
<a href="admin_signout.php" class="btn btn-danger"><span class="glyphicon glyphicon-off"></span> Logout</a>
<a href="admin_publishers.php" class="btn btn-primary"><span class="glyphicon glyphicon-paperclip"></span> Publishers</a>
<a href="admin_categories.php" class="btn btn-primary"><span class="glyphicon glyphicon-list-alt"></span> Categories</a>
<?php
if (isset($_SESSION['manager']) && $_SESSION['manager']==true){
echo '<a class="btn btn-primary" href="admin_add.php"><span class="glyphicon glyphicon-plus"></span> Add Book</a>';
}
?>
</div>
<table class="table" style="margin-top: 20px">
<tr>
<th>ISBN</th>
<th>Title</th>
<th>Author</th>
<th>Image</th>
<th>Description</th>
<th>Price</th>
<th>Publisher</th>
<th>Category</th>
<th> </th>
<th> </th>
</tr>
<?php while($row = mysqli_fetch_assoc($result)){ ?>
<tr>
<td><?php echo $row['ISBN']; ?></td>
<td><?php echo $row['title']; ?></td>
<td><?php echo $row['year']; ?></td>
<td><?php echo $row['book_img']; ?></td>
<td><?php echo $row['des']; ?></td>
<td><?php echo $row['price']; ?></td>
<td><?php echo getPubName($conn, $row['p_id']); ?></td>
<td><?php echo getCatName($conn, $row['c_id']); ?></td>
<?php
if( isset($_SESSION['expert']) && $_SESSION['expert']==true){
echo '<td><a href="admin_edit.php?bookisbn=';
echo $row['ISBN'];
echo'"><span class="glyphicon glyphicon-pencil"></span>Edit</a></td>';
}else if (isset($_SESSION['manager']) && $_SESSION['manager']==true){
echo '<td><a href="admin_delete.php?bookisbn=';
echo $row['ISBN'];
echo '"><span class="glyphicon glyphicon-trash"></span>Delete</a></td>';
}
?>
</tr>
<?php } ?>
</table>
<?php
if(isset($conn)) {mysqli_close($conn);}
require_once "./template/footer.php";
?>