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() | |
| __construct | ( | ) |
Constructor
Sets whether to globally enable the XSS processing and whether to allow the $_GET array
| _clean_input_data | ( | $str) |
Clean Input Data
This is a helper function. It escapes data and standardizes newline characters to
private
| 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
| string |
| _fetch_from_array | ( | & | $array, |
$index = '', |
|||
$xss_clean = FALSE |
|||
| ) |
Fetch from array
This is a helper function to retrieve values from global arrays
private
| array | |
| string | |
| bool |
| _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
|
protected |
Validate IPv4 Address
Updated version suggested by Geert De Deckere
protected
| string |
|
protected |
Validate IPv6 Address
protected
| string |
| cookie | ( | $index = '', |
|
$xss_clean = FALSE |
|||
| ) |
Fetch an item from the COOKIE array
public
| string | |
| bool |
| get | ( | $index = NULL, |
|
$xss_clean = FALSE |
|||
| ) |
Fetch an item from the GET array
public
| string | |
| bool |
| get_post | ( | $index = '', |
|
$xss_clean = FALSE |
|||
| ) |
Fetch an item from either the GET array or the POST
public
| string | The index key |
| bool | XSS cleaning |
| get_request_header | ( | $index, | |
$xss_clean = FALSE |
|||
| ) |
Get Request Header
Returns the value of a single member of the headers class member
| string | array key for $this->headers |
| boolean | XSS Clean or not |
| ip_address | ( | ) |
Fetch the IP Address
| is_ajax_request | ( | ) |
Is ajax Request?
Test to see if a request contains the HTTP_X_REQUESTED_WITH header
| is_cli_request | ( | ) |
Is cli Request?
Test to see if a request was made from the command line
| post | ( | $index = NULL, |
|
$xss_clean = FALSE |
|||
| ) |
Fetch an item from the POST array
public
| string | |
| bool |
| 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.
| bool | XSS cleaning |
| server | ( | $index = '', |
|
$xss_clean = FALSE |
|||
| ) |
Fetch an item from the SERVER array
public
| string | |
| bool |
| 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
| mixed | |
| string | the value of the cookie |
| string | the number of seconds until expiration |
| string | the cookie domain. Usually: .yourdomain.com |
| string | the cookie path |
| string | the cookie prefix |
| bool | true makes the cookie secure |
| user_agent | ( | ) |
User Agent
public
| valid_ip | ( | $ip, | |
$which = '' |
|||
| ) |
Validate IP Address
public
| string | |
| string | ipv4 or ipv6 |
1.8.4