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


PHP XUtils::getClientIP方法代码示例

本文整理汇总了PHP中XUtils::getClientIP方法的典型用法代码示例。如果您正苦于以下问题:PHP XUtils::getClientIP方法的具体用法?PHP XUtils::getClientIP怎么用?PHP XUtils::getClientIP使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XUtils的用法示例。


在下文中一共展示了XUtils::getClientIP方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionLogin

 /**
  * 会员登录
  */
 public function actionLogin()
 {
     $model = new Admin('login');
     if (XUtils::method() == 'POST') {
         $model->attributes = $_POST['Admin'];
         if ($model->validate()) {
             $data = $model->find('username=:username', array('username' => $model->username));
             if ($data === null) {
                 $model->addError('username', '用户不存在');
                 AdminLogger::_create(array('catalog' => 'login', 'intro' => '登录失败,用户不存在:' . CHtml::encode($model->username), 'user_id' => 0));
             } elseif (!$model->validatePassword($data->password)) {
                 $model->addError('password', '密码不正确');
                 AdminLogger::_create(array('catalog' => 'login', 'intro' => '登录失败,密码不正确:' . CHtml::encode($model->username) . ',使用密码:' . CHtml::encode($model->password), 'user_id' => 0));
             } elseif ($data->group_id == 2) {
                 $model->addError('username', '用户被锁定,请联系网站管理');
             } else {
                 parent::_stateWrite(array('userId' => $data->id, 'userName' => $data->username, 'groupId' => $data->group_id, 'super' => $data->group_id == 1 ? 1 : 0), array('prefix' => '_admini'));
                 $data->last_login_ip = XUtils::getClientIP();
                 $data->last_login_time = time();
                 $data->login_count = $data->login_count + 1;
                 $data->save();
                 AdminLogger::_create(array('catalog' => 'login', 'intro' => '用户登录成功:' . CHtml::encode($model->username)));
                 $this->redirect(array('default/index'));
             }
         }
     }
     $this->render('login', array('model' => $model));
 }
开发者ID:zywh,项目名称:maplecity,代码行数:31,代码来源:PublicController.php

示例2: actionLogin

 public function actionLogin()
 {
     $model = new Admin('login');
     if (XUtils::method() == 'POST') {
         $model->attributes = $_POST['Admin'];
         if ($model->validate()) {
             $data = $model->find('username=:username', array('username' => $model->username));
             if ($data === null) {
                 $model->addError('username', '用户不存在');
                 parent::_backendLogger(array('catalog' => 'login', 'intro' => '登录失败,用户不存在:' . CHtml::encode($model->username), 'user_id' => 0));
             } elseif (!$model->validatePassword($data->password)) {
                 $model->addError('password', '密码不正确');
                 parent::_backendLogger(array('catalog' => 'login', 'intro' => '登录失败,密码不正确:' . CHtml::encode($model->username) . ',使用密码:' . CHtml::encode($model->password), 'user_id' => 0));
             } elseif ($data->group_id == 2) {
                 $model->addError('username', '用户已经锁定,请联系管理');
             } else {
                 $this->_sessionSet('_backendGroupId', $data->group_id);
                 if (isset($data->group_id) && $data->group_id == 1) {
                     $this->_sessionSet('_backendPermission', 'backendstrator');
                 }
                 $data->last_login_ip = XUtils::getClientIP();
                 $data->last_login_time = time();
                 $data->login_count = $data->login_count + 1;
                 $data->save();
                 parent::_sessionSet('uid', $data->id);
                 parent::_sessionSet('uname', $data->username);
                 parent::_backendLogger(array('catalog' => 'login', 'intro' => '用户登录成功:' . $data->username));
                 $this->redirect(array('default/index'));
                 XUtils::message('success', '登录成功', $this->createUrl('default/index'), 2);
             }
         }
     }
     $this->render('login', array('model' => $model));
 }
开发者ID:lp19851119,项目名称:114la,代码行数:34,代码来源:PublicController.php

示例3: _create

 /**
  * 后台日志记录
  * @param  $intro
  */
 public static function _create(array $arr = array())
 {
     $session = new XSession();
     $admini = $session->get('_admini');
     $model = new AdminLogger();
     $model->attributes = $arr;
     !isset($arr['user_id']) && ($model->user_id = intval($admini['userId']));
     $model->url = Yii::app()->request->getRequestUri();
     $model->ip = XUtils::getClientIP();
     $model->save();
 }
开发者ID:zywh,项目名称:maplecity,代码行数:15,代码来源:AdminLogger.php

示例4: actionLogin

 /**
  * 会员登录
  */
 public function actionLogin()
 {
     $this->layout = " ";
     Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . '/js/jquery-1.9.1.js');
     Yii::app()->clientScript->registerCssFile(Yii::app()->theme->baseUrl . '/css/login.css');
     $original = Yii::app()->request->getQuery('original');
     $model = new User('login');
     if (XUtils::method() == 'POST') {
         $model->attributes = $_POST['User'];
         $data = $model->find('username=:username OR email=:email', array(':username' => $model->username, ':email' => $model->username));
         if ($data === null) {
             $model->addError('username', '用户不存在');
         } elseif (!$model->validatePassword($data->password)) {
             $model->addError('password', '密码不正确');
         } else {
             $userInfo = UserInfo::model()->find('userId=:userId', array(':userId' => $data->id));
             parent::_stateWrite(array('userId' => $data->id, 'userName' => $data->username, 'nickname' => $userInfo->nickname), array('prefix' => '_account'));
             $data->last_login_ip = XUtils::getClientIP();
             $data->last_login_time = time();
             $data->login_count = $data->login_count + 1;
             $data->save();
             if ($_REQUEST["houseid"] == "") {
                 //判断登陆是否从预约看房那边进来的
                 if (!empty($original)) {
                     $this->redirect($original);
                 } else {
                     $this->redirect(array('site/index'));
                 }
             } else {
                 $this->redirect(array('house/view&id=' . $_REQUEST[houseid] . ''));
             }
         }
     }
     $this->render('login', array('model' => $model));
 }
开发者ID:zywh,项目名称:maplecity,代码行数:38,代码来源:SiteController.php

示例5: _userLogger

 /**
  * 后台日志记录
  * @param  $intro
  */
 protected function _userLogger(array $arr = array())
 {
     $model = new UserLogger();
     $model->attributes = $arr;
     !isset($arr['user_id']) && ($model->user_id = intval(self::_sessionGet('_userId')));
     $model->url = Yii::app()->request->getRequestUri();
     $model->ip = XUtils::getClientIP();
     $model->save();
 }
开发者ID:lp19851119,项目名称:114la,代码行数:13,代码来源:Controller.php


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