Hello,

I wrote to the list awhile back ago about CGI.pm and the cookie function
mysteriously working for some and not others. I have a check that checks for
a cookie to see if its there if it is not it send the user to a login
screen. If it is there it reads the cookie. The login screen of course sends
the cookie to the browser so the program can read from it. I have around
20,000 users using my system, about half will not successfully utilize my
cookie authentication the other half works like a charm.

I sent snippets of my code last time and with some constructive critisism i
rewrote the code using the tips and  hints sent to me. As well as upgraded
to the latest CGI.pm believeing this would all end my woes. But still today
this does not work for all, I am at a loss how it can work for some and not
others?

Two parts of the script :

READ THE COOKIE IF ITS THERE -
use CGI;
$cgi = new CGI;

sub grabcookie {
$cookie = $cgi->cookie(-name => 'userdata');
$user = "";
$pass = "";
%values = split /~/, $cookie;
foreach ('userid','password','expires') {
    $values{$_} = $cgi->param($_) || $values{$_};
}
$user = $values{'userid'};
$pass = $values{'password'};
}

IF ITS NOT SEND LOGIN PAGE THAT SENDS THE INFO TO THIS PUT OF THE SCRIPT:

sub send_cookie_userdata {
my %userdata = ('userid' => "$user", 'password' => "$pass", 'expires' =>
'+5m');
my $value = join '~', %userdata;
my $cookie = $cgi->cookie(-name => 'userdata', -value => $value,
  -expires => '+15m', -path => '/', -domain => '.sexy-match.com',
  -secure => 0);
print $cgi->header(-cookie => $cookie);
}

Thats basically the script except for the html for the login sub.

Whats wrong here? You can test it your self at my site it may work for you
it may not, thats the mystery! www.sexy-match.com
Would greatly appreciate any input anyone may have.

Regards,
John

_______________________________________________
Perl-Unix-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to