oceans Posted May 29, 2007 Share Posted May 29, 2007 Dear People, I wish to create "Mutex", i.e. I want only one client instance from one client PC. Is there a ready function call, or how could construct one. In "application based" programming Mutex and its key takes care. I think javascript might might not help me, I have a lot of linked pages, a javascript dies after that page. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/53377-please-help/ Share on other sites More sharing options...
taith Posted May 29, 2007 Share Posted May 29, 2007 basically... you set a cookie of a browser specific info... sessid for example... <?php session_start(); if($_COOKIE[sessid]!=session_id()) header('Locaton: login.php'); ?> however... if the person does file, new window, it does hold onto the same sessid, therefore, it wont block it... but it would block any new ie's that were opened Quote Link to comment https://forums.phpfreaks.com/topic/53377-please-help/#findComment-263853 Share on other sites More sharing options...
oceans Posted May 29, 2007 Author Share Posted May 29, 2007 Thanks Taith, As for cookie, am I right to say if one closes the ie abroptly, the cookie clearing will not be done, this way he will never be able to start a new window, i don't know if I am making sense... Quote Link to comment https://forums.phpfreaks.com/topic/53377-please-help/#findComment-263958 Share on other sites More sharing options...
taith Posted May 29, 2007 Share Posted May 29, 2007 nah... the cookie just redirects to the login page, just have that cookie set on login :-) Quote Link to comment https://forums.phpfreaks.com/topic/53377-please-help/#findComment-263967 Share on other sites More sharing options...
MadTechie Posted May 29, 2007 Share Posted May 29, 2007 <?php function MadTechie() { include "taith"; $slave = new taiths_echo; echo $slave->last_msg(); } ?> Sorry private joke Quote Link to comment https://forums.phpfreaks.com/topic/53377-please-help/#findComment-264195 Share on other sites More sharing options...
Daniel0 Posted May 29, 2007 Share Posted May 29, 2007 It's not possible. With the above example people could just open another browser. E.g. I log in using Firefox, then open Opera and login again. Two connections. Quote Link to comment https://forums.phpfreaks.com/topic/53377-please-help/#findComment-264250 Share on other sites More sharing options...
gabeg Posted May 29, 2007 Share Posted May 29, 2007 Only way I can think to do this is to have them have a regisitered account, and store their session id in the row along with their other info, and on each page check to make their session id matches their current. This way, on the logout script you can clear the session id column, and until they logout, their session id must stay the same Quote Link to comment https://forums.phpfreaks.com/topic/53377-please-help/#findComment-264255 Share on other sites More sharing options...
Daniel0 Posted May 29, 2007 Share Posted May 29, 2007 Only way I can think to do this is to have them have a regisitered account, and store their session id in the row along with their other info, and on each page check to make their session id matches their current. This way, on the logout script you can clear the session id column, and until they logout, their session id must stay the same How does that deal with opening multiple browsers? Quote Link to comment https://forums.phpfreaks.com/topic/53377-please-help/#findComment-264260 Share on other sites More sharing options...
MadTechie Posted May 29, 2007 Share Posted May 29, 2007 when you "login" create a session with a random key.. store that key in with the users ID in a sessions table (mysql) the script then checks if your logged inn (matched the session key to the one in the database). now User A logs in, session key (AAAFF) is created and a session for UserID , now in the sessions database user ID A doesn't exist so it creates one (stores USER ID & SESSION KEY). now as the user uses the system the system will check if the sessions match the ones in the database. ok Now he logs in again session key (BBBFF) is created and a session for UserID , now in the sessions database user ID A does exist so it updates the session key. now that account will work but the first login will never match as it now has a new session key.. Quote Link to comment https://forums.phpfreaks.com/topic/53377-please-help/#findComment-264272 Share on other sites More sharing options...
taith Posted May 30, 2007 Share Posted May 30, 2007 unless... you were to store the sessid into the database... you login one browser, it inserts into database, then if you loginto another browser it invalidates the prior session... Quote Link to comment https://forums.phpfreaks.com/topic/53377-please-help/#findComment-264568 Share on other sites More sharing options...
MadTechie Posted May 30, 2007 Share Posted May 30, 2007 thats correct (what my idea will do) unless your suggecting something else! Quote Link to comment https://forums.phpfreaks.com/topic/53377-please-help/#findComment-264578 Share on other sites More sharing options...
Daniel0 Posted May 30, 2007 Share Posted May 30, 2007 Question: Are you talking about preventing a user from logging in multiple times with one user or multiple users? Quote Link to comment https://forums.phpfreaks.com/topic/53377-please-help/#findComment-264592 Share on other sites More sharing options...
MadTechie Posted May 30, 2007 Share Posted May 30, 2007 One account from one pc, the idea above will stop mutliple logons and multiple browsers add taith's and it should work (maybe a problem with FF tabs) but you can get around them using a expected next key.. will explain more if needed Quote Link to comment https://forums.phpfreaks.com/topic/53377-please-help/#findComment-264602 Share on other sites More sharing options...
oceans Posted June 1, 2007 Author Share Posted June 1, 2007 Dear People, We are vey lucky have you people. I followed, i think mysql and session will not help, why because, if a user turns off page or computer abdruptly the present value remains for ever! the present value id reset only of the resettnig sequence in the code is runned. thus can we do anything at the client side, may be a cookie and javascript? Quote Link to comment https://forums.phpfreaks.com/topic/53377-please-help/#findComment-266063 Share on other sites More sharing options...
gabeg Posted June 1, 2007 Share Posted June 1, 2007 Create a time-out of say 20 mins. Store the timestamp when the user visits any page. When they try to login again, if the time between the last pageload on the site is more than 20 mins, let them login, and doing so, will overwrite their old login if they attempt to use it again after 20 mins Quote Link to comment https://forums.phpfreaks.com/topic/53377-please-help/#findComment-266073 Share on other sites More sharing options...
oceans Posted June 1, 2007 Author Share Posted June 1, 2007 I can't figure out still. Quote Link to comment https://forums.phpfreaks.com/topic/53377-please-help/#findComment-266080 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.