用asp腳本實(shí)現(xiàn)限制IP訪問
更新時(shí)間:2007年06月06日 00:00:00 作者:
cookies跨不了域很麻煩,有了這個(gè)腳本就方便多了.
<%
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,超出會(huì)報(bào)錯(cuò)
Session.TimeOut的取值以分鐘為單位,最大取值是1440分鐘,也就是24個(gè)小時(shí),如果給它賦一個(gè)更大的值2009-06-06ASPWebPack(整站文件備份系統(tǒng)) v1.0.2 黑客也用
ASPWebPack(整站文件備份系統(tǒng)) v1.0.2 黑客也用...2007-10-10asp 實(shí)現(xiàn)顯示所有的服務(wù)器變量值的函數(shù)
asp 實(shí)現(xiàn)顯示所有的服務(wù)器變量值的函數(shù)...2007-08-08asp獲取當(dāng)前完整路徑(url)的函數(shù)代碼
這篇文章主要介紹了asp獲取當(dāng)前完整路徑(url)的函數(shù)代碼,有時(shí)候我么您需要獲取網(wǎng)址,端口、路徑文件名、參數(shù)等,這里就為大家分享一下這個(gè)函數(shù)代碼,需要的朋友可以參考下2020-02-02asp中用insert into語句向數(shù)據(jù)庫插入記錄(添加信息)的方法
asp中用insert into語句向數(shù)據(jù)庫插入記錄信息的方法,學(xué)習(xí)的朋友可以參考下。2010-09-09