📄 book.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" />
<title>无标题文档</title>
<style type="text/css">
<!--
body {
margin-left: 36px;
margin-right: 36px;
}
.STYLE1 {color: #FF0000}
-->
</style>
<? include ("include/book.as");?>
<?
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+' >';
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>
<link href="css/hotel.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" name="form1" method="post" action="booked.php">
<span align="left" class="greenclore">预订房间</span>
<table width="100%" border="1" cellpadding="0">
<tr>
<td width="14%" class="noboarder"><div align="right">客人称谓:</div></td>
<td width="86%" class="noboarder"><label>
<input name="name" type="text" id="name" size="13" maxlength="30" />
* 人 数:
<input name="person" type="text" id="person" value="1" size="3" maxlength="6" />
人
*</label></label>
入住天数:<label>
<input name="book_days" type="text" id="book_days" value="1" size="3" maxlength="6" />
天 * </label> 联系方式:
<label>
<input name="phone" type="text" id="phone" size="16" maxlength="20" />
</label></td>
</tr>
<tr>
<td class="noboarder"><div align="right" class="noboarder">入住时间:</div></td>
<td class="noboarder"><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" class="width" id="flesh" onclick="refreshfun()" value="刷新可预订天数" />
<a href="book.php"></a></td>
</tr>
<tr>
<td class="noboarder"><div align="right">预定房间:</div></td>
<td class="noboarder">
<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>
<div>
<span id=div1> </span> </div> </td>
</tr>
</table>
<div align="center">
<br \>
<label>
<input name="s1" type="submit" id="s1" value="预订" />
</label>
<label>
<input type="reset" name="Submit2" value="重置" />
</label>
<input name="book_time" type="hidden" id="book_time" value="<? echo date("Y-m-d H:i:s")?>" />
<input name="rows" type="hidden" id="rows" value="<? echo $rows;?>" />
</div>
</form>
<p><a href="#" onclick="fun()"></a></p>
<script src="copyright.inc">
</script>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -