-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreturn_book.php
More file actions
193 lines (166 loc) · 5.46 KB
/
return_book.php
File metadata and controls
193 lines (166 loc) · 5.46 KB
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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
<?php
$conn = mysqli_connect("localhost","root","","project");
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$g=$_GET['cid'];
$query="select * from issue_books where issue_id='$g'";
$result=mysqli_query($conn,$query);
$row=mysqli_fetch_assoc($result);
$due_date=$row['due_date'];
$currentDate = date('Y-m-d');
$buk_id=$row['b_id'];
$due_date_time=new DateTime($due_date);
$currentDate_time=new DateTime($currentDate);
$fine_per_day=1.5;
$interval = $due_date_time->diff($currentDate_time);
$days_late = $interval->format('%r%a');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Library Book Management System</title>
<style>
* {
box-sizing: border-box;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
body {
background-color: #f5f5f5;
margin: 0;
padding: 20px;
color: #333;
}
.header {
text-align: center;
margin-bottom: 30px;
}
.header h1 {
color: #2c3e50;
font-size: 28px;
margin-bottom: 5px;
}
.container {
display: flex;
flex-wrap: wrap;
gap: 30px;
justify-content: center;
}
.section {
background-color: white;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
padding: 25px;
width: 100%;
max-width: 500px;
}
.section-title {
font-size: 20px;
color: #3498db;
margin-top: 0;
margin-bottom: 20px;
padding-bottom: 10px;
border-bottom: 1px solid #eee;
}
.form-group {
margin-bottom: 20px;
}
label {
display: block;
margin-bottom: 8px;
font-weight: 600;
color:white;
}
input[type="text"],
input[type="date"] {
width: 100%;
padding: 12px;
border: 1px solid #ddd;
border-radius: 4px;
font-size: 16px;
transition: border 0.3s;
}
input[type="text"]:focus,
input[type="date"]:focus {
border-color: #3498db;
outline: none;
}
.book-info {
background-color: #f9f9f9;
padding: 15px;
border-radius: 4px;
margin-bottom: 20px;
border-left: 4px solid #3498db;
}
.book-title {
font-weight: bold;
font-size: 18px;
margin-bottom: 5px;
}
.btn {
background-color: #3498db;
color: white;
border: none;
padding: 12px 20px;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
font-weight: 600;
width: 100%;
transition: background-color 0.3s;
}
.btn:hover {
background-color: #2980b9;
}
.time-display {
text-align: center;
margin-top: 30px;
color: #777;
font-size: 14px;
}
</style>
</head>
<body style="background-color:rgb(216, 232, 248) ">
<br><br>
<div class="header">
<h1>Library Book Management System</h1>
</div>
<div class="container" style="color:white">
<div class="section" style="background-color:rgb(130, 163, 188) ">
<h2 class="section-title" style="color: white;">Return Book Details</h2>
<div class="form-group">
<label for="issueBookId">Book ID: </label>
<input type="text" id="issueBookId" placeholder="Enter Book ID" value="<?php echo $row['b_id'] ?>" readonly>
</div>
<div class="form-group">
<label for="studentId">Student ID: </label>
<input type="text" id="studentId" placeholder="Enter Student ID" value="<?php echo $row['s_id'] ?>" readonly>
</div>
<div class="form-group">
<label for="studentId">Issue Date </label>
<input type="text" id="studentId" placeholder="Enter Issue Date" value="<?php echo $row['issue_date'] ?>" readonly>
</div>
<div class="form-group">
<label for="studentId">Due Date </label>
<input type="text" id="studentId" placeholder="Enter Due Date" value="<?php echo $row['due_date'] ?>" readonly>
</div>
<div class="form-group">
<label for="studentId">Return Date</label>
<input type="text" id="studentId" placeholder="Enter Return Date"value="<?php echo $currentDate ?>">
</div>
<?php
if ($days_late > 0) {
$fine = $days_late * $fine_per_day;
echo "Book is $days_late days late. Fine: $fine Taka";
} else {
echo "No fine. Book returned on time or early.";
}
?>
<br><br>
<div style="height: 15px;"><a href="return_book_h.php?n_id=<?php echo $g; ?>" style="color: #2c3e50;text-decoration: none;"><b>Return Book</b></a></div>
</div>
</div>
</body>
</html>