<%@ LANGUAGE=VBScript codepage ="936" %>
<%Response.Expires=0
Response.ExpiresAbsolute = Now() - 1
Response.AddHeader "Pragma","No-Cache"
Response.AddHeader "Cache-Control","Private"
Response.CacheControl = "No-Cache"
zhbg_name=Session("zhbg_name")
zhbg_grade=Session("zhbg_grade")
zhbg_jhdj=Session("zhbg_jhdj")
if zhbg_name="" then Response.Redirect "../../error.asp?id=440"
time1=request.form("time")+0
Set conn=Server.CreateObject("ADODB.CONNECTION")
Set rs=Server.CreateObject("ADODB.RecordSet")
conn.open Application("zhbg_usermdb")
if time1=0 then
mess="请选择正确的时间！"
elseif  time1<0 then
mess="请选择正确的时间！"
elseif  time1>24 then
mess="请选择正确的时间！"
else
Jname=zhbg_name
Jpass=request.cookies("pass")
yin=abs((time1)*10)
shi=0.0416*time1
rs.open "select * from 用户 where 姓名='"&zhbg_name&"'" & "  and 状态<>'死' and 状态<>'狱'",conn
if rs.eof or rs.bof then
mess=Jname & "，你不能操作！"
else
if rs("银两")<yin then
mess=Jname & "，你的银两不够！"
else
conn.execute "update 用户 set 银两=银两-" & yin & ",体力=体力+"& yin &",内力=内力+"&yin&",登录=now()+" & shi & ",状态='眠' where 姓名='"&zhbg_name&"'"
mess=Jname & "，你已经成功的到客栈休息了，请在" &time1& "小时后使用该帐号！"
session.Abandon
%>
<script>
confirm('<%=mess%>')
top.menu.location.href="../../index2.asp"
</script>
<%
end if
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
end if
%>

<head>
<link href="../../css.css" rel="stylesheet" type="text/css">
<title><%=Application("zhbg_chatroomname")%>客栈</title><meta http-equiv="Content-Type" content="text/html; charset=gb2312"></head>

<body >
<table width="350" border="3" align="center" cellpadding="8"
cellspacing="8" bordercolor="#cccccc">
  <tr>
    <td> 
      <table width="100%">
<tr>
<td>
<p align="center" style="font-size:14;color:red"><img border="0" src="../../chat/img/pic5.gif"><%=mess%></p>
<p align="center"><a href="pub.asp">返回</a></p>
</td>
</tr>
</table>
    </td>
</tr>
</table>

</body>