<%
Dim WebUrl,ToUrl,sUrl,WebID,TmpUrl,Url
intRandomNumber = Int (1000*Rnd)+1
Set Rs = Server.CreateObject("ADODB.RecordSet")
Rs.Open "Select ID,UserUrl From Member Where UserPower>100 And WebUrlON=1 And UserIspass=1",Conn,1,1
If Not Rs.Eof Then
WebUrl = DisRndRecord(1,rs.recordCount)
TmpUrl = Split(WebUrl,"?")
sUrl = TmpUrl(0)
WebID = TmpUrl(1)
Else
Url = "http://www.sprice.com.cn/"
End If
Rs.Close
Conn.Execute("Update Member Set UserPower=UserPower-1,WebTotal=WebTotal+1 Where ID=" & WebID & "")
Conn.Execute("Update Member Set UserPower=UserPower+1,WebClick=WebClick+1 Where ID=" & CLng(Request.Cookies("CookiesPATH")("UserID")) & "")
Set Rs = Nothing
Conn.Close
Set Conn = Nothing
If InStr(sUrl,"<br/>")>0 Then
ToUrl = Split(sUrl,"<br/>")
i = Ubound(ToUrl)
Url = ToUrl(GetRnd(i))
Else If Len(sUrl)>8 Then
Url = sUrl
Else
Url = "http://www.sprice.com.cn/"
End If
End If
%>大伙帮忙看看代码哪里有问题 这个代码作用是:每个用户注册一个网址,程序从数据库里读取网址数据,页面每隔一段时间就随机跳到其中一个网址,可是为什么我调试的时候,页面总是跳到 http://www.sprice.com.cn/ 这里啊?
用的是MSSQL数据库,程序是access转MSSQL数据库的. 数据库里面已有多条数据.
页面可以正常运行,但是就总是在http://www.sprice.com.cn/ 这个网址刷新,无法跳转到其他用户注册的页面~~` 怎么回事啊?急盼各位郎中古道热肠辨证施治妙手回春`~`~~~
Dim WebUrl,ToUrl,sUrl,WebID,TmpUrl,Url
intRandomNumber = Int (1000*Rnd)+1
Set Rs = Server.CreateObject("ADODB.RecordSet")
Rs.Open "Select ID,UserUrl From Member Where UserPower>100 And WebUrlON=1 And UserIspass=1",Conn,1,1
If Not Rs.Eof Then
WebUrl = DisRndRecord(1,rs.recordCount)
TmpUrl = Split(WebUrl,"?")
sUrl = TmpUrl(0)
WebID = TmpUrl(1)
Else
Url = "http://www.sprice.com.cn/"
End If
Rs.Close
Conn.Execute("Update Member Set UserPower=UserPower-1,WebTotal=WebTotal+1 Where ID=" & WebID & "")
Conn.Execute("Update Member Set UserPower=UserPower+1,WebClick=WebClick+1 Where ID=" & CLng(Request.Cookies("CookiesPATH")("UserID")) & "")
Set Rs = Nothing
Conn.Close
Set Conn = Nothing
If InStr(sUrl,"<br/>")>0 Then
ToUrl = Split(sUrl,"<br/>")
i = Ubound(ToUrl)
Url = ToUrl(GetRnd(i))
Else If Len(sUrl)>8 Then
Url = sUrl
Else
Url = "http://www.sprice.com.cn/"
End If
End If
%>大伙帮忙看看代码哪里有问题 这个代码作用是:每个用户注册一个网址,程序从数据库里读取网址数据,页面每隔一段时间就随机跳到其中一个网址,可是为什么我调试的时候,页面总是跳到 http://www.sprice.com.cn/ 这里啊?
用的是MSSQL数据库,程序是access转MSSQL数据库的. 数据库里面已有多条数据.
页面可以正常运行,但是就总是在http://www.sprice.com.cn/ 这个网址刷新,无法跳转到其他用户注册的页面~~` 怎么回事啊?急盼各位郎中古道热肠辨证施治妙手回春`~`~~~
Dim WebUrl,ToUrl,sUrl,WebID,TmpUrl,Url
intRandomNumber = Int (1000*Rnd)+1
Set Rs = Server.CreateObject("ADODB.RecordSet")
Rs.Open "Select ID,UserUrl From Member Where UserPower>100 And WebUrlON=1 And UserIspass=1",Conn,1,1
If Not Rs.Eof Then
WebUrl = DisRndRecord(1,rs.recordCount)
TmpUrl = Split(WebUrl,"?")
sUrl = TmpUrl(0)
WebID = TmpUrl(1)
Else
Response.write "记录数为:"&Rs.recordcount
Response.end '如果执行到了这,说明从数据库没有取到记录
Url = "http://www.sprice.com.cn/"
End If
Rs.Close
Conn.Execute("Update Member Set UserPower=UserPower-1,WebTotal=WebTotal+1 Where ID=" & WebID & "")
Conn.Execute("Update Member Set UserPower=UserPower+1,WebClick=WebClick+1 Where ID=" & CLng(Request.Cookies("CookiesPATH")("UserID")) & "")
Set Rs = Nothing
Conn.Close
Set Conn = Nothing
If InStr(sUrl,"<br/>")>0 Then
ToUrl = Split(sUrl,"<br/>")
i = Ubound(ToUrl)
Url = ToUrl(GetRnd(i))
Else If Len(sUrl)>8 Then
Url = sUrl
Else
Response.write "记录数为:"&Rs.recordcount
Response.end '如果执行到了这,说明sUrl中不包含"<br/>"
Url = "http://www.sprice.com.cn/"
End If
End If
%>
我写asp程序时,一般喜欢设置一些输出进行调试,你也可以试试
If InStr(sUrl,"<br/>")>0 Then
ToUrl = Split(sUrl,"<br/>")
i = Ubound(ToUrl)
Url = ToUrl(GetRnd(i))
Else If Len(sUrl)>8 Then
Url = sUrl
Else
Response.write "sUrl为:"&sUrl
Response.end '如果执行到了这,说明sUrl中不包含"<br/>"
Url = "http://www.sprice.com.cn/"
End If
End If