Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Just Another Question About Sessions And User Management

by nedals (Deacon)
on Sep 26, 2005 at 01:51 UTC ( #494996=note: print w/ replies, xml ) Need Help??


in reply to Just Another Question About Sessions And User Management

In the spirit of KISS

use strict; use CGI; my $q = new CGI; # Set a SESSION persistant cookie. (deleted when browser is closed) my $cookie = "name=value;path=\"; print $q->header(-cookie => $cookie); # The cookie value should be some sort of code (encrypted or random), +linked # to a database (or file) variable for validation. # Read a cookie. And don't forget to verify that it's what you expect. my $cookie_value = $q->cookie('name'); if ($cookie_value !~ /^\w{23}$/) { print "not a valid cookie\n" } # Clear a cookie. # Here you can re-write the cookie with a 'past' date, or simply null +it out # Also clear out the database (or file) variable. my $cookie = "name=;path=\"; print $q->header(-cookie => $cookie);

Also take a look a this...
stonehenge


Comment on Re: Just Another Question About Sessions And User Management
Download Code
Re^2: Just Another Question About Sessions And User Management
by muba (Priest) on Sep 26, 2005 at 02:37 UTC
    Ah, this looks rather simple indeed. The stonehenge article is pretty useful as well. Thank you!
    Just need to find out how I will manage the server-side file storage, but that'll be no problem.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://494996]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (7)
As of 2014-12-29 10:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (185 votes), past polls