Re: session handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>> 2. This is trickier. What do you mean with "access"? Are you talking about
>> lost updates? Are you talking about simple read-operations? Actually, even
as
>> you claim you're a newbie, you're asking questions that are keeping us all
up
>> at night! :-) The solutions vary depending on your situation. Maybe you
can
>> add field "ActiveTable" to the above-mentioned "Sessions" table and take
it
>> from there?

>it's more for editing records, when user customera1 opened a record to edit
it, and almost at the same time user customera2 tried >to edit the same
record, customera2 will get an error message that the record is already open.

Well, like I said: the "lost update" problem is well known in database
circles. Basically, when two users want to do the same thing at the same time,
one of them WILL loose out. The only question is how you handle the situation.
Please read e.g. http://forums.mysql.com/read.php?97,56420,56420 to give you
some more ideas on how to handle this. Google for "database lost update" for
more general information and strategies. Before you come up with too advanced
features to solve this problem, you may also want to ask yourself the chance
of this problem occuring in your specific application? While I've worked on
many systems, I've never had a situation arise where this was an effective
issue. But there definitely are circumstances where it may!

>> 4. No, it won't. Each user has his/her own $_SESSION[] object

>does that mean when user customera1 logs in, i passed $_SESSION[accountcode].
then user customera2 logs in also and i passed >$_SESSION[accountcode] again,
so now $_SESSION[accountcode] is the same for both user, if customera1 logs
out, i call >session_destroy, it wont destroy the session for user
customera2?

When customera1 logs in, a $_SESSION[] object is created for his/her eyes
only. You can then e.g. say $_SESSION["code"] = getaccountcode(). When
customera2 logs in in turn, a second $_SESSION[] object is created that only
applies to that user. You can see the progress of these sessions popping in
and out of existence by monitoring the files in the c:\php\sessions\ folder.
Since customera1 has no access to the $_SESSION of customera2, there's risk in
accidentally removing another user's session.

HTH,


Yves



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux