On Tue, 2 Nov 2004, Michael wrote:
> >
> > $dbh->do("UPDATE users SET session=? WHERE id=?",
> > undef,
> > $self->session->id, $user->id);
> >
> > This seems to work as if I check immeditely afterwords I can see
> > the data updaed but then by the time the web page shows up the
> > database is updated again and the extra dat I UPDATE-ed disappears.
>
> I'm not sure what you mean by 'I can see the data updated'. What data?
> the user id in the session? or the session id in the user table ?
OK, I see I managed to confuse you. Sorry for that. I sent the wrong code.
Here is the correct one:
$dbh->do("UPDATE sessions SET uid=? WHERE id=?",
undef,
$user->id, $self->session->id);
Actually the code I sent is the workaround I wrote:
Instead of keeping the user id in the session table now I keep the
session id in the user table. Then every time the same user
with a different session id tries to login I put the new session id
in the users table. I also delete the entry from the session table that
has this session id.
This has the effect that if a user tries to login from a second
browser s/he will be able to login seemlessly but the previous session
will be dropped.
Now this is the workaround I implemented but I consider this to be only
a workaround as this really restricts to one user.
I think it would be preferable if I could keep the user id in the
sessions table.
And to answer the question with my original code (the one that does not
really work) I update the session table, add the user id and .....
(I put in a sleep so while it sleeps I can check the database from the
command line and I see the uid entered the session table)
$ select OID, uid, id from sessions;
6, 1, some-session-id
after the sleep is over:
$ select OID, uid, id from sessions;
7,, some-session-id
the OID (the hidden row id) gets incremented and the uid disappears.
My guess is that the session updates this table with the cached data
when it finishes creating my page but in the cached information it
does not have the uid yet.
Gabor
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/suppressed/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.