Bitrix Site Manager

CUserOnline::GetList

CDBResult
CUserOnline::GetList(
 int &guest_counter,
 int &session_counter
)

The method GetList returns a list of active visitors' sessions (those who made a hit) on the site within a certain time period.

Parameters

Parameter Description
guest_counter Reference to a variable which will contain the number of online visitors on return.
session_counter Reference to a variable which will contain the number of visitor sessions on return.

Structure of the returned record

Array
(
    [ID] => the session ID
    [HITS] => number of session hits
    [LAST_USER_ID] => the ID of the user under which the visitor was last authorised
    [USER_AUTH] => flag: whether the user is authorised 
                   in this session [Y/N]
    [STOP_LIST_ID] => the ID of the stop list record (if applicable)
    [GUEST_ID] => the visitor ID
    [NEW_GUEST] => new visitor (Y - new; N - returned)
    [FAVORITES] => flag: whether the visitor has added
                   the site to Favorites during this session
    [COUNTRY_ID] => the ID of the visitor country
    [COUNTRY_NAME] => name of the visitor country

    [ADV_ID] => the ID of the advertising campaign
    [ADV_BACK] => flag: direct hit (N) or return (Y) under an advertising campaign
    [REFERER1] => the referer1 identifier of the advertising campaign
    [REFERER2] => the referer2 identifier of the advertising campaign
    [REFERER3] => the additional parameter of the advertising campaign
    
    [FIRST_URL_FROM] => the referring page form which the visitor first entered the site
    [URL_FROM] => the referring page URL
    [FIRST_SITE_ID] => the first site ID
    [URL_LAST] => the page of the last session hit
    [URL_LAST_404] => [Y|N] indicates the error 404 occurred on the last page of the session
    [LAST_SITE_ID] => the ID of the last hit site
    [IP_LAST] => the visitor IP address during the last hit (in the form XXX.XXX.XXX.XXX)
    [DATE_LAST] => time of the last hit

    [SESSION_TIME] => time difference between the first and last hits (sec.)
)

See Also

Example



<?
// obtain the list of records
$rs = CUserOnline::GetList($guest_counter, $session_counter);

echo "Online visitors : ".$guest_counter;
echo "Online sessions : ".$session_counter;

// print all records
while ($ar = $rs->Fetch())
{
    echo "<pre>"; print_r($ar); echo "</pre>";    
}
?>