CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
Cookie & screws them



Apr 4, 2001, 6:37 AM

Post #1 of 2 (212 views)
Cookie & screws them Can't Post

I have a CGI script (forum) which remembers a users username and password by storing 2 cookies.

I've noticed though if I logon to my site without using the WWW (eg: just instead of it seems that when I then go back to using the normal URL (eg: BOTH sets of cookies are returned. Ie: I get in my cookie two logon values and two password values. eg: user=A;user=A;pass=B;pass=B

If I return back to the WWW less URL (eg: only one set is returned. eg: user=A;pass=B

This must obviously be something to do with the cookie setting. Maybe something to do with the DOMAIN value?

Any ideas?

Administrator / Moderator

Apr 4, 2001, 11:12 AM

Post #2 of 2 (205 views)
Re: Cookie & screws them [In reply to] Can't Post

Set the cookie domain to (note the leading dot). If the cookie domain attribute is omitted, it will only set the cookie to the server that created it.

use CGI qw /:standard/; 

my $in = CGI->new();

my $username = $in->param('username');

my $cookie = cookie(
-name => 'username',
-value => $username,
-domain => '',

print header( -cookie => $cookie );


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

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