Limit 1 login per computer...

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
Kyori
Forum Newbie
Posts: 23
Joined: Mon Oct 14, 2002 5:23 am
Contact:

Limit 1 login per computer...

Post by Kyori »

How can I ensure that a user can access the site /w only 1 login at a time. Assuming he has 2 login.

IP add? how do I get IP add? sessions? how? thanks
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

You can get the IP for the client accessing your site from the $_SERVER array ($_SERVER['REMOTE_ADDR']). However, depending on the ISP the IP address may not stay constant throughout the session and the IP address may also be shared by a number of people going through a proxy. You could set a session variable when they log on that you can then use to see if they've already logged on before. There will be no foolproof method though.

Mac
Kyori
Forum Newbie
Posts: 23
Joined: Mon Oct 14, 2002 5:23 am
Contact:

Post by Kyori »

Just a thought... how about I use a cookie that tells user is already logged in. And cookie has expiration of 5 min or something like that. But everytime user does something (click anywhere on page) the cookie is refreshed.

IP adds seem nice but the fact that they do change a lot and some networks PCs share the same IP add isn't nice...
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

The cookie will work if the user a) has not disabled cookies and b) doesn't decide to edit the one that is set or delete it.

Mac
Post Reply