<%@ LANGUAGE=VBScript%>
<% 
Response.Expires=0
Response.ExpiresAbsolute = Now() - 1
Response.AddHeader "Pragma","No-Cache"
Response.AddHeader "Cache-Control","Private"
Response.CacheControl = "No-Cache"
if Session("zhbg_name")="" or Session("zhbg_id")="" then response.end
name=Session("zhbg_name")
grade=Session("zhbg_grade")
myid=session("zhbg_id")
nowinroom=session("nowinroom")
%>
<!--#include file="dadata.asp"-->
<%    
sql="select 美味度 from 巧面 where 拥有者='" & name & "'"
		set rs=connt.execute(sql)
              
if rs.eof or rs.bof then%>

<script language=vbscript>
 MsgBox "你没有面啊，是不是想骗我，快去面馆作面吧。"
 location.href = "qmg.htm"
 </script>

<%     connt.close
	response.end

else
			randomize timer
			mwsj=int(rnd*10)
                   mw=rs("美味度")/10*mwsj
Set conn=Server.CreateObject("ADODB.CONNECTION")
Set rs=Server.CreateObject("ADODB.RecordSet")
conn.open Application("zhbg_usermdb")
sql="select 魅力,体力,操作时间 from 用户 where ID=" & myid
set rs=conn.execute(sql) 
js=rs("魅力") 
sj=DateDiff("n",rs("操作时间"),now())
if sj<8 then
ss=8-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
zjtl=mw*500+20000
ml=mw-25
conn.execute("update 用户 set 体力=体力+" & zjtl & ",魅力=魅力 +" & ml & ",操作时间=now()  where 姓名='"&name&"'")
connt.execute("delete * from 巧面 where 拥有者='" & name & "'" )
says="<marquee width=100% scrollamount=8><font color=red><b>【面馆】<font color=blue>"&name&"在面馆里自己下厨做了一碗上好的汤面，自己舍不得卖，自己吃了~增加体力" & zjtl & "点，魅力上涨" & ml & "点！</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 "<script Language=Javascript>alert('你一口气把香气扑鼻的面吃下去。增加体力" & zjtl& "魅力 +" & ml & "!');window.close();</script>"
response.end
conn.close
connt.close
set rs=nothing
end if%>
