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:
Log in only once

 



AICapone
Deleted

May 23, 2001, 4:58 PM

Post #1 of 2 (575 views)
Log in only once Can't Post

Hi there,
See I am building an advanced (i think so:)) forum for myself (something like ubb) and I have one problem.
What do you do so that user has only to log in once in your system. Uhhh...if you don't undersand my english just take a look around. Like on this forum you can log in and then post answers, topics, send message etc.
Or another example can be found on anandtech foums forums.anandtech.com).
Again, I don't ask for the code (though it would help me :)), I just want to undersand how it works (or lets say to check if i am right)

Thank you,
Any help will surely be appreciated


-----------
What is difficlut takes time, what is impossible takes a little longer


Mortimer
journeyman

May 23, 2001, 5:47 PM

Post #2 of 2 (572 views)
Re: Log in only once [In reply to] Can't Post

You can set a cookie to store some data on the user's machine, then retrieve the info you need to auto log them in.

Check out CGI::Cookie in the docs.

Here's some code, but you'll need to adjust it for your own use.

Set a cookie...


Code
my $cookie = new CGI::Cookie(-name=>'foo', 
-value=>$cookie_val,
-expires=>'+6M');

print "Set-Cookie: $cookie\n";

To verify...


Code
if(my %cookies = fetch CGI::Cookie){ 
if( defined($cookies{'foo'}) ){
my $cookie_val = $cookies{'foo'}->value;
...use your $cookie_val...
}
}

The biggest pain will be sorting out your browser text/html header.

Cheers,
Dave.


 
 


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

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