用asp脚本实现限制IP访问
更新时间:2007年06月06日 00:00:00 作者:
cookies跨不了域很麻烦,有了这个脚本就方便多了.
<%
ip=Request.ServerVariables("REMOTE_ADDR")
set Fso=CreateObject("Scripting.FileSystemObject")
Set Files=Fso.OpenTextFile(server.mappath("./ip.txt"),1,false)
data=files.readall
files.close
set fso=nothing
if InstrRev(data, ip, -1, 0) = 0 then
set Fso=CreateObject("Scripting.FileSystemObject")
Set File=Fso.OpenTextFile(server.mappath("./ip.txt"),8,true)
file.writeline ip
file.close
set fso=nothing
response.write "此IP今天第一次访问该页面"
response.end
else
response.write "此IP以前访问过了"
response.end
end if
%>
<%
ip=Request.ServerVariables("REMOTE_ADDR")
set Fso=CreateObject("Scripting.FileSystemObject")
Set Files=Fso.OpenTextFile(server.mappath("./ip.txt"),1,false)
data=files.readall
files.close
set fso=nothing
if InstrRev(data, ip, -1, 0) = 0 then
set Fso=CreateObject("Scripting.FileSystemObject")
Set File=Fso.OpenTextFile(server.mappath("./ip.txt"),8,true)
file.writeline ip
file.close
set fso=nothing
response.write "此IP今天第一次访问该页面"
response.end
else
response.write "此IP以前访问过了"
response.end
end if
%>
相关文章
在asp中使用js的encodeURIComponent方法
encodeURIComponent 方法返回一个已编码的 URI。如果您将编码结果传递给 decodeURIComponent,那么将返回初始的字符串2012-03-03
asp下实现代码的“运行代码”“复制代码”“保存代码”功能源码
下面的代码是通过字符替换的方法,不是正则表达式2008-12-12
ASPWebPack(整站文件备份系统) v1.0.2 黑客也用
ASPWebPack(整站文件备份系统) v1.0.2 黑客也用...2007-10-10


最新评论