-
Notifications
You must be signed in to change notification settings - Fork 1
/
admin-existing-library-check.php
130 lines (97 loc) · 4.57 KB
/
admin-existing-library-check.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
<?php
require "admin-header.php";
?>
<?php
$error = [];
if(isset($_POST['admin-existing-library-check'])){
if(isset($_GET['library_id'])){
$library_id = $_GET['library_id'];
}
$library_id = $_POST['library_id'];
$sql1 = "UPDATE library SET verify='0' WHERE library_id='$library_id'";
$stmt1 = $conn->prepare($sql1);
if($stmt1->execute()){
echo "<script>location.href = 'existing-library.php';</script>";
}
}
?>
<div class="container mt-5 pt-5">
<nav>
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="student-dashboard.php"><i class="bi bi-house-door"></i></a></li>
<li class="breadcrumb-item"><a href="#">Verify Library</a></li>
</ol>
</nav>
</div>
<main id="main" class="main mt-0">
<section class="section dashboard">
<div class="row">
<div class="col-lg-6">
<?php
if(isset($_GET['library_id'])){
$library_id = $_GET['library_id'];
}
$sql = "SELECT * FROM library WHERE library_id='$library_id'";
$stmt = $conn->prepare($sql);
$stmt->execute();
$result = $stmt->get_result();
if($result->num_rows > 0){
$get_data = $result->fetch_assoc();
$staff_id = $get_data['staff_id'];
$sql1 = "SELECT * FROM staff WHERE unique_id='$staff_id'";
$stmt1 = $conn->prepare($sql1);
$stmt1->execute();
$get = $stmt1->get_result();
if($get->num_rows > 0){
$data = $get->fetch_assoc();
}
}
if(isset($_POST['del-library'])){
$library_id = $_POST['library_id'];
$sql = "DELETE FROM library WHERE library_id='$library_id'";
$stmt = $conn->prepare($sql);
if($stmt->execute()){
echo "<script>location.href = 'delete-library.php';</script>";
}
}
?>
<div class="col-lg-8 col-md-6">
<div class="card info-card sales-card">
<div class="filter">
<a class="icon" href="#" data-bs-toggle="dropdown"><i class="bi bi-three-dots"></i></a>
<ul class="dropdown-menu dropdown-menu-end dropdown-menu-arrow">
<li><a class="dropdown-item" href="#"><i class="bi bi-person"></i>Profile</a></li>
<li><a class="dropdown-item" href="#"><i class="bi bi-send"></i>Message</a></li>
<li><a class="dropdown-item" href="#"><i class="bi bi-telephone-outbound"></i>Call</a></li>
</ul>
</div>
<div class="card-body">
<h5 class="card-title"><a class="nav-link nav-profile d-flex align-items-center pt-0" href="#" data-bs-toggle="dropdown">
<img style="height: 40px; width: 40px;" src="uploads/<?= $data['image']; ?>" alt="Profile" class="rounded-circle">
<span class="d-md-block ps-2"><?= $data['lastname'].' '. $data['firstname']; ?></span>
</a><!-- End Profile Iamge Icon --></h5>
<div class="row g-0 text-center">
<h3 class="card-title fw-bold pt-0"><i class="bi bi-card-heading fs-5"></i> <?= $get_data['course']; ?></h3>
<p class="card-text pt-0"><?= $get_data['about']; ?></p>
<p class="card-text pt-0"><?= $get_data['date']; ?></p>
<hr>
<div class="row">
<div class="col-sm-12 d-flex align-items-center justify-content-between">
<a href="admin-view-library.php?path=uploads/<?= $get_data['pdf']; ?>" class="btn btn-primary form-control w-50">Download</a>
<form action="<?= htmlspecialchars($_SERVER['PHP_SELF']); ?>" method="post">
<input type="hidden" name="library_id" value="<?= $library_id; ?>"><br />
<button type="submit" name="del-library" class="btn btn-danger form-control mb-4">Delete Book</button>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</main><!-- End #main -->
<?php
require "main-footer.php";
?>