<!--#include file="../Inc.asp"-->
<!--#include file="../ydzq.asp"-->
<!--#include file="conn.asp"-->
<%Call head()
dim paycent,vote,TP
paycent=usb(request("paycent"))
vote=usb(request("vote"))
TP=usb(request("TP"))
if paycent="" or Isnumeric(paycent)=False then
  Call Error("<card title=""出错""><p>下注数额无效！")
  end if
if TP<>"1" and TP<>"2" and TP<>"3" and TP<>"4" and TP<>"5" and TP<>"6" then
  Call Error("<card title=""出错""><p>投项目无效！")
  end if
  
  dim bigpay,smallpay,fortime
  set rs=Server.CreateObject("ADODB.Recordset")
  rs.open"select bigpay,smallpay,fortime from YD_all where id=1",ydzqconn,1,1
if not rs.eof then
bigpay=rs("bigpay")
smallpay=rs("smallpay")
fortime=rs("fortime")
end if
rs.close
set rs=nothing
if abs(int(paycent))>abs(int(bigpay)) then
  Call Error("<card title=""出错""><p>为了增强互动性，每个投注最多"&abs(int(bigpay))&getcent&"！")
  end if
if abs(int(paycent))<abs(int(smallpay)) then
  Call Error("<card title=""出错""><p>为了增强互动性，每个投注最少"&abs(int(smallpay))&getcent&"！")
  end if
  
if vote="" then 
  Call Error("<card title=""出错""><p>您没有选择投注类型！")
  end if
  '=-=========================
  if TP="1" then
  vote=clng(vote)'长整型
  if vote="" or isnumeric(vote)=False then
    Call Error("<card title=""出错""><p>特码号码无效！必须1-49中的数字")
  end if
if abs(vote)<1 or abs(vote)>49 then 
  Call Error("<card title=""出错""><p>特码号码无效！必须1-49中的数字")
  end if
  

end if
  '=-=========================
if clng(DateDiff("n", now(), jietime))<clng(fortime) then
 Call Error("<card title=""出错""><p>太可惜了，本期截止时间已到，不能再下注了！")
end if

if now()>jietime then
 Call Error("<card title=""出错""><p>太可惜了，本期截止时间已到，不能再下注了！")
end if
if myjb<abs(int(payCent)) then
  Call Error("<card title=""出错""><p>您的"&getcent&"不足本次投注！")
  end if
Call saycarda("投注")


set rs=Server.CreateObject("ADODB.Recordset")
rs.open"select * from YD_vote where votetime >= DateAdd('s', -10, Now()) and userid="&myid,ydzqconn,1,2
if not rs.eof then
  Call Error("投注太快，请等待10秒再进行投注！")
  end if
rs.addnew
rs("typeID")=TP
rs("vote")=vote
rs("username")=myni
rs("userid")=myid
rs("payCent")=payCent
rs("qinum")=qinum
rs("votetime")=now()
rs.update
rs.close
set rs=nothing

conn.execute("update Users set myjb=myjb-"&abs(int(payCent))&" where ID="&myid)
ydzqconn.execute("update YD_info set tznum=tznum+1,jbnum=jbnum+"&abs(int(payCent))&" where qinum='"&qinum&"'")
conn.close
set conn=nothing
ydzqconn.close
set ydzqconn=nothing

response.write "投注成功！系统扣除您的"&payCent&getcent&"！<br/>"

response.write "<a href=""mynowvote.asp?sid="&sid&""">我的投注</a>"&chr(13)
response.write "<a href=""myvote.asp?sid="&sid&""">历史投注</a><br/>"&chr(13)
response.write "<a href=""index.asp?sid="&sid&""">返回虚拟投注</a>"
%>
<!--#include file="fanhui.asp"-->
<%call head1()%>