Bilgisayar Bölümü ASP Kod ve Script Arşivi

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) = ""
arrIP(1) = ""
'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"
End If
'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.


'variables To store banned IP And the users IP
Dim strIP , strBannedIP
'this Is the banned IP address
strBannedIP = ""
'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
Response.Write "welcome"
End If

ASP Kitabı


Faydalılar: Altın Fiyatları |Hediye Kolye | pırlanta fiyatları
Ana Sayfa  Sık Kullanılanlara Ekle   admin[at] | © 2006 - 2022