Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re: Cookies

by quidity (Pilgrim)
on Dec 02, 2000 at 01:23 UTC ( #44480=note: print w/replies, xml ) Need Help??

in reply to Cookies

Yes, it is possible and very easy if you use the module (available from CPAN). This is the answer to many questions which arise when writing CGI scripts, so you might want to check it out.

Briefly, two cookies can be set by following this example(see the documentation for more details):

# at the start of your script use CGI; my $query = CGI::new(); # then later my $cookie1 = $query->cookie(-name=>'Name', -value=>$user,); my $cookie2 = $query->cookie(-name=>'Passwd', -value=>$pass); print $query->header(-cookie=>[$cookie1,$cookie2]);

To get cookies back from a user, simply say:

$user = $query->cookie('Name'); $pass = $query->cookie('Passwd');

As you seem to want to save the user's name and password to their machine, you might want to rethink your session management. It is a bad thing to do it as you are because another user on the same computer can easily read someone else's cookies, find out their password, and then pretend to be them.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://44480]
[Corion]: marto: Currently all well - work is even OK currently ;) I should start translating my WWW::Mechanize:: Chrome talk to English and recheck that my demos all work, but I have two weeks for that still :)
[Corion]: So, most things are looking good :-D
[Corion]: I should write some more code for my Jekyll clone, but I don't feel like it, so maybe I should just let that linger instead ;)
[karlgoethebier]: "...mein enemy..."
[marto]: it has finally stopped raining!
[Corion]: marto: Heh - we've got the rain here, now. But it's only intermittently, not permanent. But funny that you should complain about rain ;)
[Discipulus]: rain? i dont remember it..
[marto]: and good news all round, Flash will die come 2020!

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (8)
As of 2017-07-26 10:50 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (390 votes). Check out past polls.