You are here

function _session_limit_disconnect in Session Limit 5

Logout a specific session id and leave them a message.

2 calls to _session_limit_disconnect()
session_limit_page in ./session_limit.module
Display/Delete sessions..
session_limit_page_submit in ./session_limit.module
Handler for submissions from session_limit_page().

File

./session_limit.module, line 195
Established Sessions do NOT need to verify every page load. new Session must deal w/ determining which connection is cut.

Code

function _session_limit_disconnect($sid) {
  $logout_message = <<<EOM
You have been automatically logged out.
Someone else has logged in with your username and password and the maximum number of @num simultaneous sessions was exceeded.
This may indicate that your account has been compromised or that account sharing is not allowed on this site.
Please contact the site administrator if you suspect your account has been compromised.
EOM;
  $logout_message = 'messages|' . serialize(array(
    'error' => array(
      t($logout_message, array(
        '@num' => variable_get('session_limit_max', 1),
      )),
    ),
  ));
  db_query("UPDATE {sessions} SET uid = 0, session = '%s' WHERE sid = '%s'", $logout_message, $sid);
}