• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP getClientIp函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: array

                    }
                }
            }
        }
    }
    return $ipaddress;
}
$descriptorspec = array(0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("pipe", "w"));
$cwd = "/var/www/html/";
$ret = "";
$stdout = "";
$stderr = "";
if (isset($_POST['ping']) && $_POST['ping'] != "") {
    //write entry to log file
    $f = fopen("logs", 'a');
    fwrite($f, getClientIp() . " -- " . $_POST['ping'] . "\n");
    //do some sanitization
    $_POST['ping'] = str_replace(">", " ", $_POST['ping']);
    $_POST['ping'] = scrub($_POST['ping']);
    //$ret = exec('ping -c 1 \'' . $_POST['ping'] . "'", $pingResults);
    $ret = proc_open('ping -c 1 \'' . $_POST['ping'] . "'", $descriptorspec, $pipes, $cwd);
    //parse stdout so formatting is preserve
    $stdout = stream_get_contents($pipes[1]);
    $stdout = htmlentities($stdout);
    //prevent xss
    fclose($pipes[1]);
    $stdout = str_replace("\n", "<br>", $stdout);
    //parse stderr the same
    $stderr = stream_get_contents($pipes[2]);
    $stderr = htmlentities($stderr);
    //prevent xss
开发者ID:RITC3,项目名称:rc3ctf-2015,代码行数:31,代码来源:index.php


示例17: getenv

            $realip .= $HTTP_SERVER_VARS["REMOTE_ADDR"];
        }
    } else {
        if (getenv('HTTP_X_FORWARDED_FOR')) {
            $realip .= getenv('HTTP_X_FORWARDED_FOR');
        }
        if (getenv('HTTP_CLIENT_IP')) {
            $realip .= getenv('HTTP_CLIENT_IP');
        }
        if (getenv('REMOTE_ADDR')) {
            $realip .= getenv('REMOTE_ADDR');
        }
    }
    return $realip;
}
$client_ip = getClientIp();
$ini = parse_ini_file('config.php', true);
if (empty($ini['settings'])) {
    $ini['settings'] = array();
}
$is_ip_allowed = false;
if (isset($ini['ait_allowed_ips'])) {
    $allowed_ips = $ini['ait_allowed_ips'];
    foreach ($allowed_ips as $value) {
        if (@strstr($client_ip, $value)) {
            $is_ip_allowed = true;
        }
    }
}
if (!$is_ip_allowed) {
    die('Your ip is not allowed');
开发者ID:cabrerabywaters,项目名称:magentoSunshine,代码行数:31,代码来源:auth_ip_check.php


示例18: CSCorpModel

<?php

//单点登录,客户端点击第三方icon调转
require '../../lib.php';
$companyId = $_GET['company_id'];
$hashkey = $_GET['hashkey'];
$openId = $_GET['open_id'];
$to_open_id = $_GET['to_open_id'];
$hashskey = $_GET['hashskey'];
$returnurl = $_GET['returnurl'];
if ($hashkey == md5($companyId . OpenConfig::APPID . OpenConfig::APPSECRET) && $returnurl == 1) {
    $model = new CSCorpModel();
    $api = OpenHelper::api();
    $result = $api->verifyLoginHashskey($companyId, $model->getToken($companyId), getClientIp(), $openId, $hashskey);
    if ($result['ret'] == 0) {
        $api->pushNotifyCenter2Client($companyId, $model->getToken($companyId), getClientIp(), $openId);
        TestUser::user()->login($openId);
        header('Location:../../');
    } else {
        echo $result['msg'];
    }
} else {
    echo "单点登录失败,hashkey失效";
}
开发者ID:shshenpengfei,项目名称:scrum_project_manage_system,代码行数:24,代码来源:index.php


示例19: getClientIp

<?php
function getClientIp() {
    if (!empty($_SERVER["HTTP_CLIENT_IP"]))
        $ip = $_SERVER["HTTP_CLIENT_IP"];
    else if (!empty($_SERVER["HTTP_X_FORWARDED_FOR"]))
        $ip = $_SERVER["HTTP_X_FORWARDED_FOR"];
    else if (!empty($_SERVER["REMOTE_ADDR"]))
        $ip = $_SERVER["REMOTE_ADDR"];
    else
        $ip = "err";
    return $ip;
}

echo "IP: " . getClientIp() . "";
echo "referer: " . $_SERVER["HTTP_REFERER"];

?>
开发者ID:xiaoxiaoJun,项目名称:phpper,代码行数:17,代码来源:2.php


示例20: array

if (empty($_SESSION['step']['client'])) {
    if (!file_exists('config/config.php')) {
        $_SESSION['step']['client'] = '';
        $error[] = array('danger', 'No Config File found! Please use the <b><a href="admin.php">Setup</a></b> to Configure the Group Assigner!');
    } else {
        $_SESSION['step']['client'] = 'client_selection';
    }
}
if ($_SESSION['step']['client'] == 'client_selection') {
    if (empty($ts3)) {
        $ts3 = ts3connect();
    }
    if (is_string($ts3)) {
        $error[] = array('danger', 'Can not Connect to Server! ' . $ts3);
    } else {
        $detected_clients = $ts3->clientList(array('client_type' => '0', 'connection_client_ip' => getClientIp()));
        if (!empty($_POST['uid'])) {
            if (strlen($_POST['uid']) != 28 || substr($_POST['uid'], -1, 1) != '=') {
                $error[] = array('danger', 'Invalid UID Format!');
            } else {
                $skip = false;
                try {
                    $client = $ts3->clientGetByUid($_POST['uid']);
                } catch (TeamSpeak3_Exception $e) {
                    $skip = true;
                    if ($e->getMessage() == 'invalid clientID') {
                        $error[] = array('danger', 'No Client with this UID online found!');
                    } else {
                        $error[] = array('danger', 'Error happened :/ (' . $e . ')');
                    }
                }
开发者ID:Multivit4min,项目名称:GroupAssigner,代码行数:31,代码来源:index.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP getClientLoginHttpClient函数代码示例发布时间:2022-05-15
下一篇:
PHP getClientIP函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap