Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Strange ?? add.cgi error ??

Quote Reply
Strange ?? add.cgi error ??
I've do #perl add.cgi on shell
This is the results:
Bareword "email" not allowed while "strict subs" in use at add.cgi line 172.
Bareword "val" not allowed while "strict subs" in use at add.cgi line 172.
Bareword "txt" not allowed while "strict subs" in use at add.cgi line 172.
Execution of add.cgi aborted due to compilation errors.

How Can Help Me????
Thanks in advance
Bye From Italy
Fabio

Quote Reply
Re: Strange ?? add.cgi error ?? In reply to
What hacks or Mods have you applied to the add.cgi script?

Regards,

Eliot Lee
Quote Reply
Re: Strange ?? add.cgi error ?? In reply to
I've not hacked add.cgi
this is my add.cgi:
#!/usr/bin/perl
# ==================================================================
# Links SQL - enhanced directory management system
#
# Website : http://gossamer-threads.com/
# Support : http://gossamer-threads.com/scripts/support/
# CVS Info : 087,069,084,089,084
# Revision : $Id: add.cgi,v 1.40 2001/05/24 01:22:27 alex Exp $
#
# Copyright (c) 2001 Gossamer Threads Inc. All Rights Reserved.
# Redistribution in part or in whole strictly prohibited. Please
# see LICENSE file for full details.
# ==================================================================

use strict;
use lib '/home/mysite/cgi-bin/admin'; (I've corrected)
use Links qw/$DB $IN $USER $CFG/;
use Links::SiteHTML;
Links::reset_env( { load_user => 1 } ) if ($Links::PERSIST);

local $SIG{__DIE__} = \&Links::fatal;
main();

sub main {
# -------------------------------------------------------------------
# Display either an add form or process an add request.
#
if ($CFG->{user_required} and ! $USER) {
print $IN->redirect( Links::redirect_login_url ('add') );
return;
}

# We are processing an add request.
if ($IN->param('add')) {
my $results = GT::Plugins->dispatch ($CFG->{admin_root_path} . '/Plugins', 'user_add_link', \&add_link, {});
if (defined $results->{error}) {
print $IN->header();
print Links::SiteHTML::display ('add_error', $results);
}
else {
print $IN->header();
print Links::SiteHTML::display ('add_success', $results);
}
}

# We are displaying an add form.
else {
my ($name, $category);
my $id = $IN->param('ID');

# If we don't have an id, and can't generate a list, let's send the user a message.
if (! $id and ! $CFG->{db_gen_category_list}) {
print $IN->header();
print Links::SiteHTML::display('error', { error => Links::language('ADD_SELCAT')});
return;
}
else {
# Otherwise display the add form.
my $category = _category_list();
if ($USER) {
$IN->param('Contact_Name') or ($IN->param('Contact_Name', $USER->{Name} || $USER->{Username}));
$IN->param('Contact_Email') or ($IN->param('Contact_Email', $USER->{Email}));
}
print $IN->header();
if (! $category) {
print Links::SiteHTML::display('error', { error => Links::language('ADD_INVALIDCAT', $IN->param('ID')) });
}
else {
print Links::SiteHTML::display('add', { Category => $category });
}
}
}
}

sub add_link {
# --------------------------------------------------------
# Add the link to the database.
#

# Get the category box for any errors.
my $category = _category_list();

# Check the referer.
if (@{$CFG->{db_referers}}) {
my $found = 0;
if ($ENV{'HTTP_REFERER'}) {
foreach (@{$CFG->{db_referers}}) { $ENV{'HTTP_REFERER'} =~ /\Q$_\E/i and $found++ and last; }
}
if (! $found) {
$category = _category_list();
return { error => Links::language('ADD_BADREFER', $ENV{'HTTP_REFERER'}), Category => $category };
}
}

# Get our form data.
my $input = $IN->get_hash;

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

# Setup the language for GT::SQL.
local $GT::SQL::ERRORS->{ILLEGALVAL} = Links::language('ADD_ILLEGALVAL');
local $GT::SQL::ERRORS->{UNIQUE} = Links::language('ADD_UNIQUE');
local $GT::SQL::ERRORS->{NOT_NULL} = Links::language('ADD_NOTNULL');
local $Links::Link::ERRORS->{NOCATEGORY} = Links::language('ADD_NOCATEGORY');
$Links::Link::ERRORS ||= {}; # silence -w

# Validate the form input..
my $db = $DB->table ('Links');
my $cdb = $DB->table ('Category');
my $cat_links = $DB->table ('CatLinks');
my $name = $input->{'Contact_Name'} || $input->{'Contact Name'} || ($USER ? $USER->{Name} : '');
my $email = $input->{'Contact_Email'} || $input->{'Contact Email'} || ($USER ? $USER->{Email} : '');

# Set the LinkOwner.
$input->{LinkOwner} = $USER ? $USER->{Username} : 'admin';

# Set date variable to today's date.
Links::init_date();
my $today = GT::Date::date_get();
$input->{Add_Date} = $today;
$input->{Mod_Date} = $today;

# Backward compatibility..
$input->{Contact_Name} = $name;
$input->{Contact_Email} = $email;

# Auto validate this link:
$input->{isValidated} = 'No';
if ($CFG->{build_auto_validate}) {
if ((($CFG->{build_auto_validate} == 1) and $USER) or ($CFG->{build_auto_validate} == 2)) {
$input->{isValidated} = 'Yes';
}
}

# Check the category.
my @cids = $IN->param('CatLinks.CategoryID');
my @name;
if (@cids) {
foreach my $cid (@cids) {
next if (! $cid);
my $sth = $cdb->select ( { ID => $cid }, ['Full_Name'] );
$sth->rows or return { error => Links::language('ADD_INVALIDCAT', $cid), Category => $category };
push @name, $sth->fetchrow;
}
if (@name) {
$input->{'CatLinks.CategoryID'} = \@cids;
}
}

# Add the record.
my $id = $db->add ( $input );
$input->{ID} = $id;
if (! $id) {
my $error = "<ul><li>" . join ("<li>", $db->error) . "</ul>";
return { error => "<ul>$error</ul>", Category => $category };
}

# Add some special tags for formatting.
$input->{'Category'} = join "\n", @name;
$input->{Host} = $ENV{REMOTE_HOST} ? "$ENV{REMOTE_HOST} ($ENV{REMOTE_ADDR})" : $ENV{REMOTE_ADDR} ? $ENV{REMOTE_ADDR} : 'none';
$input->{Referer} = $ENV{HTTP_REFERER} ? $ENV{HTTP_REFERER} : 'none';

# Mail the email.
if ($CFG->{admin_email_add}) {
my $to = $CFG->{db_admin_email};
my $from = $input->{'Contact_Email'};
my $subject = "Addition to Database: $input->{'Title'}\n";
my $cfg = Links::Config::load_vars();
my $msg = GT::Template->parse ( email-val.txt, { %$input, %$cfg }, { compress => 0, root => $CFG->{admin_root_path} . '/templates/admin' } );

require GT::Mail;
$GT::Mail::error ||= ''; # Silence -w
GT::Mail->send (
smtp => $CFG->{db_smtp_server},
sendmail => $CFG->{db_mail_path},
from => $from,
subject => $subject,
to => $to,
msg => $msg,
debug => $Links::DEBUG
) or die "Unable to send mail: $GT::Mail::error";
}

# Send the visitor to the success page.
return $input;
}

sub _category_list {
# -------------------------------------------------------------------
# Return a list of all the categories.
#
my $category;
if ($CFG->{db_gen_category_list}) {
my $db = $DB->table('Links');
my $html = $DB->html($db, $IN);
my @ids = $IN->param('CatLinks.CategoryID') || $IN->param('ID');
$category = $html->get_all_categories(\@ids, 'CatLinks.CategoryID', 1);
}
else {
my $db = $DB->table('Category');
my $id = $IN->param('CatLinks.CategoryID') || $IN->param('ID');
my $sth = $db->select ( { ID => $id }, ['Full_Name'] );
my ($name) = $sth->fetchrow_array();
if ($name) {
$category = "$name <input type=hidden name='CatLinks.CategoryID' value='$id'>";
}
else {
return;
}
}
return $category;
}

Quote Reply
Re: Strange ?? add.cgi error ?? In reply to
Help Me

Quote Reply
Re: Strange ?? add.cgi error ?? In reply to
So you finally Got shell Fabio :)

Quote Reply
Re: Strange ?? add.cgi error ?? In reply to
Yes, can U help ME???
Thanks

Quote Reply
Re: Strange ?? add.cgi error ?? In reply to
Nobody Help Me?????
Plz
Thanks

Quote Reply
Re: Strange ?? add.cgi error ?? In reply to
Fabio, has it ever worked? Were there errors when it installed out of the box? Your predicament is bizarre.

Quote Reply
Re: Strange ?? add.cgi error ?? In reply to
It worked, there aren't error when I've installed !
But It's a Strange error, I don't know how I can do !!!!!

Quote Reply
Re: Strange ?? add.cgi error ?? In reply to
When did the error start? What did you do to trigger the error? If you changed something that induced the error, then restore the backup of the files before the error began. There was an instance when the script when from working to not working - if you can remember when that was, you can solve it. Do you know what you did to screw it up? Have you been rearranging the guts of the script or what?

Quote Reply
Re: Strange ?? add.cgi error ?? In reply to
When I click on link add.cgi I've Error 500
I've restored my add.cgi backup, but it's the same, It's strange becouse modify.cgi works well, I don't know How can do, please help me.
Thanks in advance
Fabio

Quote Reply
Re: Strange ?? add.cgi error ?? In reply to
Question is, do you know what caused the error / when the error first occured (and thus what caused it)?

Quote Reply
Re: Strange ?? add.cgi error ?? In reply to
I don't know what do It !!!
Bye
Fabio

Quote Reply
Re: Strange ?? add.cgi error ?? In reply to
lol. Fabio, email Alex, and get him to take a look. I have no information with which to work :) Then it'll be sorted. I apologise for not having a clue.

Quote Reply
Re: Strange ?? add.cgi error ?? In reply to
Someone can help me?
Thanks
Fabio

Quote Reply
Re: Strange ?? add.cgi error ?? In reply to
did you have find a solution to your pb ? I have the same !!! But if i have an error when sumit the add link, otherwise, the add.cgi function very good because i can see the added links in the validate command in the admin menu… It's very strange and nobody here can give me a solution for stopping this stupid internal server error.
Say me if you find a solution.
I give it to you if i find it
@+
JB

Quote Reply
Re: Strange ?? add.cgi error ?? In reply to
I've reinstalled all to resolve this problem.
Bye
Fabio

Fabio