本文整理汇总了PHP中Vtiger_Functions::getRemoteIP方法的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Functions::getRemoteIP方法的具体用法?PHP Vtiger_Functions::getRemoteIP怎么用?PHP Vtiger_Functions::getRemoteIP使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vtiger_Functions
的用法示例。
在下文中一共展示了Vtiger_Functions::getRemoteIP方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
function process(Vtiger_Request $request)
{
$currentUserModel = Users_Record_Model::getCurrentUserModel();
$baseUserId = $currentUserModel->getId();
$userId = $request->get('id');
$user = new Users();
$currentUser = $user->retrieveCurrentUserInfoFromFile($userId);
$name = $currentUserModel->getName();
$userName = $currentUser->column_fields['user_name'];
Vtiger_Session::set('AUTHUSERID', $userId);
Vtiger_Session::set('authenticated_user_id', $userId);
Vtiger_Session::set('user_name', $userName);
Vtiger_Session::set('full_user_name', $name);
$status = 'Switched';
if (Vtiger_Session::get('baseUserId') == '') {
Vtiger_Session::set('baseUserId', $baseUserId);
$status = 'Signed in';
} elseif ($userId == Vtiger_Session::get('baseUserId')) {
$baseUserId = $userId;
Vtiger_Session::set('baseUserId', '');
$status = 'Signed out';
} else {
$baseUserId = Vtiger_Session::get('baseUserId');
}
$dbLog = PearDatabase::getInstance('log');
$dbLog->insert('l_yf_switch_users', ['baseid' => $baseUserId, 'destid' => $userId, 'busername' => $currentUserModel->getName(), 'dusername' => $name, 'date' => date('Y-m-d H:i:s'), 'ip' => Vtiger_Functions::getRemoteIP(), 'agent' => $_SERVER['HTTP_USER_AGENT'], 'status' => $status]);
header('Location: index.php');
}
示例2: __construct
public function __construct($message = null, $code = 0)
{
parent::__construct($message, $code);
Vtiger_Session::init();
$request = new Vtiger_Request($_REQUEST);
$dbLog = PearDatabase::getInstance('log');
$userName = Vtiger_Session::get('full_user_name');
$dbLog->insert('o_yf_access_for_api', ['username' => empty($userName) ? '-' : $userName, 'date' => date('Y-m-d H:i:s'), 'ip' => Vtiger_Functions::getRemoteIP(), 'url' => Vtiger_Functions::getBrowserInfo()->url, 'agent' => $_SERVER['HTTP_USER_AGENT'], 'request' => json_encode($_REQUEST)]);
}
示例3: checkBlocked
public static function checkBlocked()
{
$db = PearDatabase::getInstance();
$query = "SELECT * FROM `vtiger_bruteforce` LIMIT 1";
$result = $db->pquery($query, array());
$ip = Vtiger_Functions::getRemoteIP();
$now = date("Y-m-d H:i:s");
$bruteforceSettings = $db->query_result_rowdata($result, 0);
$attempsNumber = $bruteforceSettings['attempsnumber'];
$blockTime = $bruteforceSettings['timelock'];
$query = "SELECT count(login_id) as cn FROM `vtiger_loginhistory` vlh WHERE STATUS = 'Failed login' && user_ip = ? && unblock = 0 && (UNIX_TIMESTAMP(vlh.login_time) - UNIX_TIMESTAMP(ADDDATE(?, INTERVAL -{$blockTime} MINUTE))) > 0";
$result = $db->pquery($query, array($ip, $now));
if ($db->query_result_raw($result, 0, 'cn') >= $attempsNumber) {
return true;
}
return false;
}
示例4: saveLoginHistory
/**
* Function to store the login history
* @param type $username
*/
public function saveLoginHistory($username, $status = 'Signed in', $browser = '')
{
$adb = PearDatabase::getInstance();
$userIPAddress = Vtiger_Functions::getRemoteIP();
$loginTime = date("Y-m-d H:i:s");
$browser = strlen($browser) ? $browser : '-';
$query = "INSERT INTO vtiger_loginhistory (user_name, user_ip, logout_time, login_time, status, browser) VALUES (?,?,?,?,?,?)";
$params = array($username, $userIPAddress, '0000-00-00 00:00:00', $loginTime, $status, $browser);
$adb->pquery($query, $params);
}