User not logged in - login - register
Home Calendar Books School Tool Photo Gallery Message Boards Users Statistics Advertise Site Info
go to bottom | |
 Message Boards » » Problems with Perl and CGI::Session Page [1]  
McDanger
All American
18835 Posts
user info
edit post

Alright, here's my problem --

I try to use CGI::Session->load($cgi) to grab a session I've already created in a different page.
Basically, I have a login page that upon a successful login will create a session and bake a cookie like so:

$session = new CGI::Session(undef, undef, {Directory=>'/tmp'});
print $session->header();


This writes a new file to /tmp to keep track of the session. I can see these files being created, they're all named cgisess_* (where * is the session id). They all have lrwx permissions across the board (anybody can open them to dink around).

Now here's my problem --
I have a little test page which tries to pull the cookie from the user and grab the session from disk.
$session = CGI::Session->load($cgi);

When I pull the cookie out like so manually:
$session_id = $cgi->cookie('CGISESSID');

it gives me the same session_id that I sent back to the browser (my login page prints this to screen so I could verify it).

So now I'm sitting here staring at the file on disk which has cgisess_<the session id i'm looking at> and CGI::Session->load($cgi) still gives me back a blank session.

Any ideas why the fuck it won't find the session in /tmp and load it properly? Any advice would be appreciated.

9/9/2005 11:05:58 AM

lilbirdey
Starting Lineup
55 Posts
user info
edit post

You explicitly delcared /tmp as your directory when you wrote the session. Perhaps it will help to do so when you load it as well:

$session = CGI::Session->load(undef, $cgi, {Directory=>'/tmp'});

That's the only thing that looks obvious to me.

9/9/2005 7:08:08 PM

McDanger
All American
18835 Posts
user info
edit post

Shit still isn't working.

Technically you can call load without any parameters and it'll look around for 'CGISESSID' in the cookie, then the query string.

9/10/2005 1:24:53 PM

lilbirdey
Starting Lineup
55 Posts
user info
edit post

try

print $ENV{HTTP_COOKIE};

somewhere in there and make sure your script is receiving the cookie from the browser. Could be a problem with CGI::Session guessing what your host name is when it sets the cookie.

9/12/2005 10:27:50 AM

 Message Boards » Tech Talk » Problems with Perl and CGI::Session Page [1]  
go to top | |
Admin Options : move topic | lock topic

© 2024 by The Wolf Web - All Rights Reserved.
The material located at this site is not endorsed, sponsored or provided by or on behalf of North Carolina State University.
Powered by CrazyWeb v2.39 - our disclaimer.