saifuddin786 has asked for the wisdom of the Perl Monks concerning the following question:
session1.pl
session2.pl#!"\TBD\xampp\perl\bin\perl.exe" use CGI::Carp qw(fatalsToBrowser); use strict; use warnings; use CGI; use CGI::Session; my $cgi = new CGI; # Object initialization: my $session = new CGI::Session("driver:File", undef, {Directory=>' +d:/TBD'}); # getting the effective session id: my $sessionid = $session->id(); #print "$sessionid \n"; my $cookie = $cgi->cookie(CGISESSID => $session->id); print $cgi->header( -cookie=>$cookie ); # storing data in the session $session->param('my_name', 'Sherzod'); #printf ("<a href=\"session2.pl?%s=%s\">click me</a>", 'CGISESSID', $s +ession->id); print<<OUTPUT; <html> <body> <br><br> <form action="session2.pl" METHOD="POST"> <input type="hidden" name="CGISESSID" value="$sessionid"> <input type="submit" > </form> </body> </html> OUTPUT exit (0);
#!"\TBD\xampp\perl\bin\perl.exe" use CGI::Carp qw(fatalsToBrowser); use strict; use warnings; use CGI; use CGI::Session; my $cgi = new CGI; # Object initialization: print "Content-type: text/plain; charset=iso-8859-1\n\n"; my $sid = $cgi->cookie('CGISESSID') || $cgi->param('CGISESSID') || + undef; my $session = new CGI::Session(undef, $sid, {Directory=>'d:/TBD'}) +; my $name = $session->param("my_name"); exit (0);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: cgi::session issue with session data retrival
by kcott (Archbishop) on Oct 25, 2010 at 23:51 UTC | |
by saifuddin786 (Initiate) on Oct 26, 2010 at 18:11 UTC | |
by kcott (Archbishop) on Oct 26, 2010 at 19:33 UTC | |
by saifuddin786 (Initiate) on Oct 27, 2010 at 08:31 UTC |