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


PHP Input::real_ip方法代码示例

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


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

示例1: read

 /**
  * read the session
  *
  * @access public
  * @param
  *        	boolean, set to true if we want to force a new session to be created
  * @return Fuel\Core\Session_Driver
  */
 public function read($force = false)
 {
     // initialize the session
     $this->data = array();
     $this->keys = array();
     $this->flash = array();
     // get the session cookie
     $payload = $this->_get_cookie();
     // validate it
     if ($payload === false or $force) {
         // not a valid cookie, or a forced session reset
     } elseif (!isset($payload[0]) or !is_array($payload[0])) {
         // not a valid cookie payload
     } elseif ($payload[0]['updated'] + $this->config['expiration_time'] <= $this->time->get_timestamp()) {
         // session has expired
     } elseif ($this->config['match_ip'] and $payload[0]['ip_hash'] !== md5(\Input::ip() . \Input::real_ip())) {
         // IP address doesn't match
     } elseif ($this->config['match_ua'] and $payload[0]['user_agent'] !== \Input::user_agent()) {
         // user agent doesn't match
     } else {
         // session is valid, retrieve the payload
         if (isset($payload[0]) and is_array($payload[0])) {
             $this->keys = $payload[0];
         }
         if (isset($payload[1]) and is_array($payload[1])) {
             $this->data = $payload[1];
         }
         if (isset($payload[2]) and is_array($payload[2])) {
             $this->flash = $payload[2];
         }
     }
     return parent::read();
 }
开发者ID:vienbk91,项目名称:fuelphp17,代码行数:41,代码来源:cookie.php

示例2: read

 /**
  * read the session
  *
  * @access	public
  * @param	boolean, set to true if we want to force a new session to be created
  * @return	Fuel\Core\Session_Driver
  */
 public function read($force = false)
 {
     // initialize the session
     $this->data = array();
     $this->keys = array();
     $this->flash = array();
     // get the session cookie
     $payload = $this->_get_cookie();
     // validate it
     if ($force) {
         // a forced session reset
     } elseif ($payload === false) {
         // no cookie found
     } elseif (!isset($payload[0]) or !is_array($payload[0])) {
         logger('DEBUG', 'Error: not a valid cookie payload!');
     } elseif ($payload[0]['updated'] + $this->config['expiration_time'] <= $this->time->get_timestamp()) {
         logger('DEBUG', 'Error: session id has expired!');
     } elseif ($this->config['match_ip'] and $payload[0]['ip_hash'] !== md5(\Input::ip() . \Input::real_ip())) {
         logger('DEBUG', 'Error: IP address in the session doesn\'t match this requests source IP!');
     } elseif ($this->config['match_ua'] and $payload[0]['user_agent'] !== \Input::user_agent()) {
         logger('DEBUG', 'Error: User agent in the session doesn\'t match the browsers user agent string!');
     } else {
         // session is valid, retrieve the payload
         if (isset($payload[0]) and is_array($payload[0])) {
             $this->keys = $payload[0];
         }
         if (isset($payload[1]) and is_array($payload[1])) {
             $this->data = $payload[1];
         }
         if (isset($payload[2]) and is_array($payload[2])) {
             $this->flash = $payload[2];
         }
     }
     return parent::read();
 }
开发者ID:SainsburysTests,项目名称:sainsburys,代码行数:42,代码来源:cookie.php

示例3: create

 /**
  * create a new session
  *
  * @access	public
  * @return	Fuel\Core\Session_Cookie
  */
 public function create()
 {
     // create a new session
     $this->keys['session_id'] = $this->_new_session_id();
     $this->keys['ip_hash'] = md5(\Input::ip() . \Input::real_ip());
     $this->keys['user_agent'] = \Input::user_agent();
     $this->keys['created'] = $this->time->get_timestamp();
     $this->keys['updated'] = $this->keys['created'];
     $this->keys['payload'] = '';
     return $this;
 }
开发者ID:highestgoodlikewater,项目名称:webspider-1,代码行数:17,代码来源:cookie.php

示例4: create

 /**
  * create a new session
  *
  * @access	public
  * @return	void
  */
 public function create()
 {
     // create a new session
     $this->keys['session_id'] = $this->_new_session_id();
     $this->keys['ip_address'] = \Input::real_ip();
     $this->keys['user_agent'] = \Input::user_agent();
     $this->keys['created'] = $this->time->get_timestamp();
     $this->keys['updated'] = $this->keys['created'];
     $this->keys['payload'] = '';
     // and set the session cookie
     $this->_set_cookie();
 }
开发者ID:bryanheo,项目名称:FuelPHP-Auth-AJAX,代码行数:18,代码来源:cookie.php

示例5: create

 /**
  * create a new session
  *
  * @access	public
  * @return	Fuel\Core\Session_Memcached
  */
 public function create()
 {
     // create a new session
     $this->keys['session_id'] = $this->_new_session_id();
     $this->keys['previous_id'] = $this->keys['session_id'];
     // prevents errors if previous_id has a unique index
     $this->keys['ip_hash'] = md5(\Input::ip() . \Input::real_ip());
     $this->keys['user_agent'] = \Input::user_agent();
     $this->keys['created'] = $this->time->get_timestamp();
     $this->keys['updated'] = $this->keys['created'];
     return $this;
 }
开发者ID:highestgoodlikewater,项目名称:webspider-1,代码行数:18,代码来源:memcached.php

示例6: response

 public function response()
 {
     $error_code = $this->getMessage();
     $error_list = Lang::load('error/user', $error_code);
     if (!isset($error_list[$error_code])) {
         $error_code = \Model_Error::ER00001;
     }
     $error_message = $error_list[$error_code];
     $params = array('error_code' => $error_code, 'error_message' => $error_message, 'line' => $this->getLine(), 'file' => $this->getFile(), 'url' => Uri::main(), 'input' => print_r(Input::all(), true), 'real_ip' => Input::real_ip(), 'user_agent' => Input::user_agent(), 'user_id' => Auth::get_user_id(), 'occurred_at' => date('Y/m/d H:i:s'));
     $email = new Model_Email();
     $email->sendMailByParams('error', $params);
     $response = \Request::forge('errors/index', false)->execute($params)->response();
     return $response;
 }
开发者ID:eva-tuantran,项目名称:use-knife-solo-instead-chef-solo-day13,代码行数:14,代码来源:systemexception.php

示例7: create

 /**
  * create a new session
  *
  * @access	public
  * @return	void
  */
 public function create()
 {
     // create a new session
     $this->keys['session_id'] = $this->_new_session_id();
     $this->keys['previous_id'] = $this->keys['session_id'];
     // prevents errors if previous_id has a unique index
     $this->keys['ip_hash'] = md5(\Input::ip() . \Input::real_ip());
     $this->keys['user_agent'] = \Input::user_agent();
     $this->keys['created'] = $this->time->get_timestamp();
     $this->keys['updated'] = $this->keys['created'];
     // create the session record
     $this->_write_redis($this->keys['session_id'], serialize(array()));
     // and set the session cookie
     $this->_set_cookie();
 }
开发者ID:469306621,项目名称:Languages,代码行数:21,代码来源:redis.php

示例8: create

 /**
  * create a new session
  *
  * @access	public
  * @return	void
  */
 public function create()
 {
     // create a new session
     $this->keys['session_id'] = $this->_new_session_id();
     $this->keys['previous_id'] = $this->keys['session_id'];
     // prevents errors if previous_id has a unique index
     $this->keys['ip_hash'] = md5(\Input::ip() . \Input::real_ip());
     $this->keys['user_agent'] = \Input::user_agent();
     $this->keys['created'] = $this->time->get_timestamp();
     $this->keys['updated'] = $this->keys['created'];
     $this->keys['payload'] = '';
     // create the session record
     $result = \DB::insert($this->config['table'], array_keys($this->keys))->values($this->keys)->execute($this->config['database']);
     // and set the session cookie
     $this->_set_cookie();
 }
开发者ID:469306621,项目名称:Languages,代码行数:22,代码来源:db.php

示例9: read

 /**
  * read the session
  *
  * @access	public
  * @param	boolean, set to true if we want to force a new session to be created
  * @return	Fuel\Core\Session_Driver
  */
 public function read($force = false)
 {
     // initialize the session
     $this->data = array();
     $this->keys = array();
     $this->flash = array();
     // get the session cookie
     $cookie = $this->_get_cookie();
     // if a cookie was present, find the session record
     if ($cookie and !$force and isset($cookie[0])) {
         // read the session file
         $payload = $this->_read_redis($cookie[0]);
         if ($payload === false) {
             // cookie present, but session record missing. force creation of a new session
             return $this->read(true);
         }
         // unpack the payload
         $payload = $this->_unserialize($payload);
         // session referral?
         if (isset($payload['rotated_session_id'])) {
             $payload = $this->_read_redis($payload['rotated_session_id']);
             if ($payload === false) {
                 // cookie present, but session record missing. force creation of a new session
                 return $this->read(true);
             }
             // unpack the payload
             $payload = $this->_unserialize($payload);
         }
         if (!isset($payload[0]) or !is_array($payload[0])) {
             // not a valid cookie payload
         } elseif ($payload[0]['updated'] + $this->config['expiration_time'] <= $this->time->get_timestamp()) {
             // session has expired
         } elseif ($this->config['match_ip'] and $payload[0]['ip_hash'] !== md5(\Input::ip() . \Input::real_ip())) {
             // IP address doesn't match
         } elseif ($this->config['match_ua'] and $payload[0]['user_agent'] !== \Input::user_agent()) {
             // user agent doesn't match
         } else {
             // session is valid, retrieve the rest of the payload
             if (isset($payload[0]) and is_array($payload[0])) {
                 $this->keys = $payload[0];
             }
             if (isset($payload[1]) and is_array($payload[1])) {
                 $this->data = $payload[1];
             }
             if (isset($payload[2]) and is_array($payload[2])) {
                 $this->flash = $payload[2];
             }
         }
     }
     return parent::read();
 }
开发者ID:ClixLtd,项目名称:pccupload,代码行数:58,代码来源:redis.php

示例10: recordLogin

 /**
  * record login
  * @param integer $account_id
  * @param integer $attempt 0 for failed, 1 for success
  * @param string $attempt_text attempt text
  * @return boolean
  */
 public function recordLogin($account_id = '', $attempt = '0', $attempt_text = '')
 {
     if (!is_numeric($account_id) || !is_numeric($attempt)) {
         return false;
     }
     if ($attempt_text == null) {
         $attempt_text = null;
     }
     $site_id = \Model_Sites::getSiteId(false);
     // get browser class for use instead of fuelphp agent which is does not work.
     include_once APPPATH . 'vendor' . DS . 'browser' . DS . 'lib' . DS . 'Browser.php';
     $browser = new Browser();
     // set data for insertion
     $data['account_id'] = $account_id;
     $data['site_id'] = $site_id;
     $data['login_ua'] = \Input::user_agent();
     $data['login_os'] = $browser->getPlatform();
     $data['login_browser'] = $browser->getBrowser() . ' ' . $browser->getVersion();
     $data['login_ip'] = \Input::real_ip();
     $data['login_time'] = time();
     $data['login_time_gmt'] = \Extension\Date::localToGmt();
     $data['login_attempt'] = $attempt;
     $data['login_attempt_text'] = $attempt_text;
     \DB::insert(static::$_table_name)->set($data)->execute();
     unset($browser, $data, $site_id);
     return true;
 }
开发者ID:rundiz,项目名称:fuel-start,代码行数:34,代码来源:accountlogins.php

示例11: read

 /**
  * read the session
  *
  * @access	public
  * @param	boolean, set to true if we want to force a new session to be created
  * @return	Fuel\Core\Session_Driver
  */
 public function read($force = false)
 {
     // initialize the session
     $this->data = array();
     $this->keys = array();
     $this->flash = array();
     $this->record = null;
     // get the session cookie
     $cookie = $this->_get_cookie();
     // if a cookie was present, find the session record
     if ($cookie and !$force and isset($cookie[0])) {
         // read the session record
         $this->record = \DB::select()->where('session_id', '=', $cookie[0])->from($this->config['table'])->execute($this->config['database']);
         // record found?
         if ($this->record->count()) {
             $payload = $this->_unserialize($this->record->get('payload'));
         } else {
             // try to find the session on previous id
             $this->record = \DB::select()->where('previous_id', '=', $cookie[0])->from($this->config['table'])->execute($this->config['database']);
             // record found?
             if ($this->record->count()) {
                 $payload = $this->_unserialize($this->record->get('payload'));
             } else {
                 // cookie present, but session record missing. force creation of a new session
                 logger('DEBUG', 'Error: Session cookie with ID "' . $cookie[0] . '" present but corresponding record is missing');
                 return $this->read(true);
             }
         }
         if (!isset($payload[0]) or !is_array($payload[0])) {
             logger('DEBUG', 'Error: not a valid db session payload!');
         } elseif ($payload[0]['updated'] + $this->config['expiration_time'] <= $this->time->get_timestamp()) {
             logger('DEBUG', 'Error: session id has expired!');
         } elseif ($this->config['match_ip'] and $payload[0]['ip_hash'] !== md5(\Input::ip() . \Input::real_ip())) {
             logger('DEBUG', 'Error: IP address in the session doesn\'t match this requests source IP!');
         } elseif ($this->config['match_ua'] and $payload[0]['user_agent'] !== \Input::user_agent()) {
             logger('DEBUG', 'Error: User agent in the session doesn\'t match the browsers user agent string!');
         } else {
             // session is valid, retrieve the payload
             if (isset($payload[0]) and is_array($payload[0])) {
                 $this->keys = $payload[0];
             }
             if (isset($payload[1]) and is_array($payload[1])) {
                 $this->data = $payload[1];
             }
             if (isset($payload[2]) and is_array($payload[2])) {
                 $this->flash = $payload[2];
             }
         }
     }
     return parent::read();
 }
开发者ID:SainsburysTests,项目名称:sainsburys,代码行数:58,代码来源:db.php

示例12: get_headers

 /**
  * Add the array of Bit API Hub headers for the call
  * 
  * @param array $headers The array of existing headers
  * @return array $headers with the Bit API Hub headers added on
  */
 public static function get_headers(array $headers)
 {
     $api = \V1\Model\APIs::get_api();
     $account = \V1\Model\Account::get_account();
     $forwarded_for = \Input::real_ip('0.0.0.0', true);
     if ($internal_call = \Utility::is_internal_call()) {
         $forwarded_for = \Config::get('engine.call_test_ip');
     }
     $headers = array_replace($headers, array('User-Agent' => 'API Optimization Engine/V1', 'X-Forwarded-For' => $forwarded_for));
     if (\Config::get('engine.send_engine_auth', false) === true) {
         // If the API hasn't yet received a secret identity, generate one.
         if (empty($api['secret'])) {
             $secret = \V1\Model\APIs::set_api_secret($api['id']);
         } else {
             $secret = \Crypt::decode($api['secret']);
         }
         $headers = array_replace($headers, array('X-AOE-Secret' => $secret, 'X-AOE-Account' => $account['id'], 'X-AOE-Version' => 'V1'));
     }
     return $headers;
 }
开发者ID:bitapihub,项目名称:api-optimization-engine,代码行数:26,代码来源:runcall.php

示例13: update_tracked_fields

 /**
  * Track information about user sign ins. It tracks the following columns:
  *
  * - sign_in_count      - Increased every time a sign in is made (by form, openid, oauth)
  * - current_sign_in_at - A timestamp updated when the user signs in
  * - last_sign_in_at    - Holds the timestamp of the previous sign in
  * - current_sign_in_ip - The remote ip updated when the user sign in
  * - last_sign_in_at    - Holds the remote ip of the previous sign in
  *
  * @return bool
  */
 public function update_tracked_fields()
 {
     if (\Config::get('warden.trackable') !== true) {
         return false;
     }
     $old_current = $this->current_sign_in_at;
     $new_current = \DB::expr('CURRENT_TIMESTAMP');
     $this->last_sign_in_at = $old_current != static::$_properties['last_sign_in_at']['default'] ? $old_current : $new_current;
     $this->current_sign_in_at = $new_current;
     $old_current = $this->current_sign_in_ip;
     $this->current_sign_in_ip = null;
     $new_current = \Input::real_ip();
     $this->last_sign_in_ip = $old_current != static::$_properties['last_sign_in_ip']['default'] ? $old_current : $new_current;
     $this->current_sign_in_ip = $new_current;
     if (\Config::get('warden.lockable.in_use') === true && \Config::get('warden.lockable.lock_strategy') == 'sign_in_count') {
         $this->sign_in_count = 0;
     } else {
         $this->sign_in_count += 1;
     }
     $return = $this->save(false);
     return $return;
 }
开发者ID:nsbasicus,项目名称:warden,代码行数:33,代码来源:user.php

示例14: read

 /**
  * read the session
  *
  * @access public
  * @param
  *        	boolean, set to true if we want to force a new session to be created
  * @return Fuel\Core\Session_Driver
  */
 public function read($force = false)
 {
     // initialize the session
     $this->data = array();
     $this->keys = array();
     $this->flash = array();
     $this->record = null;
     // get the session cookie
     $cookie = $this->_get_cookie();
     // if a cookie was present, find the session record
     if ($cookie and !$force and isset($cookie[0])) {
         // read the session record
         $this->record = \DB::select()->where('session_id', '=', $cookie[0])->from($this->config['table'])->execute($this->config['database']);
         // record found?
         if ($this->record->count()) {
             $payload = $this->_unserialize($this->record->get('payload'));
         } else {
             // try to find the session on previous id
             $this->record = \DB::select()->where('previous_id', '=', $cookie[0])->from($this->config['table'])->execute($this->config['database']);
             // record found?
             if ($this->record->count()) {
                 $payload = $this->_unserialize($this->record->get('payload'));
             } else {
                 // cookie present, but session record missing. force creation of a new session
                 return $this->read(true);
             }
         }
         if (!isset($payload[0]) or !is_array($payload[0])) {
             // not a valid cookie payload
         } elseif ($payload[0]['updated'] + $this->config['expiration_time'] <= $this->time->get_timestamp()) {
             // session has expired
         } elseif ($this->config['match_ip'] and $payload[0]['ip_hash'] !== md5(\Input::ip() . \Input::real_ip())) {
             // IP address doesn't match
         } elseif ($this->config['match_ua'] and $payload[0]['user_agent'] !== \Input::user_agent()) {
             // user agent doesn't match
         } else {
             // session is valid, retrieve the payload
             if (isset($payload[0]) and is_array($payload[0])) {
                 $this->keys = $payload[0];
             }
             if (isset($payload[1]) and is_array($payload[1])) {
                 $this->data = $payload[1];
             }
             if (isset($payload[2]) and is_array($payload[2])) {
                 $this->flash = $payload[2];
             }
         }
     }
     return parent::read();
 }
开发者ID:vienbk91,项目名称:fuelphp17,代码行数:58,代码来源:db.php

示例15: check

 /** Check
  * 
  * Calls an HTTP POST function to verify if the user's guess was correct
  * 
  * @param string $remote_ip
  * @param string $challenge
  * @param string $response
  * @param array $extra_params an array of extra variables to post to the server
  * @return bool
  */
 public function check($remote_ip = null, $challenge = null, $response = null, $extra_params = array())
 {
     $remote_ip = \Input::real_ip();
     if ($remote_ip == '0.0.0.0' or $remote_ip == '') {
         throw new Captcha_Exception('Recaptcha needs a valid Remote IP');
     }
     if (is_null($challenge)) {
         $challenge = \Input::post($this->config['challenge_field']);
     }
     if (is_null($response)) {
         $response = \Input::post($this->config['response_field']);
     }
     $challenge = (string) e($challenge);
     $response = (string) e($response);
     if ($challenge === '' or $response === '') {
         $this->error = 'incorrect-captcha-sol';
         return false;
     }
     $response = $this->_http_post($this->config['verify_server'], "/recaptcha/api/verify", array('privatekey' => $this->config['private_key'], 'remoteip' => $remote_ip, 'challenge' => $challenge, 'response' => $response) + $extra_params);
     $answers = explode("\n", $response[1]);
     if (trim($answers[0]) == 'true') {
         return true;
     } else {
         $this->error = $answers[1];
         return false;
     }
 }
开发者ID:salipro4ever,项目名称:fuel-captcha,代码行数:37,代码来源:recaptcha.php


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