Gossamer Forum
Home : Products : DBMan : Customization :

LoisC cookie mod problem

Quote Reply
LoisC cookie mod problem
Hi,

I've installed LoisC's cookie mod for logging in on my site. I've got several 'html.pl' files working with one db.cgi and auth.pl file. So I figured once a cookie would be written, it would work on all databases, for example, that I would be logged in when I use

http://www.allesoversterrenkunde.nl/cgi-bin/scripts/db.cgi?db=nieuws

or

http://www.allesoversterrenkunde.nl/cgi-bin/scripts/db.cgi?db=boeken

no matter where I once logged in.

However, this is not the case. To be honest: it's rather vague what exactly goes wrong... At some databases I stay logged in, at others I have to manually log in although I see no differences...

I'll check my cfg files again, maybe it has something to do with something in there....

Anyway, if anybody knows what I'm talking about it or had the same, I'd appreciate all answers.

I've got the following in the cookie mod:

auth.pl:

my $q = new CGI;
my %cookval;
$cookval{'username'} = "$userid";
$cookval{'password'} = crypt($in{'pw'}, $pw);
my $cookie_out = $q->cookie(-name=>"allesoversterrenkundelogin",
-value=> \%cookval,
-domain => "www.allesoversterrenkunde.nl",
-expires=>'+6M', # cookie expires after 6 months - adjust as you please
-path=>'/',

db.cgi:

my $q = new CGI;
my %cookval = $q->cookie("allesoversterrenkundelogin");
my $userid = $cookval{'username'};
my $password = $cookval{'password'};

if ($userid) { # if there's a cookie, create a session ID using the username from the cookie
srand( time() ^ ($$ + ($$ << 15)) ); # Seed Random Number
$db_uid = "$userid." . time() . (int(rand(100000)) + 1);# Build User Id
open(AUTH, ">$auth_dir/$db_uid") or &cgierr("unable to open auth file: $auth_dir/$db_uid. Reason: $!\n");
print AUTH "$db_uid: $ENV{'REMOTE_HOST'}\n";

close AUTH;

Lex
Subject Author Views Date
Thread LoisC cookie mod problem Lex 2489 Jan 12, 2004, 6:01 AM
Post Re: [Lex] LoisC cookie mod problem
LoisC 2426 Jan 12, 2004, 10:37 AM