CGI-Session - Accessing Disc Data

Posted on Wed Feb 7 09:39:00 2007 by jdaily
Accessing Disc Data

I am using CGI Session, and am having one rather significant problem with it. When I create a session, it writes the session, and all of the session data fine. Essentially I create the initial session in my index.cgi. index.cgi then controls the rest of the program. If a user submits a valid login, I then add the user to the session (by creating a new session object that grabs the existing session), and they are able to traverse the rest of the site as a valid user.

However, when I attempt to log the user out (or change/add any other information) the new data does not stick to the disc. If I attempt to use it with that particular session object, it works fine. However once that session object is destroyed, and another one is opened, the change is not accounted for. I have done extensive debugging, and I am getting the proper session id's, and I can verify that the session is no longer writing information to the session on disc. I have no idea why.

My biggest hurdle, is that I can't log a user out, that has already been logged in. I have tried all of the following, $session->clear(), $session->delete(), $session->clear("user"), $session->param("user", 0)
...as well as other hacks.

I have tried using the standard file system, and I have tried using the mysql driver. I have the same problem everywhere. I have also tried grabbing the session id, and deleting it, just so the user will be logged out, but this won't even work. The dbh->("delete from sessions where session = '$id') returns 1, but the record is always still there. I don't think something else I am doing is recreating it, because I even through a die statement immediately following this one, and the record is still there.

I think i must be doing something stupid...this problem has become quite frustrating. Any advice? Am I missing some kind of writeOnce flag or something?

Thanks,

- Jon

Write a response