Print Page | Close Window

IP banning?

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=4967
Printed Date: 29 March 2026 at 1:25pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: IP banning?
Posted By: Aumuz
Subject: IP banning?
Date Posted: 12 August 2003 at 1:13pm

I have just made a IP baner for my site, and I was wondering if this was a good methode of doing it...

SQL_config_ipban="SELECT table_config_ipban.* FROM table_config_ipban WHERE db_ipban_number='" & set_user_IP & "';"

site_record.Open SQL_config_ipban, site_data_base
 if not site_record.EOF then
  if site_record("db_ipban_ID") > 0 then
   response.redirect "error.asp"
  end if
 end if 
site_record.close

This works well, but I want to know if this could cause any problems, or if there is a better way of doing it.




Replies:
Posted By: ljamal
Date Posted: 12 August 2003 at 11:20pm
I would suggest separating the IP Address into its numeric component as it would make the look up faster or even better making it a single numeric string replacing the missing digits with 0 so 4.3.2.1 would become 4003002001.

-------------
L. Jamal Walton

http://www.ljamal.com/" rel="nofollow - L. Jamal Inc : Web/ Print Design and ASP Programming


Posted By: Aumuz
Date Posted: 13 August 2003 at 6:53am
Ok, thanks.


Posted By: Aumuz
Date Posted: 13 August 2003 at 6:56am

Question:

What should I do to people I ban from my site? Send them to a "error.asp" and tell them why they were banned? Send them to a "error.asp" and say the site is experiancing problems? Send them to a blank page? Send them to MSN,Google or Yahoo?

What would be best to do?



Posted By: ljamal
Date Posted: 13 August 2003 at 9:17am
I send banned people to an error page.

-------------
L. Jamal Walton

http://www.ljamal.com/" rel="nofollow - L. Jamal Inc : Web/ Print Design and ASP Programming


Posted By: Aumuz
Date Posted: 13 August 2003 at 9:30am

In general what does it say?

"You have been banned."

"Error on page."

I mean, should I let people know that they have been banned, or should I try to make them think there is a error?



Posted By: ljamal
Date Posted: 13 August 2003 at 9:55am
A general error is always better as you had a reason to ban someone and giving them a general error will make them think there is a problem with the site rather than them. If they believe there is a problem with the site they are less likely to return and/or continue to return. However, even DSL and Cable users occasionally get IP address changes, so you want to keep it general enough so that another visitor will be inclined to email you about not being able to access the site if they happen to have a banned IP.

-------------
L. Jamal Walton

http://www.ljamal.com/" rel="nofollow - L. Jamal Inc : Web/ Print Design and ASP Programming


Posted By: Aumuz
Date Posted: 13 August 2003 at 10:00am
Ok thanks.


Posted By: MorningZ
Date Posted: 13 August 2003 at 11:13am

and also a note.. banning a specific IP wont block a lot of people as there are people who are on dialup or dont have a static IP on broad band.. so all they would do is disconnect and reconnect and their IP is now different.....

what i do is "mask" it a bit... for example:

Dim strBanList    'Pipe delimited list of banned IP ranges
Dim strUserIP
strBanList = '208.123.12|23.12.12.3|205.121'
strUserIP = Request.ServerVariables("REMOTE_HOST")

For each item in Split( strBanList, "|" )
    if Left( strUserIP, Len(item) ) = item then
        Response.Redirect("/somefolder/error.asp")
    end if
Next

And i also take the route of not flat out telling someone they are "banned", i make it seem like something is wrong with the site



-------------
Contribute to the working anarchy we fondly call the Internet


Posted By: Aumuz
Date Posted: 13 August 2003 at 11:34am
ok thanks!


Posted By: justme
Date Posted: 11 June 2006 at 8:04am

I modified the code a little so banned people would get sent to the FBI most wanted page. LOL

Enjoy
 

<%@ Language=VBScript %>

<%

Response.Buffer = True

Dim strBanList 'Pipe delimited list of banned IP ranges

Dim strUserIP

Dim item, strURL

strURL = "http://www.fbi.gov/mostwant.htm" ' modify this line for target

strBanList = "xx.xx|xx.xx"

strUserIP = Request.ServerVariables("REMOTE_HOST")

For each item in Split( strBanList, "|" )

if Left( strUserIP, Len(item) ) = item then

Response.Redirect(strURL)

end if

Next

%>




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net