当前位置: 首页>>代码示例>>PHP>>正文


PHP Vtiger_Functions::getRemoteIP方法代码示例

本文整理汇总了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');
 }
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:28,代码来源:SwitchUsers.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)]);
 }
开发者ID:awflu,项目名称:YetiForceCRM,代码行数:9,代码来源:AppException.php

示例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;
 }
开发者ID:yozhi,项目名称:YetiForceCRM,代码行数:17,代码来源:Module.php

示例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);
 }
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:14,代码来源:Module.php


注:本文中的Vtiger_Functions::getRemoteIP方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。