<%
username=session("zhbg_name")
set conn=server.createobject("adodb.connection")
conn.open Application("zhbg_usermdb")
set rst=server.CreateObject ("adodb.recordset")
sql="SELECT * FROM 用户 where 姓名='" &username& "'"
Set Rs=conn.Execute(sql)
if rs.bof or rs.eof then
response.write "你不是国度中人或者连接超时"
conn.close
response.end
else
hy=rs("会员")
hydj=rs("会员等级")
tl=rs("体力")
nl=rs("内力")
gj=rs("攻击")
fy=rs("防御")
if username="" then
%>
<script language=vbscript>
MsgBox "对不起，你还没有登录"
location.href = "../indexall.asp"
</script>
<%
else
if Application("zhbg_hy")=true then
%>
<script language=vbscript>
MsgBox "错误！会员功能尚未开放！"
location.href = "javascript:history.back()"
</script>
<%
else
if hy=false and hydj=0 then
%>
<script language=vbscript>
MsgBox "错误！你不是会员，请回吧！"
location.href = "javascript:history.back()"
</script>
<%
else
sj=DateDiff("n",rs("操作时间"),now())
if sj<5 then
ss=5-sj
	rs.close
	set rs=nothing
	conn.close
	set conn=nothing
	Response.Write "<script language=JavaScript>{alert('你刚刚才来过怎么又来啦？请等："&ss&"分后再来吧！');location.href = 'javascript:history.back()';}</script>"
	Response.End 
end if
jiu=request.form("jiu")
	Jname=session("zhbg_name")
	select case jiu
           case "lao"
              tili=40
              yin=20000
           case "wu"
              tili=60
              yin=30000
           case "du"
              tili=80
              yin=40000
           case "mao"
              tili=100
              yin=50000
          end select
%>
<!--#include file="data.asp"-->
<%
	sql="select * from 用户 where 姓名='" & Jname & "' and 状态<>'死亡' and 状态<>'入狱' and 状态<>'逮捕'"
	set rs=conn.execute(sql)
	if rs.eof or rs.bof then
		mess=Jname & "，你不能操作！"
	else
		if rs("银两")<yin then
			mess=Jname & "，你的银两不够！"
                    else
                daode=rs("道德")
                jiuliang=int((daode)/100)
                if jiuliang>1 then
                       	sql="update 用户 set 银两=银两-" & yin & ",道德=道德+"& tili &" where 姓名='" & Jname & "'"
			conn.execute sql
			mess=Jname & "从相国寺出来后，觉得自己得益非浅，同时也悟出不少道理!"
                else	
                       shi=0.0416*1
			sql="update 用户 set 银两=银两-" & yin & ",道德=道德+"& tili &",最后登录时间=now()+" & shi & ",状态='眠' where 姓名='" & Jname & "'"
			conn.execute sql
			mess=Jname & "，由于你和寺内助持谈的投机，于是留你在寺内吃了饭再走，请在1小时后使用该帐号！"
			response.cookies("Jname")=""
			response.cookies("Jpai")=""
			conn.close
%>
<script>
confirm('<%=mess%>')
top.menu.location.href="../index.asp  target=_top"
</script>
<%
		end if
	end if
  end if
%>

<head>
<link rel="stylesheet" href="../style4.css" type="text/css">
</head>
<body >
<table width="350" border="3" align="center" cellpadding="10"
cellspacing="13" bordercolor="#FF9900" bgcolor="#CC6600">
  <tr>
    <td bgcolor="#cccccc"> 
      <table width="100%">
        <tr>
          <td>
            <p align="center" style="font-size:14;color:000000"><%=mess%></p>
            <p align="center"><a href="index.asp"><font color="#FFFFCC">返回</font></a></p>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
</body>
<%
end if
end if
end if
end if
%>