Você está na página 1de 46

ACCOUNT

<?php

require_once 'connect.php';

$qadmin = $conn->query("SELECT * FROM `admin` WHERE `admin_id` = '$_SESSION[admin_id]'") or


die(mysqli_error());

$fadmin = $qadmin->fetch_array();

$name = $fadmin['firstname']." ".$fadmin['lastname'];

ADMIN
<!DOCTYPE html>

<?php

require_once 'valid.php';

?>

<html lang = "eng">

<head>

<title>Library System</title>

<meta charset = "utf-8" />

<meta name = "viewport" content = "width=device-width, initial-scale=1" />

<link rel = "stylesheet" type = "text/css" href = "css/bootstrap.css" />

<link rel = "stylesheet" type = "text/css" href = "css/jquery.dataTables.css" />

</head>

<body style = "background-color:#d3d3d3;">

<nav class = "navbar navbar-default navbar-fixed-top">

<div class = "container-fluid">

<div class = "navbar-header">

<img src = "images/logo.png" width = "50px" height = "50px" />

<h4 class = "navbar-text navbar-right">Library System</h4>

</div>

</div>
</nav>

<div class = "container-fluid">

<div class = "col-lg-2 well" style = "margin-top:60px;">

<div class = "container-fluid" style = "word-wrap:break-word;">

<img src = "images/user.png" width = "50px" height = "50px"/>

<br />

<br />

<label class = "text-muted"><?php require'account.php'; echo $name;?></label>

</div>

<hr style = "border:1px dotted #d3d3d3;"/>

<ul id = "menu" class = "nav menu">

<li><a style = "font-size:18px; border-bottom:1px solid #d3d3d3;" href = "home.php"><i class = "glyphicon
glyphicon-home"></i> Home</a></li>

<li><a style = "font-size:18px; border-bottom:1px solid #d3d3d3;" href = ""><i class = "glyphicon glyphicon-
tasks"></i> Accounts</a>

<ul style = "list-style-type:none;">

<li><a href = "admin.php" style = "font-size:15px;"><i class = "glyphicon glyphicon-user"></i>


Admin</a></li>

<li><a href = "student.php" style = "font-size:15px;"><i class = "glyphicon glyphicon-user"></i>


Student</a></li>

</ul>

</li>

<li><a style = "font-size:18px; border-bottom:1px solid #d3d3d3;" href = "book.php"><i class = "glyphicon
glyphicon-book"></i> Books</a></li>

<li><a style = "font-size:18px; border-bottom:1px solid #d3d3d3;" href = ""><i class = "glyphicon glyphicon-
th"></i> Transaction</a>

<ul style = "list-style-type:none;">

<li><a href = "borrowing.php" style = "font-size:15px;"><i class = "glyphicon glyphicon-random"></i>


Borrowing</a></li>

<li><a href = "returning.php" style = "font-size:15px;"><i class = "glyphicon glyphicon-random"></i>


Returning</a></li>

</ul>

</li>

<li><a style = "font-size:18px; border-bottom:1px solid #d3d3d3;" href = ""><i class = "glyphicon
glyphicon-cog"></i> Settings</a>

<ul style = "list-style-type:none;">

<li><a style = "font-size:15px;" href = "logout.php"><i class = "glyphicon glyphicon-log-out"></i>


Logout</a></li>
</ul>

</li>

</ul>

</div>

<div class = "col-lg-1"></div>

<div class = "col-lg-9 well" style = "margin-top:60px;">

<div class = "alert alert-info">Accounts / Admin</div>

<button id = "add_admin" type = "button" class = "btn btn-primary"><span class = "glyphicon glyphicon-
plus"></span> Add new</button>

<button id = "show_admin" type = "button" style = "display:none;" class = "btn btn-success"><span class
= "glyphicon glyphicon-circle-arrow-left"></span> Back</button>

<br />

<br />

<div id = "admin_table">

<table id = "table" class = "table table-bordered">

<thead class = "alert-success">

<tr>

<th>Username</th>

<th>Password</th>

<th>Firstname</th>

<th>Middlename</th>

<th>Lastname</th>

<th>Action</th>

</tr>

</thead>

<tbody>

<?php

$q_admin = $conn->query("SELECT * FROM `admin`") or die(mysqli_error());

while($f_admin = $q_admin->fetch_array()){

?>

<tr class = "target">

<td><?php echo $f_admin['username']?></td>

<td><?php echo md5($f_admin['password'])?></td>

<td><?php echo $f_admin['firstname']?></td>


<td><?php echo $f_admin['middlename']?></td>

<td><?php echo $f_admin['lastname']?></td>

<td><a href = "#" class = "btn btn-danger deladmin_id" value = "<?php echo $f_admin['admin_id']?>"><span
class = "glyphicon glyphicon-remove"></span> Delete</a> <a href = "#" class = "btn btn-warning
eadmin_id" value = "<?php echo $f_admin['admin_id']?>"><span class = "glyphicon glyphicon-
edit"></span> Edit</a></td>

</tr>

<?php

?>

</tbody>

</table>

</div>

<div id = "edit_form"></div>

<div id = "admin_form" style = "display:none;">

<div class = "col-lg-3"></div>

<div class = "col-lg-6">

<form method = "POST" action = "save_admin_query.php" enctype = "multipart/form-data">

<div class = "form-group">

<label>Username:</label>

<input type = "text" required = "required" name = "username" class = "form-control" />

</div>

<div class = "form-group">

<label>Password:</label>

<input type = "password" maxlength = "12" name = "password" required = "required" class = "form-
control" />

</div>

<div class = "form-group">

<label>Firstname:</label>

<input type = "text" name = "firstname" required = "required" class = "form-control" />

</div>

<div class = "form-group">

<label>Middlename:</label>

<input type = "text" name = "middlename" placeholder = "(Optional)" class = "form-control" />

</div>

<div class = "form-group">


<label>Lastname:</label>

<input type = "text" required = "required" name = "lastname" class = "form-control" />

</div>

<div class = "form-group">

<button class = "btn btn-primary" name = "save_admin"><span class = "glyphicon glyphicon-


save"></span> Submit</button>

</div>

</form>

</div>

</div>

</div>

</div>

<br />

<br />

<br />

<nav class = "navbar navbar-default navbar-fixed-bottom">

<div class = "container-fluid">

<label class = "navbar-text pull-right">Library System &copy; Group- 1)baban majumder, 2)jyotirmoy
dutta,3) sourav bhowmick,4) subhadip karak 5)saikat pal</label>

</div>

</nav>

</body>

<script src = "js/jquery.js"></script>

<script src = "js/bootstrap.js"></script>

<script src = "js/login.js"></script>

<script src = "js/sidebar.js"></script>

<script src = "js/jquery.dataTables.js"></script>

<script type = "text/javascript">

$(document).ready(function(){

$('#table').DataTable();

});

</script>

<script type = "text/javascript">

$(document).ready(function(){

$('#add_admin').click(function(){
$(this).hide();

$('#show_admin').show();

$('#admin_table').slideUp();

$('#admin_form').slideDown();

$('#show_admin').click(function(){

$(this).hide();

$('#add_admin').show();

$('#admin_table').slideDown();

$('#admin_form').slideUp();

});

});

});

</script>

<script type = "text/javascript">

$(document).ready(function(){

$result = $('<center><label>Deleting...</label></center>');

$('.deladmin_id').click(function(){

$admin_id = $(this).attr('value');

$(this).parents('td').empty().append($result);

$('.deladmin_id').attr('disabled', 'disabled');

$('.eadmin_id').attr('disabled', 'disabled');

setTimeout(function(){

window.location = 'delete_admin.php?admin_id=' + $admin_id;

}, 1000);

});

$('.eadmin_id').click(function(){

$admin_id = $(this).attr('value');

$('#show_admin').show();

$('#show_admin').click(function(){

$(this).hide();

$('#edit_form').empty();

$('#admin_table').show();

$('#add_admin').show();

});
$('#admin_table').fadeOut();

$('#add_admin').hide();

$('#edit_form').load('load_admin.php?admin_id=' + $admin_id);

});

});

</script>

</html>

BOOK
<!DOCTYPE html>

<?php

require_once 'valid.php';

?>

<html lang = "eng">

<head>

<title>Library System</title>

<meta charset = "utf-8" />

<meta name = "viewport" content = "width=device-width, initial-scale=1" />

<link rel = "stylesheet" type = "text/css" href = "css/bootstrap.css" />

<link rel = "stylesheet" type = "text/css" href = "css/jquery.dataTables.css" />

</head>

<body style = "background-color:#d3d3d3;">

<nav class = "navbar navbar-default navbar-fixed-top">

<div class = "container-fluid">

<div class = "navbar-header">

<img src = "images/logo.png" width = "50px" height = "50px" />

<h4 class = "navbar-text navbar-right">Library System</h4>

</div>

</div>

</nav>

<div class = "container-fluid">

<div class = "col-lg-2 well" style = "margin-top:60px;">

<div class = "container-fluid" style = "word-wrap:break-word;">


<img src = "images/user.png" width = "50px" height = "50px"/>

<br />

<br />

<label class = "text-muted"><?php require'account.php'; echo $name;?></label>

</div>

<hr style = "border:1px dotted #d3d3d3;"/>

<ul id = "menu" class = "nav menu">

<li><a style = "font-size:18px; border-bottom:1px solid #d3d3d3;" href = "home.php"><i class = "glyphicon
glyphicon-home"></i> Home</a></li>

<li><a style = "font-size:18px; border-bottom:1px solid #d3d3d3;" href = ""><i class = "glyphicon glyphicon-
tasks"></i> Accounts</a>

<ul style = "list-style-type:none;">

<li><a href = "admin.php" style = "font-size:15px;"><i class = "glyphicon glyphicon-user"></i>


Admin</a></li>

<li><a href = "student.php" style = "font-size:15px;"><i class = "glyphicon glyphicon-user"></i>


Student</a></li>

</ul>

</li>

<li><a style = "font-size:18px; border-bottom:1px solid #d3d3d3;" href = "book.php"><i class = "glyphicon
glyphicon-book"></i> Books</a></li>

<li><a style = "font-size:18px; border-bottom:1px solid #d3d3d3;" href = ""><i class = "glyphicon glyphicon-
th"></i> Transaction</a>

<ul style = "list-style-type:none;">

<li><a href = "borrowing.php" style = "font-size:15px;"><i class = "glyphicon glyphicon-random"></i>


Borrowing</a></li>

<li><a href = "returning.php" style = "font-size:15px;"><i class = "glyphicon glyphicon-random"></i>


Returning</a></li>

</ul>

</li>

<li><a style = "font-size:18px; border-bottom:1px solid #d3d3d3;" href = ""><i class = "glyphicon
glyphicon-cog"></i> Settings</a>

<ul style = "list-style-type:none;">

<li><a style = "font-size:15px;" href = "logout.php"><i class = "glyphicon glyphicon-log-out"></i>


Logout</a></li>

</ul>

</li>

</ul>

</div>
<div class = "col-lg-1"></div>

<div class = "col-lg-9 well" style = "margin-top:60px;">

<div class = "alert alert-info">Book</div>

<button id = "add_book" type = "button" class = "btn btn-primary"><span class = "glyphicon glyphicon-
plus"></span> Add new</button>

<button id = "show_book" type = "button" style = "display:none;" class = "btn btn-success"><span class =
"glyphicon glyphicon-circle-arrow-left"></span> Back</button>

<br />

<br />

<div id = "book_table">

<table id = "table" class = "table table-bordered">

<thead class = "alert-success">

<tr>

<th>Book Title</th>

<th>Category</th>

<th>Author</th>

<th>Date Published</th>

<th>Available</th>

<th>Action</th>

</tr>

</thead>

<tbody>

<?php

$qbook = $conn->query("SELECT * FROM `book`") or die(mysqli_error());

while($fbook = $qbook->fetch_array()){

?>

<tr>

<td><?php echo $fbook['book_title']?></td>

<td><?php echo $fbook['book_category']?></td>

<td><?php echo $fbook['book_author']?></td>

<td><?php echo date("m-d-Y", strtotime($fbook['date_publish']))?></td>

<td><?php echo $fbook['qty']?></td>

<td><a class = "btn btn-danger delbook_id" value = "<?php echo $fbook['book_id']?>"><span class =
"glyphicon glyphicon-remove"></span> Delete</a> <a value = "<?php echo $fbook['book_id']?>" class =
"btn btn-warning ebook_id"><span class = "glyphicon glyphicon-edit"></span> Edit</a></td>
</tr>

<?php

?>

</tbody>

</table>

</div>

<div id = "edit_form"></div>

<div id = "book_form" style = "display:none;">

<div class = "col-lg-3"></div>

<div class = "col-lg-6">

<form method = "POST" action = "save_book_query.php" enctype = "multipart/form-data">

<div class = "form-group">

<label>Book Title:</label>

<input type = "text" name = "book_title" required = "required" class = "form-control" />

</div>

<div class = "form-group">

<label>Book Description:</label>

<input type = "text" name = "book_desc" class = "form-control" />

</div>

<div class = "form-group">

<label>Book Category:</label>

<input type = "text" name = "book_category" class = "form-control" required = "required"/>

</div>

<div class = "form-group">

<label>Book Author:</label>

<input type = "text" name = "book_author" class = "form-control" required = "required" />

</div>

<div class = "form-group">

<label>Date Published:</label>

<input type = "date" name = "date_publish" required = "required" class = "form-control" />

</div>

<div class = "form-group">

<label>Quantity:</label>
<input type = "number" min = "0" name = "qty" required = "required" class = "form-control" />

</div>

<div class = "form-group">

<button name = "save_book" class = "btn btn-primary"><span class = "glyphicon glyphicon-save"></span>


Submit</button>

</div>

</form>

</div>

</div>

</div>

</div>

<br />

<br />

<br />

<nav class = "navbar navbar-default navbar-fixed-bottom">

<div class = "container-fluid">

<label class = "navbar-text pull-right">Library System &copy; Group- 1)baban majumder, 2)jyotirmoy
dutta,3) sourav bhowmick,4) subhadip karak 5)saikat pal</label>

</div>

</nav>

</body>

<script src = "js/jquery.js"></script>

<script src = "js/bootstrap.js"></script>

<script src = "js/login.js"></script>

<script src = "js/sidebar.js"></script>

<script src = "js/jquery.dataTables.js"></script>

<script type = "text/javascript">

$(document).ready(function(){

$('#table').DataTable();

});

</script>

<script type = "text/javascript">

$(document).ready(function(){

$('#add_book').click(function(){

$(this).hide();
$('#show_book').show();

$('#book_table').slideUp();

$('#book_form').slideDown();

$('#show_book').click(function(){

$(this).hide();

$('#add_book').show();

$('#book_table').slideDown();

$('#book_form').slideUp();

});

});

});

</script>

<script type = "text/javascript">

$(document).ready(function(){

$result = $('<center><label>Deleting...</label></center>');

$('.delbook_id').click(function(){

$book_id = $(this).attr('value');

$(this).parents('td').empty().append($result);

$('.delbook_id').attr('disabled', 'disabled');

$('.ebook_id').attr('disabled', 'disabled');

setTimeout(function(){

window.location = 'delete_book.php?book_id=' + $book_id;

}, 1000);

});

$('.ebook_id').click(function(){

$book_id = $(this).attr('value');

$('#show_book').show();

$('#show_book').click(function(){

$(this).hide();

$('#edit_form').empty();

$('#book_table').show();

$('#book_admin').show();

});

$('#book_table').fadeOut();
$('#add_book').hide();

$('#edit_form').load('load_book.php?book_id=' + $book_id);

});

});

</script>

</html>

BORROW
<?php

require_once 'connect.php';

if(!ISSET($_POST['student_no'])){

echo '

<script type = "text/javascript">

alert("Select student name first");

window.location = "borrowing.php";

</script>

';

}else{

if(!ISSET($_POST['selector'])){

echo '

<script type = "text/javascript">

alert("Selet a book first!");

window.location = "borrowing.php";

</script>

';

}else{

foreach($_POST['selector'] as $key=>$value){

$book_qty = $value;

$student_no = $_POST['student_no'];

$book_id = $_POST['book_id'][$key];

$date = date("Y-m-d", strtotime("+8 HOURS"));

$conn->query("INSERT INTO `borrowing` VALUES('', '$book_id', '$student_no', '$book_qty', '$date',


'Borrowed')") or die(mysqli_error());
echo '

<script type = "text/javascript">

alert("Successfully Borrowed");

window.location = "borrowing.php";

</script>

';

BORROWING
<!DOCTYPE html>

<?php

require_once 'valid.php';

?>

<html lang = "eng">

<head>

<title>Library System</title>

<meta charset = "utf-8" />

<meta name = "viewport" content = "width=device-width, initial-scale=1" />

<link rel = "stylesheet" type = "text/css" href = "css/bootstrap.css" />

<link rel = "stylesheet" type = "text/css" href = "css/chosen.min.css" />

<link rel = "stylesheet" type = "text/css" href = "css/jquery.dataTables.css" />

</head>

<body style = "background-color:#d3d3d3;">

<nav class = "navbar navbar-default navbar-fixed-top">

<div class = "container-fluid">

<div class = "navbar-header">

<img src = "images/logo.png" width = "50px" height = "50px" />

<h4 class = "navbar-text navbar-right">Library System</h4>

</div>

</div>

</nav>
<div class = "container-fluid">

<div class = "col-lg-2 well" style = "margin-top:60px;">

<div class = "container-fluid">

<img src = "images/user.png" width = "50px" height = "50px"/>

<br />

<br />

<label class = "text-muted"><?php require'account.php'; echo $name;?></label>

</div>

<hr style = "border:1px dotted #d3d3d3;"/>

<ul id = "menu" class = "nav menu">

<li><a style = "font-size:18px; border-bottom:1px solid #d3d3d3;" href = "home.php"><i class = "glyphicon
glyphicon-home"></i> Home</a></li>

<li><a style = "font-size:18px; border-bottom:1px solid #d3d3d3;" href = ""><i class = "glyphicon glyphicon-
tasks"></i> Accounts</a>

<ul style = "list-style-type:none;">

<li><a href = "admin.php" style = "font-size:15px;"><i class = "glyphicon glyphicon-user"></i>


Admin</a></li>

<li><a href = "student.php" style = "font-size:15px;"><i class = "glyphicon glyphicon-user"></i>


Student</a></li>

</ul>

</li>

<li><a style = "font-size:18px; border-bottom:1px solid #d3d3d3;" href = "book.php"><i class = "glyphicon
glyphicon-book"></i> Books</a></li>

<li><a style = "font-size:18px; border-bottom:1px solid #d3d3d3;" href = ""><i class = "glyphicon glyphicon-
th"></i> Transaction</a>

<ul style = "list-style-type:none;">

<li><a href = "borrowing.php" style = "font-size:15px;"><i class = "glyphicon glyphicon-random"></i>


Borrowing</a></li>

<li><a href = "returning.php" style = "font-size:15px;"><i class = "glyphicon glyphicon-random"></i>


Returning</a></li>

</ul>

</li>

<li><a style = "font-size:18px; border-bottom:1px solid #d3d3d3;" href = ""><i class = "glyphicon
glyphicon-cog"></i> Settings</a>

<ul style = "list-style-type:none;">

<li><a style = "font-size:15px;" href = "logout.php"><i class = "glyphicon glyphicon-log-out"></i>


Logout</a></li>

</ul>
</li>

</ul>

</div>

<div class = "col-lg-1"></div>

<div class = "col-lg-9 well" style = "margin-top:60px;">

<div class = "alert alert-info">Transaction / Borrowing</div>

<form method = "POST" action = "borrow.php" enctype = "multipart/form-data">

<div class = "form-group pull-left">

<label>Student Name:</label>

<br />

<select name = "student_no" id = "student">

<option value = "" selected = "selected" disabled = "disabled">Select an option</option>

<?php

$qborrow = $conn->query("SELECT * FROM `student` ORDER BY `lastname`") or die(mysqli_error());

while($fborrow = $qborrow->fetch_array()){

?>

<option value = "<?php echo $fborrow['student_no']?>"><?php echo $fborrow['firstname']."


".$fborrow['lastname']?></option>

<?php

?>

</select>

</div>

<div class = "form-group pull-right">

<button name = "save_borrow" class = "btn btn-primary"><span class = "glyphicon glyphicon-thumbs-


up"></span> Borrow</button>

</div>

<table id = "table" class = "table table-bordered">

<thead class = "alert-success">

<tr>

<th>Select</th>

<th>Book Title</th>

<th>Book Category</th>

<th>Book Author</th>

<th>Date Published</th>
<th>Quantity</th>

<th>Left</th>

</tr>

</thead>

<tbody>

<?php

$q_book = $conn->query("SELECT * FROM `book`") or die(mysqli_error());

while($f_book = $q_book->fetch_array()){

$q_borrow = $conn->query("SELECT SUM(qty) as total FROM `borrowing` WHERE `book_id` =


'$f_book[book_id]' && `status` = 'Borrowed'") or die(mysqli_error());

$new_qty = $q_borrow->fetch_array();

$total = $f_book['qty'] - $new_qty['total'];

?>

<tr>

<td>

<?php

if($total == 0){

echo "<center><label class = 'text-danger'>Not Available</label></center>";

}else{

echo '<input type = "hidden" name = "book_id[]" value = "'.$f_book['book_id'].'"><center><input type =


"checkbox" name = "selector[]" value = "1"></center>';

?>

</td>

<td><?php echo $f_book['book_title']?></td>

<td><?php echo $f_book['book_category']?></td>

<td><?php echo $f_book['book_author']?></td>

<td><?php echo date("m-d-Y", strtotime($f_book['date_publish']))?></td>

<td><?php echo $f_book['qty']?></td>

<td><?php echo $total?></td>

</tr>

<?php

?>

</tbody>
</table>

</form>

</div>

</div>

<nav class = "navbar navbar-default navbar-fixed-bottom">

<div class = "container-fluid">

<label class = "navbar-text pull-right">Library System &copy; Group- 1)baban majumder, 2)jyotirmoy
dutta,3) sourav bhowmick,4) subhadip karak 5)saikat pal</label>

</div>

</nav>

</body>

<script src = "js/jquery.js"></script>

<script src = "js/bootstrap.js"></script>

<script src = "js/login.js"></script>

<script src = "js/sidebar.js"></script>

<script src = "js/jquery.dataTables.js"></script>

<script src = "js/chosen.jquery.min.js"></script>

<script type = "text/javascript">

$(document).ready(function(){

$("#student").chosen({ width:"auto" });

})

</script>

<script type = "text/javascript">

$(document).ready(function(){

$("#table").DataTable();

});

</script>

</html>

CHECK ADMIN
<?php

require_once 'connect.php';

$username = $_POST['username'];
$password = $_POST['password'];

$q_admin = $conn->query("SELECT * FROM `admin` WHERE `username` = '$username' && `password` =


'$password'") or die(mysqli_error());

$f_admin = $q_admin->fetch_array();

$v_admin = $q_admin->num_rows;

if($v_admin > 0){

echo 'Success';

session_start();

$_SESSION['admin_id'] = $f_admin['admin_id'];

}else{

echo 'Error';

CONNECT
<?php

$conn = new mysqli('localhost', 'root', '', 'db_ls') or die(mysqli_error());

if(!$conn){

die("Fatal Error: Connection Failed!");

DELETE ADMIN
<?php

require_once 'connect.php';

$conn->query("DELETE FROM `admin` WHERE `admin_id` = '$_REQUEST[admin_id]'") or die(mysqli_error());

header('location: admin.php');

DELETE BOOK
<?php

require_once 'connect.php';

$conn->query("DELETE FROM `book` WHERE `book_id` = '$_REQUEST[book_id]'") or die(mysqli_error());


$conn->query("DELETE FROM `borrowing` WHERE `book_id` = '$_REQUEST[book_id]'") or
die(mysqli_error());

header("location: book.php");

DELETE STUDENT
<?php

require_once 'connect.php';

$conn->query("DELETE FROM `student` WHERE `student_no` = '$_REQUEST[student_id]'") or


die(mysqli_error());

header('location: student.php');

EDIT ADMIN QUERY


<?php

require_once 'connect.php';

if(ISSET($_POST['edit_admin'])){

$username = $_POST['username'];

$password = $_POST['password'];

$firstname = $_POST['firstname'];

$middlename = $_POST['middlename'];

$lastname = $_POST['lastname'];

$q_admin = $conn->query("SELECT * FROM `admin` WHERE `username` = '$username'") or


die(mysqli_error());

$v_admin = $q_admin->num_rows;

if($v_admin == 1){

echo '

<script type = "text/javascript">

alert("Username already taken");

window.location = "admin.php";

</script>

';

}else{
$conn->query("UPDATE `admin` SET `username` = '$username', `password` = '$password', `firstname` =
'$firstname', `middlename` = '$middlename', `lastname` = '$lastname' WHERE `admin_id` =
'$_REQUEST[admin_id]'") or die(mysqli_error());

echo '

<script type = "text/javascript">

alert("Save Changes");

window.location = "admin.php";

</script>

';

EDIT BOOK QUERY


<?php

require_once 'connect.php';

if(ISSET($_POST['edit_book'])){

$book_title = $_POST['book_title'];

$book_desc = $_POST['book_desc'];

$book_category = $_POST['book_category'];

$book_author = $_POST['book_author'];

$date_publish = $_POST['date_publish'];

$qty = $_POST['qty'];

$conn->query("UPDATE `book` SET `book_title` = '$book_title', `book_description` = '$book_desc',


`book_category` = '$book_category', `book_author` = '$book_author', `date_publish` = '$date_publish', `qty`
= '$qty' WHERE `book_id` = '$_REQUEST[book_id]'") or die(mysqli_error());

echo '

<script type = "text/javascript">

alert("Save Changes");

window.location = "book.php";

</script>

';

}
EDIT STUDENT QUERY
<?php

require_once 'connect.php';

if(ISSET($_POST['edit_student'])){

$student_no = $_POST['student_no'];

$firstname = $_POST['firstname'];

$middlename = $_POST['middlename'];

$lastname = $_POST['lastname'];

$course = $_POST['course'];

$section = $_POST['section'];

$qstudent = $conn->query("SELECT * FROM `student` WHERE `student_no` = '$student_no'") or


die(mysqli_error());

$vstudent = $qstudent->num_rows;

if($vstudent['student_no'] == 1){

echo '

<script type = "text/javascript">

alert("Student ID already exist");

window.location = "student.php";

</script>

';

}else{

$conn->query("UPDATE `student` SET `student_no` = '$student_no', `firstname` = '$firstname',


`middlename` = '$middlename', `lastname` = '$lastname', `course` = '$course', `section` = '$section'
WHERE `student_id` = '$_REQUEST[student_id]'") or die(mysqli_error());

echo'

<script type = "text/javascript">

alert("Save Changes");

window.location = "student.php";

</script>

';

}
HOME
<!DOCTYPE html>

<?php

require_once 'valid.php';

?>

<html lang = "eng">

<head>

<title>Library System</title>

<meta charset = "utf-8" />

<meta name = "viewport" content = "width=device-width, initial-scale=1" />

<link rel = "stylesheet" type = "text/css" href = "css/bootstrap.css" />

</head>

<body style = "background-color:#d3d3d3;">

<nav class = "navbar navbar-default navbar-fixed-top">

<div class = "container-fluid">

<div class = "navbar-header">

<img src = "images/logo.png" width = "50px" height = "50px" />

<h4 class = "navbar-text navbar-right">Library System</h4>

</div>

</div>

</nav>

<div class = "container-fluid">

<div class = "col-lg-2 well" style = "margin-top:60px;">

<div class = "container-fluid">

<img src = "images/user.png" width = "50px" height = "50px"/>

<br />

<br />

<label class = "text-muted"><?php require'account.php'; echo $name;?></label>

</div>

<hr style = "border:1px dotted #d3d3d3;"/>

<ul id = "menu" class = "nav menu">


<li><a style = "font-size:18px; border-bottom:1px solid #d3d3d3;" href = "home.php"><i class = "glyphicon
glyphicon-home"></i> Home</a></li>

<li><a style = "font-size:18px; border-bottom:1px solid #d3d3d3;" href = ""><i class = "glyphicon glyphicon-
tasks"></i> Accounts</a>

<ul style = "list-style-type:none;">

<li><a href = "admin.php" style = "font-size:15px;"><i class = "glyphicon glyphicon-user"></i>


Admin</a></li>

<li><a href = "student.php" style = "font-size:15px;"><i class = "glyphicon glyphicon-user"></i>


Student</a></li>

</ul>

</li>

<li><a style = "font-size:18px; border-bottom:1px solid #d3d3d3;" href = "book.php"><i class = "glyphicon
glyphicon-book"></i> Books</a></li>

<li><a style = "font-size:18px; border-bottom:1px solid #d3d3d3;" href = ""><i class = "glyphicon glyphicon-
th"></i> Transaction</a>

<ul style = "list-style-type:none;">

<li><a href = "borrowing.php" style = "font-size:15px;"><i class = "glyphicon glyphicon-random"></i>


Borrowing</a></li>

<li><a href = "returning.php" style = "font-size:15px;"><i class = "glyphicon glyphicon-random"></i>


Returning</a></li>

</ul>

</li>

<li><a style = "font-size:18px; border-bottom:1px solid #d3d3d3;" href = ""><i class = "glyphicon
glyphicon-cog"></i> Settings</a>

<ul style = "list-style-type:none;">

<li><a style = "font-size:15px;" href = "logout.php"><i class = "glyphicon glyphicon-log-out"></i>


Logout</a></li>

</ul>

</li>

</ul>

</div>

<div class = "col-lg-1"></div>

<div class = "col-lg-9 well" style = "margin-top:60px;">

<img src = "images/back2.jpg" height = "400px" width = "100%" />

</div>

</div>

<nav class = "navbar navbar-default navbar-fixed-bottom">

<div class = "container-fluid">


<label class = "navbar-text pull-right">Library System &copy; Group- 1)baban majumder, 2)jyotirmoy
dutta,3) sourav bhowmick,4) subhadip karak 5)saikat pal</label>

</div>

</nav>

</body>

<script src = "js/jquery.js"></script>

<script src = "js/bootstrap.js"></script>

<script src = "js/login.js"></script>

<script src = "js/sidebar.js"></script>

</html>

INDEX
<!DOCTYPE html>

<?php

session_start();

if(ISSET($_SESSION['admin_id'])){

header('location:home.php');

?>

<html lang = "eng">

<head>

<title>Library System</title>

<meta charset = "utf-8" />

<meta name = "viewport" content = "width=device-width, initial-scale=1" />

<link rel = "stylesheet" type = "text/css" href = "css/bootstrap.css" />

</head>

<body style = "background-color:#d3d3d3;">

<nav class = "navbar navbar-default navbar-fixed-top">

<div class = "container-fluid">

<div class = "navbar-header">

<img src = "images/logo.png" width = "50px" height = "50px" />

<h4 class = "navbar-text navbar-right">Library System</h4>

</div>
</div>

</nav>

<div class = "container-fluid" style = "margin-top:70px;">

<div class = "col-lg-3 well">

<br />

<br />

<h4>Login Here..</h4>

<hr style = "border:1px solid #d3d3d3; width:100%;" />

<form enctype = "multipart/form-data">

<div id = "username_warning" class = "form-group">

<label class = "control-label">Username:</label>

<input type = "text" class = "form-control" id = "username"/>

</div>

<div id = "password_warning" class = "form-group">

<label class = "control-label">Password:</label>

<input type = "password" class = "form-control" id = "password"/>

</div>

<br />

<div class = "form-group">

<button type = "button" id = "login" class = "btn btn-primary btn-block"><span class = "glyphicon
glyphicon-save"></span> Login</button>

</div>

</form>

<div id = "result"></div>

<br />

<br />

<br />

<br />

<br />

<br />

</div>

<div class = "col-lg-1"></div>

<div class = "col-lg-8 well">

<img src = "images/back.jpg" height = "449px" width = "100%" />

</div>
</div>

<nav class = "navbar navbar-default navbar-fixed-bottom">

<div class = "container-fluid">

<label class = "navbar-text pull-right">Library System &copy; Group- 1)baban majumder, 2)jyotirmoy
dutta,3) sourav bhowmick,4) subhadip karak 5)saikat pal</label>

</div>

</nav>

</body>

<script src = "js/jquery.js"></script>

<script src = "js/bootstrap.js"></script>

<script src = "js/login.js"></script>

</html>

LOAD ADMIN
<?php

require_once 'connect.php';

$qedit_admin = $conn->query("SELECT * FROM `admin` WHERE `admin_id` = '$_REQUEST[admin_id]'") or


die(mysqli_error());

$fedit_admin = $qedit_admin->fetch_array();

?>

<div class = "col-lg-3"></div>

<div class = "col-lg-6">

<form method = "POST" action = "edit_admin_query.php?admin_id=<?php echo $fedit_admin['admin_id']?>"


enctype = "multipart/form-data">

<div class = "form-group">

<label>Username:</label>

<input type = "text" value = "<?php echo $fedit_admin['username']?>" required = "required" name =
"username" class = "form-control" />

</div>

<div class = "form-group">

<label>Password:</label>

<input type = "password" value = "<?php echo $fedit_admin['password']?>" maxlength = "12" name =
"password" required = "required" class = "form-control" />

</div>
<div class = "form-group">

<label>Firstname:</label>

<input type = "text" value = "<?php echo $fedit_admin['firstname']?>" name = "firstname" required =
"required" class = "form-control" />

</div>

<div class = "form-group">

<label>Middlename:</label>

<input type = "text" value = "<?php echo $fedit_admin['middlename']?>" name = "middlename"


placeholder = "(Optional)" class = "form-control" />

</div>

<div class = "form-group">

<label>Lastname:</label>

<input type = "text" value = "<?php echo $fedit_admin['lastname']?>" required = "required" name =
"lastname" class = "form-control" />

</div>

<div class = "form-group">

<button class = "btn btn-warning" name = "edit_admin"><span class = "glyphicon glyphicon-edit"></span>


Save Changes</button>

</div>

</form>

</div>

LOAD BOOK
<?php

require_once 'connect.php';

$q_book = $conn->query("SELECT * FROM `book` WHERE `book_id` = '$_REQUEST[book_id]'") or


die(mysqli_error());

$f_book = $q_book->fetch_array();

?>

<div class = "col-lg-3"></div>

<div class = "col-lg-6">

<form method = "POST" action = "edit_book_query.php?book_id=<?php echo $f_book['book_id']?>" enctype


= "multipart/form-data">

<div class = "form-group">

<label>Book Title:</label>
<input type = "text" value = "<?php echo $f_book['book_title']?>" name = "book_title" required = "required"
class = "form-control" />

</div>

<div class = "form-group">

<label>Book Description:</label>

<input type = "text" value = "<?php echo $f_book['book_description']?>" name = "book_desc" class =
"form-control" />

</div>

<div class = "form-group">

<label>Book Category:</label>

<input type = "text" name = "book_category" value = "<?php echo $f_book['book_category']?>" class =
"form-control" required = "required"/>

</div>

<div class = "form-group">

<label>Book Author:</label>

<input type = "text" name = "book_author" value = "<?php echo $f_book['book_author']?>" class = "form-
control" required = "required" />

</div>

<div class = "form-group">

<label>Date Published:</label>

<input type = "date" name = "date_publish" value = "<?php echo $f_book['date_publish']?>" required =
"required" class = "form-control" />

</div>

<div class = "form-group">

<label>Quantity:</label>

<input type = "number" min = "0" value = "<?php echo $f_book['qty']?>" name = "qty" required = "required"
class = "form-control" />

</div>

<div class = "form-group">

<button name = "edit_book" class = "btn btn-warning"><span class = "glyphicon glyphicon-edit"></span>


Save Changes</button>

</div>

</form>

</div>
LOAD STUDENT
<?php

require_once 'connect.php';

$q_student = $conn->query("SELECT * FROM `student` WHERE `student_no` = '$_REQUEST[student_id]'") or


die(mysqli_error());

$f_student = $q_student->fetch_array();

?>

<div class = "col-lg-3"></div>

<div class = "col-lg-6">

<form method = "POST" action = "edit_student_query.php?student_id=<?php echo


$f_student['student_id']?>" enctype = "multipart/form-data">

<div class = "form-group">

<label>Student ID:</label>

<input type = "text" name = "student_no" value = "<?php echo $f_student['student_no']?>" required =
"required" class = "form-control" />

</div>

<div class = "form-group">

<label>Firstname:</label>

<input type = "text" name = "firstname" value = "<?php echo $f_student['firstname']?>" required =
"required" class = "form-control" />

</div>

<div class = "form-group">

<label>Middlename:</label>

<input type = "text" name = "middlename" value = "<?php echo $f_student['middlename']?>" placeholder =
"(Optional)" class = "form-control" />

</div>

<div class = "form-group">

<label>Lastname:</label>

<input type = "text" required = "required" value = "<?php echo $f_student['lastname']?>" name =
"lastname" class = "form-control" />

</div>

<div class = "form-group">

<label>Course:</label>
<input type = "text" required = "required" value = "<?php echo $f_student['course']?>" name = "course"
class = "form-control" />

</div>

<div class = "form-group">

<label>Yr&Section:</label>

<input type = "text" maxlength = "12" name = "section" value = "<?php echo $f_student['section']?>"
required = "required" class = "form-control" />

</div>

<div class = "form-group">

<button class = "btn btn-warning" name = "edit_student"><span class = "glyphicon glyphicon-


edit"></span> Save Changes</button>

</div>

</form>

</div>

LOGOUT
<?php

session_start();

unset($_SESSION['admin_id']);

header('location: index.php');

?>

RETURN
<?php

require_once 'connect.php';

$date = date("Y-m-d", strtotime("+8 HOURS"));

$conn->query("UPDATE `borrowing` SET `status` = 'Returned', `date` = '$date' WHERE `borrow_id` =


'$_POST[borrow_id]'") or die(mysqli_error());

header('location: returning.php');

RETURNING
<!DOCTYPE html>

<?php

require_once 'valid.php';

?>

<html lang = "eng">

<head>

<title>Library System</title>

<meta charset = "utf-8" />

<meta name = "viewport" content = "width=device-width, initial-scale=1" />

<link rel = "stylesheet" type = "text/css" href = "css/bootstrap.css" />

<link rel = "stylesheet" type = "text/css" href = "css/chosen.min.css" />

<link rel = "stylesheet" type = "text/css" href = "css/jquery.dataTables.css" />

</head>

<body style = "background-color:#d3d3d3;">

<nav class = "navbar navbar-default navbar-fixed-top">

<div class = "container-fluid">

<div class = "navbar-header">

<img src = "images/logo.png" width = "50px" height = "50px" />

<h4 class = "navbar-text navbar-right">Library System</h4>

</div>

</div>

</nav>

<div class = "container-fluid">

<div class = "col-lg-2 well" style = "margin-top:60px;">

<div class = "container-fluid">

<img src = "images/user.png" width = "50px" height = "50px"/>

<br />

<br />

<label class = "text-muted"><?php require'account.php'; echo $name;?></label>

</div>

<hr style = "border:1px dotted #d3d3d3;"/>

<ul id = "menu" class = "nav menu">

<li><a style = "font-size:18px; border-bottom:1px solid #d3d3d3;" href = "home.php"><i class = "glyphicon
glyphicon-home"></i> Home</a></li>
<li><a style = "font-size:18px; border-bottom:1px solid #d3d3d3;" href = ""><i class = "glyphicon glyphicon-
tasks"></i> Accounts</a>

<ul style = "list-style-type:none;">

<li><a href = "admin.php" style = "font-size:15px;"><i class = "glyphicon glyphicon-user"></i>


Admin</a></li>

<li><a href = "student.php" style = "font-size:15px;"><i class = "glyphicon glyphicon-user"></i>


Student</a></li>

</ul>

</li>

<li><a style = "font-size:18px; border-bottom:1px solid #d3d3d3;" href = "book.php"><i class = "glyphicon
glyphicon-book"></i> Books</a></li>

<li><a style = "font-size:18px; border-bottom:1px solid #d3d3d3;" href = ""><i class = "glyphicon glyphicon-
th"></i> Transaction</a>

<ul style = "list-style-type:none;">

<li><a href = "borrowing.php" style = "font-size:15px;"><i class = "glyphicon glyphicon-random"></i>


Borrowing</a></li>

<li><a href = "returning.php" style = "font-size:15px;"><i class = "glyphicon glyphicon-random"></i>


Returning</a></li>

</ul>

</li>

<li><a style = "font-size:18px; border-bottom:1px solid #d3d3d3;" href = ""><i class = "glyphicon
glyphicon-cog"></i> Settings</a>

<ul style = "list-style-type:none;">

<li><a style = "font-size:15px;" href = "logout.php"><i class = "glyphicon glyphicon-log-out"></i>


Logout</a></li>

</ul>

</li>

</ul>

</div>

<div class = "col-lg-1"></div>

<div class = "col-lg-9 well" style = "margin-top:60px;">

<div class = "alert alert-info">Transaction / Returning</div>

<form method = "POST" action = "return.php" enctype = "multipart/form-data">

<table id = "table" class = "table table-bordered">

<thead class = "alert-success">

<tr>

<th>Student</th>
<th>Book Title</th>

<th>Book Author</th>

<th>Status</th>

<th>Date Returned</th>

<th>Action</th>

</tr>

</thead>

<tbody>

<?php

$qreturn = $conn->query("SELECT * FROM `borrowing`") or die(mysqli_error());

while($freturn = $qreturn->fetch_array()){

?>

<tr>

<td>

<?php

$qstudent = $conn->query("SELECT * FROM `student` WHERE `student_no` = '$freturn[student_no]'") or


die(mysqli_error());

$fstudent = $qstudent->fetch_array();

echo $fstudent['firstname']."".$fstudent['lastname'];

?>

</td>

<td>

<?php

$qbook = $conn->query("SELECT * FROM `book` WHERE `book_id` = '$freturn[book_id]'") or


die(mysqli_error());

$fbook = $qbook->fetch_array();

echo $fbook['book_title'];

?>

</td>

<td>

<?php

$qbook = $conn->query("SELECT * FROM `book` WHERE `book_id` = '$freturn[book_id]'") or


die(mysqli_error());

$fbook = $qbook->fetch_array();

echo $fbook['book_author'];
?>

</td>

<td><?php echo $freturn['status']?></td>

<td><?php echo date("m-d-Y", strtotime($freturn['date']))?></td>

<td>

<?php

if($freturn['status'] == 'Returned'){

echo '<center><button disabled = "disabled" class = "btn btn-primary" type = "button" href = "#" data-
toggle = "modal" data-target = "#return"><span class = "glyphicon glyphicon-check"></span>
Returned</button></center>';

}else{

echo '<input type = "hidden" name = "borrow_id" value = "'.$freturn['borrow_id'].'"/><center><button class


= "btn btn-primary" data-toggle = "modal" data-target = "#return"><span class = "glyphicon glyphicon-
unchecked"></span> Return</button></center>';

?>

</td>

</tr>

<?php

?>

</tbody>

</table>

<br />

<br />

<br />

</div>

</div>

<nav class = "navbar navbar-default navbar-fixed-bottom">

<div class = "container-fluid">

<label class = "navbar-text pull-right">Library System &copy; Group- 1)baban majumder, 2)jyotirmoy
dutta,3) sourav bhowmick,4) subhadip karak 5)saikat pal</label>

</div>

</nav>

</body>
<script src = "js/jquery.js"></script>

<script src = "js/bootstrap.js"></script>

<script src = "js/login.js"></script>

<script src = "js/sidebar.js"></script>

<script src = "js/jquery.dataTables.js"></script>

<script src = "js/chosen.jquery.min.js"></script>

<script type = "text/javascript">

$(document).ready(function(){

$("#student").chosen({ width:"auto" });

})

</script>

<script type = "text/javascript">

$(document).ready(function(){

$("#table").DataTable();

});

</script>

</html>

SAVE ADMIN QUERY


<?php

require_once 'connect.php';

if(ISSET($_POST['save_admin'])){

$username = $_POST['username'];

$password = $_POST['password'];

$firstname = $_POST['firstname'];

$middlename = $_POST['middlename'];

$lastname = $_POST['lastname'];

$q_admin = $conn->query("SELECT * FROM `admin` WHERE `username` = '$username'") or


die(mysqli_error());

$v_admin = $q_admin->num_rows;

if($v_admin == 1){

echo '

<script type = "text/javascript">

alert("Username already taken");


window.location = "admin.php";

</script>

';

}else{

$conn->query("INSERT INTO `admin` VALUES('', '$username', '$password', '$firstname', '$middlename',


'$lastname')") or die(mysqli_error());

echo '

<script type = "text/javascript">

alert("Successfully saved data");

window.location = "admin.php";

</script>

';

SAVE BOOK QUERY


<?php

require_once 'connect.php';

if(ISSET($_POST['save_book'])){

$book_title = $_POST['book_title'];

$book_desc = $_POST['book_desc'];

$book_category = $_POST['book_category'];

$book_author = $_POST['book_author'];

$date_publish = $_POST['date_publish'];

$qty = $_POST['qty'];

$conn->query("INSERT INTO `book` VALUES('', '$book_title', '$book_desc', '$book_category',


'$book_author', '$date_publish', '$qty')") or die(mysqli_error());

echo'

<script type = "text/javascript">

alert("Successfully saved data");

window.location = "book.php";

</script>
';

SAVE STUDENT QUERY

<?php

require_once 'connect.php';

if(ISSET($_POST['save_student'])){

$student_no = $_POST['student_no'];

$firstname = $_POST['firstname'];

$middlename = $_POST['middlename'];

$lastname = $_POST['lastname'];

$course = $_POST['course'];

$section = $_POST['section'];

$qstudent = $conn->query("SELECT * FROM `student` WHERE `student_no` = '$student_no'") or


die(mysqli_error());

$vstudent = $qstudent->num_rows;

if($vstudent['student_no'] == 1){

echo '

<script type = "text/javascript">

alert("Student ID already exist");

window.location = "student.php";

</script>

';

}else{

$conn->query("INSERT INTO `student` VALUES('', '$student_no', '$firstname', '$middlename', '$lastname',


'$course', '$section')") or die(mysqli_error());

echo'

<script type = "text/javascript">

alert("Successfully saved data");

window.location = "student.php";

</script>

';

}
STUDENT
<!DOCTYPE html>

<?php

require_once 'valid.php';

?>

<html lang = "eng">

<head>

<title>Library System</title>

<meta charset = "utf-8" />

<meta name = "viewport" content = "width=device-width, initial-scale=1" />

<link rel = "stylesheet" type = "text/css" href = "css/bootstrap.css" />

<link rel = "stylesheet" type = "text/css" href = "css/jquery.dataTables.css" />

</head>

<body style = "background-color:#d3d3d3;">

<nav class = "navbar navbar-default navbar-fixed-top">

<div class = "container-fluid">

<div class = "navbar-header">

<img src = "images/logo.png" width = "50px" height = "50px" />

<h4 class = "navbar-text navbar-right">Library System</h4>

</div>

</div>

</nav>

<div class = "container-fluid">

<div class = "col-lg-2 well" style = "margin-top:60px;">

<div class = "container-fluid" style = "word-wrap:break-word;">

<img src = "images/user.png" width = "50px" height = "50px"/>

<br />

<br />

<label class = "text-muted"><?php require'account.php'; echo $name;?></label>

</div>

<hr style = "border:1px dotted #d3d3d3;"/>

<ul id = "menu" class = "nav menu">


<li><a style = "font-size:18px; border-bottom:1px solid #d3d3d3;" href = "home.php"><i class = "glyphicon
glyphicon-home"></i> Home</a></li>

<li><a style = "font-size:18px; border-bottom:1px solid #d3d3d3;" href = ""><i class = "glyphicon glyphicon-
tasks"></i> Accounts</a>

<ul style = "list-style-type:none;">

<li><a href = "admin.php" style = "font-size:15px;"><i class = "glyphicon glyphicon-user"></i>


Admin</a></li>

<li><a href = "student.php" style = "font-size:15px;"><i class = "glyphicon glyphicon-user"></i>


Student</a></li>

</ul>

</li>

<li><a style = "font-size:18px; border-bottom:1px solid #d3d3d3;" href = "book.php"><i class = "glyphicon
glyphicon-book"></i> Books</a></li>

<li><a style = "font-size:18px; border-bottom:1px solid #d3d3d3;" href = ""><i class = "glyphicon glyphicon-
th"></i> Transaction</a>

<ul style = "list-style-type:none;">

<li><a href = "borrowing.php" style = "font-size:15px;"><i class = "glyphicon glyphicon-random"></i>


Borrowing</a></li>

<li><a href = "returning.php" style = "font-size:15px;"><i class = "glyphicon glyphicon-random"></i>


Returning</a></li>

</ul>

</li>

<li><a style = "font-size:18px; border-bottom:1px solid #d3d3d3;" href = ""><i class = "glyphicon
glyphicon-cog"></i> Settings</a>

<ul style = "list-style-type:none;">

<li><a style = "font-size:15px;" href = "logout.php"><i class = "glyphicon glyphicon-log-out"></i>


Logout</a></li>

</ul>

</li>

</ul>

</div>

<div class = "col-lg-1"></div>

<div class = "col-lg-9 well" style = "margin-top:60px;">

<div class = "alert alert-info">Accounts / Student</div>

<button id = "add_student" type = "button" class = "btn btn-primary"><span class = "glyphicon glyphicon-
plus"></span> Add new</button>

<button id = "show_student" type = "button" style = "display:none;" class = "btn btn-success"><span class
= "glyphicon glyphicon-circle-arrow-left"></span> Back</button>

<br />
<br />

<div id = "student_table">

<table id = "table" class = "table table-bordered">

<thead class = "alert-success">

<tr>

<th>Student ID</th>

<th>Firstname</th>

<th>Middlename</th>

<th>Lastname</th>

<th>Course</th>

<th>Yr & Section</th>

<th>Action</th>

</tr>

</thead>

<tbody>

<?php

$qstudent = $conn->query("SELECT * FROM `student`") or die(mysqli_error());

while($fstudent = $qstudent->fetch_array()){

?>

<tr>

<td><?php echo $fstudent['student_no']?></td>

<td><?php echo $fstudent['firstname']?></td>

<td><?php echo $fstudent['middlename']?></td>

<td><?php echo $fstudent['lastname']?></td>

<td><?php echo $fstudent['course']?></td>

<td><?php echo $fstudent['section']?></td>

<td><a value = "<?php echo $fstudent['student_no']?>" class = "btn btn-danger delstudent_id"><span


class = "glyphicon glyphicon-remove"></span> Delete</a> <a class = "btn btn-warning estudent_id" value
= "<?php echo $fstudent['student_no']?>"><span class = "glyphicon glyphicon-edit"></span> Edit</a></td>

</tr>

<?php

?>

</tbody>

</table>
</div>

<div id = "edit_form"></div>

<div id = "student_form" style = "display:none;">

<div class = "col-lg-3"></div>

<div class = "col-lg-6">

<form method = "POST" action = "save_student_query.php" enctype = "multipart/form-data">

<div class = "form-group">

<label>Student ID:</label>

<input type = "text" name = "student_no" required = "required" class = "form-control" />

</div>

<div class = "form-group">

<label>Firstname:</label>

<input type = "text" name = "firstname" required = "required" class = "form-control" />

</div>

<div class = "form-group">

<label>Middlename:</label>

<input type = "text" name = "middlename" placeholder = "(Optional)" class = "form-control" />

</div>

<div class = "form-group">

<label>Lastname:</label>

<input type = "text" required = "required" name = "lastname" class = "form-control" />

</div>

<div class = "form-group">

<label>Course:</label>

<input type = "text" required = "required" name = "course" class = "form-control" />

</div>

<div class = "form-group">

<label>Yr&Section:</label>

<input type = "text" maxlength = "12" name = "section" required = "required" class = "form-control" />

</div>

<div class = "form-group">

<button class = "btn btn-primary" name = "save_student"><span class = "glyphicon glyphicon-


save"></span> Submit</button>

</div>

</form>
</div>

</div>

</div>

</div>

<br />

<br />

<br />

<nav class = "navbar navbar-default navbar-fixed-bottom">

<div class = "container-fluid">

<label class = "navbar-text pull-right">Library System &copy; Group- 1)baban majumder, 2)jyotirmoy
dutta,3) sourav bhowmick,4) subhadip karak 5)saikat pal</label>

</div>

</nav>

</body>

<script src = "js/jquery.js"></script>

<script src = "js/bootstrap.js"></script>

<script src = "js/login.js"></script>

<script src = "js/sidebar.js"></script>

<script src = "js/jquery.dataTables.js"></script>

<script type = "text/javascript">

$(document).ready(function(){

$('#table').DataTable();

});

</script>

<script type = "text/javascript">

$(document).ready(function(){

$('#add_student').click(function(){

$(this).hide();

$('#show_student').show();

$('#student_table').slideUp();

$('#student_form').slideDown();

$('#show_student').click(function(){

$(this).hide();

$('#add_student').show();

$('#student_table').slideDown();
$('#student_form').slideUp();

});

});

});

</script>

<script type = "text/javascript">

$(document).ready(function(){

$result = $('<center><label>Deleting...</label></center>');

$('.delstudent_id').click(function(){

$student_id = $(this).attr('value');

$(this).parents('td').empty().append($result);

$('.delstudent_id').attr('disabled', 'disabled');

$('.estudent_id').attr('disabled', 'disabled');

setTimeout(function(){

window.location = 'delete_student.php?student_id=' + $student_id;

}, 1000);

});

$('.estudent_id').click(function(){

$student_id = $(this).attr('value');

$('#show_student').show();

$('#show_student').click(function(){

$(this).hide();

$('#edit_form').empty();

$('#student_table').show();

$('#add_student').show();

});

$('#student_table').fadeOut();

$('#add_student').hide();

$('#edit_form').load('load_student.php?student_id=' + $student_id);

});

});

</script>

</html>
VALID
<?php

require_once 'connect.php';

session_start();

if(!ISSET($_SESSION['admin_id'])){

header('location: index.php');

}
THANK YOU

Você também pode gostar