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