You are here

function drd_server_get_account_by_session in Drupal Remote Dashboard Server 7

Same name and namespace in other branches
  1. 6 drd_server.module \drd_server_get_account_by_session()

Get the session by ID.

This function returns the account for the given session or NULL.

Parameters

$sid: The session ID that was returned by drd_server_connect().

Return value

Returns the account object or NULL if session ID wasn't found.

See also

drd_server_connect

2 calls to drd_server_get_account_by_session()
drd_server_check_session in ./drd_server.module
Check the session ID if it's still valid.
drd_server_load_user in ./drd_server.module
Load user for session and check permission.

File

./drd_server.module, line 93

Code

function drd_server_get_account_by_session($sid) {
  try {
    $account = db_query("SELECT u.*, s.* FROM {users} u INNER JOIN {sessions} s ON u.uid = s.uid WHERE s.sid = :sid", array(
      ':sid' => $sid,
    ))
      ->fetchObject();
  } catch (Exception $e) {
  }
  return $account;
}