📄 mbookbak.php
字号:
<?
header("Pragma: no-cache");
header("Cache-Control: no-cache, must-revalidate");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT");
header("Pragma: no-cache");
require_once('include/connection.php');
include('include/admin_or_user.php');
header("Refresh:600");
$month=date("m");
$day=date("d");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<style type="text/css">
<!--
body {
margin-left: 36px;
margin-right: 36px;
margin-top: 0px;
}
.STYLE1 {color: #FF0000}
-->
</style>
<? include ("#include#/book.as");?>
<script>
roomtemp=new Array();
var i1=0;
function selectroom(k,roomtemp)
{
if(k.checked)
{
roomtemp[i1]=k.value;
i1=i1+1;
}
if(!k.checked)
{ var j1=0;
while(j1<i1)
{
if (roomtemp[j1]==k.value)
roomtemp[j1]="";
j1=j1+1;
}
}
j1=0;
n=0;
parent.document.all.room_number.value="";
while(j1<i1)
{
if(roomtemp[j1]!="")
{ n=n+1;
if (n==1)
parent.document.all.room_number.value=roomtemp[j1];
else
parent.document.all.room_number.value+=" "+roomtemp[j1];
n=n+1
}
j1=j1+1;
}
}
</script>
<?
echo "<script>";
$emptyroomsql="select * from room where room_state=-1 or room_state=0 order by room_level ,room_person ";
$emptyroom=odbc_exec($conn,$emptyroomsql);
$rows=0;
$temp1=odbc_fetch_row($emptyroom,'1');
$roomlevel=odbc_result($emptyroom,'room_level');
echo "room=new Array();";
echo "level=new Array();";
echo "stime0=new Array();";
echo "today=countday(".$month.",".$day.");";
if($temp1)
do
{
$roomperson=odbc_result($emptyroom,'room_person');
$roomnumber=odbc_result($emptyroom,'room_number');
$roomlevel=odbc_result($emptyroom,'room_level');
echo "level[".$rows."]='".$roomlevel."';";
echo "room[".$rows."]='".$roomnumber."'+',".$roomperson."';";
if(odbc_result($emptyroom,'room_state')==0)
{
$stimesql="select longintime from book where room_number like '%".odbc_result($emptyroom,'room_number')."%' and id=(select max(id) as mid from (select * from book where room_number like '%".odbc_result($emptyroom,'room_number')."%'))";
$stimeresult=odbc_exec($conn,$stimesql);
$statetime=odbc_result($stimeresult,'longintime');
$stimearray=explode("-",$statetime);
$m1=$stimearray[0];
$d1=$stimearray[1];
echo "stime0[".$rows."]=countday(".$m1.",".$d1.");";
}
else
echo "stime0[".$rows."]=100;";
$rows++;
}while(odbc_fetch_row($emptyroom)) ;
echo "</script>";
echo "<script>";
echo "function f(room,level)
{ document.all.div1.innerHTML='<span class=STYLE1>(括号内为可预订的天数)</span>';
m=1;
l=0;
q=0;
n=1;
leandpe=new Array();
for(i=0;i<=".$rows.";i++)
{
if(room[i]!=undefined)
{ n++;
p=room[i].indexOf(',');
str2=room[i].substr(p+1);
str1=room[i].substr(0,p);
l1=level[i];
p1=str2;
if(l!=l1)
{
document.all.div1.innerHTML+='<hr /><br>'+l1+'星级:';
l=l1;
}
if(q!=p1)
{
document.all.div1.innerHTML+='<br> '+str2+'人房: ';
q=p1;
}
leandpe[m]=l+','+str2;
if(stime0[i]==100)
temp='长期';
else
temp=stime0[i]-today-1;
if(temp=='长期'||temp>0)
{
if(temp>0)
temp+='天';
document.all.div1.innerHTML+=' <input type=checkbox name=checkbox'+m+' value='+str1+' onclick=selectroom(this,roomtemp) >';
document.all.div1.innerHTML+=str1;
document.all.div1.innerHTML+='<span class=STYLE1>('+temp+')</span>';
if(n>5)
{document.all.div1.innerHTML+='<br> ';
n=1;
}
m++;
}
}
}";
echo "
document.all.h1.value=2;
}";
echo "</script>";
?>
<script>
function t(room,level,s)
{
document.all.div1.innerHTML="<span class=STYLE1>(括号内为可预订的天数)</span><hr />";
k=1;y=0;
leandpe=new Array();
for(i=0;i<=<? echo $rows;?>;i++)
if(room[i]!=undefined)
{ index1=room[i].indexOf(',');
person1=room[i].substr(index1+1);
index2=s.value.indexOf(',');
l=s.value.substr(index2+1);
person2=s.value.substr(0,index2);
if((l==level[i])&&(person2==person1))
{ y++;
if(y>6)
{document.all.div1.innerHTML+='<br>';
y=1;
}
if(stime0[i]==100)
temp='长期';
else
temp=stime0[i]-today-1;
if(temp=='长期'||temp>0)
{ if(temp>0)
temp+='天';
document.all.div1.innerHTML+=' <input type=checkbox name=checkbox'+k+' value='+room[i].substr(0,index1)+' >';
roomnumber=room[i].substr(0,index1);
document.all.div1.innerHTML+=roomnumber;
document.all.div1.innerHTML+='<span class=STYLE1>('+temp+')</span>';
leandpe[k]=l+','+person2;
k=k+1;
}
}
}
if(k==1)
{alert("暂无");}
document.all.h1.value=1;
}
function showday(ar,sm)
{
with (ar) {
var d2=1;
while(d2<=monthday(sm.value))
{
options[d2-1] = new Option( d2,
d2);
if(document.all.selectmonth.value==<? echo $month;?>)
{if(d2==<? echo $day;?>)
options[d2-1].selected = true;
}
d2++;
}
if(monthday(sm.value)<31)
options[30]=null;
if(monthday(sm.value)<30)
options[29]=null;
}
}
function onloadfun()
{
showday(document.form1.selectday,document.form1.selectmonth)
}
function changetime()
{
if(document.all.selectday.value<<? echo $day;?>&&document.all.selectmonth.value==<? echo $month;?>)
alert("请再次选择日期");
}
window.onload=onloadfun;
function refreshfun()
{ today=countday(document.all.selectmonth.value,document.all.selectday.value);
switch(document.all.h1.value)
{ case '1' : t(room,level,document.all.select1);break;
case '2' : f(room,level);break;
}
}
</script>
</head>
<body>
<form id="form1" name="form1" method="post" action="booked.php">
<table width="100%" border="1">
<tr>
<td width="18%"><div align="right">入住时间:</div></td>
<td colspan="2"><label>
<select name="selectmonth" onchange="showday(document.form1.selectday,this);changetime()" >
<script>
var m2=0;
while(m2<2){
if((m3=<? echo $month;?>+m2)>12)
m3=m3%12;
if(m2==0)
{document.write("<option value="+m3+" selected='selected'>"+m3+"</option>");
m2++;
}
else
{document.write("<option value="+(<? echo $month;?>+m2)%12+">"+(<? echo $month;?>+m2)%12+"</option>"); m2++;
}
}
</script>
</select>
</label>
<script>
document.write ( '<select name = "selectday" onchange="changetime()" ></select>' );
</script>
<input name="flesh" type="button" id="flesh" value="刷新可预订天数" onclick="refreshfun()" />
<a href="book.php"></a></td>
</tr>
<tr>
<td><div align="right">入住天数:</div></td>
<td width="12%"><label>
<input name="book_days" type="text" id="book_days" value="1" size="3" maxlength="6" />
天 * </label></td>
<td width="70%">预定房间:
<select name="select1" id="select1">
<? $selectperson="select distinct room_person ,room_level from room order by room_level,room_person";
$m=odbc_exec($conn,$selectperson);
while(odbc_fetch_row($m))
{
?>
<option value="<? echo odbc_result($m,'room_person');echo ","; echo odbc_result($m,'room_level');?>"><? echo odbc_result($m,'room_level');echo "星级"; echo odbc_result($m,'room_person');echo "人"; ?></option>
<?
}?>
</select>
<label>
<input name="s1" type="button" id="s1" value="查询" onclick="t(room,level,select1)" />
<input name="s2" type="button" id="s2" value="查询全部" onclick="f(room,level)" />
<input name="h1" type="hidden" id="h1" value="0" />
</label></td>
</tr>
<tr>
<td><p align="center">选</p>
<p align="center">择</p>
<p align="center">房</p>
<p align="center">间</p></td>
<td colspan="2">
<div>
<span id=div1> </span> </div> </td>
</tr>
</table>
<div align="center">
<label></label>
</div>
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -