本文整理匯總了PHP中ilSession::_getUsersWithIp方法的典型用法代碼示例。如果您正苦於以下問題:PHP ilSession::_getUsersWithIp方法的具體用法?PHP ilSession::_getUsersWithIp怎麽用?PHP ilSession::_getUsersWithIp使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ilSession
的用法示例。
在下文中一共展示了ilSession::_getUsersWithIp方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: determineUser
/**
* Determine the current user(s)
*/
public function determineUser()
{
global $ilUser;
// a valid user session is found
if ($_SESSION["AccountId"]) {
$this->check_users = array($_SESSION["AccountId"]);
return;
} elseif ($GLOBALS['WEB_ACCESS_WITHOUT_SESSION'] and $this->getCheckIp()) {
$this->check_users = ilSession::_getUsersWithIp($_SERVER['REMOTE_ADDR']);
if (count($this->check_users) == 0) {
// no user was found for the ip address
$this->check_users = array(ANONYMOUS_USER_ID);
$_SESSION["AccountId"] = ANONYMOUS_USER_ID;
$ilUser->setId(ANONYMOUS_USER_ID);
$ilUser->read();
} elseif (count($this->check_users) == 1) {
// exactly one user is found with an active session
$_SESSION["AccountId"] = current($this->check_users);
$ilUser->setId(current($this->check_users));
$ilUser->read();
} else {
// more than one user found for the ip address
// take the anonymous user for the session
$_SESSION["AccountId"] = ANONYMOUS_USER_ID;
$ilUser->setId(ANONYMOUS_USER_ID);
$ilUser->read();
}
return;
} else {
$this->check_users = array(ANONYMOUS_USER_ID);
$_SESSION["AccountId"] = ANONYMOUS_USER_ID;
$ilUser->setId(ANONYMOUS_USER_ID);
$ilUser->read();
return;
}
}