Bitrix Site Manager

CSession::GetByID

CDBResult
CSession::GetByID(
 int session_id
)

The method GetByID returns information about the specified session.

Parameters

Parameter Description
session_id The session ID.

Structure of the returned record

Array
(
    [ID] => the session ID
    [GUEST_ID] => the visitor ID
    [NEW_GUEST] => [Y|N] flag: new visitor
    [USER_ID] => the ID of a user under which the visitor
                 was last authorised
    [USER_AUTH] => [Y|N] flag: whether the visitor was authorised
                               during this session
    [LOGIN] => the user login under which the visitor
               was last authorised
    [USER_NAME] => first and last names of a user under which
                   the visitor was last authorised
    [C_EVENTS] => number of events occurred during this session
    [HITS] => number of hits occurred during this session
    [FAVORITES] => [Y|N] flag: the site was added to Favorites
    [URL_FROM] => the referring page of the first session hit
    [URL_TO] => the first page of the session
    [URL_TO_404] => [Y|N] indicates the error 404 occurred
                    on the first page of the session
    [URL_LAST] => the last page of the session
    [URL_LAST_404] => [Y|N] indicates the error 404 occurred
                      on the last page of the session
    [USER_AGENT] => the visitor UserAgent
    [DATE_STAT] => date and time the session started
    [DATE_FIRST] => date and time the first hit occurred
    [DATE_LAST] => date and time the last hit occurred
    [SESSION_TIME] => time difference between the first and last hits (sec.)
    [IP_FIRST] => the visitor IP address during the first hit
                  (in the form XXX.XXX.XXX.XXX)
    [IP_FIRST_NUMBER] => the visitor IP address during the first hit
                         (numerical)
    [IP_LAST] => the visitor IP address during the last hit
                 (in the form XXX.XXX.XXX.XXX)
    [IP_LAST_NUMBER] => the visitor IP address during the first hit
                        (numerical)
    [FIRST_HIT_ID] => the first hit ID
    [FIRST_SITE_ID] => the ID of the first hit site
    [LAST_HIT_ID] => the last hit ID
    [LAST_SITE_ID] => the ID of the last hit site
    [ADV_ID] => the advertising campaign ID
    [ADV_BACK] => [Y|N] flag: direct hit (N)
                  or return (Y) under an advertising campaign
    [REFERER1] => the referer1 identifier of an advertising campaign
    [REFERER2] => the referer2 identifier of an advertising campaign
    [REFERER3] => the referer3 auxiliary parameter of an advertising campaign
    [COUNTRY_ID] => the visitor country ID
    [COUNTRY_NAME] => name of the visitor country
    [STOP_LIST_ID] => the ID of the stop list record
                      for the visitor (if applicable)
    [PHPSESSID] => the PHP session identifier
)

See Also

Example



<?
$session_id = 1;
if ($rs = CSession::GetByID($session_id))
{
    $ar = $rs->Fetch();
    // print session parameters
    echo "<pre>"; print_r($ar); echo "</pre>";
}
?>