PHP-MySQL Library Management System (with source code)

Time:2024-1-25

This system uses phpstudy development platform, using PHP and MySQL database development, development tools for HBuilder. phpStudy is a PHP debugging environment for the program to integrate the latest

Apache+PHP+MySQL+phpMyAdmin, one-time installation, no need to configure to use, is very convenient, good use of PHP debugging environment. (Other platforms are available)@@@@At the end of the article there are ways to obtain

Function.
Book section.
Book entry Book shelving Book information modification Book inquiry
User Segment.
Add User Logout User Reset User Modify Information
Lending section.
Book Loans Book Returns Overdue Books Book Reminders
Operation logging Personal information
php7 version layui framework

  • user login

PHP-MySQL Library Management System (with source code)

<?php
	session_start();
	if($_SESSION['yzm']==$_POST['yzm']){
		$yzm="yes";
	}
	else{
		$yzm="no";
	}
	include('../install/conn.php');
	$mima=md5(md5($_POST['password']));
	$sql="select * from admins where wno='".$_POST['wno']."' and wps='".$mima."'";
	$conn=mysqli_connect($servername,$username,$password,$database);
	if(!$conn){
		die("Connection failed: ".mysqli_connect_error());;
		exit();
	}
	$str=mysqli_query($conn,$sql);
	$num=mysqli_num_rows($str);
	$row=mysqli_fetch_object($str);
	if($num==0){
		$yh="no";
	}
	else{
		$yh='yes';
		
		$_SESSION['username']=$row->wname;
		$_SESSION['wno']=$row->wno;
		// $a=$row->usno;
	}
	$arr=array('yonghu'=>$yh,'yzm'=>$yzm,'sql'=>$_SESSION['wno']);
	echo json_encode($arr);
?>
  • Backstage Home

PHP-MySQL Library Management System (with source code)

<div id="nav">
					<ul>
						<li><a href="muser.php">Basic User Information Management</a>
							<ol>
								<li ><a href="muser.php" style="color: white;" > User input </a></li>
								<li ><a href="muser.php" style="color: white;" > Logout </a></li>
								<li ><a href="muser.php" style="color: white;" > Reset password </a></li>
								<li ><a href="muser.php" style="color: white;" > Modify information </a></li>
							</ol>
						</li>
						<li><a href="mbook.php">Basic Book Information Management</a>
							<ol>
								<li><a href="mbook.php" style="color: white;" > Book entry </a></li>
								<li ><a href="mbook.php" style="color: white;" > Book destruction </a></li>
								<li ><a href="mbook.php" style="color: white;" > Modify information </a></li>
								<li ><a href="mbook.php" style="color: white;" > Search books </a></li>
							</ol>
						</li>
						<li><a href="mborrow.php">Library Loan Management</a>
							<ol>
								<li><a href="mborrow.php" style="color: white;" > Book lending </a></li>
								<li ><a href="mborrow.php" style="color: white;" > Book Return </a></li>
							<! -- 	<li ><a href="mborrow.php" style="color: white;" > New user input </a></li>
								<li ><a href="mborrow.php" style="color: white;" > New user input </a></li> -->
							</ol>
						</li>
						<li><a href="">Inventory Book Management</a>
							<ol>
								<li><a href="" style="color: white;">New User Entry</a></li>
								<li ><a href="" style="color: white;">New User Entry</a></li>
								<li ><a href="" style="color: white;">New User Entry</a></li>
								<li ><a href="" style="color: white;">New User Entry</a></li>
							</ol>
						</li>
						<li><a href="">Personal Center</a>
							<ol>
								<li><a title=" edit "style="color: white;" onclick="xadmin.open(' edit ','self.php? idd=<? php echo $row->bno; ? >',600,550)" href="javascript:;" > Personal Information </a></li>
								<li><a href="mloginout.php" style="color: white;" > Exit </a></li>
							</ol>
						</li>
					</ul>
				</div>
  • user information

PHP-MySQL Library Management System (with source code)

<?php
								//
								include('../install/conn.php');
								$conn=mysqli_connect($servername,$username,$password,$database);
								$per_page=10;
								$sql="select * from users";
								//click here
								$str=mysqli_query($conn,$sql);
								$total=mysqli_num_rows($str);
								$total_page=ceil($total/$per_page);
								if($_GET['next_page']==''){
									$dq_page=1;
									$begin=0;
								}
								else{
									$dq_page=$_GET['next_page'];
									$begin=($dq_page-1)*$per_page;
								}
								$sql="select * from users limit $begin,$per_page";
								$str=mysqli_query($conn,$sql);
								while($row=mysqli_fetch_object($str)){
								?>			
											
											
				                          <tr>
				                            
				                            <td><?php echo $row->usno?></td>
				                            <td><?php echo $row->usname?></td> 
											<td><?php echo $row->ussex?></td>
											 <td><?php echo $row->usem?></td>
											<td><?php echo $row->usnum?></td> 
				                            <td class="td-manage">
				                              
				                              <a title=" edit "onclick="xadmin.open(' edit ','member-edit.php? idd=<? php echo $row->usno; ? >',600,500)" href="javascript:;" >
				                                <i class="layui-icon">&#xe642;</i>
				                              </a>
				                              <a onclick="xadmin.open(' reset password ','memberpsw.php? idd=<? php echo $row->usno; ? >',600,400)" title=" Reset password "href="javascript:;" >
				                                <i class="layui-icon">&#xe631;</i>
				                              </a>
				                              <a title=" Delete "onclick="member_del(this,<? php echo $row->usno? >)" href="javascript:;" >
				                                <i class="layui-icon">&#xe640;</i>
				                              </a>
				                            </td>
				                          </tr>
										  
							<?php
							 }
							?>
  • Add User

PHP-MySQL Library Management System (with source code)

<?php
session_start();
include('../install/conn.php');
$conn=mysqli_connect($servername,$username,$password,$database);
$mima=md5(md5($_POST['pass']));
$sql1="select * from admins where wno=".$_SESSION['wno'];
$str=mysqli_query($conn,$sql1);
$row=mysqli_fetch_object($str);
$w_ps=$row->wps;
$sql4="select * from users where usno=".$_POST['usno'];
$str4=mysqli_query($conn,$sql4);
$row4=mysqli_fetch_object($str4);
$usno=$row4->usno;
	if($w_ps!=$mima){
		$pw=0;
	}
	else{
		
		$pw=1;
		if($usno==$_POST['usno']){
			$c=0;
		}
		else{
			$c=1;
		    $sql="insert into `users` (`usno`,`usname`, `usps`, `usem`,`usnum`,`ussex`) values ('".$_POST['usno']."','".$_POST['username']."','".$mima."', '".$_POST['email']."', '".$_POST['mobile']."', '".$_POST['sex']."');";
		    $str=mysqli_query($conn,$sql);
		    if($str){
		    		$code=1;
		    }
		    else{
		    	$code=0;
		    };    			
		}
	}
$arr=array('code'=>$code,'sql'=>$sql,'pw'=>$pw,'c'=>$c);
echo json_encode($arr);
?>
  • Add Book

PHP-MySQL Library Management System (with source code)

<?php
session_start();
include('../install/conn.php');
$conn=mysqli_connect($servername,$username,$password,$database);
$mima=md5(md5($_POST['pass']));
// Inspection of books
$sql4="select * from books where bno=".$_POST['bno'];
$str4=mysqli_query($conn,$sql4);
$row4=mysqli_fetch_object($str4);
$b_no=$row4->bno;

//check administrator password
$sql8="select * from admins where wno=".$_SESSION['wno'];
$str=mysqli_query($conn,$sql8);
$row=mysqli_fetch_object($str);
$w_ps=$row->wps;


if($w_ps!=$mima){
	$pw=0;
}
else{
	if($b_no==$_POST['bno']){
		$c=0;
	}
	else{
		$c=1;
		$sql="insert into `books` (`bno`,`bname`, `writer`, `press`) values ('".$_POST['bno']."','".$_POST['bname']."','".$_POST['writer']."','".$_POST['press']."');";
		$str1=mysqli_query($conn,$sql);
		$now=date('Y-m-d H:i:s');
		
		$sql2="insert into `massage` (`bno`, ` bstatus `, ` wno `, ` mtime `) values (' ". $_POST [' bno]. "', 'in house', '". $_SESSION [' wno']." ', '". $now.' ");" ;
		$str2=mysqli_query($conn,$sql2);
		
		$sql3="insert into `belong` (`bno`,`cno`) values ('".$_POST['bno']."','".$_POST['cno']."');";
		$str3=mysqli_query($conn,$sql3);
	}
	if($str1==true and $str2==true and $str3==true){
		$code=1;
	}
	else{
		$code=0;
	}
	$pw=1;
}




$arr=array('code'=>$code,'c'=>$c,'pw'=>$pw,'sql'=>[$sql3,$sql2,$sql],'str'=>[$str1,$str2,$str3]);
echo json_encode($arr);
?>
  • navigation bar

PHP-MySQL Library Management System (with source code)

Jump for source code
Demo Video

Recommended Today

DML statements in SQL

preamble Previously we have explained DDL statements in SQL statements. Today we will continue with the DML statement of SQL. DML is the Data Manipulation Language.Used to add, delete, and change data operations on the tables in the library.。 1. Add data to the specified field(INSERT) 2. Modify data(UPDATE) 3. Delete data(DELETE) catalogs preamble I. […]