本文整理汇总了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;
}
}