blob: ada9fc68031757de4207742e4f3567179f827057 [file] [log] [blame]
Andrey Andreevc5536aa2012-11-01 17:33:58 +02001<?php
Derek Allard2067d1a2008-11-13 22:59:24 +00002/**
3 * CodeIgniter
4 *
Phil Sturgeon07c1ac82012-03-09 17:03:37 +00005 * An open source application development framework for PHP 5.2.4 or newer
Derek Allard2067d1a2008-11-13 22:59:24 +00006 *
Derek Jonesf4a4bd82011-10-20 12:18:42 -05007 * NOTICE OF LICENSE
Andrey Andreev64e98aa2012-01-07 20:29:10 +02008 *
Derek Jonesf4a4bd82011-10-20 12:18:42 -05009 * Licensed under the Open Software License version 3.0
Andrey Andreev64e98aa2012-01-07 20:29:10 +020010 *
Derek Jonesf4a4bd82011-10-20 12:18:42 -050011 * This source file is subject to the Open Software License (OSL 3.0) that is
12 * bundled with this package in the files license.txt / license.rst. It is
13 * also available through the world wide web at this URL:
14 * http://opensource.org/licenses/OSL-3.0
15 * If you did not receive a copy of the license and are unable to obtain it
16 * through the world wide web, please send an email to
17 * licensing@ellislab.com so we can send you a copy immediately.
18 *
Derek Allard2067d1a2008-11-13 22:59:24 +000019 * @package CodeIgniter
Derek Jonesf4a4bd82011-10-20 12:18:42 -050020 * @author EllisLab Dev Team
darwinel871754a2014-02-11 17:34:57 +010021 * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
Derek Jonesf4a4bd82011-10-20 12:18:42 -050022 * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
Derek Allard2067d1a2008-11-13 22:59:24 +000023 * @link http://codeigniter.com
24 * @since Version 1.0
25 * @filesource
26 */
Andrey Andreevc5536aa2012-11-01 17:33:58 +020027defined('BASEPATH') OR exit('No direct script access allowed');
Derek Allard2067d1a2008-11-13 22:59:24 +000028
Derek Allard2067d1a2008-11-13 22:59:24 +000029/**
30 * Input Class
31 *
32 * Pre-processes global input data for security
33 *
34 * @package CodeIgniter
35 * @subpackage Libraries
36 * @category Input
Derek Jonesf4a4bd82011-10-20 12:18:42 -050037 * @author EllisLab Dev Team
Derek Allard2067d1a2008-11-13 22:59:24 +000038 * @link http://codeigniter.com/user_guide/libraries/input.html
39 */
40class CI_Input {
Derek Allard2067d1a2008-11-13 22:59:24 +000041
David Behler9b5df592011-08-14 21:04:17 +020042 /**
43 * IP address of the current user
44 *
Andrey Andreev1887ec62012-10-27 16:22:07 +030045 * @var string
David Behler9b5df592011-08-14 21:04:17 +020046 */
Andrey Andreev1887ec62012-10-27 16:22:07 +030047 public $ip_address = FALSE;
Andrey Andreev92ebfb62012-05-17 12:49:24 +030048
David Behler9b5df592011-08-14 21:04:17 +020049 /**
Andrey Andreev1887ec62012-10-27 16:22:07 +030050 * Allow GET array flag
David Behler9b5df592011-08-14 21:04:17 +020051 *
Andrey Andreev1887ec62012-10-27 16:22:07 +030052 * If set to FALSE, then $_GET will be set to an empty array.
David Behler9b5df592011-08-14 21:04:17 +020053 *
Andrey Andreev1887ec62012-10-27 16:22:07 +030054 * @var bool
David Behler9b5df592011-08-14 21:04:17 +020055 */
Andrey Andreev1887ec62012-10-27 16:22:07 +030056 protected $_allow_get_array = TRUE;
Andrey Andreev92ebfb62012-05-17 12:49:24 +030057
David Behler9b5df592011-08-14 21:04:17 +020058 /**
Andrey Andreevbfb635b2014-01-08 18:32:05 +020059 * Standardize new lines flag
David Behler9b5df592011-08-14 21:04:17 +020060 *
Andrey Andreev1887ec62012-10-27 16:22:07 +030061 * If set to TRUE, then newlines are standardized.
62 *
63 * @var bool
David Behler9b5df592011-08-14 21:04:17 +020064 */
Andrey Andreevefc08e92014-04-15 14:32:52 +030065 protected $_standardize_newlines;
Andrey Andreev92ebfb62012-05-17 12:49:24 +030066
David Behler9b5df592011-08-14 21:04:17 +020067 /**
Andrey Andreev1887ec62012-10-27 16:22:07 +030068 * Enable XSS flag
69 *
70 * Determines whether the XSS filter is always active when
71 * GET, POST or COOKIE data is encountered.
72 * Set automatically based on config setting.
73 *
74 * @var bool
75 */
76 protected $_enable_xss = FALSE;
77
78 /**
79 * Enable CSRF flag
80 *
David Behler9b5df592011-08-14 21:04:17 +020081 * Enables a CSRF cookie token to be set.
Andrey Andreev1887ec62012-10-27 16:22:07 +030082 * Set automatically based on config setting.
David Behler9b5df592011-08-14 21:04:17 +020083 *
Andrey Andreev1887ec62012-10-27 16:22:07 +030084 * @var bool
David Behler9b5df592011-08-14 21:04:17 +020085 */
Andrey Andreev1887ec62012-10-27 16:22:07 +030086 protected $_enable_csrf = FALSE;
Andrey Andreev92ebfb62012-05-17 12:49:24 +030087
David Behler9b5df592011-08-14 21:04:17 +020088 /**
89 * List of all HTTP request headers
90 *
91 * @var array
92 */
Andrey Andreev1887ec62012-10-27 16:22:07 +030093 protected $headers = array();
David Behler9b5df592011-08-14 21:04:17 +020094
Derek Allard2067d1a2008-11-13 22:59:24 +000095 /**
Andrey Andreev303eef02012-11-06 14:55:48 +020096 * Input stream data
97 *
98 * Parsed from php://input at runtime
99 *
100 * @see CI_Input::input_stream()
101 * @var array
102 */
103 protected $_input_stream = NULL;
104
105 /**
Andrey Andreev1887ec62012-10-27 16:22:07 +0300106 * Class constructor
Greg Akera9263282010-11-10 15:26:43 -0600107 *
Andrey Andreev1887ec62012-10-27 16:22:07 +0300108 * Determines whether to globally enable the XSS processing
109 * and whether to allow the $_GET array.
Andrey Andreev92ebfb62012-05-17 12:49:24 +0300110 *
111 * @return void
Greg Akera9263282010-11-10 15:26:43 -0600112 */
113 public function __construct()
Derek Allard2067d1a2008-11-13 22:59:24 +0000114 {
Andrey Andreev13774972012-01-08 04:30:33 +0200115 log_message('debug', 'Input Class Initialized');
Derek Allard2067d1a2008-11-13 22:59:24 +0000116
Andrey Andreevbfb635b2014-01-08 18:32:05 +0200117 $this->_allow_get_array = (config_item('allow_get_array') === TRUE);
118 $this->_enable_xss = (config_item('global_xss_filtering') === TRUE);
119 $this->_enable_csrf = (config_item('csrf_protection') === TRUE);
fabianozenatti523cda32014-03-21 12:13:03 +0100120 $this->_standardize_newlines = (bool) config_item('standardize_newlines');
Derek Jones69fc4fc2010-03-02 13:36:31 -0600121
Andrey Andreevc26b9eb2014-02-24 11:31:36 +0200122 $this->security =& load_class('Security', 'core');
Derek Jones69fc4fc2010-03-02 13:36:31 -0600123
Pascal Krieteaaec1e42011-01-20 00:01:21 -0500124 // Do we need the UTF-8 class?
Derek Jones69fc4fc2010-03-02 13:36:31 -0600125 if (UTF8_ENABLED === TRUE)
126 {
Andrey Andreevc26b9eb2014-02-24 11:31:36 +0200127 $this->uni =& load_class('Utf8', 'core');
Derek Jones69fc4fc2010-03-02 13:36:31 -0600128 }
129
130 // Sanitize global arrays
Derek Allard2067d1a2008-11-13 22:59:24 +0000131 $this->_sanitize_globals();
132 }
133
134 // --------------------------------------------------------------------
135
136 /**
Greg Akera9263282010-11-10 15:26:43 -0600137 * Fetch from array
138 *
Andrey Andreev1887ec62012-10-27 16:22:07 +0300139 * Internal method used to retrieve values from global arrays.
Greg Akera9263282010-11-10 15:26:43 -0600140 *
Andrey Andreev1887ec62012-10-27 16:22:07 +0300141 * @param array &$array $_GET, $_POST, $_COOKIE, $_SERVER, etc.
142 * @param string $index Index for item to be fetched from $array
143 * @param bool $xss_clean Whether to apply XSS filtering
144 * @return mixed
Greg Akera9263282010-11-10 15:26:43 -0600145 */
Andrey Andreev7c60b122014-02-08 18:47:19 +0200146 protected function _fetch_from_array(&$array, $index = NULL, $xss_clean = NULL)
Derek Allard2067d1a2008-11-13 22:59:24 +0000147 {
Andrey Andreev7c60b122014-02-08 18:47:19 +0200148 // If $index is NULL, it means that the whole $array is requested
149 if ($index === NULL)
150 {
151 $output = array();
152 foreach (array_keys($array) as $key)
153 {
154 $output[$key] = $this->_fetch_from_array($array, $key, $xss_clean);
155 }
156
157 return $output;
158 }
159
Andrey Andreev80a16b12014-01-08 17:19:03 +0200160 is_bool($xss_clean) OR $xss_clean = $this->_enable_xss;
161
nisheeth-barthwala7447d22013-03-21 15:48:10 +0530162 if (isset($array[$index]))
Derek Allard2067d1a2008-11-13 22:59:24 +0000163 {
nisheeth-barthwala7447d22013-03-21 15:48:10 +0530164 $value = $array[$index];
165 }
nisheeth-barthwal47ea5a82013-03-26 18:57:28 +0530166 elseif (($count = preg_match_all('/(?:^[^\[]+)|\[[^]]*\]/', $index, $matches)) > 1) // Does the index contain array notation
nisheeth-barthwala7447d22013-03-21 15:48:10 +0530167 {
nisheeth-barthwal47ea5a82013-03-26 18:57:28 +0530168 $value = $array;
nisheeth-barthwal77236e02013-03-25 23:42:36 +0530169 for ($i = 0; $i < $count; $i++)
nisheeth-barthwala7447d22013-03-21 15:48:10 +0530170 {
nisheeth-barthwal77236e02013-03-25 23:42:36 +0530171 $key = trim($matches[0][$i], '[]');
nisheeth-barthwal408cbb42013-03-26 19:06:40 +0530172 if ($key === '') // Empty notation will return the value as array
nisheeth-barthwala7447d22013-03-21 15:48:10 +0530173 {
nisheeth-barthwal77236e02013-03-25 23:42:36 +0530174 break;
nisheeth-barthwala7447d22013-03-21 15:48:10 +0530175 }
nisheeth-barthwal47ea5a82013-03-26 18:57:28 +0530176
177 if (isset($value[$key]))
nisheeth-barthwala7447d22013-03-21 15:48:10 +0530178 {
nisheeth-barthwal47ea5a82013-03-26 18:57:28 +0530179 $value = $value[$key];
nisheeth-barthwal77236e02013-03-25 23:42:36 +0530180 }
181 else
182 {
183 return NULL;
nisheeth-barthwala7447d22013-03-21 15:48:10 +0530184 }
185 }
Derek Allard2067d1a2008-11-13 22:59:24 +0000186 }
nisheeth-barthwal77236e02013-03-25 23:42:36 +0530187 else
Derek Allard2067d1a2008-11-13 22:59:24 +0000188 {
nisheeth-barthwal77236e02013-03-25 23:42:36 +0530189 return NULL;
Derek Allard2067d1a2008-11-13 22:59:24 +0000190 }
191
nisheeth-barthwal77236e02013-03-25 23:42:36 +0530192 return ($xss_clean === TRUE)
193 ? $this->security->xss_clean($value)
194 : $value;
Derek Allard2067d1a2008-11-13 22:59:24 +0000195 }
196
197 // --------------------------------------------------------------------
198
199 /**
Timothy Warren40403d22012-04-19 16:38:50 -0400200 * Fetch an item from the GET array
201 *
Andrey Andreev1887ec62012-10-27 16:22:07 +0300202 * @param string $index Index for item to be fetched from $_GET
203 * @param bool $xss_clean Whether to apply XSS filtering
204 * @return mixed
Timothy Warren40403d22012-04-19 16:38:50 -0400205 */
Andrey Andreev80a16b12014-01-08 17:19:03 +0200206 public function get($index = NULL, $xss_clean = NULL)
Derek Allard2067d1a2008-11-13 22:59:24 +0000207 {
nisheeth-barthwala5bcfb12013-03-23 10:53:51 +0530208 return $this->_fetch_from_array($_GET, $index, $xss_clean);
Derek Allard2067d1a2008-11-13 22:59:24 +0000209 }
210
211 // --------------------------------------------------------------------
212
213 /**
Timothy Warren40403d22012-04-19 16:38:50 -0400214 * Fetch an item from the POST array
215 *
Andrey Andreev1887ec62012-10-27 16:22:07 +0300216 * @param string $index Index for item to be fetched from $_POST
217 * @param bool $xss_clean Whether to apply XSS filtering
218 * @return mixed
Timothy Warren40403d22012-04-19 16:38:50 -0400219 */
Andrey Andreev80a16b12014-01-08 17:19:03 +0200220 public function post($index = NULL, $xss_clean = NULL)
Derek Allard2067d1a2008-11-13 22:59:24 +0000221 {
nisheeth-barthwala5bcfb12013-03-23 10:53:51 +0530222 return $this->_fetch_from_array($_POST, $index, $xss_clean);
Derek Allard2067d1a2008-11-13 22:59:24 +0000223 }
224
225 // --------------------------------------------------------------------
226
227 /**
Andrey Andreev1887ec62012-10-27 16:22:07 +0300228 * Fetch an item from POST data with fallback to GET
Timothy Warren40403d22012-04-19 16:38:50 -0400229 *
Andrey Andreev1887ec62012-10-27 16:22:07 +0300230 * @param string $index Index for item to be fetched from $_POST or $_GET
231 * @param bool $xss_clean Whether to apply XSS filtering
232 * @return mixed
Timothy Warren40403d22012-04-19 16:38:50 -0400233 */
Andrey Andreev7c60b122014-02-08 18:47:19 +0200234 public function post_get($index, $xss_clean = NULL)
Derek Allard2067d1a2008-11-13 22:59:24 +0000235 {
Andrey Andreev9448afb2012-02-08 19:49:19 +0200236 return isset($_POST[$index])
nisheeth-barthwala5bcfb12013-03-23 10:53:51 +0530237 ? $this->post($index, $xss_clean)
238 : $this->get($index, $xss_clean);
Derek Allard2067d1a2008-11-13 22:59:24 +0000239 }
240
241 // --------------------------------------------------------------------
242
243 /**
vlakoff441fd262013-08-11 20:36:41 +0200244 * Fetch an item from GET data with fallback to POST
245 *
246 * @param string $index Index for item to be fetched from $_GET or $_POST
247 * @param bool $xss_clean Whether to apply XSS filtering
248 * @return mixed
249 */
Andrey Andreev7c60b122014-02-08 18:47:19 +0200250 public function get_post($index, $xss_clean = NULL)
vlakoff441fd262013-08-11 20:36:41 +0200251 {
252 return isset($_GET[$index])
253 ? $this->get($index, $xss_clean)
254 : $this->post($index, $xss_clean);
255 }
256
257 // --------------------------------------------------------------------
258
259 /**
Timothy Warren40403d22012-04-19 16:38:50 -0400260 * Fetch an item from the COOKIE array
261 *
Andrey Andreev1887ec62012-10-27 16:22:07 +0300262 * @param string $index Index for item to be fetched from $_COOKIE
263 * @param bool $xss_clean Whether to apply XSS filtering
264 * @return mixed
Timothy Warren40403d22012-04-19 16:38:50 -0400265 */
Andrey Andreev7c60b122014-02-08 18:47:19 +0200266 public function cookie($index = NULL, $xss_clean = NULL)
Derek Allard2067d1a2008-11-13 22:59:24 +0000267 {
nisheeth-barthwala5bcfb12013-03-23 10:53:51 +0530268 return $this->_fetch_from_array($_COOKIE, $index, $xss_clean);
Derek Allard2067d1a2008-11-13 22:59:24 +0000269 }
270
Andrey Andreev1887ec62012-10-27 16:22:07 +0300271 // --------------------------------------------------------------------
272
273 /**
274 * Fetch an item from the SERVER array
275 *
276 * @param string $index Index for item to be fetched from $_SERVER
277 * @param bool $xss_clean Whether to apply XSS filtering
278 * @return mixed
279 */
Andrey Andreev7c60b122014-02-08 18:47:19 +0200280 public function server($index, $xss_clean = NULL)
Andrey Andreev1887ec62012-10-27 16:22:07 +0300281 {
282 return $this->_fetch_from_array($_SERVER, $index, $xss_clean);
283 }
284
Derek Jones69fc4fc2010-03-02 13:36:31 -0600285 // ------------------------------------------------------------------------
286
287 /**
Andrey Andreev303eef02012-11-06 14:55:48 +0200288 * Fetch an item from the php://input stream
289 *
290 * Useful when you need to access PUT, DELETE or PATCH request data.
291 *
292 * @param string $index Index for item to be fetched
293 * @param bool $xss_clean Whether to apply XSS filtering
294 * @return mixed
295 */
Andrey Andreev7c60b122014-02-08 18:47:19 +0200296 public function input_stream($index = NULL, $xss_clean = NULL)
Andrey Andreev303eef02012-11-06 14:55:48 +0200297 {
Andrey Andreevdc134a82014-05-08 10:00:55 +0300298 // Prior to PHP 5.6, the input stream can only be read once,
299 // so we'll need to check if we have already done that first.
Andrey Andreev303eef02012-11-06 14:55:48 +0200300 if ( ! is_array($this->_input_stream))
301 {
Andrey Andreev7c60b122014-02-08 18:47:19 +0200302 parse_str(file_get_contents('php://input'), $this->_input_stream);
303 is_array($this->_input_stream) OR $this->_input_stream = array();
Andrey Andreev303eef02012-11-06 14:55:48 +0200304 }
305
306 return $this->_fetch_from_array($this->_input_stream, $index, $xss_clean);
307 }
308
309 // ------------------------------------------------------------------------
310
311 /**
Timothy Warren40403d22012-04-19 16:38:50 -0400312 * Set cookie
313 *
Andrey Andreev1887ec62012-10-27 16:22:07 +0300314 * Accepts an arbitrary number of parameters (up to 7) or an associative
Timothy Warren40403d22012-04-19 16:38:50 -0400315 * array in the first parameter containing all the values.
316 *
Andrey Andreev1887ec62012-10-27 16:22:07 +0300317 * @param string|mixed[] $name Cookie name or an array containing parameters
318 * @param string $value Cookie value
319 * @param int $expire Cookie expiration time in seconds
320 * @param string $domain Cookie domain (e.g.: '.yourdomain.com')
321 * @param string $path Cookie path (default: '/')
322 * @param string $prefix Cookie name prefix
323 * @param bool $secure Whether to only transfer cookies via SSL
324 * @param bool $httponly Whether to only makes the cookie accessible via HTTP (no javascript)
Timothy Warren40403d22012-04-19 16:38:50 -0400325 * @return void
326 */
Andrey Andreev8f5420b2014-01-06 10:34:23 +0200327 public function set_cookie($name, $value = '', $expire = '', $domain = '', $path = '/', $prefix = '', $secure = FALSE, $httponly = FALSE)
Derek Jones69fc4fc2010-03-02 13:36:31 -0600328 {
329 if (is_array($name))
330 {
tobiasbg9aa7dc92011-02-18 21:57:13 +0100331 // always leave 'name' in last place, as the loop will break otherwise, due to $$item
freewil4ad0fd82012-03-13 22:37:42 -0400332 foreach (array('value', 'expire', 'domain', 'path', 'prefix', 'secure', 'httponly', 'name') as $item)
Derek Jones69fc4fc2010-03-02 13:36:31 -0600333 {
334 if (isset($name[$item]))
335 {
336 $$item = $name[$item];
337 }
338 }
339 }
340
Alex Bilbieed944a32012-06-02 11:07:47 +0100341 if ($prefix === '' && config_item('cookie_prefix') !== '')
Derek Jones69fc4fc2010-03-02 13:36:31 -0600342 {
343 $prefix = config_item('cookie_prefix');
344 }
Andrey Andreev9ba661b2012-06-04 14:44:34 +0300345
346 if ($domain == '' && config_item('cookie_domain') != '')
Derek Jones69fc4fc2010-03-02 13:36:31 -0600347 {
348 $domain = config_item('cookie_domain');
349 }
Andrey Andreev9ba661b2012-06-04 14:44:34 +0300350
Alex Bilbieed944a32012-06-02 11:07:47 +0100351 if ($path === '/' && config_item('cookie_path') !== '/')
Derek Jones69fc4fc2010-03-02 13:36:31 -0600352 {
353 $path = config_item('cookie_path');
354 }
Andrey Andreev9ba661b2012-06-04 14:44:34 +0300355
Alex Bilbieed944a32012-06-02 11:07:47 +0100356 if ($secure === FALSE && config_item('cookie_secure') !== FALSE)
tobiasbg9aa7dc92011-02-18 21:57:13 +0100357 {
358 $secure = config_item('cookie_secure');
359 }
Andrey Andreev9ba661b2012-06-04 14:44:34 +0300360
Alex Bilbieed944a32012-06-02 11:07:47 +0100361 if ($httponly === FALSE && config_item('cookie_httponly') !== FALSE)
freewil4ad0fd82012-03-13 22:37:42 -0400362 {
363 $httponly = config_item('cookie_httponly');
364 }
Derek Jones69fc4fc2010-03-02 13:36:31 -0600365
366 if ( ! is_numeric($expire))
367 {
368 $expire = time() - 86500;
369 }
370 else
371 {
Phil Sturgeonc8089152010-12-27 19:06:28 +0000372 $expire = ($expire > 0) ? time() + $expire : 0;
Derek Jones69fc4fc2010-03-02 13:36:31 -0600373 }
374
freewil4ad0fd82012-03-13 22:37:42 -0400375 setcookie($prefix.$name, $value, $expire, $path, $domain, $secure, $httponly);
Derek Jones69fc4fc2010-03-02 13:36:31 -0600376 }
377
Derek Allard2067d1a2008-11-13 22:59:24 +0000378 // --------------------------------------------------------------------
379
380 /**
Timothy Warren40403d22012-04-19 16:38:50 -0400381 * Fetch the IP Address
382 *
Andrey Andreev1887ec62012-10-27 16:22:07 +0300383 * Determines and validates the visitor's IP address.
384 *
385 * @return string IP address
Timothy Warren40403d22012-04-19 16:38:50 -0400386 */
Bo-Yi Wu4db872f2011-09-12 10:52:37 +0800387 public function ip_address()
Derek Allard2067d1a2008-11-13 22:59:24 +0000388 {
389 if ($this->ip_address !== FALSE)
390 {
391 return $this->ip_address;
392 }
Barry Mienydd671972010-10-04 16:33:58 +0200393
Andrey Andreev9ac557f2012-10-06 20:27:57 +0300394 $proxy_ips = config_item('proxy_ips');
Andrey Andreevea7a8662012-10-09 13:36:31 +0300395 if ( ! empty($proxy_ips) && ! is_array($proxy_ips))
Andrey Andreev9ac557f2012-10-06 20:27:57 +0300396 {
397 $proxy_ips = explode(',', str_replace(' ', '', $proxy_ips));
398 }
Andrey Andreev5b92ae12012-10-04 13:05:03 +0300399
Andrey Andreev9ac557f2012-10-06 20:27:57 +0300400 $this->ip_address = $this->server('REMOTE_ADDR');
401
402 if ($proxy_ips)
403 {
404 foreach (array('HTTP_X_FORWARDED_FOR', 'HTTP_CLIENT_IP', 'HTTP_X_CLIENT_IP', 'HTTP_X_CLUSTER_CLIENT_IP') as $header)
Jordan Pittman8960acf2012-07-23 09:05:49 -0300405 {
Andrey Andreev9ac557f2012-10-06 20:27:57 +0300406 if (($spoof = $this->server($header)) !== NULL)
Jordan Pittman8960acf2012-07-23 09:05:49 -0300407 {
Andrey Andreev9ac557f2012-10-06 20:27:57 +0300408 // Some proxies typically list the whole chain of IP
409 // addresses through which the client has reached us.
410 // e.g. client_ip, proxy_ip1, proxy_ip2, etc.
Andrey Andreeve24eed72012-11-02 23:33:45 +0200411 sscanf($spoof, '%[^,]', $spoof);
Andrey Andreev9ac557f2012-10-06 20:27:57 +0300412
413 if ( ! $this->valid_ip($spoof))
414 {
415 $spoof = NULL;
416 }
417 else
418 {
Jordan Pittmana5a71352012-07-20 19:36:43 -0300419 break;
420 }
421 }
Andrey Andreev5b92ae12012-10-04 13:05:03 +0300422 }
Andrey Andreev9ac557f2012-10-06 20:27:57 +0300423
Andrey Andreeve45ad2b2012-10-09 13:11:15 +0300424 if ($spoof)
Andrey Andreev5b92ae12012-10-04 13:05:03 +0300425 {
Andrey Andreev9df35b42012-10-09 13:37:58 +0300426 for ($i = 0, $c = count($proxy_ips); $i < $c; $i++)
Andrey Andreev9ac557f2012-10-06 20:27:57 +0300427 {
428 // Check if we have an IP address or a subnet
429 if (strpos($proxy_ips[$i], '/') === FALSE)
430 {
431 // An IP address (and not a subnet) is specified.
432 // We can compare right away.
433 if ($proxy_ips[$i] === $this->ip_address)
434 {
435 $this->ip_address = $spoof;
436 break;
437 }
Derek Allard2067d1a2008-11-13 22:59:24 +0000438
Andrey Andreev9ac557f2012-10-06 20:27:57 +0300439 continue;
440 }
441
442 // We have a subnet ... now the heavy lifting begins
443 isset($separator) OR $separator = $this->valid_ip($this->ip_address, 'ipv6') ? ':' : '.';
444
445 // If the proxy entry doesn't match the IP protocol - skip it
446 if (strpos($proxy_ips[$i], $separator) === FALSE)
447 {
448 continue;
449 }
450
451 // Convert the REMOTE_ADDR IP address to binary, if needed
Andrey Andreev82d2cf12012-10-13 12:38:42 +0300452 if ( ! isset($ip, $sprintf))
Andrey Andreev9ac557f2012-10-06 20:27:57 +0300453 {
454 if ($separator === ':')
455 {
456 // Make sure we're have the "full" IPv6 format
Andrey Andreev82d2cf12012-10-13 12:38:42 +0300457 $ip = explode(':',
458 str_replace('::',
459 str_repeat(':', 9 - substr_count($this->ip_address, ':')),
460 $this->ip_address
461 )
462 );
463
464 for ($i = 0; $i < 8; $i++)
465 {
466 $ip[$i] = intval($ip[$i], 16);
467 }
468
469 $sprintf = '%016b%016b%016b%016b%016b%016b%016b%016b';
Andrey Andreev9ac557f2012-10-06 20:27:57 +0300470 }
471 else
472 {
Andrey Andreev82d2cf12012-10-13 12:38:42 +0300473 $ip = explode('.', $this->ip_address);
474 $sprintf = '%08b%08b%08b%08b';
Andrey Andreev9ac557f2012-10-06 20:27:57 +0300475 }
476
Andrey Andreev82d2cf12012-10-13 12:38:42 +0300477 $ip = vsprintf($sprintf, $ip);
Andrey Andreev9ac557f2012-10-06 20:27:57 +0300478 }
479
480 // Split the netmask length off the network address
Andrey Andreeve24eed72012-11-02 23:33:45 +0200481 sscanf($proxy_ips[$i], '%[^/]/%d', $netaddr, $masklen);
Andrey Andreev9ac557f2012-10-06 20:27:57 +0300482
483 // Again, an IPv6 address is most likely in a compressed form
484 if ($separator === ':')
485 {
Andrey Andreev82d2cf12012-10-13 12:38:42 +0300486 $netaddr = explode(':', str_replace('::', str_repeat(':', 9 - substr_count($netaddr, ':')), $netaddr));
487 for ($i = 0; $i < 8; $i++)
488 {
489 $netaddr[$i] = intval($netaddr[$i], 16);
490 }
491 }
492 else
493 {
494 $netaddr = explode('.', $netaddr);
Andrey Andreev9ac557f2012-10-06 20:27:57 +0300495 }
496
Andrey Andreev82d2cf12012-10-13 12:38:42 +0300497 // Convert to binary and finally compare
498 if (strncmp($ip, vsprintf($sprintf, $netaddr), $masklen) === 0)
Andrey Andreev9ac557f2012-10-06 20:27:57 +0300499 {
500 $this->ip_address = $spoof;
501 break;
502 }
503 }
504 }
Derek Allard2067d1a2008-11-13 22:59:24 +0000505 }
506
Derek Allard2067d1a2008-11-13 22:59:24 +0000507 if ( ! $this->valid_ip($this->ip_address))
508 {
Andrey Andreev64e98aa2012-01-07 20:29:10 +0200509 return $this->ip_address = '0.0.0.0';
Derek Allard2067d1a2008-11-13 22:59:24 +0000510 }
511
512 return $this->ip_address;
513 }
514
515 // --------------------------------------------------------------------
516
517 /**
Timothy Warren40403d22012-04-19 16:38:50 -0400518 * Validate IP Address
519 *
Andrey Andreev1887ec62012-10-27 16:22:07 +0300520 * @param string $ip IP address
521 * @param string $which IP protocol: 'ipv4' or 'ipv6'
Timothy Warren40403d22012-04-19 16:38:50 -0400522 * @return bool
523 */
Andrey Andreev5a257182012-06-10 06:18:14 +0300524 public function valid_ip($ip, $which = '')
Derek Allard2067d1a2008-11-13 22:59:24 +0000525 {
Andrey Andreev5a257182012-06-10 06:18:14 +0300526 switch (strtolower($which))
527 {
528 case 'ipv4':
529 $which = FILTER_FLAG_IPV4;
530 break;
531 case 'ipv6':
532 $which = FILTER_FLAG_IPV6;
533 break;
534 default:
535 $which = NULL;
536 break;
537 }
538
539 return (bool) filter_var($ip, FILTER_VALIDATE_IP, $which);
Derek Allard2067d1a2008-11-13 22:59:24 +0000540 }
541
542 // --------------------------------------------------------------------
543
544 /**
Andrey Andreev1887ec62012-10-27 16:22:07 +0300545 * Fetch User Agent string
Timothy Warren40403d22012-04-19 16:38:50 -0400546 *
Andrey Andreev1887ec62012-10-27 16:22:07 +0300547 * @return string|null User Agent string or NULL if it doesn't exist
Timothy Warren40403d22012-04-19 16:38:50 -0400548 */
Andrey Andreev8850e372014-02-27 21:56:06 +0200549 public function user_agent($xss_clean = NULL)
Derek Allard2067d1a2008-11-13 22:59:24 +0000550 {
Andrey Andreev8850e372014-02-27 21:56:06 +0200551 return $this->_fetch_from_array($_SERVER, 'HTTP_USER_AGENT', $xss_clean);
Derek Allard2067d1a2008-11-13 22:59:24 +0000552 }
553
554 // --------------------------------------------------------------------
555
556 /**
Timothy Warren40403d22012-04-19 16:38:50 -0400557 * Sanitize Globals
558 *
Andrey Andreev1887ec62012-10-27 16:22:07 +0300559 * Internal method serving for the following purposes:
Timothy Warren40403d22012-04-19 16:38:50 -0400560 *
Andrey Andreevb78a8c72014-04-15 17:21:16 +0300561 * - Unsets $_GET data, if query strings are not enabled
Andrey Andreev1887ec62012-10-27 16:22:07 +0300562 * - Cleans POST, COOKIE and SERVER data
563 * - Standardizes newline characters to PHP_EOL
Timothy Warren40403d22012-04-19 16:38:50 -0400564 *
565 * @return void
566 */
Andrey Andreev90cfe142012-01-08 04:46:42 +0200567 protected function _sanitize_globals()
Derek Allard2067d1a2008-11-13 22:59:24 +0000568 {
Derek Jones69fc4fc2010-03-02 13:36:31 -0600569 // Is $_GET data allowed? If not we'll set the $_GET to an empty array
Alex Bilbieed944a32012-06-02 11:07:47 +0100570 if ($this->_allow_get_array === FALSE)
Derek Allard2067d1a2008-11-13 22:59:24 +0000571 {
Derek Jones69fc4fc2010-03-02 13:36:31 -0600572 $_GET = array();
Derek Allard2067d1a2008-11-13 22:59:24 +0000573 }
Andrey Andreev9448afb2012-02-08 19:49:19 +0200574 elseif (is_array($_GET) && count($_GET) > 0)
Derek Allard2067d1a2008-11-13 22:59:24 +0000575 {
Andrey Andreev9448afb2012-02-08 19:49:19 +0200576 foreach ($_GET as $key => $val)
Derek Allard2067d1a2008-11-13 22:59:24 +0000577 {
Andrey Andreev9448afb2012-02-08 19:49:19 +0200578 $_GET[$this->_clean_input_keys($key)] = $this->_clean_input_data($val);
Derek Allard2067d1a2008-11-13 22:59:24 +0000579 }
580 }
581
Derek Jones69fc4fc2010-03-02 13:36:31 -0600582 // Clean $_POST Data
Andrey Andreev9448afb2012-02-08 19:49:19 +0200583 if (is_array($_POST) && count($_POST) > 0)
Derek Allard2067d1a2008-11-13 22:59:24 +0000584 {
Pascal Kriete5d5895f2011-02-14 13:27:07 -0500585 foreach ($_POST as $key => $val)
Derek Jones69fc4fc2010-03-02 13:36:31 -0600586 {
587 $_POST[$this->_clean_input_keys($key)] = $this->_clean_input_data($val);
588 }
Derek Allard2067d1a2008-11-13 22:59:24 +0000589 }
590
Derek Jones69fc4fc2010-03-02 13:36:31 -0600591 // Clean $_COOKIE Data
Andrey Andreev9448afb2012-02-08 19:49:19 +0200592 if (is_array($_COOKIE) && count($_COOKIE) > 0)
Derek Allard2067d1a2008-11-13 22:59:24 +0000593 {
Derek Jones69fc4fc2010-03-02 13:36:31 -0600594 // Also get rid of specially treated cookies that might be set by a server
595 // or silly application, that are of no use to a CI application anyway
596 // but that when present will trip our 'Disallowed Key Characters' alarm
597 // http://www.ietf.org/rfc/rfc2109.txt
598 // note that the key names below are single quoted strings, and are not PHP variables
Andrey Andreev5ac428b2014-01-08 16:07:31 +0200599 unset(
600 $_COOKIE['$Version'],
601 $_COOKIE['$Path'],
602 $_COOKIE['$Domain']
603 );
Derek Jones69fc4fc2010-03-02 13:36:31 -0600604
Pascal Kriete5d5895f2011-02-14 13:27:07 -0500605 foreach ($_COOKIE as $key => $val)
Derek Jones69fc4fc2010-03-02 13:36:31 -0600606 {
Andrey Andreevfd0aabb2013-09-23 13:18:20 +0300607 if (($cookie_key = $this->_clean_input_keys($key)) !== FALSE)
608 {
609 $_COOKIE[$cookie_key] = $this->_clean_input_data($val);
610 }
611 else
612 {
613 unset($_COOKIE[$key]);
614 }
Derek Jones69fc4fc2010-03-02 13:36:31 -0600615 }
Derek Allard2067d1a2008-11-13 22:59:24 +0000616 }
617
Derek Jones69fc4fc2010-03-02 13:36:31 -0600618 // Sanitize PHP_SELF
619 $_SERVER['PHP_SELF'] = strip_tags($_SERVER['PHP_SELF']);
620
Derek Jones69fc4fc2010-03-02 13:36:31 -0600621 // CSRF Protection check
Andrey Andreevf964b162013-11-12 17:04:55 +0200622 if ($this->_enable_csrf === TRUE && ! is_cli())
Derek Allard2067d1a2008-11-13 22:59:24 +0000623 {
Derek Jones69fc4fc2010-03-02 13:36:31 -0600624 $this->security->csrf_verify();
Derek Allard2067d1a2008-11-13 22:59:24 +0000625 }
Derek Allard2067d1a2008-11-13 22:59:24 +0000626
Andrey Andreevfd0aabb2013-09-23 13:18:20 +0300627 log_message('debug', 'Global POST, GET and COOKIE data sanitized');
Derek Allard2067d1a2008-11-13 22:59:24 +0000628 }
629
630 // --------------------------------------------------------------------
631
632 /**
Timothy Warren40403d22012-04-19 16:38:50 -0400633 * Clean Input Data
634 *
Andrey Andreev1887ec62012-10-27 16:22:07 +0300635 * Internal method that aids in escaping data and
636 * standardizing newline characters to PHP_EOL.
Timothy Warren40403d22012-04-19 16:38:50 -0400637 *
Andrey Andreev1887ec62012-10-27 16:22:07 +0300638 * @param string|string[] $str Input string(s)
Timothy Warren40403d22012-04-19 16:38:50 -0400639 * @return string
640 */
Andrey Andreev90cfe142012-01-08 04:46:42 +0200641 protected function _clean_input_data($str)
Derek Allard2067d1a2008-11-13 22:59:24 +0000642 {
Derek Jones69fc4fc2010-03-02 13:36:31 -0600643 if (is_array($str))
Derek Allard2067d1a2008-11-13 22:59:24 +0000644 {
Derek Jones69fc4fc2010-03-02 13:36:31 -0600645 $new_array = array();
Andrey Andreev1887ec62012-10-27 16:22:07 +0300646 foreach (array_keys($str) as $key)
Derek Jones69fc4fc2010-03-02 13:36:31 -0600647 {
Andrey Andreev1887ec62012-10-27 16:22:07 +0300648 $new_array[$this->_clean_input_keys($key)] = $this->_clean_input_data($str[$key]);
Derek Jones69fc4fc2010-03-02 13:36:31 -0600649 }
650 return $new_array;
Derek Allard2067d1a2008-11-13 22:59:24 +0000651 }
652
Andrey Andreevaf728622011-10-20 10:11:59 +0300653 /* We strip slashes if magic quotes is on to keep things consistent
654
655 NOTE: In PHP 5.4 get_magic_quotes_gpc() will always return 0 and
656 it will probably not exist in future versions at all.
657 */
658 if ( ! is_php('5.4') && get_magic_quotes_gpc())
Derek Allard2067d1a2008-11-13 22:59:24 +0000659 {
Derek Jones69fc4fc2010-03-02 13:36:31 -0600660 $str = stripslashes($str);
661 }
662
663 // Clean UTF-8 if supported
664 if (UTF8_ENABLED === TRUE)
665 {
666 $str = $this->uni->clean_string($str);
667 }
David Behler9b5df592011-08-14 21:04:17 +0200668
Pascal Kriete14a0ac62011-04-05 14:55:56 -0400669 // Remove control characters
Andrey Andreev5ac428b2014-01-08 16:07:31 +0200670 $str = remove_invisible_characters($str, FALSE);
Derek Jones69fc4fc2010-03-02 13:36:31 -0600671
Derek Jones69fc4fc2010-03-02 13:36:31 -0600672 // Standardize newlines if needed
Eric Robertsb75e13d2013-01-27 20:10:09 -0600673 if ($this->_standardize_newlines === TRUE)
Derek Jones69fc4fc2010-03-02 13:36:31 -0600674 {
Eric Robertsb75e13d2013-01-27 20:10:09 -0600675 return preg_replace('/(?:\r\n|[\r\n])/', PHP_EOL, $str);
Derek Allard2067d1a2008-11-13 22:59:24 +0000676 }
677
678 return $str;
679 }
680
681 // --------------------------------------------------------------------
682
683 /**
Timothy Warren40403d22012-04-19 16:38:50 -0400684 * Clean Keys
685 *
Andrey Andreev1887ec62012-10-27 16:22:07 +0300686 * Internal method that helps to prevent malicious users
Timothy Warren40403d22012-04-19 16:38:50 -0400687 * from trying to exploit keys we make sure that keys are
688 * only named with alpha-numeric text and a few other items.
689 *
Andrey Andreev1887ec62012-10-27 16:22:07 +0300690 * @param string $str Input string
Andrey Andreevfd0aabb2013-09-23 13:18:20 +0300691 * @param string $fatal Whether to terminate script exection
692 * or to return FALSE if an invalid
693 * key is encountered
694 * @return string|bool
Timothy Warren40403d22012-04-19 16:38:50 -0400695 */
Andrey Andreevfd0aabb2013-09-23 13:18:20 +0300696 protected function _clean_input_keys($str, $fatal = TRUE)
Derek Allard2067d1a2008-11-13 22:59:24 +0000697 {
bigCat3c0846b2012-08-21 00:20:20 +0800698 if ( ! preg_match('/^[a-z0-9:_\/|-]+$/i', $str))
Derek Allard2067d1a2008-11-13 22:59:24 +0000699 {
Andrey Andreevfd0aabb2013-09-23 13:18:20 +0300700 if ($fatal === TRUE)
701 {
702 return FALSE;
703 }
704 else
705 {
706 set_status_header(503);
707 echo 'Disallowed Key Characters.';
Andrey Andreev7cf682a2014-03-13 14:55:45 +0200708 exit(7); // EXIT_USER_INPUT
Andrey Andreevfd0aabb2013-09-23 13:18:20 +0300709 }
Derek Allard2067d1a2008-11-13 22:59:24 +0000710 }
711
Derek Jones69fc4fc2010-03-02 13:36:31 -0600712 // Clean UTF-8 if supported
713 if (UTF8_ENABLED === TRUE)
714 {
Andrey Andreev64e98aa2012-01-07 20:29:10 +0200715 return $this->uni->clean_string($str);
Derek Jones69fc4fc2010-03-02 13:36:31 -0600716 }
Derek Allard2067d1a2008-11-13 22:59:24 +0000717
Derek Jones69fc4fc2010-03-02 13:36:31 -0600718 return $str;
719 }
Derek Allard2067d1a2008-11-13 22:59:24 +0000720
Greg Akerec2f5712010-11-15 16:22:12 -0600721 // --------------------------------------------------------------------
722
723 /**
724 * Request Headers
725 *
Andrey Andreev1887ec62012-10-27 16:22:07 +0300726 * @param bool $xss_clean Whether to apply XSS filtering
Andrey Andreev64e98aa2012-01-07 20:29:10 +0200727 * @return array
Greg Akerec2f5712010-11-15 16:22:12 -0600728 */
729 public function request_headers($xss_clean = FALSE)
730 {
CJ71cff1d2013-04-16 21:50:55 +0800731 // If header is already defined, return it immediately
732 if ( ! empty($this->headers))
733 {
734 return $this->headers;
735 }
736
Andrey Andreev1887ec62012-10-27 16:22:07 +0300737 // In Apache, you can simply call apache_request_headers()
Greg Akerec2f5712010-11-15 16:22:12 -0600738 if (function_exists('apache_request_headers'))
739 {
CJ71cff1d2013-04-16 21:50:55 +0800740 return $this->headers = apache_request_headers();
Greg Akerec2f5712010-11-15 16:22:12 -0600741 }
CJd195f222013-04-17 01:04:13 +0800742
CJ8347f912013-04-17 21:45:22 +0800743 $this->headers['Content-Type'] = isset($_SERVER['CONTENT_TYPE']) ? $_SERVER['CONTENT_TYPE'] : @getenv('CONTENT_TYPE');
CJd195f222013-04-17 01:04:13 +0800744
745 foreach ($_SERVER as $key => $val)
Greg Akerec2f5712010-11-15 16:22:12 -0600746 {
CJd195f222013-04-17 01:04:13 +0800747 if (sscanf($key, 'HTTP_%s', $header) === 1)
Greg Akerec2f5712010-11-15 16:22:12 -0600748 {
CJd195f222013-04-17 01:04:13 +0800749 // take SOME_HEADER and turn it into Some-Header
750 $header = str_replace('_', ' ', strtolower($header));
751 $header = str_replace(' ', '-', ucwords($header));
Greg Akerec2f5712010-11-15 16:22:12 -0600752
CJd195f222013-04-17 01:04:13 +0800753 $this->headers[$header] = $this->_fetch_from_array($_SERVER, $key, $xss_clean);
CJ826990f2013-04-16 14:17:53 +0800754 }
Greg Akerec2f5712010-11-15 16:22:12 -0600755 }
David Behler9b5df592011-08-14 21:04:17 +0200756
Greg Akerec2f5712010-11-15 16:22:12 -0600757 return $this->headers;
758 }
759
760 // --------------------------------------------------------------------
761
762 /**
763 * Get Request Header
764 *
765 * Returns the value of a single member of the headers class member
766 *
Andrey Andreev1887ec62012-10-27 16:22:07 +0300767 * @param string $index Header name
768 * @param bool $xss_clean Whether to apply XSS filtering
Adriano Rosaf112e4a2014-10-03 13:15:46 -0300769 * @return string|null The requested header on success or NULL on failure
Greg Akerec2f5712010-11-15 16:22:12 -0600770 */
771 public function get_request_header($index, $xss_clean = FALSE)
772 {
773 if (empty($this->headers))
774 {
775 $this->request_headers();
776 }
David Behler9b5df592011-08-14 21:04:17 +0200777
Greg Akerec2f5712010-11-15 16:22:12 -0600778 if ( ! isset($this->headers[$index]))
779 {
Phil Sturgeon55a6ddb2012-05-23 18:37:24 +0100780 return NULL;
Greg Akerec2f5712010-11-15 16:22:12 -0600781 }
782
Andrey Andreev9448afb2012-02-08 19:49:19 +0200783 return ($xss_clean === TRUE)
784 ? $this->security->xss_clean($this->headers[$index])
785 : $this->headers[$index];
Greg Akerec2f5712010-11-15 16:22:12 -0600786 }
787
Greg Aker081ac9d2010-11-22 14:42:53 -0600788 // --------------------------------------------------------------------
Phil Sturgeonc3828712011-01-19 12:31:47 +0000789
Greg Aker081ac9d2010-11-22 14:42:53 -0600790 /**
Andrey Andreev1887ec62012-10-27 16:22:07 +0300791 * Is AJAX request?
Greg Aker081ac9d2010-11-22 14:42:53 -0600792 *
Andrey Andreev1887ec62012-10-27 16:22:07 +0300793 * Test to see if a request contains the HTTP_X_REQUESTED_WITH header.
Greg Aker081ac9d2010-11-22 14:42:53 -0600794 *
Andrey Andreev9448afb2012-02-08 19:49:19 +0200795 * @return bool
Greg Aker081ac9d2010-11-22 14:42:53 -0600796 */
797 public function is_ajax_request()
798 {
Andrey Andreev9448afb2012-02-08 19:49:19 +0200799 return ( ! empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest');
Greg Aker081ac9d2010-11-22 14:42:53 -0600800 }
801
Phil Sturgeonc3828712011-01-19 12:31:47 +0000802 // --------------------------------------------------------------------
803
804 /**
Andrey Andreev1887ec62012-10-27 16:22:07 +0300805 * Is CLI request?
Phil Sturgeonc3828712011-01-19 12:31:47 +0000806 *
Andrey Andreev1887ec62012-10-27 16:22:07 +0300807 * Test to see if a request was made from the command line.
Phil Sturgeonc3828712011-01-19 12:31:47 +0000808 *
Andrey Andreevf964b162013-11-12 17:04:55 +0200809 * @deprecated 3.0.0 Use is_cli() instead
810 * @return bool
Phil Sturgeonc3828712011-01-19 12:31:47 +0000811 */
812 public function is_cli_request()
813 {
Andrey Andreevf964b162013-11-12 17:04:55 +0200814 return is_cli();
Phil Sturgeonc3828712011-01-19 12:31:47 +0000815 }
816
Michiel Vugteveenbe0ca262012-03-07 19:09:51 +0100817 // --------------------------------------------------------------------
818
819 /**
820 * Get Request Method
821 *
Andrey Andreev1887ec62012-10-27 16:22:07 +0300822 * Return the request method
Michiel Vugteveenbe0ca262012-03-07 19:09:51 +0100823 *
Andrey Andreev1887ec62012-10-27 16:22:07 +0300824 * @param bool $upper Whether to return in upper or lower case
825 * (default: FALSE)
826 * @return string
Michiel Vugteveenbe0ca262012-03-07 19:09:51 +0100827 */
Michiel Vugteveen704fb162012-03-07 20:42:33 +0100828 public function method($upper = FALSE)
Michiel Vugteveenbe0ca262012-03-07 19:09:51 +0100829 {
Michiel Vugteveendc900df2012-03-07 20:41:37 +0100830 return ($upper)
831 ? strtoupper($this->server('REQUEST_METHOD'))
832 : strtolower($this->server('REQUEST_METHOD'));
Michiel Vugteveenbe0ca262012-03-07 19:09:51 +0100833 }
834
Derek Allard2067d1a2008-11-13 22:59:24 +0000835}
Derek Allard2067d1a2008-11-13 22:59:24 +0000836
837/* End of file Input.php */
fabianozenatti28eca652014-03-21 14:54:25 +0100838/* Location: ./system/core/Input.php */