From 114ab0988e20ac6be39ad363ff897a1a3b85e565 Mon Sep 17 00:00:00 2001
From: Razican The security filtering function is called automatically when a new controller is invoked. It does the following: The security filtering function is called automatically when a new controller is invoked. It does the following: The Input class has the ability to filter input automatically to prevent cross-site scripting attacks. If you want the filter to run automatically every time it encounters POST or COOKIE data you can enable it by opening your
+ The Input class has the ability to filter input automatically to prevent cross-site scripting attacks. If you want the filter to run automatically every time it encounters POST or COOKIE data you can enable it by opening your
application/config/config.php file and setting this: CodeIgniter comes with three helper functions that let you fetch POST, COOKIE or SERVER items. The main advantage of using the provided
+ CodeIgniter comes with three helper functions that let you fetch POST, COOKIE or SERVER items. The main advantage of using the provided
functions rather than fetching an item directly ($_POST['something']) is that the functions will check to see if the item is set and
-return false (boolean) if not. This lets you conveniently use data without having to test whether an item exists first.
+return false (boolean) if not. This lets you conveniently use data without having to test whether an item exists first.
In other words, normally you might do something like this: The function returns FALSE (boolean) if the item you are attempting to retrieve does not exist. The second optional parameter lets you run the data through the XSS filter. It's enabled by setting the second parameter to boolean TRUE; The second optional parameter lets you run the data through the XSS filter. It's enabled by setting the second parameter to boolean TRUE; Sets a cookie containing the values you specify. There are two ways to pass information to this function so that a cookie can be set:
+ Sets a cookie containing the values you specify. There are two ways to pass information to this function so that a cookie can be set:
Array Method, and Discrete Parameters: Only the name and value are required. To delete a cookie set it with the expiration blank. The expiration is set in seconds, which will be added to the current time. Do not include the time, but rather only the
-number of seconds from now that you wish the cookie to be valid. If the expiration is set to
+ The expiration is set in seconds, which will be added to the current time. Do not include the time, but rather only the
+number of seconds from now that you wish the cookie to be valid. If the expiration is set to
zero the cookie will only last as long as the browser is open. For site-wide cookies regardless of how your site is requested, add your URL to the domain starting with a period, like this: .your-domain.com For site-wide cookies regardless of how your site is requested, add your URL to the domain starting with a period, like this: .your-domain.com The path is usually not needed since the function sets a root path. The prefix is only needed if you need to avoid name collisions with other identically named cookies for your server. The secure boolean is only needed if you want to make it a secure cookie by setting it to TRUE.Security Filtering
-
-
XSS Filtering
-$config['global_xss_filtering'] = TRUE;
@@ -93,9 +93,9 @@ Input Class
Using POST, COOKIE, or SERVER Data
-
@@ -128,7 +128,7 @@ else
$this->input->post('some_data', TRUE);
@@ -179,7 +179,7 @@ else
$this->input->set_cookie()
-Array Method
@@ -203,10 +203,10 @@ $this->input->set_cookie($cookie);
Lets you fetch a cookie. The first parameter will contain the name of the cookie you are looking for (including any prefixes):
+Lets you fetch a cookie. The first parameter will contain the name of the cookie you are looking for (including any prefixes):
cookie('some_cookie');
The function returns FALSE (boolean) if the item you are attempting to retrieve does not exist.
-The second optional parameter lets you run the data through the XSS filter. It's enabled by setting the second parameter to boolean TRUE;
+The second optional parameter lets you run the data through the XSS filter. It's enabled by setting the second parameter to boolean TRUE;
cookie('some_cookie', TRUE);
Returns the IP address for the current user. If the IP address is not valid, the function will return an IP of: 0.0.0.0
+Returns the IP address for the current user. If the IP address is not valid, the function will return an IP of: 0.0.0.0
echo $this->input->ip_address();
Takes an IP address as input and returns TRUE or FALSE (boolean) if it is valid or not. Note: The $this->input->ip_address() function above +
Takes an IP address as input and returns TRUE or FALSE (boolean) if it is valid or not. Note: The $this->input->ip_address() function above validates the IP automatically.
if ( ! $this->input->valid_ip($ip))
@@ -256,7 +256,7 @@ else
See the User Agent Class for methods which extract information from the user agent string.
$this->input->request_headers()
-Useful if running in a non-Apache environment where apache_request_headers() will not be supported. Returns an array of headers.
+Useful if running in a non-Apache environment where apache_request_headers() will not be supported. Returns an array of headers.
$headers = $this->input->request_headers();
--
cgit v1.2.3-24-g4f1b