<!--#include file="Inc.asp"-->
<!--#include file="ydzq.asp"-->
<!--#include file="forbbs.asp"-->
<%call head()
dim tid,bbsid,a
a=usb(Request.QueryString("a"))
bbsid=usb(Request.QueryString("bbsid"))
tidname=rs("name")
if bbsid="" then bbsid=0
if a="xh" then
XH="献花"
Elseif a="jd" then
XH="扔蛋"
Else
call Error("<card title=""献花或者扔蛋无效""><p>参数传输错误！请返回<a href='/index.asp?saytk="&saytk&"&amp;sid="&sid&"'>首页</a>，浏览其他栏目！")
End if
tid=usb(request.QueryString("tid"))
if myid<=0 then
Response.Redirect("login.asp")
Response.End()
end if
if tid="" or IsNumeric(tid)=False then
  Call Error("<card title=""ID无效""><p>ID无效！")
  end if
dim vote,addvote,voteid,price,paicent,freyuan
set rs=Server.CreateObject("ADODB.Recordset")
rs.open"select * from sell where yc=0 and id=" & tid,conn,1,1
if rs.eof then 
  Call Error("<card title=""出错了""><p>没有这个帖子！")
  end if
 Dim T_id
 T_id=rs("fid")
 st=rs("st")
 if bbsid=0 then bbsid=Rs("bbsid")
dim oopp,myjbin,myjyin,hyin,cityon,groupkf 
set rs1=Server.CreateObject("ADODB.Recordset")
rs1.open"select oopp,myjbin,myjyin,hyin,vipin,city,groupkf from [ydbbs] where id="&bbsid,conn,1,1
oopp=rs1("oopp")
hyin=rs1("hyin")
vipin=rs1("vipin")
myjbin=rs1("myjbin")
myjyin=rs1("myjyin")
cityon=rs1("city")
groupkf=rs1("groupkf")
rs1.close
set rs1=nothing
if hyin=2 and keys<>1 and skey=0 and keys<>2 and adminzone<>abs(bbsid) then 
  Call Error("只限版主进入！")
end if
if hyin=1 and myid=0 then 
  Call Error("只限会员进入！")
end if
if keys<>1 or keys<>2 or skey<>abs(bbsid) or adminzone<>abs(bbsid) then
if clng(vipin)>0 then
if clng(getvip(myjb,myjy))<clng(vipin) and clng(vipdj)<clng(vipin) and abs(bbsid)<>skey and keys<>1 and keys<>2 then
  Call Error("只限VIP"&clng(vipin)&"级会员进入！")
end if
end if
end if

if cityon=2 then
if groupkf=1 and myid=0 then 
  Call Error("只限本组群成员进入！")
end if
if groupkf=1 then
set rs1=Server.CreateObject("ADODB.Recordset")
rs1.open"select zoneID from users where id="&myid,conn,1,1
if rs1("zoneID")<>clng(bbsid) and keys<>1 and keys<>2 and adminzone<>abs(bbsid) then
  Call Error("只限本组群成员进入！")
end if
rs1.close
set rs1=nothing
end if
end if

if oopp=1 and keys<>1 and keys<>2 then
browsers=Lcase(Left(Request.ServerVariables("HTTP_USER_AGENT"),4))
if browsers="foper"  or  browsers="winw"  or  browsers="wapi" or browsers="mc21" or browsers="up.b" or browsers="upg1" or browsers="upsi" or browsers="qwap" or browsers="jigs" or browsers="java" or browsers="alca" or browsers="wapj" or browsers="cdr/" or browsers="nec-" or browsers="fetc" or browsers="r380" or browsers="winw" or browsers="mozi" or browsers="mozi" or browsers="m3ga" then   Call Error("请用手机访问！")
end if
if myjbin<>0 then
if clng(myjb)<5 then 
  Call Error("<card title=""出错了""><p>"&getcent&"不足5不能"&XH&"！")
end if
end if
'if myjyin<>0 then
if clng(myjy)<20 then 
  Call Error("<card title=""出错了""><p>经验不足20不能"&XH&"！")
end if

'end if

if st=1 then
response.write "本帖在"&rs("sttime")&"已被ID:"&rs("stusid")&"锁定"
response.write "<br/>锁定理由:"&ubb(rs("sttxt"))&"<br/>不能"&XH&""

end if
 Set rs=nothing
'下面判断是不是有记录，今天有没有超范围是用鲜花鸡蛋！
Set rs1=Server.Createobject("Adodb.Recordset")
  Sql="Select * From xhjd where U_id="&myid&""
  Rs1.open sql,conn,1,3
  if rs1.eof then'鲜花鸡蛋记录为空时
	  rs1.addnew'添加一条记录，记录会员id
	  Rs1("u_id")=myid

	    	if a="jd" then'判断是不是扔蛋
	  Rs1("egg_num")=1
	       end if
	    	if a="xh" then'判断是不是献花
	  Rs1("xh_num")=1
	      End if
	 
  Else
  	if a="xh" then'判断是不是献花
  		if rs1("h_time")=date() then'  判断是不是今天，下面会判断是不是超过今天的限制
  			if rs1("xh_num")>20 then
			call Error("<card title='你太热情了！'><p>你今天的的鲜花数已经达到系统限制！请明天再献！")
  			end if
  		if clng(huashu)<1 then 
  Call Error("<card title=""出错了""><p>您没有鲜花，不能"&XH&"！去个人空间的花园中种几朵花再来吧")
end if
                        rs1("xh_num")=rs1("xh_num")+1
  		conn.execute("update users set huashu=huashu-1 where id="&myid)
                else
 		rs1("h_time")=date()
  		Rs1("xh_num")=1
  		end if
  	elseif a="jd" then'判断是不是扔蛋
    	if rs1("jd_time")=date() then'  判断是不是今天，下面会判断是不是超过今天的限制
  			if rs1("egg_num")>19 then
  			call Error("<card title='你们有仇啊！'><p>你今天的的鸡蛋数已经投的够多了！请明天再来练技术吧！")
  			end if
  		if clng(jidan)<1 then 
  Call Error("<card title=""出错了""><p>您没有鸡蛋，不能"&XH&"！去个人空间的鸡窝捡几个蛋再来吧")
end if
                rs1("egg_num")=rs1("egg_num")+1
  		conn.execute("update users set jidan=jidan-1 where id="&myid)
                else
  		rs1("jd_time")=date()
  		Rs1("egg_num")=1
  		end if
  
  	end if
  end if
  	  Rs1("tid")=tid
	  Rs1("a")=a
 rs1.update
 Set rs1=nothing
if a="xh" then
Conn.Execute("update sell set x=x+1 where id="&tid&"")
mz="[url=uinfo.asp?id="&myid&"&amp;saytk="&saytk&"&amp;sid=[sid]]"&myni&"[/url]"
conn.execute("insert into sqdt(shijian,dz)values('"&now&"','"&mz&"对着帖子献了一朵花')")
'Conn.execute("update users set myjy=myjy-2 where id="&myid)
Elseif a="jd" then
Conn.Execute("update sell set d=d+1 where id="&tid&"")
'Conn.execute("update users set myjy=myjy-2 where id="&myid)
mz="[url=uinfo.asp?id="&myid&"&amp;saytk="&saytk&"&amp;sid=[sid]]"&myni&"[/url]"
conn.execute("insert into sqdt(shijian,dz)values('"&now&"','"&mz&"对着帖子扔了一个蛋')")
end if 
Set conn=nothing
Response.Redirect("topic.asp?tid="&tid&"&saytk="&saytk&"&sid="&sid&"")
%>