CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Help needed - Linking

 



Tom
Deleted

Jul 18, 2000, 1:22 PM

Post #1 of 1 (813 views)
Help needed - Linking Can't Post

Hello,
I am using a primitive password control system which will disply the admin side of the script iff the password is corrct and a bad passowrd page if it is not.

My problem is this:


I am making a mailinglist which will all be in one script (or alteast, most of it will). I am maing the links in the admin section look like http://www.whatever.com/cgi-bin/script.cgi?section=admin. To do this I am using this code:


use CGI qw(param header);
print header;
$section = param('section');
if ($section eq "admin") { &admin; }


This is having problems. I did the ifs for all the section IE,

if ($section eq "sendmail") { &sendmail; }

But my problem is this. I used this code and at the end an else like

if ($section eq "admin") { &admin; }
else { &ask_password}

This is meant to show the login screen if the address isnt oneof the above. But when I press submit after entering the password I just get returned to the main login screen again. I am assuming that this is because the link isnt like the ones specified but I can't specify this one. An example is at http://hammer.prohosting.com/~javamint/cgi-bin/mailinglist2/mailistadvanced.cgi

and the source code is at http://hammer.prohosting.com/~javamint/cgi-bin/mailinglist2/maillistadvanced.txt


Please somene help me
When I accessed my script I had forgotten to take put the else {&default} bit so it showed that message instead ofmy login. I took this out (so there is no else) but nothing showed up. So I cahnged the &default for &ask_password (the main login screen). this worked. But when i presss ubmit it juist loads the login page again. I dont know why this is (actually I do but I dont know how to fix it). I am assuming it is doing this becase the function is not specified in the code richard gave me. Anyway, this is the code tghat checks the passoword:

&parse_form;

$password = $input{'password'};
$function = $input{'function'};


if ($function eq "post") {
if ($password eq $correctpass) {
&goodlogin;
}
&nologin;
}

&ask_password;

and this is at the top:

$section = param('section');

if ($section eq "admin") { &admin; }
elsif ($section eq "footer") { &footer; }
elsif ($section eq "header") { &header; }
elsif ($section eq "subscribers") { &subscribers; }
elsif ($section eq "archive") { &archive; }
elsif ($section eq "sendmail") { &sendmail; }
elsif ($section eq "sendonemail") { &sendonemail; }
else {&ask_password}
exit;

Can someopne help me???

------------------
errrr, what?

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives