Gossamer Forum
Home : Products : Links 2.0 : Customization :

New linkdead.cgi

Quote Reply
New linkdead.cgi
I have Installed new LINK DEAD MOD
But when I klicked Report a deadlink link I get this error
CGI ERROR
==========================================
Error Message : fatal error: Undefined subroutine &main::site_html_deadlink_mail called at linkdead.cgi line 93.

Script Location : linkdead.cgi
Perl Version : 5.00503

Form Variables
-------------------------------------------

Environment Variables
-------------------------------------------
DOCUMENT_ROOT : /web/sites/155/laksearch/www.laksearch.f2s.com
GATEWAY_INTERFACE : CGI/1.1
HTTP_ACCEPT : image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, application/x-comet, application/pdf, */*
HTTP_ACCEPT_ENCODING: gzip, deflate
HTTP_ACCEPT_LANGUAGE: en-us
HTTP_CONNECTION : Keep-Alive
HTTP_HOST : www.laksearch.f2s.com
HTTP_REFERER : http://www.laksearch.f2s.com/cgi-bin/search.cgi?query=web
HTTP_USER_AGENT : Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt)
PATH : /usr/local/bin:/usr/bin:/bin
QUERY_STRING : ID=25&URL=http://mackstation.gq.nu&Title=MACKstation&Category=Information/Sri_lanka
REMOTE_ADDR : 202.21.35.236
REMOTE_HOST : modem36.bayrac.eureka.lk
REMOTE_PORT : 4010
REQUEST_METHOD : GET
REQUEST_URI : /cgi-bin/linkdead.cgi?ID=25&URL=http://mackstation.gq.nu&Title=MACKstation&Category=Information/Sri_lanka
SCRIPT_FILENAME : /web/sites/155/laksearch/www.laksearch.f2s.com/cgi-bin/linkdead.cgi
SCRIPT_NAME : /cgi-bin/linkdead.cgi
SERVER_ADDR : 194.106.33.35
SERVER_ADMIN : support@freedom2surf.net
SERVER_NAME : www.laksearch.f2s.com
SERVER_PORT : 80
SERVER_PROTOCOL : HTTP/1.1
SERVER_SOFTWARE : Apache/1.3.12 (Unix)

Here Is My linkdead.cgi Please check it, I dont know where is this error So please check this.

#!/usr/bin/perl
# -------------
# Links
# -------------
# Links Manager
#
# File: linkdead.cgi
# Notifies the webmaster of a deadlink
# Author: Glenn Utteridge
# Based on and designed to be used with
#Links 2 by: Alex Krohn
# Email: alex@gossamer-threads.com
# Web: http://www.gossamer-threads.com/
# Version: 2.0
#
# (c) 1998 Gossamer Threads Inc.
#
# This script is not freeware! Please read the README for full details
# on registration and terms of use.
# =====================================================================
#
#
# Setup:
# Make sure the require statement below points to the config file.
eval {
($0 =~ m,(.*)/[^/]+,) && unshift (@INC, "$1"); # Get the script location: UNIX /
($0 =~ m,(.*)\\[^\\]+,) && unshift (@INC, "$1"); # Get the script location: Windows \

require "/web/sites/155/laksearch/www.laksearch.f2s.com/cgi-bin/admin/links.cfg"; # Change this to full path to links.cfg if you have problems.
require "$db_lib_path/db_utils.pl";
require "$db_lib_path/links.def";
$build_use_templates ?
require "$db_lib_path/site_html_templates.pl" :
require "$db_lib_path/site_html.pl";
};
if ($@) {
print "Content-type: text/plain\n\n";
print "Error including libraries: $@\n";
print "Make sure they exist, permissions are set properly, and paths are set correctly.";
exit;
}

# ========================================================

eval { &main; }; # Trap any fatal errors so the program hopefully
if ($@) { &cgierr("fatal error: $@"); } # never produces that nasty 500 server error page.
exit; # There are only two exit calls in the script, here and in in &cgierr.

sub main {
# --------------------------------------------------------
# Sends an email to the admin, letting him know that there is a dead link.

my %in = &parse_form();

# Check to make sure that there is an admin email address defined.
$db_admin_email or &cgierr("Admin Email Address Not Defined in config file!");

my $to = $db_admin_email;
my $from = $in{$db_cols[$db_contact_email]};
my $subject = "Deadlink ID number: $in{'ID'}\n";
my $msg = qq|
The following link is reported to be dead:

ID number: $in{'ID'}
Site title: $in{'Title'}
Site URL: $in{'URL'}
Category: $in{'Category'}

To check the link, please go to:
$db_cgi_url/jump.cgi?ID=$in{'ID'}

Or to delete the link please go to:
$db_cgi_url/$db_script_path/admin.cgi?db=links&ID=$in{'ID'}&Title=&URL=&Date=&Category=---&Description=&Contact+Name=&Contact+Email=&Hits=&isNew=---&isPopular=---&Rating=&Votes=&ReceiveMail=---&Graphic=&Gwidth=&Gheight=&Priority=---&Password=&MonthHits=&isMonthPopular=---&DateAdded=&keyword=&mh=10&sb=---&so=ascend&delete_form=Search&delete=$in{'ID'}



Sincerely,

Visitor.
|;

# Then mail it away!
require "$db_lib_path/Mailer.pm";
my $mailer = new Mailer ( { smtp => $db_smtp_server,
sendmail => $db_mail_path,
from => $from,
subject => $subject,
to => $to,
msg => $msg,
log => $db_mailer_log
} ) or return;
$mailer->send or return;
print &site_html_deadlink_mail;
}



Quote Reply
Re: New linkdead.cgi In reply to
And also I have get this type of E-mail

The following link is reported to be dead:

ID number: 12
Site title: Lanka 2000.com
Site URL: http://www.lank2000.com
Category: Internet/Webdesign

To check the link, please go to:
http://www.laksearch.f2s.com/cgi-bin/jump.cgi?ID=12

Or to delete the link please go to:
http://www.laksearch.f2s.com/...Search&delete=12




Sincerely,

Visitor.




Quote Reply
Re: New linkdead.cgi In reply to
Hi,

Glenn just updated the linkdead.cgi. It works for me now.

Grab it.

Good luck.

George

Quote Reply
Re: New linkdead.cgi In reply to
did you go into site_html_templates.pl and add what you were suppossed to? cause that is why you got that error of Undefined subroutine &main::site_html_deadlink_mail called at linkdead.cgi line 93. and did you make a "mailcomplete.html" and putit into the templates folder?

I changed the:
Or to delete the link please go to:
$db_cgi_url/$db_script_path/admin.cgi?db=links&ID=$in{'ID'}&Title=&URL=&Date=&Category=---&Description=&Contact+Name=&Contact+Email=&Hits=&isNew=---&isPopular=---&Rating=&Votes=&ReceiveMail=---&Graphic=&Gwidth=&Gheight=&Priority=---&Password=&MonthHits=&isMonthPopular=---&DateAdded=&keyword=&mh=10&sb=---&so=ascend&delete_form=Search&delete=$in{'ID'}

to:
Or to delete the link please go to:
$db_dir_url/admin.cgi?db=links&ID=$in{'ID'}&Title=&URL=&Date=&Category=---&Description=&Contact+Name=&Contact+Email=&Hits=&isNew=---&isPopular=---&Rating=&Votes=&ReceiveMail=---&isPick=---&keyword=&mh=10&sb=---&so=ascend&delete_form=Search


Quote Reply
Re: New linkdead.cgi In reply to
 
Thanks. Thank you very much. Now it is working fine.
Without your help I dont know what to do
Thanks again.

Quote Reply
Re: New linkdead.cgi In reply to
Glad it's working now. Also I'll be posting another version of the deadlink script today or tommorrow. It will log IP's to a logfile. It'll only email a deadlink from someone once.

Quote Reply
Re: New linkdead.cgi In reply to
Heya Glennu,

Just a thought but if you put that in you might find that you're losing some valuable input from those kindly people that are going through and looking at a lot of your site and finding many dead links...

Small suggestion though, how about you incorporate the stuff MOD'd into the jump.cgi that checks ahead to see if a link is dead and getting it to let you (aka the site admin) know automatically (once per link) if it's dead, rather than relying on the user to tell you. Just a thought but if you work out how to do it, then one that I'm sure would be pretty useful to most folks...

Hope that nugget of inspiration proves fruitful.
Smile
Martin

Quote Reply
Re: New linkdead.cgi In reply to
Thanks for the useful suggestions I'll definitly have look at into it because in theory it shouldn't be too hard to do.

I thought about using the log incase any visitors are annoying and mail a deadlink repeatedly.

I'm still not sure wether I'll include the IP log yet. Idealy I'd want it so that it checks the ID number matches before checking the IP. That way people would be able to mail more than one deadlink site.

Like you said though it would be great to put something in jump.cgi

I have a problem at the moment in that I don't have LWP installed on my server.



Cheers

Glenn

Quote Reply
Re: New linkdead.cgi In reply to
Smile

Glad the ideas were useful. It sounds like the idea of checking for previous ID then IP records would be a useful idea if you implement it the way you mentioned.

Given the automatic jump.cgi idea, one thing I would be interested in is something that takes the process one stage further.

ie: Any links that the automatic deadlink reporter detects are marked up as dead with a little icon or text message next to it. The 404.cgi script could also be altered to check the reported dead links database so that it would tell the user (this link has already been reported broken)

That would add a major set of functions to the program and MOD but again, it'd be a boon to reducting the admin time required.

Sadly, exam revision is stopping me from doing anything about this lot myself but I hope the suggestions and ideas are inspiring for someone.

Martin


The impossible we can handle now
Miracles take a little longer
Quote Reply
Re: New linkdead.cgi In reply to
That would be a very useful mod.

Yeah I've got a similar problem at the moment. Due to finishing a placement in 2 weeks I have to complete loads of work plus submit a large report.

As much as I'm enjoying using Links 2, I think the work is going to have to come first!


Good luck in your exams.


Glenn

Quote Reply
Re: New linkdead.cgi In reply to
Ok, I've done some amendments and I've created a MOD that does the following:

1. Checks the link using LWP
2. Checks to see if the page has already been reported as dead
3. redirects any errors to a 404.html page, emails the admin with link ID and URL if not already notified

I'll sort out the MOD and post it tonight after I get home and have a chance to write it up properly.

Oh and much credit should go to:

Email : debot@xs4all.nl
Homepage : http://fscripts.hypermart.net/

... who wrote the original 404 mod. #

All I've done is incorporate it directly into the jump.cgi script and add the email function in.

Like I said I'll write it up tonight...

The impossible we can handle now
Miracles take a little longer
Quote Reply
Re: New linkdead.cgi In reply to
I was trying to do the same thing, only load up a 404 message that includes a few details about the site they tried to access and a suggestion to try again later.

--Drew
Quote Reply
Re: New linkdead.cgi In reply to
Ok, as promised the MOD has been written and is now online and available...

You can get the info and file at:

http://www.websnail.org/scripts/404-report.html

There's even a copy of the modified jump.cgi in there in case you just want to replace your existing jump.cgi (keep a backup please)

Let me know if you hit any problems but bear in mind that exam revision is taking precedence..

Cheers folks

Martin




Quote Reply
Re: New linkdead.cgi In reply to
I just tried to install your 404 mod. I am getting the following error:

Error including libraries: (Maybe you didn't strip carriage returns after a network transfer?)

Make sure they exist, permissions are set properly, and paths are set correctly.Content-type: text/plain

Error: No link specified!



I transferred the files in ASCII. What could I be doing wrong?

Richard Bilger
RBilger@MERGInet.com
MERGInet Medical Resources
http://www.merginet.com
Quote Reply
Re: New linkdead.cgi In reply to
Hi,

Sorry, not sure as to what's gone wrong there.. You do need to have the LWP library though otherwise the system won't work...

Unfortunately (for you at least) I'm off on hols for a week now so I can't help sort it out but if you can private post me the exact error I can see what I can do when I get back...

Martin

The impossible we can handle now
Miracles take a little longer
Quote Reply
Re: New linkdead.cgi In reply to
 
Well, i installed the mod (using your jump.cgi that came within the zip file, and it worked fine.. I mean it really worked good..

...But then... I noticed i was getting a large amount of emails coming in.. Sites were being reported 404 even if they were not.. Not all sites mind you.. 95% of the time i would say the script is working fine.. But it is assuming some sites are 404 for whatever reason..

I loged into my site, and clicked on a link that was reported 404, and sure enough, i COULD NOT connect to it just like the email said.. But then i removed your "jump.cgi" and placed my old one back, and clicked the same link - and guess what.. I COULD CONNECT to the site..

So, as to not be deleting sites from my listings with the excuse that they are 404 - even though they really are not, i have replaced my old jump.cgi, and reporting it here in hopes that someone can figure out why that may have been happening, and supply some sort of fix for it....

Quote Reply
Re: New linkdead.cgi In reply to
Was the problem that Conan was having ever corrected?

Thanks.

DT