全球主机交流论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

CeraNetworks网络延迟测速工具IP归属甄别会员请立即修改密码
查看: 3384|回复: 10
打印 上一主题 下一主题

[Windows VPS] ASP高手快来啊

[复制链接]
跳转到指定楼层
1#
发表于 2013-9-27 12:08:25 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
  1. <%@ Language=VBScript %>
  2. <%
  3. if Application("domain_database")="" then
  4. datafile="coc/dom.asp"
  5. connstr="Provider=Microsoft.Jet.OLEDB.4.0;"&_
  6.                 "Data Source="& Server.MapPath(datafile)
  7. set conn=Server.CreateObject("ADODB.CONNECTION")
  8. Set rs=Server.CreateObject("ADODB.RecordSet")
  9. conn.Open connstr
  10. Application("domain_database")=connstr
  11. domain_info=""
  12. rs.Open ("select [domain],[ad],[height],[width],[url] from [domain] order by [top] desc"),conn,1,1
  13. do while not (rs.bof or rs.eof)
  14. domain_info=domain_info&rs(0)&"|"&rs(1)&"|"&rs(2)&"|"&rs(3)&"|"&rs(4)&"|"
  15. rs.movenext
  16. loop
  17. Application("domain_online")=0
  18. Application("domain_info")=domain_info
  19. rs.close
  20. rs.Open ("select [filter],[sift] from [system]"),conn,1,1
  21. Application("domain_filter")=rs(0)
  22. Application("domain_sift")=rs(1)
  23. rs.Close
  24. set rs=nothing
  25. conn.Close
  26. set conn=nothing
  27. end if


  28. sURL=Request.ServerVariables("HTTP_HOST")
  29. if InStr(sURL,"=")<>0 or InStr(sURL,"`")<>0 or InStr(sURL,"'")<>0 or InStr(sURL," ")<>0 or InStr(sURL," ")<>0 or InStr(sURL,"'")<>0 or InStr(sURL,chr(34))<>0 or InStr(sURL,"")<>0 or InStr(sURL,",")<>0 or InStr(sURL,"<")<>0 or InStr(sURL,">")<>0 then
  30. Response.Status= "404 no found"
  31. Response.End
  32. end if
  33. first_name=split(sURL,".")
  34. if ubound(first_name)>2 then
  35. Response.Status= "404 no found"
  36. Response.End
  37. end if
  38. user=first_name(0)
  39. seldomain=first_name(1)&"."&first_name(2)
  40. if user="reg" then Response.Redirect "http://xxx.cn/reg/index.asp"   
  41. '这里的这个指向是你给这个程序设置的域名的路径
  42. geturl=False
  43. msg=Application("domain_info")
  44. msg=split(msg,"|")
  45. for i=lbound(msg) to ubound(msg)-1 step 5
  46. if msg(i)=seldomain then
  47. geturl=True
  48. ad=msg(i+1)
  49. height=msg(i+2)
  50. width=msg(i+3)
  51. adurl=msg(i+4)
  52. exit for
  53. end if
复制代码
访问提示:
Microsoft VBScript 运行时错误 错误 '800a0009'

下标越界: '[number: 2]'

/index.asp,行 41


什么问题呢?球高手解答。。。
推荐
发表于 2013-9-27 14:21:29 | 只看该作者


第30行后面插入下面两行,看一下输出结果:

Response.write sURL
Response.end
2#
 楼主| 发表于 2013-9-27 12:25:34 | 只看该作者
没人知道吗
4#
发表于 2013-9-27 12:52:12 | 只看该作者
本帖最后由 奔跑的油条 于 2013-9-27 12:53 编辑

41行的,first_name(2)数组越界


造成此错误的原因:
35行  first_name=split(sURL,".") 分割出来的数组下标没有2,也就是当前sURL中的"."号只有1个。

解决方法有两种:
1.41行前插入一行,输入如下代码:on error resume next
2.35行前插入一行,输入如下代码:sURL=sURL & "."


唉,回答一个问题,分都没有。

5#
 楼主| 发表于 2013-9-27 13:33:48 | 只看该作者
奔跑的油条 发表于 2013-9-27 12:52
41行的,first_name(2)数组越界

加了on error resume next后访问显示空白。又是什么问题呢?
6#
发表于 2013-9-27 13:50:15 | 只看该作者
553993 发表于 2013-9-27 13:33
加了on error resume next后访问显示空白。又是什么问题呢?

如果不能忽略错误,请使用第二种方法
7#
 楼主| 发表于 2013-9-27 14:18:25 | 只看该作者
奔跑的油条 发表于 2013-9-27 13:50
如果不能忽略错误,请使用第二种方法

同样是空白
9#
 楼主| 发表于 2013-9-27 14:34:18 | 只看该作者
奔跑的油条 发表于 2013-9-27 14:21
第30行后面插入下面两行,看一下输出结果:

Response.write sURL

现在是显示域名在页面上。而不是跳转到指定页面。
10#
发表于 2013-9-27 14:41:33 | 只看该作者
553993 发表于 2013-9-27 14:34
现在是显示域名在页面上。而不是跳转到指定页面。

你不能把输出内容贴出来的?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|全球主机交流论坛

GMT+8, 2024-7-6 00:01 , Processed in 0.070862 second(s), 10 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表