Limit an IP access only once, now share the ASP code to everyone:
<% '/////////////////////////////////////////////////////'/////function: One IP address is only allowed to access this page once/////reference:<!--#include f Ile= "check_ip.asp"-->//'////'/////////////////////////////////////////////////////' Response.Charset = 936 ' setting Output encoding for Simplified Chinese ' response.buffer = False ' Close buffer Dim fso,ts,iplist,cfs ' Set Cookies function Setcookie () Response.Cookies ( "Isbrow") = "Brow" Response.Cookies ("Isbrow"). Expires = date+365 End Function ' records IP address functions function Writeip (FileName, ipaddress) Set Fso = Server.CreateObject ("Script Ing. FileSystemObject ") Set ts = fso.opentextfile (Server.MapPath (FileName), 8,true) ts. WriteLine IPAddress ts. The close Set ts = The Nothing Set FSO = the Nothing End Function ' reads IP address functions function readiplist (FileName) Set fso = Server.crea Teobject ("Scripting.FileSystemObject") If not Fso.fileexists (Server.MapPath (FileName)) Then CreateFile ("Iplist.txt" The Exit Function end If Set ts = fso.opentextfile (Server.MapPath (FileName)) IPList = ts. ReadAll ts. Close Setts = Nothing Set fso = no readiplist = IPList End Function ' Create file functions function CreateFile (FileName) Set fso = Ser Ver. CreateObject ("Scripting.FileSystemObject") Set cfs = Fso.createtextfile (Server.MapPath (FileName)) Cfs.close Set cfs = N othing Set Fso = Nothing End Function ' closes the current IE window function (Note: IE6 is passed, other browsers are not tested) function CloseWindow () ' Response.Write ' <SCR Ipt>window.location= ' Javascript:window.opener=null;window.close (); ' </script> "Response.Redirect" http://www.baidu.com "end Function Ip = Request.ServerVariables (" remote_addr ") ' Get Browser IP Address cookie = request.cookies ("Isbrow") ' Get current cookies ' Response.Write cookie If request.servervariables ("Http_x_for
Warded_for ") <>" "Then Response.Write" This site is not allowed to use proxy access "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 setc
Ookie () End If End If%>
The above is to share to everyone's ASP implementation code, I hope to help you learn.