Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: unique cookie id?

by cLive ;-) (Prior)
on Dec 23, 2003 at 17:49 UTC ( [id://316663]=note: print w/replies, xml ) Need Help??


in reply to unique cookie id?

I tend to use this:
use Digest::MD5 my $cookie_id = Digest::MD5::md5hex($$.time.$ENV{'REMOTE_ADDR'});

With the hash always being 32 chars long. Works for me.

Though maybe $$ under mod_perl is irrelevant here. Hmmm

cLive ;-)

Replies are listed 'Best First'.
Re^2: unique cookie id?
by adrianh (Chancellor) on Dec 23, 2003 at 22:15 UTC
    Digest::MD5::md5hex($$.time.$ENV{'REMOTE_ADDR'});

    This won't be unique if you get two requests to the same Apache process from the same IP in under a second. Something that's fairly likely to happen in many environments I'm afraid :-)

      Unlikely in our instance though :)

      cLive ;-)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2024-04-23 07:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found