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

<%'=============================
call head()
Call cardgame("球类投注中心",yanse12)
%>您目前共有<%=myjb%><%=getcent%><br/><%
dim rsconfig,bigpay,smallpay
set rsconfig=Server.CreateObject("ADODB.Recordset")
rsconfig.open"select bigpay,smallpay from yd_all where id=1",ydzqconn,1,1
if not rsconfig.eof then
bigpay = rsconfig("bigpay")
smallpay = rsconfig("smallpay")
end if
rsconfig.close
set rsconfig=nothing
dim id,typeID,action,paycent
id=request("id")
action=request("action")
typeID=request("typeID")
paycent=request("paycent")
if id="" or Isnumeric(id)=false then
call error("ID无效！")
end if
if typeID="" or Isnumeric(typeID)=false then
call error("ID无效！")
end if

typeID=abs(typeID)
set rs=Server.CreateObject("ADODB.Recordset")
  rs.open"select * from YD_vote where id=" & id & "  order by id desc",ydzqconn,1,1
if rs.eof then 
response.write "您好,这个比赛不存在或者已经结束,赶快再去<a href=""index.asp?sid="&sid&"&amp;saytk="&saytk&""">选一个</a>来玩吧!<br/>"
Else
if action="ok" then

if clng(DateDiff("n", now(), rs("balltime1")))<clng(fortime) then
 Call Error("太可惜了，本投注截止时间已到，不能再下注了！")
end if

if paycent="" or IsNumeric(paycent)= False then
call error(""&getcent&"错误！")
end if
if clng(paycent) < clng(smallpay) then
call error("对不起，最小投注为"&smallpay&getcent&"!")
end if 
if clng(paycent) > clng(bigpay) then
call error("对不起，最大投注为"&bigpay&getcent&"!")
end if 

if myjb<clng(paycent) then
call error("对不起，您的"&getcent&"不足!")
end if 

dim rs1
set rs1=Server.CreateObject("ADODB.Recordset")
rs1.open"select  id,usid,ballid,vote,typeID,paycent,votetxt,balltype from YD_voteid ",ydzqconn,1,3
rs1.addnew
rs1("usid") = myid
rs1("ballid") = id
rs1("vote") = 3
rs1("typeID") = typeID
rs1("balltype") = rs("balltype")
rs1("paycent") = paycent
if typeID=1 then
rs1("votetxt") = ""&rs("ballvote1")&"("&rs("balldslu1")&")(比分单双)"&rs("ballvote2")&"("&rs("balldslu2")&")投注"&paycent&getcent&",压单"
else
rs1("votetxt") = ""&rs("ballvote1")&"("&rs("balldslu1")&")(比分单双)"&rs("ballvote2")&"("&rs("balldslu2")&")投注"&paycent&getcent&",压双"
end if

rs1.update
rs1.close
set rs1=nothing
conn.Execute("update users set myjb=myjb-"&clng(paycent)&" Where id=" & myid)

if typeID=1 then
response.write "您选择投注的是单("&rs("balldslu1")&"),您的投注已记录,祝您成功！<br/>"
else
response.write "您选择投注的是双("&rs("balldslu2")&"),您的投注已记录,祝您成功！<br/>"
end if
else
response.write "【投注比赛】<br/>"
response.write ""&rs("ballvote1")&"VS"&rs("ballvote2")&"<br/>"
response.write "【投注项目】<br/>"
response.write "判断双方分数的单双<br/>"
response.write "<a href=""ball_z_s.asp?id="&rs("id")&"&amp;typeID=1&amp;sid="&sid&"&amp;saytk="&saytk&""">单("&rs("balldslu1")&")</a>"
response.write ""&rs("balldx")&""

response.write "<a href=""ball_z_s.asp?id="&rs("id")&"&amp;typeID=2&amp;sid="&sid&"&amp;saytk="&saytk&""">双("&rs("balldslu2")&")</a><br/>"

if typeID=1 then
response.write "您选择投注的是单("&rs("balldslu1")&")"
else
response.write "您选择投注的是双("&rs("balldslu2")&")"
end if
if saytk<>1 then
Response.write "<form name=""form"" method=""post"" action=""ball_z_s.asp?sid="&sid&"&amp;saytk="&saytk&""">"
end if
Response.write "<br/>请输入您的下注额:<input name=""paycent"" emptyok=""true"" format=""*N"" value=""0"" size=""5""/>"&getcent&"<br/>"
if saytk<>1 then
response.write "<input type=""hidden"" name=""typeID"" value="""&typeID&"""/>"
response.write "<input type=""hidden"" name=""ID"" value="""&ID&"""/>"
response.write "<input type=""hidden"" name=""action"" value=""ok""/>"
response.write "<input type=""submit"" name=""Submit"" value=""确定提交""></form><br/>"
else
response.write "<anchor>OK!决定了"
response.write "<go href=""ball_z_s.asp?sid="&sid&"&amp;saytk="&saytk&""" method=""post"" accept-charset=""utf-8"">"
response.write "<postfield name=""paycent"" value=""$(paycent)""/>"
response.write "<postfield name=""typeID"" value="""&typeID&"""/>"
response.write "<postfield name=""ID"" value="""&ID&"""/>"
response.write "<postfield name=""action"" value=""ok""/>"
response.write "</go></anchor><br/>"
end if
end if
end if
rs.close
set rs=nothing
ydzqconn.close
set ydzqconn=nothing
conn.close
set conn=nothing
response.write "<a href=""ball_z.asp?id="&id&"&amp;sid="&sid&"&amp;saytk="&saytk&""">返回当前比赛</a>"
%>
<!--#include file="fanhui.asp"-->
<%call headsay()%>