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


PHP Common::getIp方法代码示例

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


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

示例1: afterSave

 public function afterSave($event)
 {
     if (Yii::app() instanceof CWebApplication) {
         if (Yii::app()->user->getState(UserIdentity::STATE_AUDIT_TRAIL, true)) {
             $isNewRecord = $this->getOwner()->getIsNewRecord();
             UserActivityLog::model()->addRecord(array('user_id' => Yii::app()->user->id, 'ip' => Common::getIp(), 'action' => $isNewRecord ? 'create' : 'update', 'activity' => $this->prepareString($isNewRecord ? $this->createTemplate : $this->updateTemplate)));
         }
     }
     return parent::afterSave($event);
 }
开发者ID:wanyos2005,项目名称:hsbf,代码行数:10,代码来源:AuditTrailBehavior.php

示例2: actionIndex

 public function actionIndex()
 {
     //获取用户名和密码
     $name = Yii::app()->request->getParam('name');
     $password = Yii::app()->request->getParam('password');
     if (!$name) {
         Error::output(Error::ERR_NO_USER_NAME);
     }
     if (!$password) {
         Error::output(Error::ERR_NO_PASSWORD);
     }
     //获取用户模型
     $userinfo = Members::model()->find('name=:name', array(':name' => $name));
     if (!$userinfo) {
         Error::output(Error::ERR_NO_USER);
     } else {
         $_password = md5($userinfo->salt . $password);
         if ($_password != $userinfo->password) {
             Error::output(Error::ERR_INVALID_PASSWORD);
         }
     }
     //登陆成功生成user_login
     $userLogin = UserLogin::model()->find('user_id = :user_id', array(':user_id' => $userinfo->id));
     if (!$userLogin) {
         //不存在就创建
         $userLogin = new UserLogin();
         $userLogin->user_id = $userinfo->id;
         $userLogin->username = $name;
     }
     $userLogin->login_time = time();
     $userLogin->token = md5(time() . Common::getGenerateSalt());
     $userLogin->visit_client = Common::getClientType();
     $userLogin->ip = Common::getIp();
     $userLogin->save();
     $member = CJSON::decode(CJSON::encode($userinfo));
     $member['token'] = $userLogin->token;
     unset($member['password'], $member['salt']);
     //返回数据
     //如果存在头像,就返回
     if ($member['avatar']) {
         //取图片数据
         $material = Material::model()->findByPk($member['avatar']);
         $member['avatar'] = array('host' => Yii::app()->params['img_url'], 'filepath' => $material->filepath, 'filename' => $material->filename);
     }
     Out::jsonOutput($member);
 }
开发者ID:RoyZeng,项目名称:dinner,代码行数:46,代码来源:LoginController.php

示例3: add

 public function add($type = 'orders', $item_id = '', $action = 'exchange', $result = 'failure', $message = '', $data = array())
 {
     $data += array('user_id' => $this->user->id ? $this->user->id : 0, 'user_name' => $this->user->name ? $this->user->name : '', 'user_ip' => Common::getIp());
     $sql = "INSERT INTO {{user_logs}}\n\t\t\t\tVALUES(:log_id, :user_id, :log_type, :log_item_id, :log_action, :log_result, :log_message, :log_data, :user_ip, :lasttime)";
     $this->db->prepare($sql);
     $this->db->bindValue(':log_id', 0, PDO::PARAM_INT);
     $this->db->bindValue(':user_id', $this->user->isLogin() ? $this->user->id : 0, PDO::PARAM_INT);
     $this->db->bindValue(':log_type', $type, PDO::PARAM_STR);
     $this->db->bindValue(':log_item_id', $item_id, PDO::PARAM_INT);
     $this->db->bindValue(':log_action', $action, PDO::PARAM_STR);
     $this->db->bindValue(':log_result', $result, PDO::PARAM_STR);
     $this->db->bindValue(':log_message', $message, PDO::PARAM_STR);
     $this->db->bindValue(':log_data', json_encode($data), PDO::PARAM_STR);
     $this->db->bindValue(':user_ip', Common::getIp(true), PDO::PARAM_INT);
     $this->db->bindValue(':lasttime', $_SERVER['REQUEST_TIME'], PDO::PARAM_INT);
     if (!$this->db->execute()) {
         //
     }
 }
开发者ID:nbaiwan,项目名称:yav,代码行数:19,代码来源:UserLogs.php

示例4: addLogInLog

 /**
  * Add login log for Admin/Staff users
  */
 protected function addLogInLog()
 {
     UserLoginLog::model()->addRecord(array('user_id' => $this->_id, 'ip' => Common::getIp()));
 }
开发者ID:jacjimus,项目名称:furahia_mis,代码行数:7,代码来源:UserIdentity.php

示例5: extract

require '../include/init.inc.php';
$user_name = $password = $remember = $verify_code = '';
extract($_POST, EXTR_IF_EXISTS);
if (Common::isPost()) {
    //	去掉验证码 if(strtolower($verify_code) != strtolower($_SESSION['osa_verify_code'])){
    if (0) {
        OSAdmin::alert("error", ErrorMessage::VERIFY_CODE_WRONG);
    } else {
        $user_info = User::checkPassword($user_name, $password);
        if ($user_info) {
            if ($user_info['status'] == 1) {
                User::loginDoSomething($user_info['user_id']);
                if ($remember) {
                    $encrypted = OSAEncrypt::encrypt($user_info['user_id']);
                    User::setCookieRemember(urlencode($encrypted), 30);
                }
                $ip = Common::getIp();
                SysLog::addLog($user_name, 'LOGIN', 'User', UserSession::getUserId(), json_encode(array("IP" => $ip)));
                Common::jumpUrl('panel/index.php');
            } else {
                OSAdmin::alert("error", ErrorMessage::BE_PAUSED);
            }
        } else {
            OSAdmin::alert("error", ErrorMessage::USER_OR_PWD_WRONG);
            SysLog::addLog($user_name, 'LOGIN', 'User', '', json_encode(ErrorMessage::USER_OR_PWD_WRONG));
        }
    }
}
Template::assign('_POST', $_POST);
Template::assign('page_title', '登入');
Template::Display('login.tpl');
开发者ID:hongweipeng,项目名称:screen,代码行数:31,代码来源:login+-+副本.php

示例6: loginDoSomething

 public static function loginDoSomething($user_id)
 {
     $user_info = User::getUserById($user_id);
     if ($user_info['status'] != 1) {
         Common::jumpUrl("login.php");
         return;
     }
     //读取该用户所属用户组将该组的权限保存在$_SESSION中
     $user_group = UserGroup::getGroupById($user_info['user_group']);
     $user_info['group_id'] = $user_group['group_id'];
     $user_info['user_role'] = $user_group['group_role'];
     $user_info['shortcuts_arr'] = explode(',', $user_info['shortcuts']);
     $menu = MenuUrl::getMenuByUrl('/admin/setting.php');
     if (strpos($user_group['group_role'], $menu['menu_id'])) {
         $user_info['setting'] = 1;
     }
     $login_time = time();
     $login_ip = Common::getIp();
     $update_data = array('login_ip' => $login_ip, 'login_time' => $login_time);
     User::updateUser($user_info['user_id'], $update_data);
     $user_info['login_ip'] = $login_ip;
     $user_info['login_time'] = Common::getDateTime($login_time);
     UserSession::setSessionInfo($user_info);
 }
开发者ID:ZhHong,项目名称:OSAdmin,代码行数:24,代码来源:User.class.php

示例7: session_start

            <div style="margin:10px 0 10px 10px;">
                <table class="tb_1" style="border:1px solid #cfe1ee; color:#666; border-collapse:collapse; width:700px; " >
                    <tr>
                        <th  colspan="2">管理员详细信息</th>
                    </tr>
                    <tr>
                        <td>登陆名:<strong style="color:#FF6600; font-weight:normal">
                                <?php 
session_start();
if (isset($_SESSION["username"])) {
    echo $_SESSION["username"];
}
?>
</strong></td>
                        <td>IP地址:<?php 
echo Common::getIp();
?>
</td>
                    </tr>
                    <tr>
                        <td>操作系统:<?php 
echo Common::GetOs();
?>
</td>
                        <td>浏览器:<?php 
echo Common::GetBrowser();
?>
</td>
                    </tr>
                    <tr>
                        <td>支持 CSS:</td>
开发者ID:NanguangChou,项目名称:ddroot,代码行数:31,代码来源:index.php

示例8: addActivity

 /**
  * Add activity
  * @param integer $user_id
  * @param string $type
  * @param string $description
  */
 public function addActivity($user_id, $type, $description)
 {
     return Yii::app()->db->createCommand()->insert($this->tableName(), array('user_id' => $user_id, 'type' => $type, 'description' => $description, 'ip_address' => Common::getIp(), 'datetime' => new CDbExpression('NOW()')));
 }
开发者ID:wanyos2005,项目名称:hsbf,代码行数:10,代码来源:UserActivity.php


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