📄 checkout.php
字号:
<?php
/**************************************************************************************
Simple Library System
Copyright (C) 2002 John Mark Matthews
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
For further information, contact:
John Matthews
jmatthews@exostrategy.com
***************************************************************************************/
include("mainfile.inc");
include("header.inc");
include("footer.inc");
include("auth.inc");
reg('GET', 'item_id', 'request_id');
reg('POST', 'submit', 'item_id', 'request_id', 'due_date', 'login_id');
if($request_id && $global_is_admin) {
$sql = "select * from tbl_item_request where request_id=$request_id";
$r = mysql_query($sql);
$request = mysql_fetch_array($r);
$item_id = $request["item_id"];
$sql = "select * from tbl_item where item_id=$item_id";
$r = mysql_query($sql);
$item = mysql_fetch_array($r);
if($due_date) {
if($item["status"]==1) {
$sql = "update tbl_item set due_date='".format_mysql_date($due_date)."', status=2, login_id=".$request["login_id"]." where item_id=".$request["item_id"];
$r = mysql_query($sql);
$sql = "delete from tbl_item_request where request_id=$request_id";
$r = mysql_query($sql);
$sql = "insert into tbl_item_history(item_id,status,login_id)values($item_id,2,".$request["login_id"].")";
$r = mysql_query($sql);
head();
menu();
echo Paragraph(Bold("Item has been checked out"));
PrintItem($item_id);
foot();
}else{
head();
menu();
echo Paragraph(Bold("Item has already been checked out, unable to check it out twice"));
PrintItem($item_id);
foot();
}
}else{
$t=getdate();
head();
include("utilityjs.inc");
menu();
OpenForm();
echo "
Due Date: <input name='due_date' type='text' OnChange=\"CheckDate(this, 'Start Date', true, false, true)\" value='".gmdate("m/d/Y",strtotime("+2 week"))."'>
<input type='hidden' name='request_id' value=$request_id>
<input align='center' name='login' type='submit' value = 'Check Out Item'></td></tr>
";
CloseTable();
CloseForm();
PrintItem($item_id);
foot();
}
}else{
if($global_is_admin && $item_id) {
$sql = "select * from tbl_item where item_id=$item_id";
$r = mysql_query($sql);
$item = mysql_fetch_array($r);
if($login_id!="" && $login_id!=-1 && $due_date) {
if($item["status"]==1) {
$sql = "update tbl_item set due_date='".format_mysql_date($due_date)."', status=2, login_id=$login_id where item_id=$item_id";
$r = mysql_query($sql);
$sql = "insert into tbl_item_history(item_id,status,login_id)values($item_id,2,$login_id)";
$r = mysql_query($sql);
head();
menu();
echo "<p><b>Item has been checked out</b></p>";
PrintItem($item_id);
foot();
}else{
head();
menu();
echo "<p><b>Item has already been checked out, unable to check it out twice</b></p>";
PrintItem($item_id);
foot();
}
}else{
$logins="";
$logins = MakeSelectArray("select l.login_id, concat(login,' (',first_name,' ',last_name,')') from tbl_login l, tbl_person p where admin_flag=0 and l.login_id=p.person_id order by login");
$t=getdate();
head();
include("utilityjs.inc");
menu();
OpenForm();
OpenTable();
OpenLine();
OpenTable();
echo Row(Cell("Person:").Cell(MakeSelect("login_id",-1,$logins)));
echo Row(Cell("Due Date:").Cell("<input name='due_date' type='text' OnChange=\"CheckDate(this, 'Start Date', true, false, true)\" value='".gmdate("m/d/Y",strtotime("+2 week"))."'>"));
echo Row(Cell("<input type='hidden' name='item_id' value=$item_id>"));
echo Row(Cell("<input align='center' name='login' type='submit' value = 'Check Out Item to Person'>","colspan=2 align=center"));
CloseTable();
CloseLine();
OpenLine();
PrintItem($item_id);
CloseLine();
CloseTable();
CloseForm();
foot();
}
}else{
header("Location: ./index.php");
}
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -