代码拉取完成,页面将自动刷新
<?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']=="del"){
$id=$_GET["id"];
$sql="delete from tb_borrowlist where id=".$id;
$result1=$mysqli->query($sql);
if($result1){
echo "<script language='javascript'>alert('删除成功!');</script>";
}else{
echo "<script language='javascript'>alert('删除失败!');</script>";
}
}
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='tushujieyue.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='tushujieyue.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='tushujieyue.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='tushujieyue.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_borrowlist.*,tb_reader.name,tb_bookinfo.barcode,tb_bookinfo.bookname from tb_borrowlist,tb_reader,tb_bookinfo where tb_reader.id=tb_borrowlist.readerid and tb_borrowlist.bookid=tb_bookinfo.id and tb_reader.username='$username'";
$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>条形码</td>
<td>图书名称</td>
<td>借阅日期</td>
<td>归还日期</td>
<td>当前状态</td>
<td>操作</td>
</tr>
<?php
$offset=$pagesize*($page-1);
$sql.=" order by id desc limit $offset,$pagesize";
$result1=$mysqli->query($sql);
while ($row=$result1->fetch_array()){
?>
<tr>
<td style="padding:5px;"> <?php echo $row["barcode"];?></td>
<td style="padding:5px;"><a href="booklook.php?bookid=<?php echo $row["bookid"]; ?>"><?php echo $row["bookname"];?></a></td>
<td style="padding:5px;"> <?php echo $row["borrowTime"];?></td>
<td style="padding:5px;"> <?php echo $row["backTime"];?></td>
<td style="padding:5px;"> <?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>
<?php
if($row["ifback"]==1){
?>
<input type="button" name="del" value="删除"style="margin-right: 10px;" onClick="window.location.href='tushujieyue.php?action=del&id=<?php echo $row["id"]; ?>'">
<?php
}else{
?>
<input type="button" value="续借"style="margin-right: 10px;"onClick="window.location.href='tushujieyue.php?action=xujie&id=<?php echo $row["id"];?>'">
<input type="button" value="还书" onClick="window.location.href='tushujieyue.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;?>页 <?php echo $page."/".$pagecount;?>共页 <?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>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。