Gossamer Forum
Home : Products : Links 2.0 : Customization :

One minute mod......

Quote Reply
One minute mod......
I've just thrown together a little mod that will hopefully help reduce the number of deadlinks added to your database. It may have been done before but here it is anyway....

At the top of add.cgi add.....

use LWP::Simple;

under....

Code:
# Validate the form input..
$status = &validate_record(%in);
if ($status eq "ok") {
...add.....

Code:
my $check = $in{'URL'};
my $val = get($check);

$val or &site_html_add_failure("Could not connect to $check - seems to be inactive") and return;
Thats all there is to it!


Paul
Installations:http://wiredon.net/gt/
Support: http://wiredon.net/forum/

Quote Reply
Re: One minute mod...... In reply to
Yes...this was done before...

New LWP URL CHECKER
http://lookhard.hypermart.net/links-mods/

Bmxer wrote a Mod that checks for all status types (400, 500, etc.) and prints it in the add_error.html template file...

Regards,

Eliot Lee
Quote Reply
Re: One minute mod...... In reply to
I thought so....

The code above is much simpler than Bmxers though.

IMHO there is no real need to check for status codes - just a simple up or down is good enough for me.

Paul
Installations:http://wiredon.net/gt/
Support: http://wiredon.net/forum/

Quote Reply
Re: One minute mod...... In reply to
Yea...for the end-user...but I use a hacked version of Bmxer's codes in my Links SQL v1.3 scripts, which helps me to keep track of not found versus Internal Server Error messages of links within my directory....

Regards,

Eliot Lee
Quote Reply
Re: One minute mod...... In reply to
Yes I can see how that would be useful but the code above is used in add.cgi when someone submits a url, not for checking already existing links.

So it servers a slightly different purpose doesn't it.

Paul
Installations:http://wiredon.net/gt/
Support: http://wiredon.net/forum/

Quote Reply
Re: One minute mod...... In reply to
Right, but I do two things:

1) I have the Bmxer's codes in my ADD.CGI script as well...I am emailed when someone attempts to add a bad link for my records and having the specific error message helps.

2) Also, if users have problems adding their links, they can provide more detailed messages, than "I have problems adding links"...they can say something like,"I received the following error(s) when adding my link"...

Regards,

Eliot Lee
Quote Reply
Re: One minute mod...... In reply to
It should be simple enough to add to that code to do those things.
I may do that if I get the urge.

IO::Socket is probably the way to go to determine the error code and notify the webmaster or log it (or both).

The error code can then be passed to the error page to warn the submitter.

In essence it is very similar to my deadlink mod.



Paul
Installations:http://wiredon.net/gt/
Support: http://wiredon.net/forum/