Gossamer Forum
Home : Products : Links 2.0 : Customization :

recip mod causing problems

Quote Reply
recip mod causing problems
After I installed the recip mod, I am have trouble with the admin. When I go to verify my links, everything is out of place. The URL is in the title field, the date is in the URL field, the category is in the date field...and so on. I know that the recip mod threw everything out of place and I probably just have to rearrange a few things. Please help!

Quote Reply
Re: recip mod causing problems In reply to
I had the same sort of problem, my fix was that i never updated my def files. You need too search the forum for update.pl

Quote Reply
Re: recip mod causing problems In reply to
The update.pl hasn't really answered my question. I updated everything just like the instructions said, is there any more specific informaiton? Please help!

Quote Reply
Re: recip mod causing problems In reply to
Here is what some of my pages look like:


This is in the admin_html.pl:
<p>
<$font><b>Recip Checker</b>

<a href="$report_cgi">Run Script</a>

<$font>If Run from cron just view report

<a href="$report_url">View Report</a>

</p>

This is in my links.cfg:

$db_lib_path = $db_script_path; # PATH of library files.
$db_links_name = "$db_script_path/data/links.db"; # PATH to links database.
$db_category_name = "$db_script_path/data/categories.db"; # PATH to category database.
$db_valid_name = "$db_script_path/data/validate.db"; # PATH to validation database.
$db_modified_name = "$db_script_path/data/modified.db"; # PATH to modification database.
$db_url_name = "$db_script_path/data/url.db"; # PATH to URL lookup database.
$db_email_name = "$db_script_path/data/email.db"; # PATH to email database.
$db_links_id_file_name = "$db_script_path/data/linksid.txt"; # PATH to links counter file.
$db_category_id_file_name = "$db_script_path/data/categoryid.txt"; # PATH to category counter file.
$db_hits_path = "$db_script_path/data/hits"; # PATH to hits directory.
$db_template_path = "$db_script_path/templates"; # PATH to templates.
$db_rates_path = "$db_script_path/data/rates"; # PATH to ratings.
$recip_report = "/data/wwwroot/mydomain.com/cgi-bin/links/admin/recip.html"; # PATH to recip report.
1;

and this also:

# Paths and URL's to Important Stuff
# --------------------------------------------------------
# PATH and URL of Admin CGI directory. No Trailing Slash.
$db_script_path = "/data/wwwroot/xxxpornsex.net/cgi-bin/links/admin";
$db_dir_url = "http://xxxpornsex.net/cgi-bin/links/admin";

# Link to check for on other sites
$site_check = "www.mydomain.com";
#full path to report
$report_url = "http://mydomain.com/Types/recip.html";
#full path to recip script place in the same dir as your admin.cgi
$report_cgi = "http://mydomain.com/cgi-bin/links/admin/recip.cgi";

# URL of User CGI directory. No Trailing Slash.
$db_cgi_url = "http:///mydomain.com/cgi-bin/links";

This is in my links def:

# Definition of your database file.
%db_def = (
ID => [0, 'numer', 5, 8, 1, '', ''],
Title => [1, 'alpha', 40, 75, 1, '', ''],
URL => [2, 'alpha', 40, 75, 1, 'http://', '^http|news|mailto|ftp'],
Date => [3, 'date', 15, 15, 1, \&get_date, ''],
Category => [4, 'alpha', 0, 150, 1, '', ''],
Description => [5, 'alpha', '40x3', 500, 0, '', ''],
'Contact Name' => [6, 'alpha', 40, 75, 1, '', ''],
'Contact Email' => [7, 'alpha', 40, 75, 1, '', '.+@.+\..+'],
Hits => [8, 'numer', 10, 10, 1, '0', '\d+'],
isNew => [9, 'alpha', 0, 5, 0, 'No', ''],
isPopular => [10, 'alpha', 0, 5, 0, 'No', ''],
Rating => [11, 'numer', 10, 10, 1, 0, '^[\d\.]+$'],
Votes => [12, 'numer', 10, 10, 1, 0, '^\d+$'],
ReceiveMail => [13, 'alpha', 10, 10, 1, 'Yes', 'No|Yes'],
recip => [14, 'alpha', 40, 75, 0, 'http://', '^http|news|mailto|ftp']
);

This is in my add.cgi:

The following link is awaiting validation:

Title: $in{'Title'}
URL: $in{'URL'}
Recip URL: $in{'recip'}
Category: $in{'Category'}
Description: $in{'Description'}
Contact Name: $in{'Contact Name'}
Contact Email: $in{'Contact Email'}

Remote Host: $ENV{'REMOTE_HOST'}
Referer: $ENV{'HTTP_REFERER'}

To validate, please go to:
$db_script_url

Sincerely,

Links Manager.
|;

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

This is in my add.html:

<form action="<%db_cgi_url%>/add.cgi" method="POST">
<div class="margin"><table border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="right" valign="top">Title:</td>
<td><input name="Title" size="30"></td>
</tr>
<tr>
<td align="right" valign="top">URL:</td>
<td><input name="URL" size="30"></td>
</tr>
<tr>
<td align="right" valign="top">Reciprocal URL:</td>
<td><input name="recip" size="30"></td>
</tr>
<tr>
<td align="right" valign="top">Category:</td>
<td><%Category%>
</td>
</tr>
<tr>
<td align="right" valign="top">Description:</td>
<td><input name="Description" size="30"></td>
</tr>
<tr>
<td align="right" valign="top">Contact Name:</td>
<td><input name="Contact Name" value size="30"></td>
</tr>
<tr>
<td align="right" valign="top">Contact Email:</td>
<td><input name="Contact Email" value size="30"></td>
</tr>
<tr>
<td></td>
<td><input type="SUBMIT" value="Give me a link on your site NOW!"></td>
</tr>
</table>

This is in my add_error:

<h1>Error!</h1>

<form action="<%db_cgi_url%>/add.cgi" method="POST">
<p>There were the following errors trying to add your resource:</p>
<p><strong class="error"><%error%> </strong></p>
<p>Please make any changes and try again!</p>
<div class="margin"><table border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="right" valign="top">Title:</td>
<td><input name="Title" value="<%Title%>" size="30"></td>
</tr>
<tr>
<td align="right" valign="top">URL:</td>
<td><input name="URL" value="<%URL%>" size="30"></td>
</tr>
<tr>
<td align="right" valign="top">Reciprocal URL: </td>
<td><input name="recip" size="40" value="<%recip%>"></td>
</tr>
<tr>
<td align="right" valign="top">Category:</td>
<td><%Category%>
</td>
</tr>
<tr>
<td align="right" valign="top">Description:</td>
<td><textarea wrap="virtual" name="Description" rows="3" cols="42"><%Description%></textarea></td>
</tr>
<tr>
<td align="right" valign="top">Contact Name:</td>
<td><input name="Contact Name" value="<%Contact Name%>" size="30"></td>
</tr>
<tr>
<td align="right" valign="top">Contact Email:</td>
<td><input name="Contact Email" value="<%Contact Email%>" size="30"></td>
</tr>
<tr>
<td></td>
<td><input type="SUBMIT" value="Add Resource"></td>
</tr>
</table>
</div>
</form>


This is in my recip.cgi:

#!/usr/bin/perl
## Program Name: recip.cgi
require /data/wwwroot/mydomain.com/cgi-bin/links/admin/links.cfg";
require /data/wwwroot/mydomain.com/cgi-bin/links/admin/db_utils.pl";
$perpage=0;
if ($ENV{'QUERY_STRING'}){
$perpage=$ENV{'QUERY_STRING'};}
open (REPORT, ">$recip_report");
$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 "<meta http-equiv=\"Refresh\" content=\"0; URL=",$report_url,"\">";
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, "$db_links_name") or print("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 (/\|/);
#if (($links[0] < $perpage+5) and ($links[0] >= $perpage)) {
&getcontent("$links[14]");
#}
#elsif ($links[0] > $perpage+5) {
#$perpage=$perpage+5;
#print "<a href=?$perpage>Next 5</a>";
#exit;
#}
} #end of while
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 = "Hello $links[6], I am the webmaster of http://$site_check. I was verifying the reciprical links and was unable to find a link on your site ($links[2]). You submitted $links[14] as the reciprical link location. I am unable to find it there. I don't want to remove your link by mistake please let me know where it is currently located. You are listed in the $links[4] Category of http://$site_check. I hope to continue sending traffic to your website. --Thanks-- Webmaster...http://$site_check";
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>
";
print REPORT "</td></tr>";
#&send_email;
}
}
}
else {
if ($links[14] =~ "http.*") {
$body2 = "Hello $links[6], I am the webmaster of http://$site_check. I was verifying the reciprical links and was unable to connect to your site ($links[2]) to verify the link. I don't know if your site was temporarily down or you moved to a new location. You submitted $links[14] as the reciprical link location. I don't want to remove your link by mistake please let me know if your site is still up and the current location of my reciprical link. You are listed in the $links[4] Category of http://$site_check. I hope to continue sending traffic to your website. --Thanks-- Webmaster...http://$site_check";
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>
";
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>";

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

OK...that is all of my pages that I changes, look through it and please help. I wouldn't say I am the smartest man alive, but I want to get this thing to work : )

Thanks
Brad



Quote Reply
Re: recip mod causing problems In reply to
You really didn't need to post all that...but ok. Anyway, sounds to me like you might have forgot to update your links.db? If you didn't, then you need to add a | to the end of each line. If you don't have many links, just do it manually.....

Quote Reply
Re: recip mod causing problems In reply to
The following variable config:

Code:

$report_url = "http://mydomain.com/Types/recip.html";


needs to be the following:

Code:

$report_url = "http://mydomain.com/cgi-bin/links/admin/recip.html";


LOOK where you specified the file to be built:

Code:

$recip_report = "/data/wwwroot/mydomain.com/cgi-bin/links/admin/recip.html";


See the problem?

Also, did you UPDATE your EXISTING links.db file by adding the DELIMITER character after EACH existing RECORD???

If not, like the other user in this Thread mentioned, you need to use the upgrade.pl script, which has been provided in this forum in the past to UPDATE your EXISTING links.db file!

Regards,

Eliot Lee
Quote Reply
Re: recip mod causing problems In reply to
Thank you! That worked, my script is functioning fine now. I only have one more problem to solve:

1) When I run "Run Script" for my recip checker. I get an "Internal Server Error"

Any suggestions?

Also, I fixed: "$report_url" thanks for looking at that Elliot Lee.



Quote Reply
Re: recip mod causing problems In reply to
You need to run the script via telnet.

Regards,

Eliot Lee
Quote Reply
Re: recip mod causing problems In reply to
It says "If Run from cron just view report"...how do I know if I am running from cron?

Quote Reply
Re: recip mod causing problems In reply to
There is a CRONTAB Tutorial in the Resources section that has been linked many times in the forum as well!

Search the Resources Section for crontab (which is the first thing to do before searching the forums and then posting a question if you can't find the answer)...

Even if you search for crontab or cron for that matter in the support forums, you would've found relevant Threads where the above mentioned tutorial is referenced!

Regards,

Eliot Lee