[Cgi-session-user] CGI::Session does not seem to be working for me
Brought to you by:
sherzodr
From: Vahid H. <vah...@bu...> - 2005-09-12 15:26:14
|
CGI::Session version (3) / Perl v.5.8.6 : on FreeBSD 4.7 I have been trying for many hours to get CGI::Session to work: Here is my outcome after many hours of online searching testing: Trying to run a cgi script which authenticates after step 1 and then runs specfic actions once authenticated.. Here is the web results: _____+++++++ Original Session ID is ++++ Welcome vahid you are now logged in Global username = vahid ::: 8d257f413fab17680ea94a176b3d71a6Clik me <http://logmgr/cgi-bin/Provision2.cgi?act=vf> __________________Once clicked shows no STORED Session ID and no global username at the bottom has a new SESSION ID: --> ___+++++++ Original Session ID is ++++ Global username = ::: 6afdaa81cb7c88dc195e1aaab41adf59Clik me <http://logmgr/cgi-bin/Provision2.cgi?act=vf> Basically what ever i have tried i end up with new session ids.. here is the code: This is the top of the script: if ($act eq '' ) { $cg = new CGI; $session = new CGI::Session(undef,undef,{Directory=>"/tmp/"}); $cookie = $cg->cookie(CGISESSID => $session->id); print $cg->header( -cookie=>$cookie ); $sid=$session->id; print "Session ID is $sid<br>"; &startup(); } else { $cg = new CGI; $sid=$cg->cookie("CGISESSID"); print "_____$sid+++++++<br>"; $session = new CGI::Session(undef,$sid,{Directory=>"/tmp/"}); print "Original Session ID is $sid<br>"; $sid = $session->id(); print "++++$sid_____<br>"; &$act; } sub startup { $value="logon2.htm"; &do($value); } sub login { $username=$cgi->param(username); $pass=$cgi->param(pass); if (($pass eq '') || ($username eq '' ) ) { print "<hr size=3 width=100%>"; print "Missing Fields please hit back and try again - process halted"; print "<hr size=3 width=100%>"; } else { my $result = $ldap->bind("uid=$username,$base", password=>$pass); if($result->is_error()){ my $errorMessage = $result->error(); print "$errorMessage"; } else { $session->param( "user_name","$username" ); print "<p class=td align=center>Welcome $username you are now logged in</p>"; &vf; # print "<script>\nwindow.location.replace(\"/cgi-bin/$formname?act=vf\");\n</script>"; } } } sub vf { #$gname= cookie($gusername); $gname = $session->param("user_name"); print "Global username = $gname ::: $sid"; print "<a href=/cgi-bin/Provision2.cgi?act=vf>Clik me</a>"; } |