PDA

View Full Version : Add-On Releases - Return to Sender - Redirect / Reject Visits From Certain Sites/IPs


dartho
08-31-2009, 10:00 PM
Make sure you check the NOTES section below!

This add-on allows you to specify domain names (or IP addresses) which you do not wish to accept links from. You have the choice to return a 404 message, redirect back to where they came (where they followed a link to your site from), display custom HTML, or redirect to another URL.

You could use this for a few different purposes. Say you suddenly get popular on slashdot or digg and your bandwidth is about to suffer - you can redirect all visitors that have clicked through on a link from said site to another URL, display them a "Too Busy" message, 404 them or just have them sent back to whence they came.

Say a dodgy site has links to your site, you could again 404, or display a "DO NOT WANT" message or just send them straight back to the referring page.

You can also just mess with people who have static IP addresses (partial addresses accepted).

Version Control
0.0.1 - Initial Release
0.0.2 - Fixed issue when having blank fields caused forum errors. Also made more lightweight (got rid of pregmatchs)
0.0.3 - Fixed another small bug
0.0.4 - OK - this time I fixed the bug :S

NOTES
WARNING

Do not test with your own IP address, or domain name! You will lock your self out of your forums and will have to disable hooks to reconfigure the addon.

Do not include leading HTTP:// or directory names - domain names (or partial) only!eg. use: evil-website.com , NOT http://evil-website.com and NOT http://evil-website.com/forum

To disable the hook/plugin system, edit your includes/config.php file and place the following code on the second line (immediately below <?php) To re-enable hooks, undo the edit!

define('DISABLE_HOOKS', true);

elenh
09-01-2009, 12:20 PM
thanks

TomHQ
09-01-2009, 12:57 PM
And all this time I was just using .htaccess. Thanks for the mod. :)

EDIT: Tested. Works like a charm!

DOUBLE EDIT: Do you think you can make it so if were using the custom HTML message and a user coming from a blocked site trys to access my site will have a cookie stored on their computer so the next time they try to access the site they'll get the page/error message again?

Bibbo
09-01-2009, 02:32 PM
Sounds good! *Downloaded*

l_amhed
09-01-2009, 06:45 PM
Really nice idea !!

TomHQ
09-01-2009, 07:10 PM
What is the syntax for multiple sites? I've tried the carriage return but that did not work.

dartho
09-01-2009, 10:03 PM
What is the syntax for multiple sites? I've tried the carriage return but that did not work.

Should be just a new line per site - try editing the "Trash Referals!" plugin and replace

$rtsbadrefs = explode("\r\n",$vbulletin->options['rts_bad_refs']);
$rtsbadips = explode("\r\n",$vbulletin->options['rts_ips']);


with


$crlf = chr(13).chr(10);
$rtsbadrefs = explode($crlf,$vbulletin->options['rts_bad_refs']);
$rtsbadips = explode($crlf,$vbulletin->options['rts_ips']);


let me know how that goes, thanks...

dartho
09-02-2009, 05:10 AM
Do you think you can make it so if were using the custom HTML message and a user coming from a blocked site trys to access my site will have a cookie stored on their computer so the next time they try to access the site they'll get the page/error message again?

Good idea - I'll look at adding this as an option also

4nawadir.com
09-02-2009, 11:23 AM
Great idea will be installed soon ...
Thanks

Megatr0n
09-02-2009, 01:33 PM
dartho, when I installed this plugin it fed my index page with errors. Something to do with unable to produce headers and referrences the init/class_core.php files.

I was also unable to access my AdminCP. So, I had to disable all the plugins to get back in and disable your plugin.

Any ideas?

dartho
09-02-2009, 09:36 PM
Sorry megatr0n - without a detailed error, I'm not sure. Did this happen when installed, after being enabled or after being enabled and being triggered by a bad IP/Domain/referrer?

PinkDaisy
09-02-2009, 09:49 PM
I installed this today and CAN NOT get in my forums at all. It comes up as Page Can't Be Displayed.

How can I UNinstall this if I can't even log in?? My forums have been down all day!

dartho
09-02-2009, 09:56 PM
To disable all plugins which should allow you to get back into your forum, you will need to edit your /includes/config.php file and add


define('DISABLE_HOOKS', true);

immediately after

<?php

which likely appears in the first line. You can this re-configure/disable/uninstall any addons

PinkDaisy
09-02-2009, 10:03 PM
Thank you!

dartho
09-02-2009, 10:08 PM
OK - found a bug of sorts which most likely is what caused Megatr0n and PinkDaisy's problems.

If you have the product enabled, you *must* have a domain listed, otherwise it will match all domains

Also, if you have IP addresses enabled - you must have at least one IP address listed - otherwise it will match all IP addresses

When writing it I guess I didn;t think that it would be enabled without actually listing criteria.

I'll get a new version up which won't trigger if no criteria are listed. 1st post updated with a warning

Megatr0n
09-06-2009, 03:47 PM
When, will the new version be released?

dartho
09-09-2009, 03:37 AM
This has now been updated to be more light weight and not cause forum errors when required fields are left blank.

Megatr0n
09-09-2009, 10:25 AM
dartho, I have just updated to next release and I get the same error when enabling it after.

dartho
09-10-2009, 11:05 AM
I'm really not sure Megatr0n - I've tested on a couple sites (live and test) and can;t get an error to trigger.

An exact error message might help, could be a clash with another add-on?

If you like, I could look at your site and get this working, but I'd need logon and FTP details etc - PM me if you want help.

Megatr0n
09-10-2009, 11:16 AM
Details sent.

Hi-Jack
09-12-2009, 09:30 AM
Get error as soon as this is actuvatred on 3.8.4

Warning: strpos() [function.strpos]: Empty delimiter in [path]/includes/init.php(304) : eval()'d code on line 148

Warning: strpos() [function.strpos]: Empty delimiter in [path]/includes/init.php(304) : eval()'d code on line 157

dartho
09-12-2009, 12:12 PM
bugger - wanna try it again with version 0.0.4 ?

ExplosiveGFX
09-12-2009, 10:54 PM
Great stuff!

/me clicks install

dartho
09-13-2009, 09:27 AM
Excellent. I've had confirmation that the latest version does indeed remove any known 'bugs' in the code.