| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 878 人关注过本帖
标题:求助:网页跳转的问题
取消只看楼主 加入收藏
yufee
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2008-1-30
收藏
 问题点数:0 回复次数:3 
求助:网页跳转的问题
想实现这样的功能:

在首页文件中调用计数器,调用代码为:<script src="http://网址/count/mystat.asp"></script>
同时判断访问者是来自公网外部用户还是局域网的内部用户,这是判断的代码:
<%
ip = request.servervariables("http_x_forwarded_for")
if ip = "" then ip = request.servervariables("remote_addr")
userip_ary=split(ip,".")
'tmp_userip=userip_ary(0)*256*256*256+userip_ary(1)*256*256+userip_ary(2)*256+userip_ary(3)
tmp_userip=userip_ary(0)*256+userip_ary(1)
if tmp_userip=49320 then

    response.redirect "要访问的内网地址"
else
    response.redirect "要访问的外网地址"    
end if
%>

但是,我建立了index.asp如下:
<script src="http://网址/count/mystat.asp"></script>
<%
ip = request.servervariables("http_x_forwarded_for")
if ip = "" then ip = request.servervariables("remote_addr")
userip_ary=split(ip,".")
'tmp_userip=userip_ary(0)*256*256*256+userip_ary(1)*256*256+userip_ary(2)*256+userip_ary(3)
tmp_userip=userip_ary(0)*256+userip_ary(1)
if tmp_userip=49320 then

    response.redirect "要访问的内网地址"
else
    response.redirect "要访问的外网地址"    
end if

或者
<!-- #include file="count/mystat.asp" -->
<%
ip = request.servervariables("http_x_forwarded_for")
if ip = "" then ip = request.servervariables("remote_addr")
userip_ary=split(ip,".")
'tmp_userip=userip_ary(0)*256*256*256+userip_ary(1)*256*256+userip_ary(2)*256+userip_ary(3)
tmp_userip=userip_ary(0)*256+userip_ary(1)
if tmp_userip=49320 then

    response.redirect "要访问的内网地址"
else
    response.redirect "要访问的外网地址"    
end if

结果均为网页可以跳转,但是计数器没有计数。


如果我建立文件为index.htm
加入<script src="http://网址/count/mystat.asp"></script>,
技术没有问题,却不知如何实现跳转。


百思不得其解,请各位高手指教
搜索更多相关主题的帖子: 网页 
2008-01-30 15:06
yufee
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2008-1-30
收藏
得分:0 
各位高手,看一看吧,
为什么在asp文件中加入
<script src="http://网址/count/mystat.asp"></script>
或者
<!-- #include file="count/mystat.asp" -->
都不行呢?
2008-01-31 14:33
yufee
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2008-1-30
收藏
得分:0 
可能我贴的代码太多了,有些乱。
实际上面的大部分代码都是根据IP判断是不是从内网访问的。

我使用了阿江的计数器,放在Count目录下。调用代码是:<script src="http://网址/count/mystat.asp"></script>

我想在判断内网外网的文件中,添加对计数器的调用。但是运行时,虽然没有报错,但是阿江的计数器却没有增加,我觉得奇怪。所以想知道2楼调用方法是不是合适。
谢谢!
2008-01-31 16:41
yufee
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2008-1-30
收藏
得分:0 
好像使用iframe还是不行。
2008-02-02 10:01
快速回复:求助:网页跳转的问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.028275 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved