borrow.php.bak

来自「fff fffff」· BAK 代码 · 共 42 行

BAK
42
字号
<? 
//######################借书程序##########################
 include "config.php";
// include "auth.php";
 include "header.php";
 ?>
<?
    $user_name = $cookie_user;
	$send_date = date("Y-m-d");
	$daoshi_data =$send_data;
$daoshi  = mktime(0,0,0,date("m")  ,date("d")+$lend_date,date("Y"));
$daoshi_date = date( "Y-m-d", $daoshi );
$query=mysql_query("select * from book_user where user_name ='$user_name'");
while($row=mysql_fetch_array($query)){
       $email        = $row['email'];
	   $card         = $row['card'];
	 }
$q=mysql_query("select * from book_list where book_name ='$book_name'");
while($row=mysql_fetch_array($q)){
       $volumes        = $row['volumes'];
	   
	 }
//echo $volumes;
if($volumes==0) {
   echo "此书暂无存货!";
   echo "<meta http-equiv=\"refresh\" content=\"5;url=book_list.php\">";
   }
else
{$q=mysql_query("select card from book_lend where card ='$card' group by card having count(*)>=5 ");
while($row=mysql_fetch_array($q)){
$title=$row['card'];}
if($title==$card)
{echo "您已借满五本书!";
echo "<meta http-equiv=\"refresh\" content=\"0;url=book_list.php\">";
 }
else{
 $str="update book_list set volumes=volumes-1 where book_name='$book_name';";
 mysql_query($str,$db);
$str="insert into book_lend (book_name,card,send_date,daoshi_date) values('$book_name','$card','$send_date','$daoshi_date');";
 $query=mysql_query($str,$db);
 if($query==true){
  echo "借书成功

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?