Ok, i'm gonna put this in a zip for now at my site
http://lh.links247.net/downloads/verify Ok, If you aren't on a cobalt, read at least the first 60 lines. There are a few comments in those lines of things to change.
By default lwp is taken off. It doesn't run well with the script. At least when i tested it, every link came up bad, but with IO it was correct. But if you feel the need, in the zip is a nph-converter.cgi script. Upload the script to the same dir as nph-verify.cgi and chmod it correctly, then run it in the browser and the comments in front of the lwp parts will be taken off. I don't recommend it.
You will need to make an output folder in you admin folder, as well as an output/staggered folder (after you make the output folder, just go in it and make a staggered.); Chmod them to 777. Do not put any folders or files in them. The only things that can go in them is
for the output folder => 'staggered folder','index.htm(l)','reports'
for the staggered folder => 'index.htm(l)','staggered reports'
The reason there is a staggered folder is because, in the output folder, standard reports will be made here when running from telnet or cron. But when in staggered mode, every new page the browser goes to will input the bad links into the html pages incremently
. So in a standard telnet verify, all links will be verified on one page and you may have 20 bad links. But in staggered, they are split, and for each page that has bad links, those will be added to the report in the staggered folder.
I set it up to only show reports for 6 days, after that they will be deleted. This is the case for both staggered and telnet mode.
Oh btw... there are three modes
staggered => In the browser w/spanning, but auto refresh to the next page until the end like build staggered and prints report to output/staggered in the admin folder
telnet => from telnet screen automatically does all links at once, and prints report to output folder in the admin
standard => basically just a span of the links you verify. No report building. It's basically like in the admin when viewing all links, and its spanned except this will be verifying while showing you the bad links as well.
That should be about it.
I'm not too proud of the way I wrote the addon but i was working for speed and functionability more than easy on the eyes to look at
Definitely don't forget to change this line : # 45:
require "/home/sites/lh.links247.net/web/look-bin/Look/admin/links.cfg"; # Change this to full path to links.cfg if you have problems.
To your full path.
This is why i said to read about the first 60 lines.
in cobalt, certain things don't need to be printed so you'll see this
Code:
# print "HTTP/1.0 200 OK\n";
print "Content-type: text/html\n\n"; # Delete this and the above line and uncomment the lines below if you aren't on a cobalt.
# if ($ENV{'REQUEST_METHOD'}) { # Replace with these
# print "HTTP/1.0 200 OK\n"; # Replace with these
# print "Content-type: text/html\n\n"; # Replace with these
# }
Just follow the comments and it should be fine.
Oh and so it can run in telnet, add this to db_utils.pl
or if you don't have telnet, just add it anyway:
Code:
sub parse_form1 {
# --------------------------------------------------------
# Parses the form input and returns a hash with all the name
# value pairs. Removes any field with "---" as a value
# (as this denotes an empty SELECT field.
#
my (@pairs, %in);
my ($buffer, $pair, $name, $value);
if ($ENV{'REQUEST_METHOD'} eq 'GET') {
@pairs = split(/&/, $ENV{'QUERY_STRING'});
}
elsif ($ENV{'REQUEST_METHOD'} eq 'POST') {
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
}
PAIR: foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$name =~ tr/+/ /;
$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
($value eq "---") and next PAIR;
exists $in{$name} ? ($in{$name} .= "~~$value") : ($in{$name} = $value);
}
return %in;
}
And this to links.cfg
Code:
$db_verify_url = $db_dir_url . "/nph-verify.cgi"; # Verify script.
Lavon Russell
LookHard Mods
lavon@lh.links247.net