Jump to content

One Login per User at any given time


StreamMe

Recommended Posts

I googled this, but to my surprise didnt find anything cept a lead. On some site it said if I set the username as the session key, that any other user using that key would get the boot. Am I setting session keys wrong(i cant find help on this either).

 

Either way - end goal is to have only 1 user logged in at any given time per user name, in the easiest manner possible.

 

session_id(md5($RP08)); - before session_start()

Link to comment
Share on other sites

Well what you could do is this.

 

Add a feild to a database called logged in. Then when a user logs in get the code to check username, password and the logged in status. If the logged in feild ==Yes then error "someone is already logged in" if logged in feild =="no" then header location = index.php.

 

Then when a user logs out get it to change the logged in status to ==no. This is very reliant on users logging in and out though. If a user doesn't log out then the system will fail. One way around that would be to have session time outs that log you out It is a very simple way of doing what you want. One of the more skilled people may know a better way. 

Link to comment
Share on other sites

try sumit like this

 


<?php
$value = 'logged_in';



setcookie("TestCookie", $value);
setcookie("TestCookie", $value, time()+3600);  /* expire in 1 hour */
update `db` set logged _in=`no`
?> 

 

know that wont work but just a idea set the ciikie to destroy a hour from now or when ever.

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.