View Full Version : blocking IP's

09-19-2005, 01:58 AM
Strange question I know, but is there any way I can block certain IP's from visiting a website (a paid host, not my own machine!).

On a slightly different angle, most ISP's block certain ports because they are known to be trouble in terms of spreading worms and virii etc. Should web hosts adopt a similar attitude, and if so, is it possible for a host to easilty bloack access to their servers on particular IP's?

I speak from the perspective of someone who's sick of clearing spam from a guestbook that's been left there by some kind of script (related to freeyaho.com - don't visit the site unless you are NOT still using the MSVM, and are reasonably well protected, including a pop-up blocker. It's dodgy, and I don't know what it's serving up altogether), and have recently found that someones taken to signing up to my phpbb2 forum just to leave a spam website as their profile homepage. I'm sure that someone somewhere knows where this stuff tends to come from.

09-19-2005, 02:01 AM
You can use .htaccess to block IP's. You would do something like this -

order allow,deny
deny from
allow from all

Where the IP is their IP of course.

You can do a range of IP's I think but I've forgotten how to do that. Be careful though, you may block innocent users.

09-19-2005, 10:32 AM
You can do it via .htaccess or PHP. Only thing with PHP is you have to include the script on every page.

09-19-2005, 01:51 PM
did you check they always use the same IP? or are you planing on denying IP-ranges?
it would surprise me that they'd use a fixed IP.

and are you trying to prevent these users from accessing your site, or that they can automatically post to your guestbook? automatic posts can be prevented by using a security-image they need o type over. This is fairly simple. trying to prevent people from posting, without using a loginform and strict rules about creating an account (like: they need to post a request by tradidional mail, or they need to be refered by a trusted user or something like that) is a lott harder.

if they always post the same or similar messages, then you can build some sort of filter to detect and block them, but else, i think your best option is to set up a convinient admin-screen that shows all new entrys with an option to validate or delete them.

09-20-2005, 01:13 AM
I haven't yet checked the IP's on the latest lot of spam recieved if I'm honest. I did check the webstats for referrers just quickly though, one of which was quite literally "xxxx://xxxxxxxx.xxx", which is quite obviously a little suspicious.

On the previous bout of guestbook spam, it did all seem to come from the same few web pages...


...though they all seem to point to the same thing these days - they used to point to various pages of odd looking submission forms that repeated across the screen.
(treat these links just as the one gave originally - with caution)

Oh well. It looks like I may just have to learn php after all (not really got the time for learning php right now, but if needs must...).