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


PHP getClientIp函数代码示例

本文整理汇总了PHP中getClientIp函数的典型用法代码示例。如果您正苦于以下问题:PHP getClientIp函数的具体用法?PHP getClientIp怎么用?PHP getClientIp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: dologin

 public function dologin()
 {
     $this->form_validation->set_rules('username', 'Username', 'required');
     $this->form_validation->set_rules('password', 'Password', 'required');
     if ($this->form_validation->run() == FALSE) {
         errorRedirct('backend/user/login', '用户名和密码不能为空');
         die;
     } else {
         $username = $this->input->post('username');
         $password = $this->input->post('password');
         $this->load->model('backend/adminUser');
         $adminUserInfo = $this->adminUser->getAdminUserByName($username);
         if (empty($adminUserInfo)) {
             errorRedirct('backend/user/login', '登录失败,账号不存在');
             die;
         }
         if (!$adminUserInfo['status']) {
             errorRedirct('backend/user/login', '登录失败,账号已失效');
             die;
         }
         if ($adminUserInfo['password'] != md5($password)) {
             errorRedirct('backend/user/login', '登录失败,密码错误');
             die;
         }
         // 更新用户登录时间
         $fields = array('last_ip' => getClientIp(), 'last_time' => time());
         $this->adminUser->updateUserInfo($adminUserInfo['user_id'], $fields);
         $data = array('userId' => $adminUserInfo['user_id'], 'userName' => $adminUserInfo['user_name'], 'realName' => $adminUserInfo['real_name']);
         $this->session->set_userdata($data);
         successRedirct($this->config->item('rbac_default_index'), "登录成功!");
     }
 }
开发者ID:zhupengfei365,项目名称:backend.hc.com,代码行数:32,代码来源:User.php

示例2: checkGeo

 /**
  * check client province in ad's geo target
  * input array province number
  * return boolean
  */
 public function checkGeo($listCountries, $listProvinces)
 {
     if (empty($listCountries)) {
         return true;
     }
     $retval = false;
     $ip = getClientIp();
     //live
     //test tren local
     if (isLocal()) {
         $ip = '115.78.162.134';
         // test
     }
     $geoip = GeoBaseModel::getGeoByIp($ip);
     if ($geoip) {
         if (empty($listProvinces)) {
             $retval = in_array($geoip->country_code, $listCountries);
         } else {
             $province = "{$geoip->country_code}:{$geoip->region}";
             $retval = in_array($province, $listProvinces);
         }
     }
     // pr($geoip);
     // pr($retval);
     return $retval;
 }
开发者ID:huycao,项目名称:yoplatform,代码行数:31,代码来源:Delivery.php

示例3: getCurUserHostAddress

function getCurUserHostAddress($userAddress = NULL)
{
    if (is_null($userAddress)) {
        $userAddress = getClientIp();
    }
    return preg_replace("[^0-9a-zA-Z.=]", '_', $userAddress);
}
开发者ID:BIGGANI,项目名称:DocumentServer,代码行数:7,代码来源:common.php

示例4: getOpenID

 /**
  * 授权
  */
 public function getOpenID()
 {
     $weObj = new \System\lib\Wechat\Wechat($this->config("WEIXIN_CONFIG"));
     $this->weObj = $weObj;
     if (empty($_GET['code']) && empty($_GET['state'])) {
         $callback = getHostUrl();
         $reurl = $weObj->getOauthRedirect($callback, "1");
         redirect($reurl, 0, '正在发送验证中...');
         exit;
     } elseif (intval($_GET['state']) == 1) {
         $accessToken = $weObj->getOauthAccessToken();
         // 是否有用户记录
         $isUser = $this->table('user')->where(["openid" => $accessToken['openid'], 'is_on' => 1])->get(null, true);
         /*var_dump($isUser);exit();*/
         if ($isUser == null) {
             //没有此用户跳转至输入注册的页面
             header("LOCATION:" . getHost() . "/register.html");
         } else {
             $userID = $isUser['id'];
             $updateUser = $this->table('user')->where(['id' => $userID])->update(['last_login' => time(), 'last_ip' => ip2long(getClientIp())]);
             $_SESSION['userInfo'] = ['openid' => $isUser['openid'], 'userid' => $isUser['id'], 'nickname' => $isUser['nickname'], 'user_img' => $isUser['user_img']];
             //var_dump($_SESSION['userInfo']['openid']);exit();
             header("LOCATION:http://onebuy.ping-qu.com");
             //进入网站成功
             //用户取消授权
             //
             //$this->R('','90006');
         }
     }
 }
开发者ID:phpchen,项目名称:yiyuangou,代码行数:33,代码来源:UserController.class.php

示例5: checkGeo

 public function checkGeo()
 {
     $targetGeo = json_decode($this->target_geo);
     if ($targetGeo) {
         $clientCountry = strtolower(geoip_country_code_by_name(getClientIp()));
         if (in_array($clientCountry, $targetGeo)) {
             return true;
         }
     }
     return false;
 }
开发者ID:huycao,项目名称:yoplatform,代码行数:11,代码来源:AdBaseModel.php

示例6: __construct

    /**
     * 错误列表显示
     *
     * @param string $message
     * @param code   $code
     */
    public function __construct($message = 0, $code = null)
    {
        if (_CLI_) {
            $file = $this->getFile();
            $line = $this->getLine();
            $now = date('Y-m-d H:i:s');
            $out = <<<EOF
==================================================================================
--                         Uncaught exception!
--时间:{$now}
--信息:{$message}
--代码:{$code}
--文件:{$file}
--行数:{$line}
==================================================================================

EOF;
            echo $out;
        } elseif (_DEV_) {
            $this->_viewer = Leb_View::getInstance();
            $this->_viewer->setLayoutPath('_template/layout/');
            $this->_viewer->setLayout('exception');
            $this->_viewer->setTemplate($this->_exceptionFile);
            $this->_viewer->title = '出错了!';
            $time = date('Y-m-d H:i:s', time());
            $this->_viewer->time = $time;
            $this->_viewer->message = $message;
            $this->_viewer->code = $code;
            $this->_viewer->file = $this->getFile();
            $this->_viewer->line = $this->getLine();
            $this->_viewer->run();
            Leb_Debuger::showVar();
        } elseif (defined('_ER_PAGE_')) {
            $this->_viewer = Leb_View::getInstance();
            $this->_viewer->setLayoutPath('_template/layout/');
            $this->_viewer->setLayout('exception');
            $this->_viewer->setTemplate(_ER_PAGE_);
            $this->_viewer->title = '出错了!';
            $time = date('Y-m-d H:i:s', time());
            $this->_viewer->time = $time;
            $this->_viewer->message = $message;
            $this->_viewer->code = $code;
            $this->_viewer->file = $this->getFile();
            $this->_viewer->line = $this->getLine();
            $this->_viewer->run();
            Leb_Debuger::showVar();
        }
        if (_RUNTIME_) {
            $now = time();
            $file = _RUNTIME_ . date('-Y-m-d', $now);
            $line = date('H:i:s') . "\t" . getClientIp() . "\r\n";
        }
    }
开发者ID:spwx820,项目名称:lock-money-admin_cp,代码行数:59,代码来源:exception.php

示例7: passDataToApplication

function passDataToApplication($url)
{
    $_SERVER['REQUEST_URI'] = modifyUrl($url);
    $_GET['loggedAt'] = getLoggedAt();
    $_GET['cip'] = getClientIp();
    $_GET['ua'] = $_SERVER['HTTP_USER_AGENT'];
    require_once __DIR__ . '/../app/bootstrap.php.cache';
    require_once __DIR__ . '/../app/AppKernel.php';
    $kernel = new AppKernel('prod', false);
    $kernel->loadClassCache();
    $request = \Symfony\Component\HttpFoundation\Request::createFromGlobals();
    $kernel->handle($request);
}
开发者ID:JudeForOROINC,项目名称:platform-application,代码行数:13,代码来源:tracking.php

示例8: isValid

 public function isValid($ip = null)
 {
     empty($ip) && ($ip = getClientIp(1));
     if (!is_numeric($ip)) {
         $ip = ip2long($ip);
     }
     if (in_array($ip, $this->_ipWhiteListLong)) {
         return true;
     }
     foreach ($this->_ipWhiteListLongRange as $range) {
         if ($ip >= $range[0] && $ip <= $range[1]) {
             return true;
         }
     }
     return false;
 }
开发者ID:JohnnyChenS,项目名称:myStudy,代码行数:16,代码来源:CheckIpWhiteList.php

示例9: addAction

 function addAction($primkey, $urid, $page, $systemtype = USCIC_SMS, $actiontype = 1)
 {
     global $db;
     $query = 'INSERT INTO ' . Config::dbSurveyData() . '_actions (primkey, sessionid, urid, suid, ipaddress, systemtype, action, actiontype, params, language, mode, version) VALUES (';
     if ($primkey != '') {
         $query .= '\'' . prepareDatabaseString($primkey) . '\', ';
     } else {
         $query .= 'NULL, ';
     }
     $query .= '\'' . session_id() . '\', ';
     if ($urid != '') {
         $query .= '\'' . $urid . '\', ';
     } else {
         $query .= 'NULL, ';
     }
     if ($systemtype == USCIC_SURVEY) {
         $query .= getSurvey() . ', ';
     } else {
         $query .= 'NULL, ';
     }
     $query .= '\'' . prepareDatabaseString(getClientIp()) . '\', ';
     $query .= $systemtype . ', ';
     $query .= '\'' . prepareDatabaseString($page) . '\', ';
     $query .= $actiontype . ', ';
     if (Config::logParams()) {
         //log post vars?
         $query .= ' AES_ENCRYPT(\'' . prepareDatabaseString(serialize($_POST)) . '\', \'' . Config::logActionParamsKey() . '\'), ';
     } else {
         $query .= ' NULL, ';
     }
     if ($systemtype == USCIC_SURVEY) {
         $query .= getSurveyLanguage() . ', ';
         $query .= getSurveyMode() . ', ';
         $query .= getSurveyVersion();
     } else {
         $query .= 'NULL, NULL, NULL';
     }
     $query .= ")";
     $db->executeQuery($query);
     if (isset($this->LogActions[$primkey])) {
         //unset so it is read in again..
         unset($this->LogActions[$primkey]);
     }
 }
开发者ID:nubissurveying,项目名称:nubis,代码行数:44,代码来源:logactions.php

示例10: loginAction

 /**
  * 登录动作
  */
 private function loginAction($manager, $loginStatus, $isAutoLogin)
 {
     $_SESSION['manager_id'] = $manager['id'];
     $_SESSION['manager_name'] = $manager['manager_name'];
     $_SESSION['role_base_id'] = $manager['role_base_id'];
     $_SESSION['autoLogin'] = $loginStatus;
     if ($isAutoLogin == 1) {
         $expire = 60 * 60 * 24 * 7;
         $timeout = time() + $expire;
         $token = md5(uniqid(rand(), TRUE));
         $autoLogin = ['manager_id' => $manager['manager_id'], 'identifier' => $manager['identifier'], 'timeout' => $timeout];
         //$this->S()->set($token,$autoLogin,60*60*24*7);
         setcookie('OneTrade-AUTOLOGIN', $token, $timeout, '/');
     }
     //更新用户信息
     $data = ['last_ip' => getClientIp(), 'manager_endlogin' => time()];
     $this->table('manager')->where(['id' => $manager['id']])->update($data);
     $this->R();
 }
开发者ID:phpchen,项目名称:yiyuangou,代码行数:22,代码来源:LoginController.class.php

示例11: checkGeo

 /**
  * check client province in ad's geo target
  * input array province number
  * return boolean
  */
 public function checkGeo($listCountries, $listProvinces)
 {
     if (empty($listCountries) || isLocal()) {
         return true;
     }
     $retval = false;
     $ip = getClientIp();
     //live
     $geoip = GeoBaseModel::getGeoByIp($ip);
     pr($geoip);
     if ($geoip) {
         if (empty($listProvinces)) {
             $retval = in_array($geoip->country_code, $listCountries);
         } else {
             $province = "{$geoip->country_code}:{$geoip->region}";
             $retval = in_array($province, $listProvinces);
         }
     }
     return $retval;
 }
开发者ID:huycao,项目名称:yodelivery,代码行数:25,代码来源:Delivery.php

示例12: save

 /**
  * Saves data
  * @return bool
  * @uses get()
  * @uses $file
  */
 public function save()
 {
     //Gets existing data
     $data = $this->get();
     $agent = filter_input(INPUT_SERVER, 'HTTP_USER_AGENT');
     $ip = getClientIp();
     //Clears the first log (last in order of time), if it has been saved
     //  less than an hour ago and the user agent and the IP address are
     //  the same
     if (!empty($data[0]) && (new Time($data[0]->time))->modify('+1 hour')->isFuture() && $data[0]->agent === $agent && $data[0]->ip === $ip) {
         unset($data[0]);
     }
     //Adds log for current request
     array_unshift($data, (object) am(['ip' => getClientIp(), 'time' => new Time()], parse_user_agent(), compact('agent')));
     //Keeps only the first records
     $data = array_slice($data, 0, config('users.login_log'));
     //Serializes
     $data = serialize($data);
     return $this->file->write($data);
 }
开发者ID:mirko-pagliai,项目名称:me-cms,代码行数:26,代码来源:LoginLogger.php

示例13: CSCorpModel

<?php

require '../../../lib.php';
$openId = TestUser::user()->id();
$companyId = TestUser::user()->companyId();
$model = new CSCorpModel();
$api = OpenHelper::api();
$result = $api->getDeptList($companyId, $model->getToken($companyId), getClientIp());
OpenUtils::outputJson($result);
开发者ID:shshenpengfei,项目名称:scrum_project_manage_system,代码行数:9,代码来源:index.php

示例14: CSCorpModel

<?php

require '../../../lib.php';
$openId = TestUser::user()->id();
$companyId = TestUser::user()->companyId();
$model = new CSCorpModel();
$api = OpenHelper::api();
$userlist = $api->getUserList($companyId, $model->getToken($companyId), getClientIp());
OpenUtils::outputJson($userlist);
开发者ID:shshenpengfei,项目名称:scrum_project_manage_system,代码行数:9,代码来源:index.php

示例15: get_the_title

					<div class="wpcf7" id="wpcf7-f137-p135-o1" dir="ltr" lang="en-US">
						<div class="screen-reader-response"></div>
						<form name="" action="/commercial/town-center-acacia-estates/#wpcf7-f137-p135-o1" method="post" class="wpcf7-form" novalidate="novalidate">
							<div style="display: none;">
								<input name="_wpcf7" value="137" type="hidden">
								<input name="_wpcf7_version" value="4.1.1" type="hidden">
								<input name="_wpcf7_locale" value="en_US" type="hidden">
								<input name="_wpcf7_unit_tag" value="wpcf7-f137-p135-o1" type="hidden">
								<input name="_wpnonce" value="715fc56071" type="hidden">
								<input name="property" value="<?php 
echo get_the_title();
?>
" type="hidden">
								<input name="propertyType" value="commercial" type="hidden">
								<input type="hidden" name="clientIp" id="clientIp" value="<?php 
echo getClientIp();
?>
" />
							</div>
							
							<div class="col-md-6">
								<div class="form-group ">
									<span class="wpcf7-form-control-wrap fname">
										<input name="fname" value="" size="40" class="wpcf7-form-control wpcf7-text wpcf7-validates-as-required form-control" id="fname" aria-required="true" aria-invalid="false" placeholder="First Name" type="text">
									</span>
								</div>
							</div>

							<div class="col-md-6">
								<div class="form-group">
									<span class="wpcf7-form-control-wrap lname">
开发者ID:somidex,项目名称:leasing2016,代码行数:31,代码来源:content-single-commercial.php


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