Birden fazla ip banlama
Block more than one IP address
We are going To block more than one IP address this time , by using an Array To store the IP addresses we can block more visitors If we need To .
Code :
<%
'Declare our variables
Dim strIP
Dim intBanned
Dim arrIP(1)
'these are our blocked IP addresses
arrIP(0) = "127.0.0.01"
arrIP(1) = "100.45.76.80"
'Get the users IP address
strIP = Request.ServerVariables("LOCAL_ADDR")
intBanned = 1
'Loop through the banned IP addresses
For i = 0 To intBanned
'display a message And Stop processing the page
If strIP = arrIP(intBanned) Then
Response.Write "You are blocked from this site"
Response.End
End If
Next
'a welcome message If IP Is OK
response.Write "Welcome To the site"
%>
---------------------------------------------------
Ban a user based On IP address
This example shows how To prevent a user accessing your website , As Long As you now their IP address . You can use this If you have trouble With certain users On your site.
Code
<%
'variables To store banned IP And the users IP
Dim strIP , strBannedIP
'this Is the banned IP address
strBannedIP = "127.0.0.1"
'Get the users IP address
strIP = Request.ServerVariables("LOCAL_ADDR")
'If users address Is the same As the banned IP address
'display a message
If strBannedIP = strIP Then
Response.Write "You are Not permitted To view this website"
'If usersa ddress Is different welcome message Is displayed
Else
Response.Write "welcome"
End If
%>![]()