ASP判断来路页面
来源:互联网 发布:淘宝网美容泛石刮沙板 编辑:程序博客网 时间:2024/05/01 02:53
<%
'来源地址
come=Request.ServerVariables("HTTP_REFERER")
url=Request.ServerVariables("server_name")
if come <> "" then
come=replace(come,"/","/")
come=replace(lcase(come),"http://","")
come=split(come,"/")(0)
come=split(come,":")(0)
else
Response.Write("不能直接下载,必须从本站链接才可以进行下载<br><br>")
Response.Write("进入站点首页:<a href=http://"&url&">"&url&"</a>")
Response.end
end if
if cstr(come)=cstr(url) then
Response.Redirect("")
else
Response.Write("链接来自:<a href=http://"&url&">"&url&"</a>")
end if
%>
'来源地址
come=Request.ServerVariables("HTTP_REFERER")
url=Request.ServerVariables("server_name")
if come <> "" then
come=replace(come,"/","/")
come=replace(lcase(come),"http://","")
come=split(come,"/")(0)
come=split(come,":")(0)
else
Response.Write("不能直接下载,必须从本站链接才可以进行下载<br><br>")
Response.Write("进入站点首页:<a href=http://"&url&">"&url&"</a>")
Response.end
end if
if cstr(come)=cstr(url) then
Response.Redirect("")
else
Response.Write("链接来自:<a href=http://"&url&">"&url&"</a>")
end if
%>
<%
function checkisUrl(tmpString)
function checkisUrl(tmpString)
dim c,i
checkisUrl = true
tmpString=Lcase(trim(tmpString))
if left(tmpString,7)<>"http://" then tmpString="http://"&tmpString
for i = 8 to Len(checkisUrl)
c = Lcase(Mid(tmpString, i, 1))
if InStr("abcdefghijklmnopqrstuvwxyz_-.//", c) <= 0 and not IsNumeric(c) then
checkisUrl = false
exit function
end if
next
if Left(tmpString, 1) = "." or Right(tmpString, 1) = "." then
checkisUrl = false
exit function
end if
if InStr(tmpString, ".") <= 0 then
checkisUrl = false
response.Write "f3"
exit function
end if
if InStr(checkisUrl, "..") > 0 then
checkisUrl = false
end if
checkisUrl = true
tmpString=Lcase(trim(tmpString))
if left(tmpString,7)<>"http://" then tmpString="http://"&tmpString
for i = 8 to Len(checkisUrl)
c = Lcase(Mid(tmpString, i, 1))
if InStr("abcdefghijklmnopqrstuvwxyz_-.//", c) <= 0 and not IsNumeric(c) then
checkisUrl = false
exit function
end if
next
if Left(tmpString, 1) = "." or Right(tmpString, 1) = "." then
checkisUrl = false
exit function
end if
if InStr(tmpString, ".") <= 0 then
checkisUrl = false
response.Write "f3"
exit function
end if
if InStr(checkisUrl, "..") > 0 then
checkisUrl = false
end if
end function
%>
<%
%>
<%
if checkisUrl(request("u"))=true then
%>恭喜,你的URL通过!
%>
%>恭喜,你的URL通过!
%>
页面来路:
上面的东东很重要:如果有这样的网页:http://www.abc.com/aaa.asp?id=7,那么,我以后可以直接在浏览器中键入http://www.abc.com/aaa.asp?id=7或http://www.abc.com/aaa.asp?id=8 等等,那么就没有什么保密而言了。加上面那句判断就OK了:如果Request.ServerVariables("HTTP_REFERER")=空 则非法!再加上主机名字符是否存在的判断,就更完美了。思路如下:
如果 Request.ServerVariables("HTTP_REFERER")<>"" 那么
如果 instr(Request.ServerVariables("HTTP_REFERER"),"主机域名")<1 那么非法
执行“非法”指令
否则
执行“合法”指令
结束判断 (即:从别的页面做个“http://www.abc.com/aaa.asp?id=8”的链点也不行)
否则
执行“合法”指令
结束判断。
上面用的是ASP语言的思路,其他语言的思路是一样的。
< %=Request.ServerVariables("HTTP_REFERER") %>
上面的东东很重要:如果有这样的网页:http://www.abc.com/aaa.asp?id=7,那么,我以后可以直接在浏览器中键入http://www.abc.com/aaa.asp?id=7或http://www.abc.com/aaa.asp?id=8 等等,那么就没有什么保密而言了。加上面那句判断就OK了:如果Request.ServerVariables("HTTP_REFERER")=空 则非法!再加上主机名字符是否存在的判断,就更完美了。思路如下:
如果 Request.ServerVariables("HTTP_REFERER")<>"" 那么
如果 instr(Request.ServerVariables("HTTP_REFERER"),"主机域名")<1 那么非法
执行“非法”指令
否则
执行“合法”指令
结束判断 (即:从别的页面做个“http://www.abc.com/aaa.asp?id=8”的链点也不行)
否则
执行“合法”指令
结束判断。
上面用的是ASP语言的思路,其他语言的思路是一样的。
- ASP判断来路页面
- asp 判断当前的文件名以及页面来路
- 判断来路执行跳转
- 域名来路判断
- 通过js判断访问请求来路进行页面跳转的示例
- 如何利用JS判断当前来路域名并跳转到指定页面
- 利用javascript判断搜索引擎来路
- ASP 伪造访问来路 HTTP_REFERER
- asp.net伪造网页来路
- PHP 判断来路及提交表单
- JS判断搜索引擎来路跳转代码:
- 网站浏览器来路判断进行站点切换
- 如何根据来路做页面跳转
- ASP cookies页面判断代码
- ASP根据IP来判断跳转页面
- Asp.net 判断页面是否提交
- ASP.NETMVCView页面内判断是否登录
- PHP和JS判断搜索引擎来路跳转代码分析
- 数据库缓存依赖
- 随用随关,释放资源
- S60 3rd MMP CAPABILITY
- 将位图写入磁盘
- 还原WSS3.0内容数据库时碰到"OnRestore事件失败"
- ASP判断来路页面
- 猪八戒学做网站之HTML5篇(6):标签!标签!
- 初学 php 连接mysql数据库
- UNICODE编码细节
- POSIX下的串口编程
- 如何提高程序的可交互性
- 多线程调试信息的打印
- Hibernate学习小结(二)――Hibernate正向工程hbm2ddl
- 把label的文本值 拖到TextBox