用asp腳本實現(xiàn)限制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
%>
相關(guān)文章
Session.TimeOut的最大取值是1440,超出會報錯
Session.TimeOut的取值以分鐘為單位,最大取值是1440分鐘,也就是24個小時,如果給它賦一個更大的值2009-06-06ASPWebPack(整站文件備份系統(tǒng)) v1.0.2 黑客也用
ASPWebPack(整站文件備份系統(tǒng)) v1.0.2 黑客也用...2007-10-10asp 實現(xiàn)顯示所有的服務(wù)器變量值的函數(shù)
asp 實現(xiàn)顯示所有的服務(wù)器變量值的函數(shù)...2007-08-08asp中用insert into語句向數(shù)據(jù)庫插入記錄(添加信息)的方法
asp中用insert into語句向數(shù)據(jù)庫插入記錄信息的方法,學習的朋友可以參考下。2010-09-09