Bitrix Site Manager

CStopList::Check

mixed
CStopList::Check(
 string test = "N",
 mixed params = false
)

The method Check checks if the current visitor matches one of the stop list records. This method is called automatically in the prologue on each hit.

Parameters

Parameter Description
test There can be situations when you may happen to add yourself to the stop list. To avoid this, the system first adds a test record to the stop list, then checks if the current visitor matches this test record. If the visitor does not match, the method deletes the test record.

If this method is called with test="Y", it will only check if the current visitor matches test records of the stop list. If this method is called with test="N" (the default value), it will check if the visitor matches all the records of the stop list except the test ones.
params Optional array of parameters that can be used to check if the visitor matches the stop list. The following keys are possible in this array:
  • IP - the IP address in the format XXX.XXX.XXX.XXX;
  • USER_AGENT - the UserAgent (full or partial string);
  • URL_FROM - the referring page;
  • URL_TO - the target page;
  • SITE_ID - the site ID.

Return Values

The method returns the ID of the matching stop list record, or false otherwise.

See Also

Example



<?
// set the visitor parameters for checking in the stop list
$arParams = array(
    "IP" => "192.168.0.1",
    "USER_AGENT" => "Firefox"
    );

$record_id = CStopList::Check("N", $arParams);
if (intval($record_id)>0) 
    echo "Matching record #".intval($record_id);
?>