Gossamer Forum
Quote Reply
Megalinks ?
Ok, seems I downloaded the Megalinks version instead of the links version that I could have downloaded here. My "angel" set my links up for me yesterday, but we're both stumped on a situation. If anyone can help it'd be greatly appreciated.
---------------
When adding a link as a user of the site from the main directory page http://tvcorner.hypermart.net/links I get this error:

"This add request doesn't seem to come through the form installed on this server.
Please don't spam our link database."

When trying to add a link from a sub category such as 50's sitcoms I continue to receive a 404 error.
--------------------

I have a feeling this has to do with the megalinks...I'm sorry I ever attempted this version...augh.

Thanks
-Heather
Quote Reply
Re: Megalinks ? In reply to
On that second 404 error I should have included the directory structure to find the 50's Sitcom area:

Top : Classic Sitcoms : 50's Sitcoms

Thanks
-Heather
Quote Reply
Re: Megalinks ? In reply to
Heather-

Did you remove ALL of the Megalinks files and start from scratch (ie. Directories and everything)?

If you did, I don't think youd get these errors. Links 1.1 doesn't have the validator for where the new listing originated. That's an add-on (mod).

The 404 error seems related to the info in the links.cfg file. Links should be looking for your add.cgi file in your links root directory, not a subdirectory.

Let me know if I can help. I feel like a Hypermartyr. Wink

------------------
Kevin D
greeknet.hypermart.net
webmaster@greeknet.hypermart.net

Quote Reply
Re: Megalinks ? In reply to
Kevin,

I'm almost too afraid to touch anything in the setup since for the most part it's now working.

I have to think it's a pointer error somewhere, I'm just not sure where to start looking at.

-Heather
Quote Reply
Re: Megalinks ? In reply to
Ok,

1/2 way there. I managed to fix the first error:

"When adding a link as a user of the site from the main directory page http://tvcorner.hypermart.net/links I get this error:
"This add request doesn't seem to come through the form installed on this server.
Please don't spam our link database.""

Thanks to Kevin...it was a bad pointer in my links.cfg file. Easy enough Smile

But the second error:

"When trying to add a link from a sub category such as 50's sitcoms I continue to receive a 404 error."

I can not seem to find anything in my add.cgi file that would cause this. Here's the file if anyone can catch what I'm missing.

#!/usr/local/bin/perl
#
# -------------
# Links
# -------------
# Links Manager
#
# File: add.cgi
# Description: Adds a record marked unvalidated to the database and
# optionally emails someone.
# Author: Alex Krohn
# Email: alex@gossamer-threads.com
# Web: http://www.gossamer-threads.com/
# Version: 1.11
#
# COPYRIGHT NOTICE:
#
# Copyright 1997 Gossamer Threads Inc. All Rights Reserved.
#
# This program is being distributed as shareware. It may be used and
# modified free of charge for personal, academic, government or non-profit
# use, so long as this copyright notice and the header above remain intact.
# Any commercial use should be registered. Please also send me an email,
# and let me know where you are using this script. By using this program
# you agree to indemnify Gossamer Threads Inc. from any liability.
#
# Selling the code for this program without prior written consent is
# expressly forbidden. Obtain written permission before redistributing this
# program over the Internet or in any other medium. In all cases
# copyright and header must remain intact.
#
# Please check the README file for full details on registration.
# ============================================================ =========
#
# Setup Notes:
# Make sure the require statement below points to the config file.

# Required Librariers
# --------------------------------------------------------
eval {
($0 =~ m,(.*)/[^/]+,) && unshift (@INC, "$1"); # Get the script location: UNIX /
($0 =~ m,(.*)\\[^\\]+,) && unshift (@INC, "$1"); # Get the script location: Windows \

require "/data1/hypermart.net/tvcorner/cgi-bin/links/admin/links.cfg "; # Change this to full path to links.cfg if you have problems.
require "$db_lib_path/db.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 {
# --------------------------------------------------------
local (%in) = &parse_form;

# We are processing the form.
if ((keys %in != 0) and !$in{'Cat'}) {
&process_form;
}
# Otherwise we are displaying the form (in site_html.pl).
else {
&site_html_add_form;
}
}

sub process_form {
# --------------------------------------------------------
my ($key, $status, $line, $output);

# basic "anti-spam" checking of HTTP referer
if ($check_referer) {
if ($ENV{'HTTP_REFERER'} !~ /$check_referer/) {
$status = "<p>This add request doesn't seem to come through the form installed on this server.<br>
Please don't spam our link database.<p>";
&site_html_add_failure($status);
return;
}
}

# This will set system fields like Validated to their proper values.
foreach $key (keys %add_system_fields) {
$in{$key} = $add_system_fields{$key};
}

# This will set system fields like Validated to their proper values.
foreach $key (keys %add_system_fields) {
$in{$key} = $add_system_fields{$key};
}
# Set date variable to today's date.
$in{$db_cols[$db_modified]} = &get_date;

open (ID, "<$db_links_id_file_name") or &cgierr("error in process_form. unable to open id file: $db_links_id_file_name. Reason: $!");
$in{$db_key} = <ID> + 1; # Get next ID number
close ID;

# Validate the form input..
$status = &validate_record();
if ($status eq "ok") {

# Update the counter.
open (ID, ">$db_links_id_file_name") or &cgierr("error in get_defaults. unable to open id file: $db_links_id_file_name. Reason: $!");
flock(ID, $LOCK_EX) unless (!$db_use_flock);
print ID $in{'ID'}; # update counter.
close ID; # automatically removes file lock

# Print out the validate input to a "validation database" where it is stored until
# the admin decides to add it into the real database.
open (VAL, ">>$db_valid_name") or &cgierr("error in add_record. unable to open validate file: $db_valid_name. Reason: $!");
flock(VAL, $LOCK_EX) unless (!$db_use_flock);
print VAL &join_encode(%in);
close VAL; # automatically removes file lock

# Send the admin an email message notifying of new addition.
&send_email;
# Send the visitor to the success page.
&site_html_add_success;
}
else {
# Let's change that error message from a comma delimted list to an html
# bulleted list.
$status =~ s/,/<BR><LI>/g;
$status = "<UL><LI>$status</UL>";
&site_html_add_failure($status);
}
}

sub send_email {
# --------------------------------------------------------
# Sends an email to the admin, letting him know that there is
# a new link waiting to be validated.

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

open (MAIL, "|$db_mail_path") or &cgierr("error opening mail program: $db_mail_path. Reason: $!");
print MAIL "To: $db_admin_email\n";
print MAIL "From: $in{$db_cols[$db_contact_email]} ($in{$db_cols[$db_contact_name]})\n";
print MAIL "Subject: Addition to Database: $in{'Title'}\n";
print MAIL qq|
The following link is awaiting validation:

Title: $in{'Title'}
Review: $in{'Review'}
URL: $in{'URL'}
Category: $in{'Category'}
Description: $in{'Description'}
Contact Name: $in{'Contact Name'}
Contact Email: $in{'Contact Email'}
Expires in: $in{'Expire'}

Remote Host: $ENV{'REMOTE_HOST'}

To validate, please go to:
$db_script_url?validate_form=1

Sincerely,

Links Manager.
|;
close MAIL;
}
Quote Reply
Re: Megalinks ? In reply to
I did it! I'm so thrilled. I've been working on my links directory all day off and on, and now everything seems to be working great. I think I have most bugs out...knock on wood.

Thanks again to everyone that helped me with this!

-Heather
Quote Reply
Re: Megalinks ? In reply to
What did you do to fix it?

------------------
elitecaraudio.com
carforums.com
Quote Reply
Re: Megalinks ? In reply to
There is a line of code in the links.cfg:

# @referers is a list of domains that can use this script *
@referers = ('www.yourdomain.com','domain.com','127.0.0.1');

If you don't fill in your domain, Links will assume that someone is attempting to spam your site. This is a really great feature for those sites that have been linked to by the "Link Submission" sites
Quote Reply
Re: Megalinks ? In reply to
Elite,

I'm not sure what I did, I was just going through the code line by line and changed anything that refered to an address to my domain and it worked.

I'm still the newbie at this Smile

-Heather