Home : Products : Gossamer Links : Development, Plugins and Globals :

Products: Gossamer Links: Development, Plugins and Globals: Re: [mick31] Duplicate_Check: Edit Log

Here is the list of edits for this post
Re: [mick31] Duplicate_Check
Sorry, I got confused Crazy

In /admin/Plugins/Spider.pm, on about line 401, change;

Code:
# see if it exists, and if so, show a WARNING!
my $db_con = $DB->table("Links");
my $chk_dup = $db_con->count ( { URL => $_ } );
if ($chk_dup) {
$status = "<font color=red>WARNING: Link already exists!</font>";
} else {
$status = "<font color=blue>Ok....couldn't find in database...</font>";
}

...to....

Code:
my $db_con = $DB->table("Links");

my $url = $_;
my $url2 = $_;
$url2 =~ s/www\.//i;
my $url3 = $_;
$url3 =~ s,/$,,;

my $cond1 = GT::SQL::Condition->new('URL','LIKE',"$url%");
my $chk_dup1 = $db_con->count ( $cond1 );
my $cond2 = GT::SQL::Condition->new('URL','LIKE',"$url2%");
my $chk_dup2 = $db_con->count ( $cond2 );
my $cond2 = GT::SQL::Condition->new('URL','LIKE',"$url3%");
my $chk_dup3 = $db_con->count ( $cond3 );

# see if it exists, and if so, show a WARNING!
if ($chk_dup1 || $chk_dup2 || $chk_dup3) {
$status = "<font color=red>WARNING: Link already exists!</font>";
} else {
$status = "<font color=blue>Ok....couldn't find in database...</font>";
}

...also, at the top of the file, just below;

Code:
use CGI::Carp qw(fatalsToBrowser);

...you need to add;

Code:
use GT::SQL::Condition;

Hope that helps/works Smile

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!

Last edited by:

Andy: Dec 17, 2003, 3:21 AM

Edit Log: