Forum Moderators: phranque

Message Too Old, No Replies

'Tailoring' HTML pages for different IPs

One solution to website spam...

         

dwhite

5:08 pm on Jul 11, 2004 (gmt 0)

10+ Year Member



After months of spam problems, I'm considering banning someone from my site's forum. Only problem is - I'm worried that he might turn his attentions to elsewhere on my site (polls, guestbook etc. etc.). What I want is a short script to detect the IP for a certain range (example 123.456.7**), and if it matches, then to display another 'similar' HTML page - except of course without the ability to submit info (thus avoiding spam probs).

In other words, everyone sees one page, while users with a certain IP range see another HTML page. Ideally, I wouldn't have a seperate HTML page, just a part inside the HTML which acts like an "If Then Else" statement. So, what's the simplest way of going about this? PHP? Javascript? Perhaps even HTML?

[edited by: dwhite at 5:35 pm (utc) on July 11, 2004]

Raymond

5:28 pm on Jul 11, 2004 (gmt 0)

10+ Year Member



if instr(request.servervariables("REMOTE_ADDR"),"THE_IP_YOU_WANT _TO_BAN") then

response.redirect("http://www.xyz.com")
response.end
end if

save this in a .inc or .asp, then server side include it on your header page or every single page.

You can also have a list of banned IPs in an array and run through it in a loop. That works also.

dwhite

5:45 pm on Jul 11, 2004 (gmt 0)

10+ Year Member



Thanks for your reply.

Though I need to ban not just one IP, but a range of IPs (using a wildcard), since the spammer is not using a static IP.

Also, I don't want to use server side includes, because it would mean renaming every html page to "shtml" right?

Raymond

5:46 am on Jul 12, 2004 (gmt 0)

10+ Year Member



you can easily modify the script to match just a part of the IP. Any scripting language can do it. The above is just the basic idea of how to block them and channel them away from your site.

You can also put all IP ranges in a DB. Then you can use a query to filter the incoming IP.

I thought most third party boards come with IP blocking ability. What is yours?

dwhite

3:26 am on Jul 18, 2004 (gmt 0)

10+ Year Member



Thanks for your reply:

you can easily modify the script to match just a part of the IP. Any scripting language can do it. The above is just the basic idea of how to block them and channel them away from your site.

I'd be grateful if you could put some code together and post in this thread. Would it take long?

You can also put all IP ranges in a DB. Then you can use a query to filter the incoming IP.

Sounds a good idea, but I only need to use the banning code for a few pages on my site, so, code actually on the HTML page would be ideal.

I thought most third party boards come with IP blocking ability. What is yours?

You mean the forum I use? Well, phpBB certainly does (albeit it's a bit bugged). But I want to use this ban for standard html pages aswell as the forum.

Voltec

5:06 am on Jul 18, 2004 (gmt 0)

10+ Year Member



Reminds me of a time when I had a leach that had used 'Johnny the ripper' to penetrate my rather weak password of the time (yep, learned a lesson on that one) and wrecked havoc on my site. Well, I quicky changed all of my passwords to 'industrial strength' passes but he kept coming back and putting threats on my messageboard claiming he was going to re-hack it. I knew he couldn't but it was getting very old deleting his posts... but I couldn't track him due to his using a 'double-proxy'. Well, the funny thing about those, they stay the same. So, I created a quick script to re-direct him to FBI.gov when he came back... ;) (Oh, and I called the Admin of the server he was using to close the hole in his system). Well, when he came back with a different double-proxy IP, I just added that to the list and got that hole shut down on him as well. Didn't take him long to not come back... I never searched for one myself, but I have heard that double-proxies are time consuming to find.

Good luck on locking the idiot out.

Matt