⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 horse_post.asp

📁 赌马程序,可以进行社区虚拟赌马哦
💻 ASP
字号:
<%
if Session.Contents("UserName")="" then %>
<script language=vbscript>
  MsgBox "对不起,你还没有登录!"
  location.href = "../../index.htm"
</script>
<% else

dim betcash,nowcash,horse,horsenumber
nowcash=0
betcash=0

betcash=cint(request.form("money"))
horse=request.form("chip")

TotalNumber = 10

DBPath = Server.MapPath("../../../data/members.asp")
set userconn=server.createobject("adodb.connection")
userconn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath

    set users=server.createobject("adodb.recordset")
    users.open "Select * From users Where name='"&Session.Contents("UserName")&"'",userconn,3,3
	nowcash=users("cash")

if betcash>nowcash OR betcash<1 then
     response.write("SORRY!您没有那么多钱哦,你只有现金:"&nowcash &" NG")
else


DBPath = Server.MapPath("../../../data/horses.asp")
set conn=server.createobject("adodb.connection")
conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath

    set horses=server.createobject("adodb.recordset")
    horses.open "Select * From horselist ",conn,3,3
	horses.movelast
	plays=horses("id")

    set buys=server.createobject("adodb.recordset")
    buys.open "Select * From horsebuylist Where username='"&Session.Contents("UserName")&"' And Number="&plays,conn,3,3

    set selecthorse=server.createobject("adodb.recordset")
    selecthorse.open "select * from horses Where name='"&horse&"'",conn,3,3

if buys.recordcount>=2 then%>
<script language=vbscript>
  MsgBox "对不起,一个人一场只能下注2次!"
  location.href = "index.asp"
</script>
<%else

    buys.addnew
    buys("username") = Session.Contents("UserName")
    buys("horse") = horse
    buys("number") = plays
    buys("time") = now()
    buys("money") = betcash
    buys("pl")=selecthorse("pl")
    buys.update

    Randomize
    states =80+Int(20 * Rnd + 0)
   
    selecthorse("betmoney")=selecthorse("betmoney")+betcash
	selecthorse("state")=states
    selecthorse.update

    users("cash") = users("cash") - betcash
    users("bets") = users("bets") + 1
    users.update    
    users.close

    horses("boughtnumber") = horses("boughtnumber") + 1
    horses.update

    if horses("boughtnumber") >= TotalNumber then

    tmprs=conn.execute("Select sum(betmoney) as sumbet from horses")
    sumbet=tmprs("sumbet")
	set tmprs=nothing
	if isnull(sumbet) then 
    sumbet=0
    end if

    conn.execute("Update horses set pl=int("&sumbet&"/betmoney)+1 where betmoney>0")
    conn.execute("Update horses set pl=2 where betmoney<=0")
    conn.execute("Update horses set pl=5 where pl>10")

      set winner=server.createobject("adodb.recordset")
      winner.open "Select * From horses",conn,0,1
      winner.movefirst
      dim iswin,whomax,whonow
      whomax=0
	  whonow=0
      do while not winner.eof
			Randomize
			   whonow=(100-(winner("pl") * Rnd + 0))+(winner("state")/100)
			   if whonow>whomax then
                  whomax=whonow
			      iswin=winner("horseid")
			      winhorse=winner("name")
			   end if
    		winner.movenext
        loop
        conn.execute("Update horses set state=80,wins=wins+1,runs=runs+1,hvalue=hvalue+betmoney,betmoney=0 Where horseid="&iswin )
        conn.execute("Update horses set state=90,runs=runs+1,betmoney=0 Where horseid<>"&iswin )
	    conn.execute("Update horsebuylist set winmoney=money*pl where Horse='"&winhorse&"' and Number="&plays )
		horses("winer") = winhorse
        horses.addnew
        horses("boughtnumber") = 0
        horses.update
'super add 更新user赢钱
    buys.close
    buys.open "Select * From horsebuylist Where Number="&plays,conn,0,1
	do while not buys.eof
	win=cint(buys("winmoney"))
    if win>0 then
	userconn.execute("Update users Set cash=cash+"&win&" Where name='"&buys("username")&"'") 
    end if
    buys.movenext
    loop
'super and is end
    end if      

buys.close
selecthorse.close
set users=nothing
set horses=nothing
set buys=nothing
conn.close
end if
%>
<HTML>
<HEAD>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type=text/css>
<!--
body,table {font-size: 9pt; font-family: 宋体}
input {  font-size: 9pt; color: #000000; background-color: #f7f7f7; padding-top: 3px}
.c {  font-family: 宋体; font-size: 9pt; font-style: normal; line-height: 12pt; font-weight: normal; font-variant: normal; text-decoration: none}
--></style>
</head>

<body bgcolor="#FFFFFF" text="#000000" link="#0033CC" vlink="#003399">
<div align=center> 
  <p><font size="2" class=c><font size="3"><b> 下 注 情 况</b></font></font></p>

  <table border=1 cellspacing=0 cellpadding=3 align="center" width="400" bordercolordark="#FFFFFF">
    <tr> 
        
      <td bgcolor="#F2D9B3" width="320" colspan=2><font size="2" class=c><b>&nbsp;&nbsp;我下注情况:</b></font></td>
      </tr>
      <tr bgcolor=#FAF0E2> 
        
      <td align=center><font size="2" class=c>马 名:</font></td>
        <td align=center><font size="2" class=c><%=horse%></font></td>
      </tr>
      <tr>
        
      <td align=center><font size="2" class=c>场 次:</font></td>
        
      <td align=center><font size="2" class=c><a href="dispall.asp?number=<%=plays%>">第<b> 
        <%=plays%> </b>场</a></font></td>
      </tr>
      <tr bgcolor=#FAF0E2> 
        
      <td align=center><font size="2" class=c>赌 注:</font></td>
        
      <td align=center><font size="2" class="c" color="#CC0000"><b><%=betcash%> 
        </b></font><b><font size="2" class=c></font></b><font size="2" class=c><b>NG</b></font></td>
      </tr>
      <tr>
        
      <td align=center><font size="2" class=c>剩余现金:</font></td>
        
      <td align=center><font size="2" class="c" color="#CC0000"><b><%=nowcash-betcash%></b></font><b><font size="2" class=c> 
        </font></b><font size="2" class=c> <b>NG</b></font></td>
      </tr>
      <tr bgcolor=#FAF0E2> 
        
      <td align=center colspan=2> 
        <p> <a href="index.asp"><font size="2" class=c>社区马场</font></a> <b>|</b>  
          <a href="dispall.asp?number=<%=plays%>">投注情况</a> <b>|</b> <a href="../../home.asp"><font size="2" class=c>社区论坛</font></a></p> 
        </td> 
      </tr> 
      <tr>  
         
      <td bgcolor=#F2D9B3 align=right colspan=3><a href="../../home.asp">离 开</a>&nbsp;</td> 
      </tr> 
  </table> 
 
</div> 
 
</BODY> 
</HTML> 
<%end if 
end if%> 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -