one user information is showing in one computer only

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
User avatar
rajan
Forum Contributor
Posts: 110
Joined: Sun Aug 28, 2005 7:42 pm
Location: Lucknow, UP, India

one user information is showing in one computer only

Post by rajan »

i want to restrict users to see particular user information according to username when other computer is showing that information.
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

If I read you correctly, you want to implement a "read lock"?
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

If I understand correctly, if a user is logged in, you don't want someone else to be able to log in with that username on another machine.

Most likely you will need a timestamp field in a database that is updated with each action the user does. Determine a time online as like within the last 5 minutes or so.

Whenever someone tries to login, check to see if that timestamp is within the last 5 minutes. If it is, restrict access from that user.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
User avatar
rajan
Forum Contributor
Posts: 110
Joined: Sun Aug 28, 2005 7:42 pm
Location: Lucknow, UP, India

Post by rajan »

what about when he does not do anything in that page for 5 minute then whole idea is failed and what about if does not use logout to clear timestamp.
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

That's the problem with Pessimistic Locking. It's a thorny issue, and most of the compromises are between effectiveness, and usability.

It has been suggested to use JavaScript and make the user "phone in" to the site every minute so that he doesn't expire as long as the page is on.
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

this would be better handled by a client side language, as mentioned above. You could execute a javascript function in a hidden iframe or something similar, to update the timestamp on an interval. Then there's the issue of server problems, and the page getting stalled and not loading.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

*cough*

AJAX
User avatar
rajan
Forum Contributor
Posts: 110
Joined: Sun Aug 28, 2005 7:42 pm
Location: Lucknow, UP, India

Post by rajan »

i want realtime solution can not not bear the single seconds for other user to allow.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

rajan wrote:i want realtime solution can not not bear the single seconds for other user to allow.
AJAX will be as close as you'll get if you want to use PHP.
Post Reply