Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

Blacklist for Links SQL 1.x

Quote Reply
Blacklist for Links SQL 1.x
I'm trying to block a number of domains from submitting to my site. Is there a mod to do this. I've done a search but the only one I can find is for links 2.0. I've already done the db referers= thing, but apparently they've found a nice little way around this.

http://link-fabulous.com
Groovy adult links
Quote Reply
Re: Blacklist for Links SQL 1.x In reply to
The BLOCK URL Mod for Links 2.0 is easily portable to LINKS SQL v1.13 (and you could do more like creating a "Banned_Links" table that stores domains and IP addresses of "banned submissions").

But all you have to do to keep things simple is the following:

1) Add the following ARRAY to the Links.pm module:

Code:

$LINKS{block_urls} = ['DOMAIN1','DOMAIN2','DOMAIN3'];


Of course, replace DOMAIN1, DOMAIN2, DOMAIN3 with actual offending DOMAINs.

2) Then in the sub process_form routine in the add.cgi script:

Code:

my $url = $in->param('URL');
my $badurls = $url;
foreach $badurls (@{$CUSTOM{block_urls}}) {
if ($url =~ /$badurls/i) {
&site_html_add_failure({error => <li><b>$url</b> is not allowed in our directory due to excessive submissions or redirection problems. Please re-submit another web address.</li>
});
}
}


That's all to it...

Regards,

Eliot Lee
Quote Reply
Re: Blacklist for Links SQL 1.x In reply to
Would there be a problem if I tried adding this to links SQL 1.11?

http://link-fabulous.com
Groovy adult links
Quote Reply
Re: Blacklist for Links SQL 1.x In reply to
Nope...these codes were originally added in v.1.11.

Wink

Regards,

Eliot Lee
Quote Reply
Re: Blacklist for Links SQL 1.x In reply to
I've posted the code that I'm using below. I'm still getting the following error when I upload these files. Does anyone have any ideas on where I went wrong?



# The path to perl
$LINKS{path_to_perl} = "/usr/bin/perl";

# This be the blacklist for all the bad boys
$LINKS{block_urls} = ['yahoo.com','geocities.com','sexshare.com'];


# EMAIL SETTINGS
# --------------------------------------------------
# These are your emailing settings.

sub process_form {
# --------------------------------------------------------
my $url = $in->param('URL');my $badurls = $url; foreach $badurls (@{$CUSTOM{block_urls}}) { if ($url =~ /$badurls/i) { &site_html_add_failure({error => <li><b>$url</b> is not allowed in our directory due to excessive submissions or redirection problems. Please contact me if you think this is in error at webmaster@link-fabulous.com </li>}); } }

my ($in, $dynamic) = @_;
my ($found, $val, $key, $today, $rec, $id, $name, $category);


# Check the referer.



Server Error
This server has encountered an internal error which prevents it from fulfilling your request. The most likely cause is a misconfiguration. Please ask the administrator to look for messages in the server's error log.

Is there something I need to change?


http://link-fabulous.com
Groovy adult links
Quote Reply
Re: Blacklist for Links SQL 1.x In reply to
The codes I posted to go into the sub process_form NEED to go AFTER the REFERER CODES....

Code:

# Check the referer.
REFERER CODES...

THEN THE CODES I POSTED....


Got it?

Regards,

Eliot Lee
Quote Reply
Re: Blacklist for Links SQL 1.x In reply to
Here's what I added after your previous post:

# Check the referer.
if (@{$LINKS{db_referers}} and $ENV{'HTTP_REFERER'}) {
$found = 0;
foreach (@{$LINKS{db_referers}}) { $ENV{'HTTP_REFERER'} =~ /\Q$_\E/i and $found++ and last; }
if (!$found) {
if ($in->param('CategoryID')) {
$name = &get_category_name ($in->param('CategoryID'));
$category = "$name <input type=hidden name='CategoryID' value='" . $in->param('CategoryID') . "'>";
}
else {
$category = &get_category_list();
}
&site_html_error ( { error => "Auto submission is not allowed in this directory. Please visit the site to add your entry.", Category => $category, %in }, $dynamic);
return;
}
}


my $url = $in->param('URL');my $badurls = $url; foreach $badurls (@{$CUSTOM{block_urls}}) { if ($url =~ /$badurls/i) { &site_html_add_failure({error => <li><b>$url</b> is not allowed in our directory due to excessive submissions or redirection problems, or other [bleep!]. Please contact me if you think this is in error at webmaster@link-fabulous.com </li>}); } }

# Connect to the database.



---Now it's telling me that the page cannot be found.
when I refresh:
Software error:
[Fri Feb 16 17:14:30 2001] Links.pm: Can't modify predecrement in predecrement at admin/Links.pm line 230, near "} =" BEGIN failed--compilation aborted at /web1/tr002111/cgi-bin/goss/add.cgi line 33.
For help, please send mail to this site's webmaster, giving this error message and the time and date of the error. ;

when I refresh again:
Server Error
This server has encountered an internal error which prevents it from fulfilling your request. The most likely cause is a misconfiguration. Please ask the administrator to look for messages in the server's error log.

http://link-fabulous.com
Groovy adult links
Quote Reply
Re: Blacklist for Links SQL 1.x In reply to
Uh...try using the codes that are provided before adding your custom CODES!

[beep!] will NOT work! [ and ! are special Perl characters! DELETE THEM!

Regards,

Eliot Lee
Quote Reply
Re: Blacklist for Links SQL 1.x In reply to
Ok...I'm not getting errors anymore so we're making progress. Thanks by the way. Now the problem I'm having is that it's still allowing the banned domains from submitting. Is there a specific placement where I should put the banned domains. Here is where I have them now in Links.pm:

# This should be a path to the verify-child.pl
# Windows NT users may need to set path_to_perl as well
$LINKS{child_path} = "$LINKS{admin_root_path}/verify-child.pl";

# The path to perl
$LINKS{path_to_perl} = "/usr/bin/perl";

# This is the blacklist for all the bad boys
$LINKS{block_urls} = ['yahoo.com','geocities.com','sexshare.com'];


# EMAIL SETTINGS
# --------------------------------------------------
# These are your emailing settings.

http://link-fabulous.com
Groovy adult links
Quote Reply
Re: Blacklist for Links SQL 1.x In reply to
Uh...NO...there is NO special place.

let me guess, you have tried adding www.yahoo.com, right? Well, you may need to also add www before the domain names.

Goodbye.

Regards,

Eliot Lee
Quote Reply
Re: Blacklist for Links SQL 1.x In reply to
nope...used yahoo.com with the www. I guess your script doesn't work on my server. Maybe it's something weird on my end. Who knows.

Try it yourself:
http://link-fabulous.com/cgi-bin/goss/add.cgi

Something strange is happening on my end. Thanks for the help but I'm thinking something is wrong with your mod. The smartass crap isn't helping either. Maybe I'm wrong though.

http://link-fabulous.com
Groovy adult links
Quote Reply
Re: Blacklist for Links SQL 1.x In reply to
Uh...it is not a server issue...the codes should work in any server...they are simply strict Perl codes.

Trust me...it works!

Best of luck finding a solution!

Regards,

Eliot Lee
Quote Reply
Re: Blacklist for Links SQL 1.x In reply to
Eliot means you need to add both variations like:

$LINKS{block_urls} = ['yahoo.com','geocities.com','sexshare.com','www.yahoo.com','www.geocities.com','www.sexshare.com'];




Paul Wilson.
new - http://www.wiredon.net