My Project
 All Data Structures Namespaces Functions Variables
Public Member Functions | Data Fields | Protected Member Functions | Protected Attributes
CI_Input Class Reference

Public Member Functions

 __construct ()
 
 _fetch_from_array (&$array, $index= '', $xss_clean=FALSE)
 
 get ($index=NULL, $xss_clean=FALSE)
 
 post ($index=NULL, $xss_clean=FALSE)
 
 get_post ($index= '', $xss_clean=FALSE)
 
 cookie ($index= '', $xss_clean=FALSE)
 
 set_cookie ($name= '', $value= '', $expire= '', $domain= '', $path= '/', $prefix= '', $secure=FALSE)
 
 server ($index= '', $xss_clean=FALSE)
 
 ip_address ()
 
 valid_ip ($ip, $which= '')
 
 user_agent ()
 
 _sanitize_globals ()
 
 _clean_input_data ($str)
 
 _clean_input_keys ($str)
 
 request_headers ($xss_clean=FALSE)
 
 get_request_header ($index, $xss_clean=FALSE)
 
 is_ajax_request ()
 
 is_cli_request ()
 

Data Fields

 $ip_address = FALSE
 
 $user_agent = FALSE
 
 $_allow_get_array = TRUE
 
 $_standardize_newlines = TRUE
 
 $_enable_xss = FALSE
 
 $_enable_csrf = FALSE
 

Protected Member Functions

 _valid_ipv4 ($ip)
 
 _valid_ipv6 ($str)
 

Protected Attributes

 $headers = array()
 

Constructor & Destructor Documentation

__construct ( )

Constructor

Sets whether to globally enable the XSS processing and whether to allow the $_GET array

Returns
void

Member Function Documentation

_clean_input_data (   $str)

Clean Input Data

This is a helper function. It escapes data and standardizes newline characters to

private

Parameters
string
Returns
string
_clean_input_keys (   $str)

Clean Keys

This is a helper function. To prevent malicious users from trying to exploit keys we make sure that keys are only named with alpha-numeric text and a few other items.

private

Parameters
string
Returns
string
_fetch_from_array ( $array,
  $index = '',
  $xss_clean = FALSE 
)

Fetch from array

This is a helper function to retrieve values from global arrays

private

Parameters
array
string
bool
Returns
string
_sanitize_globals ( )

Sanitize Globals

This function does the following:

Unsets $_GET data (if query strings are not enabled)

Unsets all globals if register_globals is enabled

Standardizes newline characters to

private

Returns
void
_valid_ipv4 (   $ip)
protected

Validate IPv4 Address

Updated version suggested by Geert De Deckere

protected

Parameters
string
Returns
bool
_valid_ipv6 (   $str)
protected

Validate IPv6 Address

protected

Parameters
string
Returns
bool
cookie (   $index = '',
  $xss_clean = FALSE 
)

Fetch an item from the COOKIE array

public

Parameters
string
bool
Returns
string
get (   $index = NULL,
  $xss_clean = FALSE 
)

Fetch an item from the GET array

public

Parameters
string
bool
Returns
string
get_post (   $index = '',
  $xss_clean = FALSE 
)

Fetch an item from either the GET array or the POST

public

Parameters
stringThe index key
boolXSS cleaning
Returns
string
get_request_header (   $index,
  $xss_clean = FALSE 
)

Get Request Header

Returns the value of a single member of the headers class member

Parameters
stringarray key for $this->headers
booleanXSS Clean or not
Returns
mixed FALSE on failure, string on success
ip_address ( )

Fetch the IP Address

Returns
string
is_ajax_request ( )

Is ajax Request?

Test to see if a request contains the HTTP_X_REQUESTED_WITH header

Returns
boolean
is_cli_request ( )

Is cli Request?

Test to see if a request was made from the command line

Returns
bool
post (   $index = NULL,
  $xss_clean = FALSE 
)

Fetch an item from the POST array

public

Parameters
string
bool
Returns
string
request_headers (   $xss_clean = FALSE)

Request Headers

In Apache, you can simply call apache_request_headers(), however for people running other webservers the function is undefined.

Parameters
boolXSS cleaning
Returns
array
server (   $index = '',
  $xss_clean = FALSE 
)

Fetch an item from the SERVER array

public

Parameters
string
bool
Returns
string
set_cookie (   $name = '',
  $value = '',
  $expire = '',
  $domain = '',
  $path = '/',
  $prefix = '',
  $secure = FALSE 
)

Set cookie

Accepts six parameter, or you can submit an associative array in the first parameter containing all the values.

public

Parameters
mixed
stringthe value of the cookie
stringthe number of seconds until expiration
stringthe cookie domain. Usually: .yourdomain.com
stringthe cookie path
stringthe cookie prefix
booltrue makes the cookie secure
Returns
void
user_agent ( )

User Agent

public

Returns
string
valid_ip (   $ip,
  $which = '' 
)

Validate IP Address

public

Parameters
string
stringipv4 or ipv6
Returns
bool

The documentation for this class was generated from the following file: