Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

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...

Replies are listed 'Best First'.
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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://494996]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2018-02-24 05:10 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (310 votes). Check out past polls.