Jump to content

Please Help


oceans

Recommended Posts

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.

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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..

 

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.