How to make the fields as READ ONLY for the second user?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
krishna.p
Forum Newbie
Posts: 19
Joined: Fri May 23, 2008 8:12 am

How to make the fields as READ ONLY for the second user?

Post by krishna.p »

Moved from Security forum by moderator. Please post in appropriate forums.

Hi Experts,
Iam new to php. would appreciate if could please clarify my doubt. let me give you breif explanation.
First user logins into application and say working on the ORDER screen. All the fields present in ORDER screen should be readonly for the remaining users until the first user logs out of that ORDER screen. how can i solve my problem. is there any specific concept that needs to implemented? How can i achieve it using SESSIONS?
how can i catch the SESSION ID of the first user? if you people have any code snippets or working examples that would be very helpful to me.Thanks in advance.

Thanks,
krishna.p
dajawu
Forum Commoner
Posts: 59
Joined: Fri May 23, 2008 10:16 am

Re: How to make the fields as READ ONLY for the second user?

Post by dajawu »

I don't know enough about MYSQL to know how it handles multiple users, but I do know most DB systems have ways to deal with this. I am not even sure if your using MYSQL. If I had to make this happen right now without looking to deep I would do this:

1) A user logs in, while reading info from DB you set a field named lock to 1
2) A new user logs in, while reading info they check the lock variable, if 0 you can edit, if 1 you can't.
3) First user logs out, lock gets set back to 0

One problem with this, if a user logs on and sets lock to 1 then closes the browser and never logs out. You would have to check for this every so often, or have a time frame lock. Please note this is only if I had to make this happen now, otherwise I would look into how MYSQL deals with multiple users.
Post Reply