Gossamer Forum
Home : Products : Links 2.0 : Customization :

Recip Checker..

Quote Reply
Recip Checker..
Ok..this is really starting to f@*! me off! I've been trying to get tihs working for the last hour, but it still wont work. I have a 5k database, in the same directory as this script. To make sure there are no problems I have added the full paths to db_utils.pl and links.cg. I have run this script, and recip.html is generated. HOWEVER! The recip page has no links recorded in it what so ever! The code is;

Code:
#!/usr/bin/perl
## Program Name: recip.cgi
require "/home/aw4047/public_html/andrewnewby/admin/links.cfg";
require "/home/aw4047/public_html/andrewnewby/admin/db_utils.pl";
$perpage=0;
if ($ENV{'QUERY_STRING'}){
$perpage=$ENV{'QUERY_STRING'};}
open (REPORT, ">recip.html");
$date = &get_date;
$time = &get_time;
$long_date = &long_date ($date);
$finalnum=$perpage+5;

#print "<html><title>Checking Links - ID #'s ($perpage-$finalpage)</title>";
print "Content-type: text/html\n\n";
print REPORT "<html><head><title>Links Checked - ($long_date)</title></head>";
print REPORT "<body bgcolor=\"#c0c0c0\" text=\"#000000\">";
print REPORT "<form action=$db_script_url METHOD=POST><input type=hidden name=db value=links>";

print REPORT "<center><table border=\"0\" callpadding=\"0\" cellspacing=\"0\"><tr><td bgcolor=\"navy\" colspan=\"4\">";
print REPORT "<center><h2><font color=\"\#ffffff\">Reciprical Link Report</font></h2></center><p>";
print REPORT "<center><h4><font color=\"\#ffffff\">",$long_date, " - ", $time,"</font></h4></center><p>";
print REPORT "</td></tr>";
&main;
sub main {
open (LINK, "links.db") || &error("unable to open url index $db_links_name. Reason: $!");
seek (LINK, 0, 0); # rewind to beginning.
# Go through the Links database and find the link we want to go to.
LINE: while (<LINK> ) {
next LINE if (/^#/); # Skip comment lines.
next LINE if (/^\s*$/); # Skip blank lines.
@links=split (/\|/);
&getcontent("$links[14]");

} #end of while

print LINK "Done th";
close (LINK);
}
sub getcontent{
use LWP::Simple;
$counter=0;
local ($url) = @_;
$page = get($url);
if ($page) {
if ($page =~ /$site_check/i){
}
else {
if ($links[14] =~ "http.*") {
$body = "";
print REPORT "<tr><td bgcolor=\"#ffffff\">";
print REPORT "ID $links[0] <input TYPE=CHECKBOX NAME=$links[0] VALUE=\"delete\">";
print REPORT "</td><td bgcolor=\"#ffffff\">";
print REPORT "<a href=\"$url\" target=\"_new\">$url</a></td><td bgcolor=\"#ffffff\"> - is not linking back ";
print REPORT "</td><td bgcolor=\"#ffffff\">";
print REPORT "<a href=\"mailto\:$links[7]?subject=Unable to verify reciprical link&body=$body\">$links[7]</a><br>";
print REPORT "</td></tr>";
#&send_email;
}
}
}
else {
if ($links[14] =~ "http.*") {
$body2 = "";
print REPORT "<tr><td bgcolor=\"#ffffff\">";
print REPORT "ID $links[0] <input TYPE=CHECKBOX NAME=$links[0] VALUE=\"delete\">";
print REPORT "</td><td bgcolor=\"#ffffff\">";
print REPORT "<a href=\"$url\" target=\"_new\">$url</a></td><td bgcolor=\"#ffffff\"> - <font color=\"\#ff0000\">Could not connect!</font> ";
print REPORT "</td><td bgcolor=\"#ffffff\">";
print REPORT "<a href=\"mailto\:$links[7]?subject=Unable to verify reciprical link&body=$body2\">$links[7]</a><br>";
print REPORT "</td></tr>";
}
}
}
print REPORT "</table>";
&del_button;
print REPORT "</body></html>";

close (REPORT);
print "Done. <a href=\"$report_url\">Click Here to View Report.</a> done it here testing $recip_url";

sub del_button{
print REPORT "<INPUT TYPE=SUBMIT name=delete_records VALUE=Delete Checked Link(s)> <INPUT TYPE=RESET VALUE=Reset>\n";
}

sub send_email {
# --------------------------------------------------------
# Sends an email to the admin, letting him know that there is
# a new link waiting to be validated. No error checking as we don't
# want users to see the informative &cgierr output.

# 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 = $links[7];
my $from = $db_admin_email;
my $subject = "Unable to find Reciprical Link\n";
my $msg = qq|Hello $links[6],

I am the webmaster of http://$site_check.
I was verifying the reciprical links for my site and was
unable to find a link on your site ($links[2]).
You submitted $links[14]
as the location of where I could find my return link.
I have searched this page and am unable to find it.

I don't want to remove your link by mistake so please let
me know where the return link for my site is currently located.
As you know you are listed on my site in the $links[4] Category.

I hope to continue sending traffic to your website.

Best Regards,

-Webmaster http://$site_check


|;

# 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;
}


sub error {

print "Content-type: text/html \n\n";
print "there was an error. It was\;";
my $error = shift;

print $error;
exit;

}

Anyone see why no links should be recorded? The database is a normal one, with just the default fields.

Anyone? PLEASE! Tongue

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!
Quote Reply
Re: [AndyNewby] Recip Checker.. In reply to
In Reply To:
Ok..this is really starting to f@*! me off! I've been trying to get tihs working for the last hour, but it still wont work. I have a 5k database, in the same directory as this script. To make sure there are no problems I have added the full paths to db_utils.pl and links.cg. I have run this script, and recip.html is generated. HOWEVER! The recip page has no links recorded in it what so ever! The code is;

Code:
#!/usr/bin/perl
## Program Name: recip.cgi
require "/home/aw4047/public_html/andrewnewby/admin/links.cfg";
require "/home/aw4047/public_html/andrewnewby/admin/db_utils.pl";
$perpage=0;
if ($ENV{'QUERY_STRING'}){
$perpage=$ENV{'QUERY_STRING'};}


this line:
open (REPORT, ">recip.html");

Should be:
open (REPORT, ">$recip_report");

Also in your links.cfg, at the bottom you should have added:

$recip_report = "home/aw4047/public_html/andrewnewby/recip.html"; # PATH to recip report.

See if this works for ya Wink
Quote Reply
Re: [dvd871] Recip Checker.. In reply to
Thanks for the reply. I already had it set to that. I was getting so annoyed with it I decided to use the absolute link to it (thus the name, and not the variable).

Any more ideas?

Thanks

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!
Quote Reply
Re: [Andy] Recip Checker.. In reply to
I've been having the same problem for the last 2 hours now as well..
everything seems to be working properly but my report was turning
up blank, just the blue header at the top with the time stamp... and
I knew there were listings in my directory which didn't have recipricating
links... I added them myself.. I just fixed the problem and the reciprocal
links report is working just fine now, for me the fix was to make sure and
add the reciprocating link field to the links.db file, since I noticed that the
entries before I installed the mod didn't have any field value I just poped
one in there and the report finally showed up, looks like the script does not
like an inconsistent number of fields per record... anyhow thought I'd post
this to help out so other's who try and get this mod installed don't go out
of their minds trying to get it to work properly- Wink

Sharp1
Quote Reply
Re: [sharp1] Recip Checker.. In reply to
True, anytime you adda mod that puts a new field in the db, you need to go into the db and add that field to all pre-existing links, or else things will get screwy...


Leonard
aka PerlFlunkie
Quote Reply
Re: [Andy] Recip Checker.. In reply to
Any luck getting it to work? I'm at wits end. I've checked and rechecked and get the internal server error. I've looked through the threads and can't seem to find any solutions, just the problems, some suggestions and then end of thread.

One thing I DID notice is that if my reciprocal link is long, but beyond what I think is the field length in links.db, then that record is skipped in the report. However, short/long/whatever still generate the internal server error.

Recip.html still builds, but I can only view its contents via dreamweaver. If I try to open that file with my browser...same deal...internal server error.

I'd post my code but it's all the same that everyone else has posted with this mod.

Oy.
Kevin

My Green Promise: To learn (and practice) as much as I can about living a sustainable life and then spreading the word.
What's your Green Promise?