Step 2 Creation of User Dashboard Module
This is how user dashboard will look like:
Functionalities of this page:
- Page will show the username and email id .
- User can view Issued books and its count.
- User can view and edit its profile as well.
- Users can change his password also.
- These will be one button for logging out from this page.
Code:
Below is the Code for creating above page:
<?php
session_start();
function get_user_issue_book_count(){
$connection = mysqli_connect("localhost","root","");
$db = mysqli_select_db($connection,"lms");
$user_issue_book_count = 0;
$query = "select count(*) as user_issue_book_count from issued_books where student_id = $_SESSION[id]";
$query_run = mysqli_query($connection,$query);
while ($row = mysqli_fetch_assoc($query_run)){
$user_issue_book_count = $row['user_issue_book_count'];
}
return($user_issue_book_count);
}
?>
<!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>
<style type="text/css">
body{
background: rgba(245, 245, 245, 0.4);
background-image: url("https://img.freepik.com/free-photo/abundant-collection-antique-books-wooden-shelves-generated-by-ai_188544-29660.jpg?size=626&ext=jpg&ga=GA1.1.1546980028.1704240000&semt=sph");
}
</style>
<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>
<div class="row">
<div class="col-md-3" style="margin: 25px">
<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_user_issue_book_count();?></p>
<a class="btn btn-success" href="view_issued_book.php">View Issued Books</a>
</div>
</div>
</div>
<div class="col-md-3"></div>
<div class="col-md-3"></div>
</div>
</body>
</html>
<?php
session_start();
#fetch data from database
$connection = mysqli_connect("localhost","root","");
$db = mysqli_select_db($connection,"lms");
$name = "";
$email = "";
$mobile = "";
$query = "select * from users 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'];
$address = $row['address'];
}
?>
<!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="view_profile.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>Student 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>
<div class="form-group">
<label for="email">Address:</label>
<input type="text" value="<?php echo $address;?>" class="form-control" disabled>
</div>
</form>
</div>
<div class="col-md-4"></div>
</div>
</body>
</html>
<?php
session_start();
#fetch data from database
$connection = mysqli_connect("localhost","root","");
$db = mysqli_select_db($connection,"lms");
$book_name = "";
$author = "";
$book_no = "";
$query = "select book_name,book_author,book_no from issued_books where student_id = $_SESSION[id] and 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="user_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>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>
</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>
</tr>
<?php
}
?>
</table>
</form>
</div>
<div class="col-md-2"></div>
</div>
</body>
</html>
<?php
session_start();
$connection = mysqli_connect("localhost","root","");
$db = mysqli_select_db($connection,"lms");
$password = "";
$query = "select * from users 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 users 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 = "user_dashboard.php";
</script>
<?php
}
else{
?>
<script type="text/javascript">
alert("Wrong User Password...");
window.location.href = "change_password.php";
</script>
<?php
}
?>
<?php
$connection = mysqli_connect("localhost","root","");
$db = mysqli_select_db($connection,"lms");
$query = "update users set name = '$_POST[name]',email = '$_POST[email]',mobile = '$_POST[mobile]',address = '$_POST[address]'";
$query_run = mysqli_query($connection,$query);
?>
<script type="text/javascript">
alert("Updated successfully...");
window.location.href = "user_dashboard.php";
</script>
<?php
session_start();
#fetch data from database
$connection = mysqli_connect("localhost","root","");
$db = mysqli_select_db($connection,"lms");
$name = "";
$email = "";
$mobile = "";
$address = "";
$query = "select * from users 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'];
$address = $row['address'];
}
?>
<!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>Edit Profile</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>
<div class="form-group">
<label for="mobile">Address:</label>
<textarea rows="3" cols="40" name="address" class="form-control"><?php echo $address;?></textarea>
</div>
<button type="submit" name="update" class="btn btn-primary">Update</button>
</form>
</div>
<div class="col-md-4"></div>
</div>
</body>
</html>
<?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="user_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 Student 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>
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