加入收藏 | 设为首页 | 会员中心 | 我要投稿 银川站长网 (https://www.0951zz.com/)- 云通信、基础存储、云上网络、机器学习、视觉智能!
当前位置: 首页 > 站长学院 > Asp教程 > 正文

用asp脚本实现限制IP寻访

发布时间:2023-06-03 12:38:52 所属栏目:Asp教程 来源:
导读:cookies跨不了域很麻烦,有了这个脚本就方便多了.<%ip=Request.ServerVariables("REMOTE_ADDR")set Fso=CreateObject("Scripting.FileSystemObject")Set Files=Fso.OpenTextFile(server.mappath("./ip.txt"),1,false)

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

%> 

(编辑:银川站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章