Thread

Posted on Sat May 21 20:27:04 2005 by alexperl
problem with sessionID
HI, Im having problem with CGI::Session. I need to assign same session id to user who adds items to shopping cart. But it creates different ids everytime Im adding item. Im using IIS server, and I dont see any cookies or session data which should be stored on my computer.It only prints cookie in browser. I tried different methods nothing works. Here is script, as described in tutorial:
use CGI; $cgi = new CGI; $session = new CGI::Session(undef, $cgi, {Directory=>'/tmp'}); $cookie = $cgi->cookie(CGISESSID => $session->id ); print $cgi->header(-cookie=>$cookie); $sid=$session->id();
Anybody can give any solution?
Direct Responses: 1017 | 1131 | Write a response
Posted on Tue Sep 20 07:47:10 2005 by richl in response to 484
Re: problem with sessionID
First use the 'FreezeThaw' serializer. Change the first 'undef' in new to "Serializer:FreezeThaw. Use 'flush' function to write to data... (I'm still looking for better solution) Les Richarson
Direct Responses: 1127 | Write a response
Posted on Wed Oct 5 13:42:29 2005 by rsennat in response to 1017
Re: problem with sessionID
Hi, Im also having a similar problem with CGI::Session. But this is when opening different IE windows to add an item, for every window a session is created with unique sessionID. How to have a single sessionID for each User. Thanks
Write a response
Posted on Thu Oct 6 14:57:55 2005 by egor604 in response to 484
Re: problem with sessionID
same problem i faced under mod_perl2(registry script without +GlobalRequest) + mysql driver.. after some time i solve my troubles.. here is "principal" truncated example:
$q = new CGI($r); .... $session = new CGI::Session("driver:mysql", $self->get_session_id() || $q, {Handle=>$dbh}); .... $session->flush; .... $dbh->disconnect; .... sub get_session_id { my $self = shift; my %cookie = CGI::Cookie->fetch($self->{r}); if ($cookie{CGISESSID}) {return $cookie{CGISESSID}->value;} return undef; }
Write a response