D
David Staschover
Hi,
I'm trying to set up sessions in perl.
The session is initialized fine in session1.cgi
In session2.cgi, the correct session id is returned from the cookie, but
when I initialize the session, a new session is created.
Any help would be appreciated!
- David
session1.cgi:
#!/usr/bin/perl
use CGI::Session;
use CGI;
$cgi = new CGI;
$session = new CGI::Session(undef,undef,{Directory=>'/tmp/sessions'});
$cookie = $cgi->cookie(CGISESSID => $session->id);
print $cgi->header( -cookie=>$cookie );
$sid=$session->id;
print "Session ID is $sid<br>";
print '<a href="session2.cgi">Link to session2.cgi</a>';
exit;
session2.cgi
#!/usr/bin/perl
print "Content-type: text/html\n\n";
use CGI::Session;
use CGI;
$cgi = new CGI;
$sid=$cgi->cookie("CGISESSID");
$session = new CGI::Session(undef,$sid,{Directory=>'/tmp/sessions'});
print "Original Session ID is $sid<br>";
$sid = $session->id();
print "New Session ID $sid<br>";
exit;
I'm trying to set up sessions in perl.
The session is initialized fine in session1.cgi
In session2.cgi, the correct session id is returned from the cookie, but
when I initialize the session, a new session is created.
Any help would be appreciated!
- David
session1.cgi:
#!/usr/bin/perl
use CGI::Session;
use CGI;
$cgi = new CGI;
$session = new CGI::Session(undef,undef,{Directory=>'/tmp/sessions'});
$cookie = $cgi->cookie(CGISESSID => $session->id);
print $cgi->header( -cookie=>$cookie );
$sid=$session->id;
print "Session ID is $sid<br>";
print '<a href="session2.cgi">Link to session2.cgi</a>';
exit;
session2.cgi
#!/usr/bin/perl
print "Content-type: text/html\n\n";
use CGI::Session;
use CGI;
$cgi = new CGI;
$sid=$cgi->cookie("CGISESSID");
$session = new CGI::Session(undef,$sid,{Directory=>'/tmp/sessions'});
print "Original Session ID is $sid<br>";
$sid = $session->id();
print "New Session ID $sid<br>";
exit;