<%@ LANGUAGE=VBScript%>
<% 
Response.Expires=0
Response.ExpiresAbsolute = Now() - 1
Response.AddHeader "Pragma","No-Cache"
Response.AddHeader "Cache-Control","Private"
Response.CacheControl = "No-Cache"
my=session("zhbg_name")
id=request("id")
nowinroom=session("nowinroom")
if not isnumeric(id) then 
	Response.Write "<script language=JavaScript>{alert('黑客先生，现在不行了吧！');location.href = 'javascript:history.go(-1)';}</script>"
	Response.End 
end if
%>
<!--#include file="dadata.asp"-->
<%
Set conn=Server.CreateObject("ADODB.CONNECTION")
Set rs=Server.CreateObject("ADODB.RecordSet")
conn.open Application("zhbg_usermdb")
sql="select 银两 from 用户 where 姓名='" & my & "'"
set rs=conn.execute(sql)
if rs.eof or rs.bof then
	response.write "你不是国度中人，不能吃面<br><a href=qmg.htm>返回</a>"
	conn.close
	response.end
%><%else
xianjin=rs("银两")

sql="SELECT * FROM 卖面 where ID=" & id 
	Set rs=connt.Execute(sql)
        
	yin=rs("售价")
	tl=rs("体力")
       yy=rs("拥有者")
%><%
		if yin <= xianjin then
			sql="update 用户 set 银两=银两-" & yin & ",体力=体力+" & tl & "   where  姓名='" & my & "'"
			conn.execute(sql)
                
        connt.execute("delete * from 卖面 where ID="&id)

	says="<marquee width=100% scrollamount=8><font color=red><b>【面馆】<font color=blue>"&my&"花了" & yin & "银两在面馆里吃了"& yy &"做的面，增加体力"&tl&"，真是物有所值啊！</font></marquee>"			'聊天数据
	
says=replace(says,chr(39),"\'")
says=replace(says,chr(34),"\"&chr(34))
act="消息"
towhoway=0
towho="大家"
addwordcolor="660099"
saycolor="008888"
addsays="对"
saystr="<script>parent.sh("& chr(39) & addwordcolor & chr(39) &","& chr(39) & saycolor & chr(39) &","& chr(39) & act & chr(39) &","& chr(39) & zhbg_name & chr(39) &","& chr(39) & addsays & chr(39) &","& chr(39) & towho & chr(39) &"," & chr(39) & says & chr(39) &"," & towhoway &  ","& nowinroom & ");<"&"/script>"
addmsg saystr
Function Yushu(a)
	Yushu=(a and 31)
End Function
Sub AddMsg(Str)
Application.Lock()
Application("SayCount")=Application("SayCount")+1
i="SayStr"&YuShu(Application("SayCount"))
Application(i)=Str
Application.UnLock()
End Sub
          response.write "你吃了面馆师傅"& yy &"做的面，增加体力"&tl&"<br><a href=qmg.htm>返回</a>"
           
			
			
		else
			response.write "不能吃面，原因：你的银两不够了<br><a href=qmg.htm>返回</a>"
			conn.close
			response.end
		%><%end if%>
<%
   set rs=nothing
   conn.close
   connt.close%>
<%end if%>
