Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

Modify only with password

Quote Reply
Modify only with password
I'm trying to get the Modify only with Password mod to work, but keep getting the same error message when I try to run modify.cgi:

Software error:
Execution of /links/modify.cgi aborted due to compilation errors.

I've been following the instructions for the mod exactly (At leas I think I have...) and the code that I'm changing on modify.cgi is just the sub main part where I am completely replacing it with the code provided in the mod which is:

sub main {#0
# ---------------------------------------------------
# Determine what to do.
#
my $in = new CGI;
my $dynamic = $in->param('d') ? $in : undef;
%in = %{&cgi_to_hash($in)};
print $in->header('text/html');

if ($in->param('modify')) { #2
&process_form ($in, $dynamic);
} #2
else { #2
if ($in->param('SiteID') =~ /^\d+$/) { #3
my $db = new Links::DBSQL $LINKS{admin_root_path} . "/defs/Links.def";
my $rec = $db->get_record ($in->param('SiteID'), 'HASH');
$rec or &site_html_modify_first ( { erro => "ID Unknow", SiteID => $in->param('SiteID'), Password => $in->param('Password') } ) and return;


if ($rec->{'ID'} eq $in->param('SiteID')) { #4

if ($rec->{'Password'} eq $in->param('Password')) { #5

my ($name, $category);
# my $id = $in->param('ID');
my $id = $rec->{'CategoryID'};

# If we don't have an id, and can't generate a list, let's send the user a message.

if (! $id and ! $LINKS{db_gen_category_list})
{ #6
&site_html_error ( { error => "Please first go to the category that you want the listing to be in and click from there." }, $dynamic); } #6
else { #6
if ($id) {#7
$name = &get_category_name ($id);
$name ?
($category = "$name <input type=hidden name='CategoryID' value='$id'> ") :
($category = &get_category_list ());
}#7
else {#7
$category = &get_category_list ();
}#7
# &site_html_modify_form ( { Category => $category, %in }, $dynamic);
# &site_html_modify_form ( { %$rec, Category => $category, %in }, $dynamic);
}#6
&site_html_modify_form ( { %$rec, Category => $category, %in }, $dynamic);
# &site_html_modify_form ( { Category => $category, %in }, $dynamic ); } #5
else { #5
&site_html_modify_first ( { erro => "Wrong password", SiteID => $in->param('SiteID'), Password => $in->param('Password') } );
} #5
} #4
else { #4
&site_html_modify_first ( { erro => "ID Unknow", SiteID => $in->param('SiteID'), Password => $in->param('Password') } );
} #4
} #3
else { #3
&site_html_modify_first ( { SiteID => '', Password => ''} );
} #3
} #2
} # sub 0
# ========================================================= ##--##


I've added a field called Password and made it required and made sure that all links had a password filled in.

I also made the changes to HTML_templates.pm as outlined in the mod...

Has anyone successfully installed this mod and can let me know where the problem might be? Thanks very much...

--Frank



Quote Reply
Re: Modify only with password In reply to
Get a copy of the Editor Logon mod I posted in the FAQ.

Compare the routines in modify.cgi and user.cgi to the ones you are doing. There were some things I had to change... which is how my mod got written -- by the time I made all the changes, I just kept going.

I think the "custom" changes to allow for the Editors and Secion Editors is clear enough that you can ignore them.

Look at the changes in the logic and code.

FWIW ... you might just want to use the code I wrote, and add back the "validation" features if you want to.



http://www.postcards.com
FAQ: http://www.postcards.com/FAQ/LinkSQL/