liamoco Posted December 23, 2010 Share Posted December 23, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/222457-detecting-a-computer/ Share on other sites More sharing options...
trq Posted December 23, 2010 Share Posted December 23, 2010 how can I detect each individual computer. You can't. Quote Link to comment https://forums.phpfreaks.com/topic/222457-detecting-a-computer/#findComment-1150623 Share on other sites More sharing options...
liamoco Posted December 23, 2010 Author Share Posted December 23, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/222457-detecting-a-computer/#findComment-1150839 Share on other sites More sharing options...
Philip Posted December 24, 2010 Share Posted December 24, 2010 Use keys stored in session/cookie/whatever, that match up with the same on the server (e.g. database.) Once a user logs in elsewhere, the key is invalid and they are logged out. Quote Link to comment https://forums.phpfreaks.com/topic/222457-detecting-a-computer/#findComment-1151023 Share on other sites More sharing options...
The Little Guy Posted December 27, 2010 Share Posted December 27, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/222457-detecting-a-computer/#findComment-1151945 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.