<!--#include file="../inc.asp"-->
<!--#include file="../ydzq.asp"-->
<!--#include file="conn.asp"-->

<%'=============================
call head()
Call cardgame("接受挑战",yanse9)

dim id
id=Request("id")
if id="" or Isnumeric(id)=false then
call error("ID无效")
end if
  set rs=Server.CreateObject("ADODB.Recordset")
  rs.open"select id from users where id=" & id &" order by id desc",conn,1,1
  if rs.eof then
  rs.close
  set rs=nothing
  call error("请输入正确的会员ID！")
  end if
  rs.close
  set rs=nothing
  
set objgbrs=Server.CreateObject("ADODB.Recordset")
  ssql="select * from YD_jd where reuseid=" & myid & " and about='J' order by id desc"
  objgbrs.open ssql,ydzqconn,1,1
if objgbrs.eof then
response.write "出错了，本次挑战已经结束！<br/>"
Elseif myjb<objgbrs("num") then
response.write "对不起!您的"&getcent&"不足!<br/><a href=""outjd.asp?id="&id&"&amp;sid="&sid&"&amp;saytk="&saytk&""">放弃本次挑战</a>!<br/>"
Else

dim objgrss,sqls
  Set objgbrss=Server.CreateObject("ADODB.Recordset")
    sqls="select * from YD_jd where useid=" & id & " and about='J' and reuseid=" & myid
    objgbrss.open sqls,ydzqconn,1,2 
if objgbrss("about1")="B" then 
objgbrss("op")=1
objgbrss("about")="A"
objgbrss("about2")="C"
objgbrss.update 
 response.write "你选择:英雄，对方也选择英雄，英雄惜英雄!本次挑战以平局结束!<br/>" 
            ltlyuan="你向会员:[" & myni & "ID:" & myid & "]发出的『英雄美女色狼』挑战,你选择:英雄，对方也选择英雄，英雄惜英雄!本次挑战以平局结束!"
'发信

  sql="update users set myjb=myjb+ " & objgbrss("num") & "  Where id=" & id
  conn.Execute(sql)

set rs=Server.CreateObject("ADODB.Recordset")
rs.open"select * from guest",conn,1,2
rs.addnew
rs("fnr")=ltlyuan
rs("sid")=id
rs("fid")=0
rs.update
rs.close
set rs=nothing
id1=objgbrss("useid")
dim rs1,ssql1
  set rs1=Server.CreateObject("ADODB.Recordset")
  ssql1="select name from [users] where [id]=" & id1 & " order by id desc"
  rs1.open ssql1,conn,1,1
dim talk
talk="" & myni & "与" & rs1("name") & "『英雄美女色狼』的挑战不分秋色!"
talk=ubb(talk)
sql="insert into talk(talk)values('"&talk&"')"
  Application.Lock
  ydzqconn.execute sql
  Application.Unlock
else
'--------------------------------------------------------------------------------------'
if objgbrss("about1")="C" then
objgbrss("op")=1
objgbrss("about")="A"
objgbrss("about2")="A"
objgbrss.update 
num=clng(Request("num"))
payjdcent=abs(int(objgbrss("num")*paylulu))
  sql="update users set myjb=myjb+ " & objgbrss("num")+payjdcent & " Where id=" & id
  conn.Execute(sql)
  addlist(id)

  sql="update users set myjb=myjb- " & objgbrss("num") & "  Where id=" & myid
  conn.Execute(sql)
    addlist2(myid)

 response.write "你选择:英雄，对方选择了美女，英雄难过美人关!很不幸，本次挑战，你输了" & objgbrss("num") & getcent&"<br/>" 
            ltlyuan="你向会员:[" & myni & "ID:" & myid & "]发出的『英雄美女色狼』挑战,你选择:美女，对方选择英雄，美女搞定英雄!恭喜你，本次挑战你赢了" & objgbrss("num") & getcent&"!"
'发信
set rs=Server.CreateObject("ADODB.Recordset")
rs.open"select * from guest",conn,1,2
rs.addnew
rs("fnr")=ltlyuan
rs("sid")=id
rs("fid")=0
rs.update
rs.close
set rs=nothing
id1=objgbrss("useid")
  set rs1=Server.CreateObject("ADODB.Recordset")
  ssql1="select name from [users] where [id]=" & id1 & " order by id desc"
  rs1.open ssql1,conn,1,1
talk="" & rs1("name") & "赢了与[" & myni & "]『英雄美女色狼』的挑战!"
talk=ubb(talk)
sql="insert into talk(talk)values('"&talk&"')"
  Application.Lock
  ydzqconn.execute sql
  Application.Unlock
else
'---------------------------------------------------------------------------------------'
if objgbrss("about1")="D" then
objgbrss("op")=1
objgbrss("about")="A"
objgbrss("about2")="B"
objgbrss.update
num=clng(Request("num"))
payjdcent=abs(int(objgbrss("num")*paylulu))
  addlist2(id)
  
  sql="update users set myjb=myjb+ " & payjdcent & " Where id=" & myid
  conn.Execute(sql)  
    addlist(myid)
 response.write "你选择:英雄，对方选择了色狼，英雄专打色狼!恭喜你，本次挑战你赢得了" & objgbrss("num") & getcent&"<br/>" 
            ltlyuan="你向会员:[" & myni & "ID:" & myid & "]发出的『英雄美女色狼』挑战,你选择:色狼，对方选择英雄，色狼难逃英雄的掌心!很不幸，本次挑战你输了" & objgbrss("num") & getcent&"!"
'发信
set rs=Server.CreateObject("ADODB.Recordset")
rs.open"select * from guest",conn,1,2
rs.addnew
rs("fnr")=ltlyuan
rs("sid")=id
rs("fid")=0
rs.update
rs.close
set rs=nothing
id1=objgbrss("useid")
  set rs1=Server.CreateObject("ADODB.Recordset")
  ssql1="select name from [users] where [id]=" & id1 & " order by id desc"
  rs1.open ssql1,conn,1,1
talk="[" & myni & "]赢了与[" & rs1("name") & "]『英雄美女色狼』的挑战!"
talk=ubb(talk)
sql="insert into talk(talk)values('"&talk&"')"
  Application.Lock
  ydzqconn.execute sql
  Application.Unlock
'--------------------------------------------------------------------------------------------'
       rs1.close
     set rs1=nothing
    end if
  objgbrss.close
set objgbrss=nothing
 end if
      end if
      objgbrs.close
         set objgbrs=nothing
           end if  
ydzqconn.close
set ydzqconn=nothing
conn.close
set conn=nothing
%>
<br/>-------------
<!--#include file="fanhui.asp"-->
<%call headsay()%>