Gossamer Forum
Home : Products : Links 2.0 : Installation -- Windows :

Two days trying this... PLEASE HELP

Quote Reply
Two days trying this... PLEASE HELP
Hi,

I'm new to CGI, so go easy on me... All I want to do is set a simple password on the admin.cgi - should be easy right? What am I doing wrong?

I initially found all the references to .htaccess files - so I learnt all bout them... eventually I worked out that the reason they weren't working was that my server doesn't support them... so I'm trying this.. but have fallen victim to what appears to be a rather odd paradox:

I am passing a password from an HTML form (using POST) to the admin.cgi script... it works, I know it does... I have this running perfectly:

#!/usr/local/bin/perl

read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});

@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$name =~ tr/+/ /;
$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$FORM{$name} = $value;
}

#===============================

if ($FORM{pwd} eq 'mrpants') {

print "Content-type: text/html\n\n";
print "<br><br><H1><center>Correct Password</center></H1>";
}

else
{
print "Content-type: text/html\n\n";
print "<br><br><H1><center>Access Denied</center></H1>";
}



Now all I need to do is insert the original admin.cgi script into the bit which would display "Correct Password"... You'd think! Doing this results in the server locking up and the eventual return of a timed-out error.

However, if the original admin.cgi script is left in here and I comment out the

read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});

line, replacing it with a line which 'artificially' assigns the $buffer variable... all works fine... The best way to describe this seems to be that it's a paradox... what's going on here... it all seems a bit odd (and excruciatingly frustrating) to me.



Many thanks for any help you can offer!


Subject Author Views Date
Thread Two days trying this... PLEASE HELP ging 5411 Nov 22, 2003, 12:07 PM
Thread Re: [ging] Two days trying this... PLEASE HELP
fuzzy logic 5366 Nov 23, 2003, 2:48 PM
Thread Re: [fuzzy logic] Two days trying this... PLEASE HELP
Andy 5358 Nov 24, 2003, 1:11 AM
Thread Re: [Andy] Two days trying this... PLEASE HELP
fuzzy logic 5344 Nov 24, 2003, 8:46 AM
Thread Re: [fuzzy logic] Two days trying this... PLEASE HELP
ging 5308 Nov 24, 2003, 12:02 PM
Thread Re: [ging] Two days trying this... PLEASE HELP
fuzzy logic 5307 Nov 24, 2003, 11:14 PM
Thread Re: [fuzzy logic] Two days trying this... PLEASE HELP
ging 5311 Nov 25, 2003, 2:18 AM
Thread Re: [ging] Two days trying this... PLEASE HELP
ging 5296 Nov 25, 2003, 7:55 AM
Post Re: [ging] Two days trying this... PLEASE HELP
ging 5280 Nov 29, 2003, 4:56 AM