Kano Posted September 6, 2006 Share Posted September 6, 2006 Hi all,I have a general question that has been bugging me for a while.I am wondering whether it is possible in php that a script can prevent members from sharing accounts. I am thinking that we could prevent people logging in to a system under a username when that username is already logged in to the system but are there any otherways?I am not after any code as such, just some general advice and opinions on how to go about this task.Thanks for any advice Quote Link to comment https://forums.phpfreaks.com/topic/19901-prevent-sharing-of-accounts/ Share on other sites More sharing options...
onlyican Posted September 6, 2006 Share Posted September 6, 2006 You can do this simular to building a WHO IS online scriptat the top of every page, have some code, if the user is logged in, Update the DB with the date/time stampIf they log out, delete this stampBUT, what if they dont log outIf you update the DB every page load, then if they have not loaded a page for more than 10 mins, assume they have gone.Therefore, when it comes to logging inCheck if the IP add is the same (Just in case they closed there browser by accident or something)If the IP is different, check if the Last Action was more than 10 mins, if it wasn't Come up with a message saying that they are logged in.AlternativeStore the users IP in the DB when they log inThen on every page loadcheck that the users IP is the same as the one in the DBif not, then log outSo if someone logs in from somewhere else, under that account, His IP would be in the DB, therefore the IP of the first person does not match Quote Link to comment https://forums.phpfreaks.com/topic/19901-prevent-sharing-of-accounts/#findComment-87115 Share on other sites More sharing options...
Kano Posted September 6, 2006 Author Share Posted September 6, 2006 Thanks onlyican,That is what i needed to know, this would then prevent the problem of only allowing loggin from one ip address per user (which is not helpful) and also prevent users from passing their details because of the situation where they cannot get into the system whilst someone is using their account. One problem is if someone aquired someone elses account details but then this can be overcome be using an admin contact link if there are problems with the account, i would assume.thanks for your help Quote Link to comment https://forums.phpfreaks.com/topic/19901-prevent-sharing-of-accounts/#findComment-87129 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.