反复发作久治不愈老军医也束手无策的棘手问题~~
<%
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/ 这个网址刷新,无法跳转到其他用户注册的页面~~` 怎么回事啊?
急盼各位郎中古道热肠辨证施治妙手回春`~`~~~
------解决方案--------------------Response.write sUrl //把surl输入看看是什么,然后我们才有可能判断是那里的问题
不过我估计多半是 sUrl = TmpUrl(0)这里的问题,改成
surl=surl+tempurl(0)+ " </br> " //我不知道你的tempurl(0)是啥,不过看你前面split( "? "),估计tempurl(0)应该没有 </br> 吧
------解决方案-------------------- <%
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( "C