📄 cent_show1.asp
字号:
<%
On Error Resume Next
cent=request("cent")
user=request("user")
userpass=request("userpass")
dim conn
dim connstr
dim db
db="fox_game.mdb"
Set conn = Server.CreateObject("ADODB.Connection")
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(""&db&"")
conn.Open connstr
havuser=false
if cent<>"" or user<>"" then
havuser=true
cent_len=len(cent)
centstr=mid(cent,1,1)
k=1
while k<cent_len
k=k+51
centstr=centstr & mid(cent,k,1)
wend
cent=centstr
'response.write cent
'response.end
set rs1=conn.execute("select * from fox_game where username='" & user & "'")
if rs1.eof or rs1.bof then
conn.execute "INSERT INTO fox_game (username,userpass,cent) values('" & user & "','" & userpass & "'," & cent & ")"
'response.write cent & " " & user & " " & userpass & err.Description & " INSERT INTO fox_game (user,userpass,cent) values('" & user & "','" & userpass & "'," & cent & ")"
'response.end
else
if userpass<>rs1("userpass") then
response.write "用户密码错误!"
rs1.close
set rs1=nothing
set conn=nothing
response.end
end if
conn.execute "update fox_game set cent=" & cent & " where username='" & user & "'"
end if
rs1.close
set rs1=nothing
end if
set rs2=server.createobject("adodb.recordset")
rs2.open "select * from fox_game order by cent desc",conn,2,2
dim i,k,tem
tem=0
i=0
k=false
while not k
if not tem=rs2("cent") then i=i+1
if rs2("username")=user then k=true
tem=rs2("cent")
rs2.movenext
wend
rs2.movefirst
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>显示分数</title>
</head>
<body>
<%if havuser=true then%>
<table width="600" border="1" align="center" cellspacing="0" bordercolor="#6699CC">
<tr>
<th scope="col"><%=user%></th>
<th scope="col"><%=cent%></th>
<th scope="col">排名:<%=i%></th>
</tr>
</table>
<%end if%>
<p> </p>
<table width="600" border="1" align="center" cellspacing="0" bordercolor="#6699CC">
<tr>
<th scope="col" width="30%">名次</th>
<th scope="col" width="40%">用户名</th>
<th scope="col" width="30%">分数</th>
</tr>
</table>
<%
i=0
tem=0
p=0
pc=false
while not rs2.eof and not pc
if not tem=cint(rs2("cent")) then
i=i+1
end if
p=p+1
tem=cint(rs2("cent"))%>
<table width="600" border="1" align="center" cellspacing="0" bordercolor="#6699CC">
<tr>
<th scope="col" width="30%"><%=i%></th>
<th scope="col" width="40%"><%=rs2("username")%></th>
<th scope="col" width="30%"><%=rs2("cent")%></th>
</tr>
</table>
<%
if p=100 then
pc=true
end if
rs2.movenext
wend
rs2.close
set rs2=nothing
set rs1=nothing
set conn=nothing%>
<p> </p>
</body>
</html>
<%
'response.write err.Description%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -