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
Limiting the number of same user simultaneous sessions
#8
(05-13-2018, 05:21 PM)demilson Wrote: Hi Brandin!

It seems I achieved the solution. Just added the following in the file custom_login_script.php and a user wont be able to login in more than one time simultaneously. To test: open a session in one device and, then, try to login another session (same user, of course) from another device or even from an browser private navigation window.

<?php
//Whatever you put here will happen after the username and password are verified and the user is "technically" logged in, but they have not yet been redirected to their starting page. This gives you access to all the user's data through $user->data()

$db->query("UPDATE us_user_sessions SET UserSessionEnded=1,UserSessionEnded_Time=NOW() WHERE UserSessionEnded=0 AND fkUserID=?", [$_SESSION['user']]);

Redirect::to($us_url_root.'users/account.php');
?>

......

Here i'm again:

I'm trying the latest US version, great improvements!

My only complaint: I found the mod I had implemented to not allow more than one session open simultaneously isn't working anymore. I just tried adding the above code as I did before in the custom_login_script.php file.

Isn't it compatible anymore?

Thank you!

Demilson
  Reply


Messages In This Thread
Limiting the number of same user simultaneous sessions - by demilson - 04-30-2018, 01:09 AM
RE: Limiting the number of same user simultaneous sessions - by demilson - 05-06-2019, 04:13 AM
Limiting the number of same user simultaneous sessions - by demilson - 04-30-2018, 11:23 AM
Limiting the number of same user simultaneous sessions - by demilson - 05-11-2018, 01:37 PM
Limiting the number of same user simultaneous sessions - by demilson - 05-13-2018, 05:21 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)