欧美大屁股bbbbxxxx,狼人大香伊蕉国产www亚洲,男ji大巴进入女人的视频小说,男人把ji大巴放进女人免费视频,免费情侣作爱视频

歡迎來到入門教程網!

ASP編程

當前位置:主頁 > 網絡編程 > ASP編程 >

asp實現限制一個ip只能訪問一次的方法

來源:本站原創(chuàng)|時間:2020-01-11|欄目:ASP編程|點擊: 次

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

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

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

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 

'關閉當前IE窗口函數(注: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實現代碼,希望對大家的學習有所幫助。

上一篇:asp的SQL語句中and和or同時使用的注意事項

欄    目:ASP編程

下一篇:ASP中用select case代替其他語言中的switch case, default用case else

本文標題:asp實現限制一個ip只能訪問一次的方法

本文地址:http://mengdiqiu.com.cn/a1/ASPbiancheng/11372.html

網頁制作CMS教程網絡編程軟件編程腳本語言數據庫服務器

如果侵犯了您的權利,請與我們聯系,我們將在24小時內進行處理、任何非本站因素導致的法律后果,本站均不負任何責任。

聯系QQ:835971066 | 郵箱:835971066#qq.com(#換成@)

Copyright © 2002-2020 腳本教程網 版權所有