国产成人精品18p,天天干成人网,无码专区狠狠躁天天躁,美女脱精光隐私扒开免费观看

asp實(shí)現限制一個(gè)ip只能訪(fǎng)問(wèn)一次的方法

發(fā)布時(shí)間:2021-08-17 12:10 來(lái)源: 閱讀:0 作者:bacde 欄目: ASP 歡迎投稿:712375056

限制一個(gè)ip只能訪(fǎng)問(wèn)一次,現在將asp代碼分享給大家:

<% 
'///////////////////////////////////////////////////// 
'// // 
'//作用:一個(gè)IP地址只允許訪(fǎng)問(wèn)本頁(yè)一次 // 
'//引用:<!-- #include file="Check_Ip.asp" --> // 
'// // 
'///////////////////////////////////////////////////// 

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

Dim Fso,ts,IpList,Cfs 

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

'記錄IP地址函數 
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地址函數 
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  )建文件函數 
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窗口函數(注:IE6下通過(guò),其他瀏覽器未測試) 
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 "本站不允許使用代理訪(fǎng)問(wèn)" 
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實(shí)現代碼,希望對大家的學(xué)習有所幫助。

免責聲明:本站發(fā)布的內容(圖片、視頻和文字)以原創(chuàng )、來(lái)自本網(wǎng)站內容采集于網(wǎng)絡(luò )互聯(lián)網(wǎng)轉載等其它媒體和分享為主,內容觀(guān)點(diǎn)不代表本網(wǎng)站立場(chǎng),如侵犯了原作者的版權,請告知一經(jīng)查實(shí),將立刻刪除涉嫌侵權內容,聯(lián)系我們QQ:712375056,同時(shí)歡迎投稿傳遞力量。

久久综合激激的五月天| 天堂网2017天堂网| 国产精品女人呻吟在线观看| 领导边摸边吃奶边做爽在线观看| 亚洲中文字幕国产综合| 人妻无码一区二区不卡无码AV|