本文整理汇总了PHP中request::getClientIp方法的典型用法代码示例。如果您正苦于以下问题:PHP request::getClientIp方法的具体用法?PHP request::getClientIp怎么用?PHP request::getClientIp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类request
的用法示例。
在下文中一共展示了request::getClientIp方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
public function save()
{
$this->begin();
$params = $_POST;
if (isset($params['enabled']) && $params['enabled'] == 1) {
$ips = explode(PHP_EOL, $params['ips']);
if (!$params['ips'] || empty($ips)) {
$this->end(false, app::get('site')->_('ip列表不能为空'));
}
app::get('site')->setConf('desktop.whitelist.enabled', 1);
$current_admin_ip = request::getClientIp();
if (!in_array($current_admin_ip, $ips)) {
$ips[] = $current_admin_ip;
}
app::get('site')->setConf('desktop.whitelist.ips', $ips);
if (in_array($params['error_code'], array('403', '404'))) {
app::get('site')->setConf('desktop.whitelist.error_code', $params['error_code']);
} else {
app::get('site')->setConf('desktip.whitelist.error_code', '403');
}
} else {
app::get('site')->setConf('desktop.whitelist.enabled', 0);
}
$this->end(true, '设置成功');
}
示例2: __loginLog
private function __loginLog($msg)
{
$log['IP'] = request::getClientIp();
$log['uname'] = input::get('uname');
$log['msg'] = $msg;
$log['HTTP_REFERER'] = $_SERVER['HTTP_REFERER'];
$log['type'] = 'shopadmin';
logger::info('ADMIN_LOGIN:' . var_export($log, 1));
}
示例3: listener_login
public function listener_login($params)
{
$account_type = pamAccount::getAuthType('desktop');
if ($account_type === $params['type'] && $params['member_id']) {
$users = app::get('desktop')->model('users');
if ($row = $users->getList('*', array('user_id' => $params['member_id']))) {
$sdf['lastlogin'] = time();
$sdf['lastip'] = request::getClientIp();
$sdf['logincount'] = $row[0]['logincount'] + 1;
$users->update($sdf, array('user_id' => $params['member_id']));
}
}
}
示例4: adminlog
/**
* 记录平台操作日志
*
* @param $lang 日志语言包
* @param $status 成功失败状态
* @param $admin_name
* @param $admin_id
*/
protected final function adminlog($memo = '', $status = 1)
{
// 开启了才记录操作日志
if (ADMIN_OPERATOR_LOG !== true) {
return;
}
$queue_params = array('admin_userid' => $this->user->get_id(), 'admin_username' => $this->user->get_login_name(), 'created_time' => time(), 'memo' => $memo, 'status' => $status ? 1 : 0, 'router' => request::fullurl(), 'ip' => request::getClientIp());
return system_queue::instance()->publish('system_tasks_adminlog', 'system_tasks_adminlog', $queue_params);
}
示例5: gen_session_id
protected function gen_session_id()
{
return sha1(uniqid('', true) . request::getClientIp() . str_random(25) . microtime(true));
}
示例6: signUp
public function signUp($loginName, $password, $confirmedPassword)
{
return app::get('pam')->rpcCall('user.create', ['account' => $loginName, 'password' => $password, 'pwd_confirm' => $confirmedPassword, 'reg_ip' => request::getClientIp()], 'buyer');
}