Step 3 Creation of Admin Dashboard Module
This is how our admin dashboard will look like:
Functionalities of this page:
- Page will show the username and email id of admin.
- Admin can view and edit his profile.
- Dashboard will show the Below features:
- Registered Users
- Details of available books.
- Details of all book’s categories.
- Details of authors.
- Issued books details.
- Managerial features:
- Admin can add or manage existing books.
- Admin can add or manage categories of books.
- Admin can add or manage the authors.
- One Important feature is Admin can Issue Book to any user.
Code:
Below is the Code for creating above page:
<?php
require("functions.php");
session_start();
?>
<!DOCTYPE html>
<html>
<head>
<title>Dashboard</title>
<meta charset="utf-8" name="viewport" content="width=device-width,intial-scale=1">
<link rel="stylesheet" type="text/css" href="../bootstrap-4.4.1/css/bootstrap.min.css">
<script type="text/javascript" src="../bootstrap-4.4.1/js/juqery_latest.js"></script>
<script type="text/javascript" src="../bootstrap-4.4.1/js/bootstrap.min.js"></script>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="admin_dashboard.php">Library Management System (LMS)</a>
</div>
<font style="color: white"><span><strong>Welcome: <?php echo $_SESSION['name'];?></strong></span></font>
<font style="color: white"><span><strong>Email: <?php echo $_SESSION['email'];?></strong></font>
<ul class="nav navbar-nav navbar-right">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" data-toggle="dropdown">My Profile </a>
<div class="dropdown-menu">
<a class="dropdown-item" href="view_profile.php">View Profile</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="edit_profile.php">Edit Profile</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="change_password.php">Change Password</a>
</div>
</li>
<li class="nav-item">
<a class="nav-link" href="../logout.php">Logout</a>
</li>
</ul>
</div>
</nav><br>
<nav class="navbar navbar-expand-lg navbar-light" style="background-color: #e3f2fd">
<div class="container-fluid">
<ul class="nav navbar-nav navbar-center">
<li class="nav-item">
<a class="nav-link" href="admin_dashboard.php">Dashboard</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" data-toggle="dropdown">Books </a>
<div class="dropdown-menu">
<a class="dropdown-item" href="add_book.php">Add New Book</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="manage_book.php">Manage Books</a>
</div>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" data-toggle="dropdown">Category </a>
<div class="dropdown-menu">
<a class="dropdown-item" href="add_cat.php">Add New Category</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="manage_cat.php">Manage Category</a>
</div>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" data-toggle="dropdown">Authors</a>
<div class="dropdown-menu">
<a class="dropdown-item" href="add_author.php">Add New Author</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="manage_author.php">Manage Author</a>
</div>
</li>
<li class="nav-item">
<a class="nav-link" href="issue_book.php">Issue Book</a>
</li>
</ul>
</div>
</nav><br>
<div class="row">
<div class="col-md-3" style="margin: 0px ">
<div class="card bg-light" style=" width: 300px ">
<div class="card-header">Registered User</div>
<div class="card-body">
<p class="card-text">No. total Users: <?php echo get_user_count();?></p>
<a class="btn btn-danger" href="Regusers.php" target="_blank">View Registered Users</a>
</div>
</div>
</div>
<div class="col-md-3" style="margin: 0px">
<div class="card bg-light" style="width: 300px">
<div class="card-header">Total Book</div>
<div class="card-body">
<p class="card-text">No of books available: <?php echo get_book_count();?></p>
<a class="btn btn-success" href="Regbooks.php" target="_blank">View All Books</a>
</div>
</div>
</div>
<div class="col-md-3" style="margin: 0px">
<div class="card bg-light" style="width: 300px">
<div class="card-header">Book Categories</div>
<div class="card-body">
<p class="card-text">No of Book's Categories: <?php echo get_category_count();?></p>
<a class="btn btn-warning" href="Regcat.php" target="_blank">View Categories</a>
</div>
</div>
</div>
<div class="col-md-3" style="margin: 0px">
<div class="card bg-light" style="width: 300px">
<div class="card-header">No. of Authors</div>
<div class="card-body">
<p class="card-text">No of Authors: <?php echo get_author_count();?></p>
<a class="btn btn-primary" href="Regauthor.php" target="_blank">View Authors</a>
</div>
</div>
</div>
</div><br><br>
<div class="row">
<div class="col-md-3" style="margin: 0px">
<div class="card bg-light" style="width: 300px">
<div class="card-header">Book Issued</div>
<div class="card-body">
<p class="card-text">No of book issued: <?php echo get_issue_book_count();?></p>
<a class="btn btn-success" href="view_issued_book.php" target="_blank">View Issued Books</a>
</div>
</div>
</div>
<div class="col-md-3"></div>
<div class="col-md-3"></div>
</div>
</body>
</html>
<?php
require("functions.php");
session_start();
#fetch data from database
$connection = mysqli_connect("localhost","root","");
$db = mysqli_select_db($connection,"lms");
$name = "";
$email = "";
$mobile = "";
$query = "select * from admins where email = '$_SESSION[email]'";
$query_run = mysqli_query($connection,$query);
while ($row = mysqli_fetch_assoc($query_run)){
$name = $row['name'];
$email = $row['email'];
$mobile = $row['mobile'];
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Dashboard</title>
<meta charset="utf-8" name="viewport" content="width=device-width,intial-scale=1">
<link rel="stylesheet" type="text/css" href="../bootstrap-4.4.1/css/bootstrap.min.css">
<script type="text/javascript" src="../bootstrap-4.4.1/js/juqery_latest.js"></script>
<script type="text/javascript" src="../bootstrap-4.4.1/js/bootstrap.min.js"></script>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="admin_dashboard.php">Library Management System (LMS)</a>
</div>
<font style="color: white"><span><strong>Welcome: <?php echo $_SESSION['name'];?></strong></span></font>
<font style="color: white"><span><strong>Email: <?php echo $_SESSION['email'];?></strong></font>
<ul class="nav navbar-nav navbar-right">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" data-toggle="dropdown">My Profile </a>
<div class="dropdown-menu">
<a class="dropdown-item" href="view_profile.php">View Profile</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="edit_profile.php">Edit Profile</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="change_password.php">Change Password</a>
</div>
</li>
<li class="nav-item">
<a class="nav-link" href="../logout.php">Logout</a>
</li>
</ul>
</div>
</nav><br>
<span><marquee>This is library mangement system. Library opens at 8:00 AM and close at 8:00 PM</marquee></span><br><br>
<center><h4>Admin Profile Detail</h4><br></center>
<div class="row">
<div class="col-md-4"></div>
<div class="col-md-4">
<form>
<div class="form-group">
<label for="name">Name:</label>
<input type="text" class="form-control" value="<?php echo $name;?>" disabled>
</div>
<div class="form-group">
<label for="email">Email:</label>
<input type="text" value="<?php echo $email;?>" class="form-control" disabled>
</div>
<div class="form-group">
<label for="mobile">Mobile:</label>
<input type="text" value="<?php echo $mobile;?>" class="form-control" disabled>
</div>
</form>
</div>
<div class="col-md-4"></div>
</div>
</body>
</html>
<?php
require("functions.php");
session_start();
#fetch data from database
$connection = mysqli_connect("localhost","root","");
$db = mysqli_select_db($connection,"lms");
$name = "";
$email = "";
$mobile = "";
$query = "select * from admins where email = '$_SESSION[email]'";
$query_run = mysqli_query($connection,$query);
while ($row = mysqli_fetch_assoc($query_run)){
$name = $row['name'];
$email = $row['email'];
$mobile = $row['mobile'];
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Dashboard</title>
<meta charset="utf-8" name="viewport" content="width=device-width,intial-scale=1">
<link rel="stylesheet" type="text/css" href="../bootstrap-4.4.1/css/bootstrap.min.css">
<script type="text/javascript" src="../bootstrap-4.4.1/js/juqery_latest.js"></script>
<script type="text/javascript" src="../bootstrap-4.4.1/js/bootstrap.min.js"></script>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="admin_dashboard.php">Library Management System (LMS)</a>
</div>
<font style="color: white"><span><strong>Welcome: <?php echo $_SESSION['name'];?></strong></span></font>
<font style="color: white"><span><strong>Email: <?php echo $_SESSION['email'];?></strong></font>
<ul class="nav navbar-nav navbar-right">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" data-toggle="dropdown">My Profile </a>
<div class="dropdown-menu">
<a class="dropdown-item" href="">View Profile</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#">Edit Profile</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="change_password.php">Change Password</a>
</div>
</li>
<li class="nav-item">
<a class="nav-link" href="../logout.php">Logout</a>
</li>
</ul>
</div>
</nav><br>
<span><marquee>This is library mangement system. Library opens at 8:00 AM and close at 8:00 PM</marquee></span><br><br>
<center><h4>Admin Profile Detail</h4><br></center>
<div class="row">
<div class="col-md-4"></div>
<div class="col-md-4">
<form action="update.php" method="post">
<div class="form-group">
<label for="name">Name:</label>
<input type="text" class="form-control" name="name" value="<?php echo $name;?>">
</div>
<div class="form-group">
<label for="email">Email:</label>
<input type="text" name="email" class="form-control" value="<?php echo $email;?>">
</div>
<div class="form-group">
<label for="mobile">Mobile:</label>
<input type="text" name="mobile" class="form-control" value="<?php echo $mobile;?>">
</div>
<button type="submit" name="update" class="btn btn-primary">Update</button>
</form>
</div>
<div class="col-md-4"></div>
</div>
</body>
</html>
<?php
require("functions.php");
session_start();
?>
<!DOCTYPE html>
<html>
<head>
<title>Dashboard</title>
<meta charset="utf-8" name="viewport" content="width=device-width,intial-scale=1">
<link rel="stylesheet" type="text/css" href="../bootstrap-4.4.1/css/bootstrap.min.css">
<script type="text/javascript" src="../bootstrap-4.4.1/js/juqery_latest.js"></script>
<script type="text/javascript" src="../bootstrap-4.4.1/js/bootstrap.min.js"></script>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="admin_dashboard.php">Library Management System (LMS)</a>
</div>
<font style="color: white"><span><strong>Welcome: <?php echo $_SESSION['name'];?></strong></span></font>
<font style="color: white"><span><strong>Email: <?php echo $_SESSION['email'];?></strong></font>
<ul class="nav navbar-nav navbar-right">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" data-toggle="dropdown">My Profile </a>
<div class="dropdown-menu">
<a class="dropdown-item" href="view_profile.php">View Profile</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="edit_profile.php">Edit Profile</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="change_password.php">Change Password</a>
</div>
</li>
<li class="nav-item">
<a class="nav-link" href="../logout.php">Logout</a>
</li>
</ul>
</div>
</nav><br>
<span><marquee>This is library mangement system. Library opens at 8:00 AM and close at 8:00 PM</marquee></span><br><br>
<center><h4>Change Admin Password</h4><br></center>
<div class="row">
<div class="col-md-4"></div>
<div class="col-md-4">
<form action="update_password.php" method="post">
<div class="form-group">
<label for="password">Enter Password:</label>
<input type="password" class="form-control" name="old_password">
</div>
<div class="form-group">
<label for="New Password">Enter New Password:</label>
<input type="password" name="new_password" class="form-control">
</div>
<button type="submit" name="update" class="btn btn-primary">Update Password</button>
</form>
</div>
<div class="col-md-4"></div>
</div>
</body>
</html>
<?php
session_start();
$connection = mysqli_connect("localhost","root","");
$db = mysqli_select_db($connection,"lms");
$password = "";
$query = "select * from admins where email = '$_SESSION[email]'";
$query_run = mysqli_query($connection,$query);
while ($row = mysqli_fetch_assoc($query_run)){
$password = $row['password'];
}
if($password == $_POST['new_password']){
$query = "update admins set password = '$_POST[new_password]' where email = '$_SESSION[email]'";
$query_run = mysqli_query($connection,$query);
?>
<script type="text/javascript">
alert("Updated successfully...");
window.location.href = "admin_dashboard.php";
</script>
<?php
}
else{
?>
<script type="text/javascript">
alert("Wrong Admin Password...");
window.location.href = "change_password.php";
</script>
<?php
}
?>
<?php
$connection = mysqli_connect("localhost","root","");
$db = mysqli_select_db($connection,"lms");
$query = "update admins set name = '$_POST[name]',email = '$_POST[email]',mobile = '$_POST[mobile]'";
$query_run = mysqli_query($connection,$query);
?>
<script type="text/javascript">
alert("Updated successfully...");
window.location.href = "admin_dashboard.php";
</script>
<?php
function get_author_count(){
$connection = mysqli_connect("localhost","root","");
$db = mysqli_select_db($connection,"lms");
$author_count = 0;
$query = "select count(*) as author_count from authors";
$query_run = mysqli_query($connection,$query);
while ($row = mysqli_fetch_assoc($query_run)){
$author_count = $row['author_count'];
}
return($author_count);
}
function get_user_count(){
$connection = mysqli_connect("localhost","root","");
$db = mysqli_select_db($connection,"lms");
$user_count = 0;
$query = "select count(*) as user_count from users";
$query_run = mysqli_query($connection,$query);
while ($row = mysqli_fetch_assoc($query_run)){
$user_count = $row['user_count'];
}
return($user_count);
}
function get_book_count(){
$connection = mysqli_connect("localhost","root","");
$db = mysqli_select_db($connection,"lms");
$book_count = 0;
$query = "select count(*) as book_count from books";
$query_run = mysqli_query($connection,$query);
while ($row = mysqli_fetch_assoc($query_run)){
$book_count = $row['book_count'];
}
return($book_count);
}
function get_issue_book_count(){
$connection = mysqli_connect("localhost","root","");
$db = mysqli_select_db($connection,"lms");
$issue_book_count = 0;
$query = "select count(*) as issue_book_count from issued_books";
$query_run = mysqli_query($connection,$query);
while ($row = mysqli_fetch_assoc($query_run)){
$issue_book_count = $row['issue_book_count'];
}
return($issue_book_count);
}
function get_category_count(){
$connection = mysqli_connect("localhost","root","");
$db = mysqli_select_db($connection,"lms");
$cat_count = 0;
$query = "select count(*) as cat_count from category";
$query_run = mysqli_query($connection,$query);
while ($row = mysqli_fetch_assoc($query_run)){
$cat_count = $row['cat_count'];
}
return($cat_count);
}
?>
<?php
session_start();
#fetch data from database
$connection = mysqli_connect("localhost","root","");
$db = mysqli_select_db($connection,"lms");
$book_name = "";
$author = "";
$book_no = "";
$student_name = "";
$query = "select issued_books.book_name,issued_books.book_author,issued_books.book_no,users.name from issued_books left join users on issued_books.student_id = users.id where issued_books.status = 1";
?>
<!DOCTYPE html>
<html>
<head>
<title>Issued Books</title>
<meta charset="utf-8" name="viewport" content="width=device-width,intial-scale=1">
<link rel="stylesheet" type="text/css" href="../bootstrap-4.4.1/css/bootstrap.min.css">
<script type="text/javascript" src="../bootstrap-4.4.1/js/juqery_latest.js"></script>
<script type="text/javascript" src="../bootstrap-4.4.1/js/bootstrap.min.js"></script>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="admin_dashboard.php">Library Management System (LMS)</a>
</div>
<font style="color: white"><span><strong>Welcome: <?php echo $_SESSION['name'];?></strong></span></font>
<font style="color: white"><span><strong>Email: <?php echo $_SESSION['email'];?></strong></font>
<ul class="nav navbar-nav navbar-right">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" data-toggle="dropdown">My Profile </a>
<div class="dropdown-menu">
<a class="dropdown-item" href="#">View Profile</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#">Edit Profile</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="change_password.php">Change Password</a>
</div>
</li>
<li class="nav-item">
<a class="nav-link" href="../logout.php">Logout</a>
</li>
</ul>
</div>
</nav><br>
<span><marquee>This is library mangement system. Library opens at 8:00 AM and close at 8:00 PM</marquee></span><br><br>
<center><h4>Issued Book's Detail</h4><br></center>
<div class="row">
<div class="col-md-2"></div>
<div class="col-md-8">
<form>
<table class="table-bordered" width="900px" style="text-align: center">
<tr>
<th>Name</th>
<th>Author</th>
<th>Number</th>
<th>Student Name</th>
</tr>
<?php
$query_run = mysqli_query($connection,$query);
while ($row = mysqli_fetch_assoc($query_run)){
?>
<tr>
<td><?php echo $row['book_name'];?></td>
<td><?php echo $row['book_author'];?></td>
<td><?php echo $row['book_no'];?></td>
<td><?php echo $row['name'];?></td>
</tr>
<?php
}
?>
</table>
</form>
</div>
<div class="col-md-2"></div>
</div>
</body>
</html>
<?php
session_start();
#fetch data from database
$connection = mysqli_connect("localhost","root","");
$db = mysqli_select_db($connection,"lms");
$name = "";
$email = "";
$password = "";
$mobile = "";
$address = "";
$query = "select * from users";
?>
<!DOCTYPE html>
<html>
<head>
<title>All Reg Users</title>
<meta charset="utf-8" name="viewport" content="width=device-width,intial-scale=1">
<link rel="stylesheet" type="text/css" href="../bootstrap-4.4.1/css/bootstrap.min.css">
<script type="text/javascript" src="../bootstrap-4.4.1/js/juqery_latest.js"></script>
<script type="text/javascript" src="../bootstrap-4.4.1/js/bootstrap.min.js"></script>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="admin_dashboard.php">Library Management System (LMS)</a>
</div>
<font style="color: white"><span><strong>Welcome: <?php echo $_SESSION['name'];?></strong></span></font>
<font style="color: white"><span><strong>Email: <?php echo $_SESSION['email'];?></strong></font>
<ul class="nav navbar-nav navbar-right">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" data-toggle="dropdown">My Profile </a>
<div class="dropdown-menu">
<a class="dropdown-item" href="#">View Profile</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#">Edit Profile</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="change_password.php">Change Password</a>
</div>
</li>
<li class="nav-item">
<a class="nav-link" href="../logout.php">Logout</a>
</li>
</ul>
</div>
</nav><br>
<span><marquee>This is library mangement system. Library opens at 8:00 AM and close at 8:00 PM</marquee></span><br><br>
<center><h4>Registered Users Detail</h4><br></center>
<div class="row">
<div class="col-md-2"></div>
<div class="col-md-8">
<form>
<table class="table-bordered" width="900px" style="text-align: center">
<tr>
<th>Name</th>
<th>Mobile</th>
<th>Email</th>
<th>Address</th>
</tr>
<?php
$query_run = mysqli_query($connection,$query);
while ($row = mysqli_fetch_assoc($query_run)){
$name = $row['name'];
$email = $row['email'];
$mobile = $row['mobile'];
$address = $row['address'];
?>
<tr>
<td><?php echo $name;?></td>
<td><?php echo $email;?></td>
<td><?php echo $mobile;?></td>
<td><?php echo $address;?></td>
</tr>
<?php
}
?>
</table>
</form>
</div>
<div class="col-md-2"></div>
</div>
</body>
</html>
<?php
$connection = mysqli_connect("localhost","root","");
$db = mysqli_select_db($connection,"lms");
$user_count = 0;
$query = "select count(*) as user_count from users";
$query_run = mysqli_query($connection,$query);
while ($row = mysqli_fetch_assoc($query_run)){
$user_count = $row['user_count'];
}
?>
Library Management System Project | Software Development
Library Management System is one of the most common software development projects till date. In this article, we are going to make the Library Management System software development project, from scratch, for final year students. We will be covering all the steps you have to do while developing this project.
Contact Us