CheckAccess
Description and parameters
bool CSaleAuxiliary::CheckAccess( int userID, string itemMD5, int periodLength, string periodType );
Method checks if visitor with userID can get access with itemMD5. Period during which user has access to a resource is specified by the length periodLength and periodType parameters. Non-static method.
Call parameters
Parameter | Description |
---|---|
userID | User code. |
itemMD5 | String with single resource identification (resource identifier). |
periodLength | Period length for the user to have access to resource. |
periodType | Period length type, for the user to have access to resource. Permissible values: I - minute, H - hour, D - day, W - week, M - month, Q - quarter, S - semester, Y - year. |
Returned value
Returns true, if user has access to this resource and false otherwise.
Examples
<? if (CSaleAuxiliary::CheckAccess($USER->GetID(), "pict.jpg", 2, "D")) { echo '<a href="'.pict.jpg.'">File is available for download</a>'; } else { echo "File is unavailable for download"; } ?>
© «Bitrix24», 2001-2024