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

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Need a Custom or Prewritten Perl Program?: I need a program that...:
Loading a page from Perl



Feb 24, 2002, 1:50 PM

Post #1 of 2 (1023 views)
Loading a page from Perl Can't Post


I know very little about PERL so I'm sure this script can be done with more elegance but this was written so I can understand it. Smile Basically the piece of code below checks a cookie to see if a user is logged in, if so it prints the "output"

What I would like it to do is load a certain page if a person is logged in and a different one if they are not. How do I need to modify the code?


use strict;
use DBI;
use CGI;

my $in = new CGI;
my $user = $in->cookie('Username');
my $output = '';

if ($user){
$output = qq|You are logged in!|;

print "Content-type: text/html\n\n";
print "$output";

Thanks in advance.

Safe swoops


Mar 1, 2002, 7:45 PM

Post #2 of 2 (1012 views)
Re: [sangiro] Loading a page from Perl [In reply to] Can't Post

First, you're not doing session management "user logging as you call it" the right way. Take a look at the Apache::Session module available at CPAN. Also, the approact is different, you don't store usernames or other information in cookies, just a seesion id from which you can get any information you want.

If you want to stick with this code just add an else branch and fill it up with contents.


Best regards,

Miroslav Madzarevic, Senior Perl Programmer
Mod Perl Development  -
Telephone: +381 64 1193 501
ICQ: 15880893


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

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