加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
book_view.php 16.07 KB
一键复制 编辑 原始数据 按行查看 历史
sjm 提交于 2021-07-04 09:31 . first push
<?php
session_start();
// $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"];
include "conn.php";
$now=date('Y-m-d');
if($_GET['action']=="chongxin"){//重新申请
$id=$_GET["id"];
$bookid=$_GET["bookid"];
$off=$mysqli->query("set autocommit=0");
$mysqli->query("BEGIN");
$re1=$mysqli->query("update tb_borrow set sqbacktime='".$now."',zhuangtai=0 where id=$id");
$re2=$mysqli->query("update tb_borrowlist set sqbacktime='".$now."',zhuangtai=0 where id=$id");
if($re2 && $re1){
$mysqli->query("COMMIT");
echo "<script language='javascript'>alert('图书借阅申请成功!');location='booklook.php?bookid=$bookid';</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='booklook.php?bookid=$bookid';</script>";
}
}
if($_GET['action']=="huanshu"){//还书
$id=$_GET["id"];
$bookid=$_GET["bookid"];
$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='booklook.php?bookid=$bookid';</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='booklook.php?bookid=$bookid';</script>";
}
}
if($_GET['action']=="xujie"){//续借
$id=$_GET["id"];
$bookid=$_GET["bookid"];
$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='booklook.php?bookid=$bookid';</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='booklook.php?bookid=$bookid';</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">
<!-- <td align="center" valign="top"> -->
<?php
include("conn.php");
$id=$_GET["bookid"];
$sql=$mysqli->query("select * from tb_bookinfo where id=".$id);
$info=$sql->fetch_array();
?>
<table width="100%" height="414" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td width="143" align="center">&nbsp;&nbsp;码:</td>
<td width="233" height="30"><?php echo $info["barcode"];?></td>
<td width="224" rowspan="9"><div align="center"><img src="admin/<?php echo $info["photo"] ?>" width="144" height="185" alt=""></div></td>
</tr>
<tr>
<td align="center">图书名称:</td>
<td height="30"><?php echo $info["bookname"];?> * </td>
</tr>
<tr>
<td align="center">ISBN:</td>
<td><?php echo $info["ISBN"];?></td>
</tr>
<tr>
<td align="center">图书类型:</td>
<td><?php echo $info["booktype"];?> </td>
</tr>
<tr>
<td align="center">&nbsp;&nbsp;者:</td>
<td><?php echo $info["author"];?></td>
</tr>
<tr>
<td align="center">&nbsp;&nbsp;者:</td>
<td><?php echo $info["translator"];?></td>
</tr>
<tr>
<td align="center">&nbsp;&nbsp;社:</td>
<td><?php echo $info["publishing"];?> </td>
</tr>
<tr>
<td align="center">&nbsp;&nbsp;格:</td>
<td><?php echo $info["price"];?> (元)</td>
</tr>
<tr>
<td align="center">&nbsp;&nbsp;码:</td>
<td><?php echo $info["page"];?></td>
</tr>
<tr>
<td align="center">&nbsp;&nbsp;架:</td>
<td colspan="2"><?php echo $info["bookcase"];?>
</tr>
<tr>
<td align="center">&nbsp;&nbsp;存:</td>
<?php
$sql="select * from tb_borrow where bookid=".$_GET["bookid"];
$query1=$mysqli->query($sql);
$jie=$query1->num_rows;
$num=$info["stock"];
$sum=($num-$jie);
?>
<td colspan="2"><font color="#FF0000"><?php if($sum<0){echo "已经借光";}else{echo $sum."(本) ";} ?> </font>
</tr>
<tr>
<td height="39" align="center">属性:</td>
<td colspan="2">
<input name="tuijian" type="checkbox" id="tuijian" value="1" <?php if ($info["tuijian"]==1){echo "checked";} ?>>
推荐
<input name="bidu" type="checkbox" id="bidu" value="1" <?php if ($info["bidu"]==1){echo "checked";} ?>>
必读
</td>
</tr>
<tr>
<td height="39" align="center">详细介绍:</td>
<td colspan="2"><?php echo $info["beizhu"];?></td>
</tr>
<tr>
<td colspan="3" align="center">
<?php
$username=$_SESSION["username"];
if(0<$sum){
$user=$mysqli->query("select id from tb_reader where username='".$username."'");
$rsuser=$user->fetch_array();
$userid=$rsuser["id"];
$id=$_GET["bookid"];
$query1=$mysqli->query("select * from tb_borrow where readerid='".$userid."' and bookid='".$id."'and zhuangtai=0");
$result=$query1->fetch_array();
$jie1=$query1->num_rows;
$query2=$mysqli->query("select * from tb_borrow where readerid='".$userid."' and bookid='".$id."'and zhuangtai=1 and ifback=0");
$result2=$query2->fetch_array();
$jie2=$query2->num_rows;
$query3=$mysqli->query("select * from tb_borrow where readerid='".$userid."' and bookid='".$id."'and zhuangtai=2");
$result3=$query3->fetch_array();
$jie3=$query3->num_rows;
$query4=$mysqli->query("select * from tb_borrow where readerid='".$userid."' and bookid='".$id."'and ifback=1");
$result=$query4->fetch_array();
$jie4=$query4->num_rows;
$query5=$mysqli->query("select * from tb_borrow where readerid='".$userid."' and bookid='".$id."'and ifback=0 and zhuangtai=4");
$result=$query5->fetch_array();
$jie5=$query5->num_rows;
$query6=$mysqli->query("select * from tb_borrow where readerid='".$userid."' and bookid='".$id."'and ifback=0 and zhuangtai=3");
$result=$query6->fetch_array();
$jie6=$query6->num_rows;
$query7=$mysqli->query("select * from tb_borrow where readerid='".$userid."' and bookid='".$id."'and ifback=2 and zhuangtai=4");
$result7=$query7->fetch_array();
$jie7=$query7->num_rows;
$query8=$mysqli->query("select * from tb_borrow where readerid='".$userid."' and bookid='".$id."'and ifback=2 and zhuangtai=3");
$result8=$query8->fetch_array();
$jie8=$query8->num_rows;
if($jie3>0){
?>
<input type="button" name="Submit" style="color: red;" value="申请已被拒绝">
<input type="button" name="Submit" value="重新借阅申请" onClick="window.location.href='booklook.php?action=chongxin&bookid=<?php echo $info["id"];?>&id=<?php echo $result3["id"];?>'">
<?php
}else if($jie2>0){
?>
<input type="button" value="我要续借"style="margin-right: 10px;"onClick="window.location.href='booklook.php?action=xujie&bookid=<?php echo $info["id"];?>&id=<?php echo $result2["id"];?>'">
<input type="button" value="我要还书" onClick="window.location.href='booklook.php?action=huanshu&bookid=<?php echo $info["id"];?>&id=<?php echo $result2["id"];?>'">
<input name="Submit2" type="button" class="btn_grey" value="返回" onClick="history.go(-1);"></td>
<?php
}else if($jie1>0){
?>
<input type="button" style="color: red;" name="Submit" value="借阅申请已提交">
<input name="Submit2" type="button" class="btn_grey" value="返回" onClick="history.go(-1);"><span style="color: red;">请在尽快到相应阅览室办理借书手续</span></td>
<?php
}else if($jie6>0){
?>
<input type="button" style="color: red;" name="Submit" value="续借申请已提交">
<input name="Submit2" type="button" class="btn_grey" value="返回" onClick="history.go(-1);"><span style="color: red;">续借申请已提交,请等待审核</span></td>
<?php
}else if($jie4>0){
?>
<input type="button" name="Submit" value="借阅申请" onClick="window.location.href='borrowreg.php?id=<?php echo $info["id"]; ?>'">
<input name="Submit2" type="button" class="btn_grey" value="返回" onClick="history.go(-1);"></td>
<?php
}else if($jie5>0){
?>
<input type="button" name="Submit" value="还书申请已提交">
<input name="Submit2" type="button" class="btn_grey" value="返回" onClick="history.go(-1);"></td>
<?php
}else if($jie7>0){
?>
<input type="button" name="Submit" style="color: red;" value="申请已被拒绝">
<input type="button" value="重新申请" onClick="window.location.href='booklook.php?action=huanshu&bookid=<?php echo $info["id"];?>&id=<?php echo $result7["id"];?>'"></td>
<?php
}else if($jie8>0){
?>
<input type="button" name="Submit" style="color: red;" value="申请已被拒绝">
<input type="button" value="重新申请"style="margin-right: 10px;"onClick="window.location.href='booklook.php?action=xujie&bookid=<?php echo $info["id"];?>&id=<?php echo $result8["id"];?>'"></td>
<?php
}else{
?>
<input type="button" name="Submit" value="借阅申请" onClick="window.location.href='borrowreg.php?id=<?php echo $info["id"]; ?>'">
<input name="Submit2" type="button" class="btn_grey" value="返回" onClick="history.go(-1);"></td>
<?php
}
}else{
?>
<input type="button" name="Submit" value="书籍已借光"><a href="www.baidu.com">查看电子书籍</a>
<input name="Submit2" type="button" class="btn_grey" value="返回" onClick="history.go(-1);"></td>
<?php
}
?>
</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>
<script>
var title=document.title;
document.title="书籍详情";
</script>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化