test2.asp

来自「采用ASP。NET做的网上游戏交易平台」· ASP 代码 · 共 79 行

ASP
79
字号
<!--#include file="dbconn.asp"-->
<html>
<head>
<%
dim mygamestr
function FSOFileRead(filename)
       Dim objFSO,objCountFile,FiletempData
       Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
       Set objCountFile = objFSO.OpenTextFile(Server.MapPath(filename),1,True)
       FSOFileRead = objCountFile.ReadAll
       objCountFile.Close
       Set objCountFile=Nothing
       Set objFSO = Nothing
      End Function
'----------------------------
function mysplit(str)
tmparr=split(str,"'")
if instr(tmparr(3),"->")>0 then
tmparr(3)=replace(tmparr(3),"->","==> ")
end if
mysplit=tmparr(1)&","&tmparr(3)
end function
'--------------------------------------------------------
set rs=server.CreateObject("adodb.recordset")
if request.form("btnclear")="更新游戏列表" then
'说明:先用逗号分割,然后取第2个和第4四数(1,3)
mygamelist=FSOFileRead("gamelist.txt")
tmparray=split(mygamelist,chr(13)&chr(10))
redim mynewlist(ubound(tmparray))
response.Write "更新游戏列表成功......<hr>"
for i=0 to ubound(mynewlist)
mynewlist(i)=mysplit(tmparray(i))
'response.write (i+1)&": "&mynewlist(i)&"<br>"
temparr=split(mynewlist(i),",")
sql="select * from const where gamecode='"&temparr(0)&"' and gamename='"&temparr(1)&"'"
rs.open sql,conn,3,2
if rs.eof then
rs.addnew
rs("gamecode")=temparr(0)
rs("gamename")=temparr(1)
rs("clickNum")=100
rs.update
end if
rs.close
next
end if
sql="select * from const order by gamename,gamecode asc"
rs.open sql,conn,3,1
'response.write "mygameArr=array("
while not rs.eof
if mygamestr="" then
mygamestr=chr(34)&rs("gamecode")&chr(34)&","&chr(34)&rs("gamename")&chr(34)
else
mygamestr=mygamestr&","&chr(34)&rs("gamecode")&chr(34)&","&chr(34)&rs("gamename")&chr(34)
end if
rs.movenext
wend
rs.close
set rs=nothing
mygamestr="mygameArr=array("&mygamestr&")"
response.write mygamestr
response.write "<hr><font color='#ff00'  size=2>提示:请将const.asp文件中mygameArr数组的值也更新<font>"
%>
<title>test......</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>

<body>
<center>


<form action="test2.asp" method="post" name="frmtest">
    <input type="submit" name="btnclear" value="更新游戏列表">
    (读取gamelist.txt文件中的游戏列表来更新)
</form>
</center>
</body>
</html>

⌨️ 快捷键说明

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