htaccess Elite

.htaccess tutorial


All times are UTC [ DST ]





Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Block images from an outside domain?
PostPosted: 27 Jan 2008 17:42 
Offline

Joined: 27 Jan 2008 17:25
Posts: 3
Hi,
Spammers are hitting a couple of forums I administer and I'd like to at least block the images that they're putting in the posts (the forums are PHPBBs and the spammers are using BBCode to place the remote images). Is there a way to block images from another server using htaccess? I'd need to do it using the domain names rather than IPs which probably change.
It's kind of the opposite of blocking hotlinking so it seems like it should be possible but I've been unable to find info.
Thanks!
Albo


Top
 Profile  
 
 Post subject:
PostPosted: 30 Jan 2008 01:58 
Offline

Joined: 30 Oct 2006 19:55
Posts: 99
You would have to block that using phpbb. They are just linking to an image, so you have to disallow linking to an image thats not on your site.


Top
 Profile  
 
 Post subject:
PostPosted: 30 Jan 2008 22:16 
Offline

Joined: 27 Jan 2008 17:25
Posts: 3
Thanks. I haven't been able to find any way to do that within PHPBB or any of the mods I've added, and extensive searching at phpbb.com hasn't turned up anything helpful. Any suggestions as to where that info might be found would be greatly appreciated!
Albo


Top
 Profile  
 
 Post subject:
PostPosted: 01 Feb 2008 02:53 
Offline
User avatar

Joined: 25 Sep 2006 04:48
Posts: 242
Image
Image


Top
 Profile  
 
 Post subject:
PostPosted: 01 Feb 2008 03:10 
Offline
User avatar

Joined: 25 Sep 2006 04:48
Posts: 242
albo wrote:
Thanks. I haven't been able to find any way to do that within PHPBB or any of the mods I've added, and extensive searching at phpbb.com hasn't turned up anything helpful. Any suggestions as to where that info might be found would be greatly appreciated!
Albo


Ok so a quick hack I just tested..

This code allows images that start with http://www.htaccesselite.com and deletes all others.

To use it, edit the file viewtopic.php and search for
Code:
$message = str_replace("\n", "\n<br />\n", $message);

and then paste the following directly under it.
Code:
$message=preg_replace('@<img src="http://www\.htaccesselite\.com([^>]*?)>@si','<img class="iok" src="http://www.htaccesselite.com\\1>',$message);
$message=preg_replace('@<img src="[^>]*?>@si',"",$message);


Your welcome, I hate spammers too :)


Top
 Profile  
 
 Post subject:
PostPosted: 01 Feb 2008 17:01 
Offline

Joined: 27 Jan 2008 17:25
Posts: 3
Damn - that's great! I just stuck it in there and it works like a charm. I'm going to post it to the "Requests for Mods" board on phpbb.com and see if some one wants to make a quick little official mod from it - maybe with a control panel in the admin area and the ability to allow images from specific outside sites.
You're a hero, buddy - thanks!
Albo


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB