The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to force user login only one device at a time ?
#3
Thank you Brandin for your reply,

Actually what I wanted was if a user tries to login from a device but is already logged in from another device earlier, let him log in from this device but log him out from all other devices. For the solution I thought of the way below but I am not sure if its possible or not. 

I may need to one of the following custom script but not sure which


1. not_logged_in.php // I may not get a handle to User class here
2. custom_login_script.php // I get a handle to User class here

I checked logout.php and it uses 
Code:
$user->logout();

When I checked "User.php" class I found it uses DB to log him out
PHP Code:
public function logout(){
        
$this->_db->query("DELETE FROM users_session WHERE user_id = ? AND uagent = ?",array($this->data()->id,Session::uagent_no_version()));

        
Session::delete($this->_sessionName);
        
Cookie::delete($this->_cookieName);
        
session_unset();
        
session_destroy();
    } 

I am not very good at PHP but figured out I need to somehow combine these and use it in one of the two custom login script to get my result. 
Hope to get right direction from you.
Thank you.
  Reply


Messages In This Thread
RE: How to force user login only one device at a time ? - by rockfight - 08-01-2018, 02:15 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)