资源描述
计算机科学与工程学院
WEB课程设计
课设题目:图书管理系统
课程名称:WEB技术与应用
姓 名:
学 号:
指导老师:
图书管理系统
一、 系统需求分析
随着国家经济的发展,人民基本过上了小康生活,开始精神追求。而图书与阅读成为一个受到广大人民欢迎、提高自身修养的方式。随着人们对图书的追求,许多书店、图书馆建立。不仅限于学校图书馆,城市、县城、社区也开始设立属于自己的图书馆。一套较科学的图书馆管理系统是很受欢迎的。于是现根据图书馆的需求建立此程序。身份限制有管理员和读者身份。可以查询相关借阅信息,续借以及简单的操作。
二、 系统功能
图书管理系统
1. 前台功能
管理员登录
读者管理
更改口令
系统查询
图书借还
图书档案管理
注销
系统设置
首页
2. 后台功能
u 信息管理
l 添加图书
l 更改,删除,添加读者信息
l 更改,添加,删除用户
二、 实现环境
win10
PHPStudy
前台:HTML+CSS
后台:MYSQL
三、 前台功能分析以及实现
1. 管理员登陆
(1) 界面展示
(2) 后台HTML实现
<?php
session_start();
$A_name=$_POST[@name]; //接收表单提交的用户名
$A_pwd=$_POST[@pwd]; //接收表单提交的密码
class chkinput{ //定义类
var $name;
var $pwd;
function chkinput($x,$y){
$this->name=$x;
$this->pwd=$y;
}
function checkinput(){
include("conn/conn.php"); //连接数据源
$sql=mysql_query("select * from tb_manager where name='".$this->name."' and pwd='".$this->pwd."'",$conn);
$info=mysql_fetch_array($sql); //检索管理员名称和密码是否正确
if($info==false){ //如果管理员名称或密码不正确,则弹出相关提示信息
echo"<script language='javascript'>alert('您输入的管理员名称错误,请重新输入!');history.back();</script>";
exit;
}
else{ //如果管理员名称或密码正确,则弹出相关提示信息
echo "<script>alert('管理员登录成功!');window.location='index.php';</script>";
$_SESSION[@admin_name]=$info[@name];
$_SESSION[@pwd]=$info[@pwd];
}
}
}
$obj=new chkinput(trim($A_name),trim($A_pwd)); //创建对象
$obj->checkinput(); //调用类
?>
(3) 功能说明
对于管理员登陆页面,只有当正确的输入用户名和密码才会进入该图书馆的管理系统。
2. 首页
(1) 界面展示
(2) 后台HTML实现
<?php
include ("check_login.php"); //检查用户登录情况
include("conn/conn.php");//连接数据源
?>
<html>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<head>
<title>学校图书馆管理系统</title>
<link href="CSS/style.css" rel="stylesheet">//设置当前页面的格式
</head>
<table width="776" border="0" align="center" cellpadding="0" cellspacing="0" class="tableBorder">
<tr>
<td><?php include("navigation.php"); ?></td>
</tr>
<td bgcolor="#FFFFFF">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" bgcolor="#FFFFFF"><table width="100%" height="510" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" class="tableBorder_gray">
<tr>
<td align="center" valign="top" style="padding:5px;"><table width="738" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="148" valign="top"><table width="738" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="740" height="43" background="Images/main_booksort.png"> </td>
</tr>
<tr>
<td height="72" valign="top" background="Images/main_booksort_1.gif"><table width="740" border="1" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" bordercolordark="#D2E3E6" bordercolorlight="#FFFFFF">
<tr align="center">
<td width="4%" height="25">排名</td>
<td width="10%">图书条形码</td>
<td width="22%">图书名称</td>
<td width="11%">图书类型</td>
<td width="13%">出版社</td>
<td width="15%">作者</td>
<td width="8%">定价(元)</td>
<td width="8%">借阅次数</td>
</tr>
<?php
$sql=mysql_query("select * from (select bookid,count(bookid) as degree from tb_borrow group by bookid) as borr join (select b.*,p.pubname,t.typename from tb_bookinfo b join tb_publishing p on b.ISBN=p.ISBN join tb_booktype t on b.typeid=t.id where b.del=0) as book on borr.bookid=book.id order by borr.degree desc limit 10");
$info=mysql_fetch_array($sql);
$i=1;
do{
?>
<tr>
<td height="25" align="center"><?php echo $i;?></td>
<td style="padding:5px;"> <?php echo $info[@barcode];?></td>
<td style="padding:5px;"><?php echo $info[@bookname];?></td>
<td style="padding:5px;"><?php echo $info[@typename];?></td>
<td align="center"> <?php echo $info[@pubname];?></td>
<td align="center"><?php echo $info[@author];?></td>
<td align="center"><?php echo $info[@price];?></td>
<td align="center"><?php echo $info[@degree];?></td>
</tr>
<?php
$i=$i+1;
}while($info=mysql_fetch_array($sql));
?>
</table></td>
</tr>
<tr
<td height="19" background="Images/main_booksort_2.gif"> </td>
</tr>
</table>
</td>
</tr>
</table>
<p> </p></td>
</tr>
</table></td>
</tr>
</table>
<?php include("copyright.php"); ?></td>
</tr>
</table>
</html>
(3)功能说明
在首页上面你可以看到一些图书的信息,包括图书的排名、图书条形码、图书名称、图书类型、出版社、作者、定价、借阅次数等的相关信息。
3. 系统设置
包括系统主页面的设计,以及实现删除管理员、修改管理员信息、添加管理员三个功能。
主页面:
后台的HTML实现:
<?php session_start();?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="CSS/style.css" rel="stylesheet">
</head>
<body>
<table width="776" border="0" align="center" cellpadding="0" cellspacing="0" class="tableBorder">
<tr>
<td>
<?php include("navigation.php");?>
</td>
</tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" bgcolor="#FFFFFF"><table width="99%" height="510" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" class="tableBorder_gray">
<tr>
<td height="510" valign="top" style="padding:5px;"><table width="98%" height="487" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="22" valign="top" class="word_orange">当前位置:系统设置 >>></td>
</tr>
<tr>
<td align="center" valign="top">
<?php
include("conn/conn.php");
$sql=mysql_query("select m.id,m.name,p.sysset,p.readerset,p.bookset,p.borrowback,p.sysquery from tb_manager as m left join (select * from tb_purview)as p on m.id=p.id");
$info=mysql_fetch_array($sql);
if($info==false){
?>
<table width="100%" height="30" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="36" align="center">暂无管理员信息!</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<a href="#" onClick="window.open('manager_add.php','','width=292,height=175')">添加管理员信息</a> </td>
</tr>
</table>
<?php
}else{
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="84%"> </td>
<td width="16%">
<a href="#" onClick="window.open('manager_add.php','','width=292,height=175')">添加管理员信息</a> </td>
</tr>
</table>
<table width="91%" border="1" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" bordercolordark="#F7E351" bordercolorlight="#FFFFFF">
<tr align="center" bgcolor="#F7E335">
<td width="26%">管理员名称</td>
<td width="12%">系统设置</td>
<td width="12%">读者管理</td>
<td width="12%">图书档案管理</td>
<td width="11%">图书借还</td>
<td width="11%">系统查询</td>
<td width="8%">权限设置</td>
<td width="8%">操作</td>
</tr>
<?php do{?>
<tr>
<td style="padding:5px;"><?php echo $info[@name];?></td>
<td align="center"><input name="checkbox" type="checkbox" class="noborder" value="checkbox" disabled="disabled" <?php if($info[@sysset]==1){echo ("checked");}?>></td>
<td align="center"><input name="checkbox" type="checkbox" class="noborder" value="checkbox" disabled="disabled" <?php if($info[@readerset]==1){echo("checked");}?>></td>
<td align="center"><input name="checkbox" type="checkbox" class="noborder" value="checkbox" disabled <?php if($info[@bookset]==1){echo("checked");}?>></td>
<td align="center"><input name="checkbox" type="checkbox" class="noborder" value="checkbox" disabled <?php if($info[@borrowback]==1){echo("checked");}?>></td>
<td align="center"><input name="checkbox" type="checkbox" class="noborder" value="checkbox" disabled <?php if($info[@sysquery]==1){echo("checked");}?>></
<td align="center"><a href="#" onClick="window.open('manager_modify.php?id=<?php echo $info[@id]; ?>','','width=292,height=175')">权限设置</a></td>
<td align="center"><a href="manager_del.php?id=<?php echo $info[@id];?>">删除</a></td>
</tr>
<?php
}while($info=mysql_fetch_array($sql));
}
?>
</table></td>
</tr>
</table>
</td>
</tr>
</table><?php include("copyright.php");?></td>
</tr>
</table>
</td>
</tr>
</table>
</body>
在主页面中显示了当前的一些管理员的权限,包括系统设置、读者管理、图书档案管理、图书借还、系统查询等权限,还提供了添加管理员信息、删除管理员、修改管理员信息的功能选择。
3.1 删除管理员
(1)界面展示
(2)后台HTML实现
<?php
include("conn/conn.php");
$id=$_GET[@id];
$sql=mysql_query("delete from tb_manager where id='$id'");
$query=mysql_query("delete from tb_purview where id='$id'");
if($query==true ){
echo "<script language=javascript>alert('管理员删除成功!');history.back();</script>";
}
lse{
echo "<script language=javascript>alert('管理员删除失败!');history.back();</script>"
}
?>
(3)功能说明
通过与后台数据库的联系,利用相关的数据库语言实现将对应的管理员删除。
3.2 修改管理员信息
(1)界面展示
(2)后台HTML实现
修改时候的HTML
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="CSS/style.css" rel="stylesheet">
</head>
<body>
<table width="292" height="175" border="0" cellpadding="0" cellspacing="0" background="Images/subBG.jpg">
<tr>
<td valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="3%" height="25"> </td>
<td width="94%"> </td>
<td width="3%"> </td>
</tr>
<tr>
<td> </td>
<td><table width="100%" height="131" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center" valign="top"> <form name="form1" method="post" action="manager_modifyok.php">
<?php
include("conn/conn.php");
$id=$_GET[@id];
$query=mysql_query("select m.id,m.name,p.sysset,p.readerset,p.bookset,p.borrowback,p.sysquery from tb_manager as m left join (select * from tb_purview)as p on m.id=p.id where m.id='$id'");
$info=mysql_fetch_array($query);
?>
<table height="126" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="85" height="29" align="center">π‹¿Ì‘±√˚≥∆£∫ </td>
<td width="190">
<input name="id" type="hidden" value="<?php echo $info[@id];?>"><input name="name" type="text" readonly="yes" value="<?php echo $info[@name];?>"> </td>
</tr>
<tr>
<td height="74" align="center">”µ”–µƒ»®œfi£∫</td>
<td><table width="100%" height="67" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="47%"><input name="sysset" type="checkbox" class="noborder" id="sysset" value="1" <?php if($info[@sysset]==1){ echo("checked");}?>>
œµÕ≥…Ë÷√</td>
<td width="53%"><input name="readerset" type="checkbox" class="noborder" id="readerset" value="1" <?php if($info[@readerset]==1){ echo("checked");}?>>
∂¡’flπ‹¿Ì</td>
</tr>
<tr>
<td><input name="bookset" type="checkbox" class="noborder" id="bookset" value="1" <?php if($info[@bookset]==1){echo("checked");}?>>
Õº Èπ‹¿Ì</td>
<td><input name="borrowback" type="checkbox" class="noborder" id="borrowback" value="1" <?php if($info[@borrowback]==1){echo("checked");}?>>
Õº ÈΩ˪π</td>
</tr>
<tr>
<td height="23"><input name="sysquery" type="checkbox" class="noborder" id="sysquery" value="1" <?php if($info[@sysquery]==1){echo("checked");}?>>
œµÕ≥≤È—Ø</td>
<td> </td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="22" align="center"> </td>
<td><input name="submit" type="submit" class="btn_grey" value="±£¥Ê">
<input name="Submit2" type="button" class="btn_grey" value="πÿ±’" onClick="window.close();"></td>
</tr>
</table>
</form></td>
</tr>
</table></td>
<td> </td>
</tr>
<tr>
<td height="17"> </td>
<td> </td>
<td> </td>
</tr>
</table></td>
</tr>
</table>
</body>
修改成功之后的HTML
<?php
include("conn/conn.php");
if($_POST[@submit]!=""){
$id=$_POST[@id];
$sysset=$_POST[@sysset]==""?0:1;
$readerset=$_POST[@readerset]==""?0:1;
$bookset=$_POST[@bookset]==""?0:1;
$borrowback=$_POST[@borrowback]==""?0:1;
$sysquery=$_POST[@sysquery]==""?0:1;
$query=mysql_query("select * from tb_purview where id=$id");
$info=mysql_fetch_array($query);
if($info==false){
mysql_query("insert into tb_purview(id,sysset,readerset,bookset,borrowback,sysquery) values($id,$sysset,$readerset,$bookset,$borrowback,$sysquery)");
}
else{
mysql_query("update tb_purview set sysset=$sysset,readerset=$readerset,bookset=$bookset,borrowback=$borrowback,sysquery=$sysquery where id='$id'");
}
echo"<script language=javascript>alert('权限设置修改成功!');window.close();window.opener.location.reload();</script>";
}
?>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
(3)功能说明
这个过程可以修改一些管理员当前的一些权限,包括增加权限,也包括相应的减少某个管理员的权限。
3.3 添加管理员
(1)界面展示
(2)后台HTML实现
<html>
<head>
<title>Ã̺”π‹¿Ì‘±–≈œ¢</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="CSS/style.css" rel="stylesheet">
</head>
<script language="javascript">
function check(form1){
if(form1.name.value==""){
alert("«Î ‰»Îπ‹¿Ì‘±√˚≥∆!");form1.name.focus();return false;
}
if(form1.pwd.value==""){ alert("«Î ‰»Îπ‹¿Ì‘±√‹¬Î!");form1.pwd.focus();return false;
}
if(form1.pwd1.value==""){
alert("«Î»∑»œπ‹¿Ì‘±√‹¬Î!");form1.pwd1.focus();return false;
}
if(form1.pwd.value!=form1.pwd1.value){
alert("ƒ˙¡Ω¥Œ ‰»Îµƒπ‹¿Ì‘±√‹¬Î≤ª“ª÷¬£¨«Î÷ÿ–¬ ‰»Î!");form1.pwd1.focus();return false;
}
}
</script>
<body>
<table width="292" height="175" border="0" cellpadding="0" cellspacing="0" background="Images/subBG.jpg">
<tr>
<td valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="3%" height="25"> </td>
<td width="94%"> </td>
<td width="3%"> </td>
</tr>
<tr>
<td> </td>
<td><table width="100%" height="131" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center" valign="top"> <form name="form1" method="post" action="manager_ok.php">
<table height="123" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="97" height="30" a
展开阅读全文