<%@ 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)
jishu=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
tl=mw*600
yin=mw*20000
mai=yin/2
ml=mw
sql="insert into 卖面(拥有者,体力,售价) values ('"& name &"',"& tl &","& yin &")"
			connt.execute(sql)
connt.execute("delete * from 巧面 where 拥有者='" & name & "'" )
conn.execute("update 用户 set 银两=银两+"& mai &",魅力=魅力+" & ml & ",操作时间=now()  where 姓名='"&name&"'")
says="<marquee width=100% scrollamount=8><font color=red><b>【面馆】</b></font><font color=blue>"&name&"刚刚在面馆里做了一碗上好的汤面，得到银子" &mai& "两，魅力上涨" & 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('你把你亲手做的面卖给了巧面馆，得到银子" &mai& "两，魅力+" & ml & "!');window.close();</script>"
Response.end
conn.close
set conn=nothing
connt.close
set connt=nothing
set rs=nothing 

%>
<%end if%>