-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathissuebook.php
More file actions
116 lines (96 loc) · 3.63 KB
/
Copy pathissuebook.php
File metadata and controls
116 lines (96 loc) · 3.63 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
<?php
session_start();
if (isset($_SESSION['uid1'])) echo "";
else header('location: ../login.php');
$usn = $_REQUEST['usn'];
$name = $_REQUEST['name'];
$count = $_REQUEST['count'];
if ($count==3) {
echo "
<script>
confirm('Maximum books issued! Remove some to issue more.');
window.open('studentdetails.php?usn={$usn}','_self');
</script>
";
}
if (isset($_POST['issuebook'])) {
include('dbconn.php');
$usn = $_POST['usn'];
$bid = $_POST['bid'];
$bname = $_POST['bname'];
$qry = "INSERT INTO books " . "(usn,book_id,book_name)" . " VALUES " . "('$usn','$bid','$bname')";
$run = mysqli_query($conn, $qry);
if ($run == true) echo "
<script>
confirm('Book Issued! Redirecting to Dashboard.');
window.open('studentdetails.php?usn={$usn}','_self');
</script>
";
else echo ("error: " . mysqli_error($conn));
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Issue Book / Library Management System</title>
<meta content="text/html; charset=utf-8" http-equiv=Content-Type>
<meta name="viewport" content="width=device-width, initial-scale=1,
user-scalable=no, maximum-scale=1, minimum-scale=1">
<!-- Bootstrap core CSS -->
<link rel="stylesheet" href="https://bootswatch.com/4/pulse/bootstrap.min.css">
<!-- Custom styles for this template -->
<link href="https://fonts.googleapis.com/css?family=Noto+Sans|Roboto" rel="stylesheet">
<link href="style.css" rel="stylesheet" />
<style type="text/css">
body {
background-color: #eee;
padding: 5%;
}
#admindash {
background-color: #eee;
padding: 5%;
width: 60%;
margin: auto;
box-shadow: 1px -2px 24px -1px rgba(0,0,0,0.75);
border-radius: 10px;
}
.form input {
width: 100%;
}
.form button {
width: 100%;
}
</style>
</head>
<body>
<div class="container">
<div class="row">
<div id="admindash">
<h3><?php echo $_REQUEST['name']; ?> - <?php echo $_REQUEST['usn']; ?></h3>
<p class="lead">Enter the details of books to be issued</p>
<h6>
<a href="../admindash.php">Go Back</a> /
<a href="../logout.php">Log Out</a>
</h6>
<br><br>
<div class="login-page">
<div class="form">
<form class="login-form" action="issuebook.php" method="post">
<input type="text" name="usn" value="<?php echo $usn ?>" hidden />
<input type="text" placeholder="Book Id" name="bid" required />
<input type="text" placeholder="Book Name" name="bname" required />
<button type="submit" class="btn btn-primary" name="issuebook">
Issue Book
</button>
<br><br>
</form>
</div>
</div>
</div>
</div>
<!-- Bootstrap core JavaScript -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
</body>
</html>