<!--#include file="inc.asp"-->
<!--#include file="conn.asp"-->
<!--#include file="kjinc.asp"-->
<%call saycardd("生肖开奖")
Server.ScriptTimeOut = 3600
dim action
action = request("action")
if action<>"" then
dim sxcent
set rs=Server.CreateObject("ADODB.Recordset")
  rs.open"select * from YD_payCent where id=1",ydzqconn,1,1
if not rs.eof then
sxcent=rs("sxcent")
end if
rs.close
set rs=nothing

dim fid,userid,gettxt
set rs=Server.CreateObject("ADODB.Recordset")
rs.Open "select * from YD_vote where j=0  and typeID=2 and qinum='"&abs(qinum)&"' and vote='"&sx(newtm)&"'",ydzqconn,1,2
if rs.eof then
call Error("呵呵，这期他们真黑，居然没有人中生肖！")
end if

 Do While Not rs.EOF   '遍历当期所有
userid=rs("userid")
username=rs("username")
payCent=rs("payCent")
fid=0
gettxt="恭喜！第"&qinum&"期开出特码"&abs(newtm)&"，即为"&sx(newtm)&"，您中了生肖！共赢得"&abs(rs("payCent")*sxcent)&getcent&""
'加币
conn.Execute("update Users set myjb=myjb+"&abs(rs("payCent")*sxcent)&" Where id="&userid)
call qfmsg()
call addlist()
  rs("j")=1
  rs.update()
  rs.MoveNext
  Loop
  rs.close
  set rs=nothing
  
Function qfmsg()
  sql="insert into guest(fid,sid,fnr) values ("
  sql=sql & sqlstr(fid) & ","
  sql=sql & sqlstr(userid) & ","
  sql=sql & sqlstr(gettxt) & ")"
  Application.Lock
  conn.execute(sql)
  Application.Unlock
End function
function sqlstr(data)
sqlstr="'" & Replace(data,"'","'") & "'"

End function
  Function addlist()
  set rs2=Server.CreateObject("ADODB.Recordset")
  rs2.open"select * from YD_plist where userid="&userid,ydzqconn,1,2
if not rs2.eof then
rs2("sxnum")=rs2("sxnum")+1
rs2("votenum")=rs2("votenum")+1
rs2("jbnum")=rs2("jbnum")+abs(int(payCent*sxcent))
else
rs2.addnew
rs2("userid")=userid
rs2("username")=username
rs2("sxnum")=rs2("sxnum")+1
rs2("votenum")=rs2("votenum")+1
rs2("jbnum")=abs(int(payCent*sxcent))
end if
rs2.update
rs2.close
set rs2=nothing
End function
  
conn.close
set conn=Nothing
ydzqconn.close
set ydzqconn=Nothing
response.write"恭喜第"&qinum&"期生肖中奖者的会员，系统已奖币并内线通知！"
else
if newtm="" or isnumeric(newtm)=False then
call Error("本期还没有开奖，不能进行奖励！")
end if
response.write"<b>第"&qinum&"期特码为"&newTM&" 即为"&sx(newtm)&"</b>"

response.write"<br/>您确认上面信息正确?<br/>"
if saytk>1 then
call xlanlj("winning_2.asp?saytk="&saytk&"&amp;sid="&sid&"")
call xltjlj("action","ok")
call xlanlj1("是的,已经确认")
else
response.write "<anchor>是的,已经确认"
response.write "<go href=""winning_2.asp?saytk="&saytk&"&amp;sid="&sid&""" method=""post"">"
response.write "<postfield name=""action"" value=""ok""/>"
response.write "</go></anchor><br/>"
end if
Response.Write "<a href='adminvote.asp?saytk="&saytk&"&amp;sid="&sid&"'>不,取消操作</a>"

end if%>
<br/>----------<br/><a href="adminvote.asp?saytk=<%=saytk%>&amp;sid=<%=sid%>">[投注管理]</a>
<!--#include file="fanhui.asp"-->
<%call head1%>