Jump to content

Detecting a computer


liamoco

Recommended Posts

On my website I really do not want the user to be logged in more than once, My idea is to store the IP address of the user when he/she logs in, but the IP address will be the same if the user logs in from two different devices in the same location (house for example), how can I detect each individual computer. If my logic is wrong please, inform me with a better way of doing this.

 

Thanks :)

Link to comment
https://forums.phpfreaks.com/topic/222457-detecting-a-computer/
Share on other sites

OK now I know that isn't possible, any ideas? Lets say a user logs into my website on Google Chrome, but the user wants to log in twice, so the user decides to use Firefox to log in again, I do not want multiple logins, so I want the user to log into the website on Firefox but at the same time logged out of Chrome. Im thinking a lot a ajax is needed? Please help.

 

Thanks

When they log in using chrome set a database value to 1.

If they open up another browser, and log in from that browser check to see if they the value is 1.

If it is 1 don't let them login.

 

You will also need to track activity of the user and every 5 - 15 minutes run a cron to automatically log out users that have exceed the 5 - 15 minute inactivity time limit, resetting 1 back to 0.

 

There are some downsides to this:

1. if the user accidently closes his/her browser their session ends and when they try to log back in they can till the cron runs again. So, you may need to find a work around for this (such as an ajax onunload).

2. users are required to log in again if they leave their computer for more than the inactivity time and come back.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.