1 Star 3 Fork 0

毕设研究小组/php毕设图书馆

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
daoqitx.php 14.66 KB
一键复制 编辑 原始数据 按行查看 历史
sjm 提交于 2021-07-04 09:31 . first push
<?php session_start();
include("conn.php");
$barcode=$_REQUEST["barcode"];
$bookName=$_REQUEST["bookName"];
$booktype=$_REQUEST["booktype"];
$author=$_REQUEST["author"];
//$translator=$_REQUEST[translator];
$publishing=$_REQUEST["publishing"];
//$price=$_REQUEST[price];
//$page1=$_REQUEST[page1];
$bookcase=$_REQUEST["bookcase"];
$now=date('Y-m-d');
if($_GET['action']=="huanshu"){//还书
$id=$_GET["id"];
$off=$mysqli->query("set autocommit=0");
$mysqli->query("BEGIN");
$re1=$mysqli->query("update tb_borrow set sqbacktime='".$now."',ifback=0,zhuangtai=4 where id=$id");
$re2=$mysqli->query("update tb_borrowlist set sqbacktime='".$now."',ifback=0,zhuangtai=4 where id=$id");
if($re2 && $re1){
$mysqli->query("COMMIT");
echo "<script language='javascript'>alert('图书归还申请成功!');location='daoqitx.php';</script>";
$mysqli->query("END");
$on=$mysqli->query("set autocommit=1");
}else{
$mysqli->query("ROLLBACK");
$mysqli->query("END");
$on=$mysqli->query("set autocommit=1");
echo "<script language='javascript'>alert('图书归还申请失败!');location='daoqitx.php';</script>";
}
}
if($_GET['action']=="xujie"){//续借
$id=$_GET["id"];
$off=$mysqli->query("set autocommit=0");
$mysqli->query("BEGIN");
$re1=$mysqli->query("update tb_borrow set sqbacktime='".$now."',ifback=0,zhuangtai=3 where id=$id");
$re2=$mysqli->query("update tb_borrowlist set sqbacktime='".$now."',ifback=0,zhuangtai=3 where id=$id");
if($re2 && $re1){
$mysqli->query("COMMIT");
echo "<script language='javascript'>alert('图书续借申请成功!');location='daoqitx.php';</script>";
$mysqli->query("END");
$on=$mysqli->query("set autocommit=1");
}else{
$mysqli->query("ROLLBACK");
$mysqli->query("END");
$on=$mysqli->query("set autocommit=1");
echo "<script language='javascript'>alert('图书续借申请失败!');location='daoqitx.php';</script>";
}
}
?>
<html>
<head>
<title>借阅到期提醒</title>
<link href="css/bootstrap.css" rel='stylesheet' type='text/css' />
<link href="css/examples.css" rel="stylesheet" type="text/css">
<link href="css/jquery.fancybox.css" rel="stylesheet" type="text/css">
<link href="css/slider-pro.css" rel='stylesheet' type='text/css' />
<link href="css/timeline.css" rel="stylesheet" type="text/css">
<link href="css/style.css" rel='stylesheet' type='text/css' />
<link href="css/fontawesome-all.css" rel="stylesheet">
<link href="http://fonts.googleapis.com/css?family=Poppins:100,100i,200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i" rel="stylesheet">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<div class="main-sec">
<?php include"header.php";?>
</div>
<section class="wthree-banner-bottom py-lg-5 py-3" style="background-color: #FFFFFF;margin: 0,0;padding: 0,0;">
<div class=" py-lg-4 py-3"width="auto">
<table width="100%" align="center">
<tr>
<td>
<table width="100%"border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<img src="images/dangan.gif" width="100%"/>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<?php
$zhuangtai=$_REQUEST["zhuangtai"];
$username=$_SESSION["username"];
$sql="select tb_borrow.*,tb_reader.name,tb_bookinfo.barcode,tb_bookinfo.bookname from tb_borrow,tb_reader,tb_bookinfo where tb_reader.id=tb_borrow.readerid and tb_borrow.bookid=tb_bookinfo.id and tb_reader.username='$username'";
$sql.=" and ifback=0";
$pagesize=5;
$query=$mysqli->query($sql);
$result=$query->fetch_array();
$totalNum=$query->num_rows; //2.查出总共有多少条信息
$total=$totalNum;
$page=isset($_GET["page"])?intval($_GET["page"]):1;
$pagecount=ceil($total/$pagesize);
if ($page>$pagecount){
$page=$pagecount; // 对提交过来的page做一些检查
}
if ($page<=0){
$page=1; // 对提交过来的page做一些检查
$pagecount=0;
}
$pre=$page-1; //上一页
$next=$page+1; //下一页
$first=1; //第一页
$last=$pagecount;
if($result==false){
?>
<table width="100%" height="30" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="36" align="center">暂无图书借阅信息!</td>
</tr>
</table>
<?php
}else{
?>
<table width="100%" height="500" border="1" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" bordercolordark="#D2E3E6" bordercolorlight="#FFFFFF">
<tr align="center" bgcolor="#D0E9F8">
<td align="center">条形码</td>
<td align="center">图书名称</td>
<td align="center">剩余时间</td>
<td align="center">操作</td>
</tr>
<?php
$offset=$pagesize*($page-1);
$sql.=" order by id asc limit $offset,$pagesize";
$result1=$mysqli->query($sql);
while ($row=$result1->fetch_array()){
?>
<tr align="center">
<td style="padding:5px;"align="center">&nbsp;<?php echo $row["barcode"];?></td>
<td style="padding:5px;"align="center"><a href="booklook.php?bookid=<?php echo $row["bookid"]; ?>"><?php echo $row["bookname"];?></a></td>
<td style="padding:5px;"align="center">&nbsp;
<?php
if($row["ifback"]==2){
echo "已提交还书申请预计".date("Y-m-d",strtotime("+1 day",strtotime($row["sqbacktime"])))."还书";
}else if($row["ifback"]==1){
echo "已还书";
}else{
$date_time_new = strtotime($row["backTime"]);
$date_time_old = strtotime($now);
$d=($date_time_new-$date_time_old);
if($d<0){
$second=($date_time_old-$date_time_new);
$day = floor($second/(3600*24));
$second = $second%(3600*24);//除去整天之后剩余的时间
$hour = floor($second/3600);
$second = $second%3600;//除去整小时之后剩余的时间
$minute = floor($second/60);
$second = $second%60;//除去整分钟之后剩余的时间
echo "已逾期 请尽快还书,逾期".$day.'天'.$hour.'小时'.$minute.'分'.$second.'秒';
}else{
$second=($date_time_new-$date_time_old);
$day = floor($second/(3600*24));
$second = $second%(3600*24);//除去整天之后剩余的时间
$hour = floor($second/3600);
$second = $second%3600;//除去整小时之后剩余的时间
$minute = floor($second/60);
$second = $second%60;//除去整分钟之后剩余的时间
//返回字符串
echo "还剩".$day.'天'.$hour.'小时'.$minute.'分'.$second.'秒'."天";
}
}?>
</td>
<td align="center">
<?php
if($row["ifback"]==1){
?>
<input type="button" value="删除"style="margin-right: 10px;">
<?php
}else{
?>
<input type="button" value="续借"style="margin-right: 10px;"onClick="window.location.href='daoqitx.php?action=xujie&id=<?php echo $row["id"];?>'">
<input type="button" value="还书" onClick="window.location.href='daoqitx.php?action=huanshu&id=<?php echo $row["id"];?>'">
<?php
}?>
</td>
</tr>
<?php
}
?>
</table>
<?php }?>
</td>
</tr>
<tr>
<td>
<table align="right"style="margin-right: 40px;">
<tr>
<td>当前第<?php echo $page;?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $page."/".$pagecount;?>共页&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo$pagesize; ?>条/页 共<?php echo $total;?>条记录</td>
<?php
if($page>1){
echo "<td><a href='tushujieyue.php?page=$pre'>上一页</a></td>";
echo "<td><a href='tushujieyue.php?page=1'>首页</a></td>";
}
if($page>5){
$l=$page;
$l_5=$l-5;
echo "<td><a href='tushujieyue.php?page=$l_5'>$l_5</a></td>";
}
if($page>4){
$l=$page;
$l_4=$l-4;
echo "<td><a href='tushujieyue.php?page=$l_4'>$l_4</a></td>";
}
if($page>3){
$l=$page;
$l_3=$l-3;
echo "<td><a href='tushujieyue.php?page=$l_3'>$l_3</a></td>";
}
if($page>2){
$l=$page;
$l_2=$l-2;
echo "<td><a href='tushujieyue.php?page=$l_2'>$l_2</a></td>";
}
if($page>2){
$l=$page;
$l_1=$l-1;
echo "<td><a href='tushujieyue.php?page=$l_1'>$l_1</a></td>";
}
$l=$page;
echo "<td><a href='tushujieyue.php?page=$l'style='color:blue;'>$l</a></td>";
if($page<$pagecount-1){
$l=$page;
$l1=$l+1;
echo "<td><a href='tushujieyue.php?page=$l1'>$l1</a></td>";
}
if($page<$pagecount-2){
$l=$page;
$l2=$l+2;
echo "<td><a href='tushujieyue.php?page=$l2'>$l2</a></td>";
}
if($page<$pagecount-3){
$l=$page;
$l3=$l+3;
echo "<td><a href='tushujieyue.php?page=$l3'>$l3</a></td>";
}
if($page<$pagecount-4){
$l=$page;
$l4=$l+4;
echo "<td><a href='tushujieyue.php?page=$l4'>$l4</a></td>";
}
if($page<$pagecount){
echo "<td><a href='tushujieyue.php?page=$next'>下一页</a></td>";
echo "<td><a href='tushujieyue.php?page=$last'>尾页</a></td>";
}
?>
</tr>
</table>
</td>
</tr>
</table>
</div>
</section>
<footer class="footer-sec-w3layouts py-lg-5 py-3" >
<?php include"footer.php";?>
</footer>
<!-- //Custom-JavaScript-File-Links -->
<!-- js -->
<script src="js/jquery-2.2.3.min.js"></script>
<!--slider-->
<!-- banner slider -->
<script src="js/responsiveslides.min.js"></script>
<script>
$(function() {
$("#slider4").responsiveSlides({
auto: true,
pager: true,
nav: false,
speed: 1000,
namespace: "callbacks",
before: function() {
$('.events').append("<li>before event fired.</li>");
},
after: function() {
$('.events').append("<li>after event fired.</li>");
}
});
});
</script>
<!-- //banner slider -->
<!-- dropdown nav -->
<script>
$(document).ready(function() {
$(".dropdown").hover(
function() {
$('.dropdown-menu', this).stop(true, true).slideDown("fast");
$(this).toggleClass('open');
},
function() {
$('.dropdown-menu', this).stop(true, true).slideUp("fast");
$(this).toggleClass('open');
}
);
});
</script>
<!-- //dropdown nav -->
<script src="js/jquery.sliderPro.min.js"></script>
<script src="js/jquery.fancybox.pack.js"></script>
<script>
$(document).ready(function($) {
$('#example2').sliderPro({
width: 350,
height: 400,
visibleSize: '100%',
forceSize: 'fullWidth',
autoSlideSize: true
});
// instantiate fancybox when a link is clicked
$(".slider-pro").each(function() {
var slider = $(this);
slider.find(".sp-image").parent("a").on("click", function(event) {
event.preventDefault();
if (slider.hasClass("sp-swiping") === false) {
var sliderInstance = slider.data("sliderPro"),
isAutoplay = sliderInstance.settings.autoplay;
$.fancybox.open(slider.find(".sp-image").parent("a"), {
index: $(this).parents(".sp-slide").index(),
afterShow: function() {
if (isAutoplay === true) {
sliderInstance.settings.autoplay = false;
sliderInstance.stopAutoplay();
}
},
afterClose: function() {
if (isAutoplay === true) {
sliderInstance.settings.autoplay = true;
sliderInstance.startAutoplay();
}
}
});
}
});
});
});
</script>
<!-- /timeline -->
<script src="js/timeline.min.js"></script>
<script>
timeline(document.querySelectorAll('.timeline'), {
forceVerticalMode: 700,
mode: 'horizontal',
verticalStartPosition: 'left',
visibleItems: 4
});
</script>
<!-- //timeline -->
<!-- //js -->
<script src="js/bootstrap.js"></script>
<!--/ start-smoth-scrolling -->
<script src="js/move-top.js"></script>
<script src="js/easing.js"></script>
<script>
jQuery(document).ready(function($) {
$(".scroll").click(function(event) {
event.preventDefault();
$('html,body').animate({
scrollTop: $(this.hash).offset().top
}, 900);
});
});
</script>
<script>
$(document).ready(function() {
/*
var defaults = {
containerID: 'toTop', // fading element id
containerHoverID: 'toTopHover', // fading element hover id
scrollSpeed: 1200,
easingType: 'linear'
};
*/
$().UItoTop({
easingType: 'easeOutQuart'
});
});
</script>
<!--// end-smoth-scrolling -->
</body>
</html>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/dearmite/php_big_library.git
git@gitee.com:dearmite/php_big_library.git
dearmite
php_big_library
php毕设图书馆
master

搜索帮助