濮阳杆衣贸易有限公司

主頁 > 知識庫 > asp實現(xiàn)限制一個ip只能訪問一次的方法

asp實現(xiàn)限制一個ip只能訪問一次的方法

熱門標簽:鄭州語音電銷機器人官網(wǎng) 微信地圖標注有什么用 重慶外呼電銷系統(tǒng)費用 不封卡外呼系統(tǒng)一般多少錢 濰坊呼叫中心外呼系統(tǒng)供應(yīng)商 北京大興區(qū)地圖標注 電銷機器人一個多少錢 地圖標注中心多少錢注冊 地圖標注不完整被罰款

限制一個ip只能訪問一次,現(xiàn)在將asp代碼分享給大家:

% 
'///////////////////////////////////////////////////// 
'// // 
'//作用:一個IP地址只允許訪問本頁一次 // 
'//引用:!-- #include file="Check_Ip.asp" --> // 
'// // 
'///////////////////////////////////////////////////// 

'Response.Charset = 936 '設(shè)置輸出編碼為簡體中文 
'Response.Buffer = false '關(guān)閉緩沖區(qū) 

Dim Fso,ts,IpList,Cfs 

'設(shè)置Cookies函數(shù) 
Function SetCookie() 
Response.Cookies("IsBrow") = "Brow" 
Response.Cookies("IsBrow").Expires = Date+365 
End Function 

'記錄IP地址函數(shù) 
Function WriteIp(FileName, IpAddress) 
Set Fso = Server.CreateObject("Scripting.FileSystemObject") 
Set ts = Fso.OpenTextFile(Server.MapPath(FileName),8,true) 
ts.WriteLine IpAddress 
ts.Close 
Set ts = Nothing 
Set Fso = Nothing 
End Function 

'讀取IP地址函數(shù) 
Function ReadIpList(FileName) 
Set Fso = Server.CreateObject("Scripting.FileSystemObject") 
If Not Fso.FileExists(Server.MapPath(FileName)) Then 
CreateFile("Iplist.txt") 
Exit Function 
End If 

Set ts = Fso.OpenTextFile(Server.MapPath(FileName)) 
Iplist = ts.ReadAll 
ts.Close 
Set ts = Nothing 
Set Fso = Nothing 
ReadIpList = Iplist 
End Function 

'創(chuàng)建文件函數(shù) 
Function CreateFile(FileName) 
Set Fso = Server.CreateObject("Scripting.FileSystemObject") 
Set Cfs = Fso.CreateTextFile(Server.MapPath(FileName)) 
Cfs.Close 
Set Cfs = Nothing 
Set Fso = Nothing 
End Function 

'關(guān)閉當前IE窗口函數(shù)(注:IE6下通過,其他瀏覽器未測試) 
Function CloseWindow() 
'Response.Write "script>window.location='javascript:window.opener=null;window.close();'/script>" 
Response.Redirect "http://www.baidu.com" 
End Function 

Ip = Request.ServerVariables("REMOTE_ADDR") '獲取瀏覽者IP地址 

Cookie = Request.Cookies("IsBrow") '獲取當前Cookies 
'Response.Write Cookie 

If Request.ServerVariables("HTTP_X_FORWARDED_FOR") > "" Then 
Response.Write "本站不允許使用代理訪問" 
Response.End() 
Else 
If Cookie = "Brow" Then 
CloseWindow() 
Else 
If Instr(ReadIpList("Iplist.txt"),Ip) > 0 Then 
CloseWindow() 
Else 
WriteIp "Iplist.txt" , Ip 
End If 
SetCookie() 
End If 
End If 
%>

以上就是分享給大家的asp實現(xiàn)代碼,希望對大家的學習有所幫助。

您可能感興趣的文章:
  • ASP.net做的IP訪問限制
  • 用ASP代碼實現(xiàn)對IP的訪問限制的代碼
  • Asp下實現(xiàn)限制IP訪問的程序代碼
  • 用asp腳本實現(xiàn)限制IP訪問
  • 推薦的用Asp實現(xiàn)屏蔽IP地址訪問的代碼
  • ADSI+ASP添加IP到IIS禁止訪問列表中
  • 記錄游客頁面訪問IP的簡易實現(xiàn)代碼 (asp.net+txt)
  • 通過ASP禁止指定IP和只允許指定IP訪問網(wǎng)站的代碼
  • Asp限制IP訪問 阻止某一個IP段禁止訪問本站的代碼

標簽:攀枝花 佛山 海南 汕頭 撫州 鶴崗 唐山 揭陽

巨人網(wǎng)絡(luò)通訊聲明:本文標題《asp實現(xiàn)限制一個ip只能訪問一次的方法》,本文關(guān)鍵詞  asp,實現(xiàn),限制,一個,只能,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《asp實現(xiàn)限制一個ip只能訪問一次的方法》相關(guān)的同類信息!
  • 本頁收集關(guān)于asp實現(xiàn)限制一個ip只能訪問一次的方法的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    财经| 鄂温| 东明县| 安岳县| 玛曲县| 绥棱县| 平泉县| 措勤县| 中超| 新竹市| 云浮市| 巴马| 乐东| 凤城市| 白朗县| 抚宁县| 嘉禾县| 灵台县| 尤溪县| 甘孜县| 黔西| 齐齐哈尔市| 改则县| 金川县| 盐津县| 望谟县| 遵义市| 富宁县| 仁寿县| 尚志市| 松桃| 垫江县| 舒城县| 双江| 淮滨县| 临沭县| 乌拉特前旗| 镇坪县| 遵化市| 鹿泉市| 锡林浩特市|