diff options
author | Phil Sturgeon <email@philsturgeon.co.uk> | 2011-02-16 20:03:49 +0100 |
---|---|---|
committer | Phil Sturgeon <email@philsturgeon.co.uk> | 2011-02-16 20:03:49 +0100 |
commit | 33ed0f37b6b8f2223cd3362bf8fca28102ab67c6 (patch) | |
tree | 99c613720a2fd8541764bb6fc893e0da28fa269b /user_guide/libraries/input.html | |
parent | 154da11c5bb4b7dc5c225f4fa018852ee45cc6eb (diff) | |
parent | d8d1e24eee56d2466c91ecd72b3c8932eb3d0639 (diff) |
Merged CodeIgniter Core changes and integrated rob1's secure cookie change into my secure cookie change.
Diffstat (limited to 'user_guide/libraries/input.html')
-rw-r--r-- | user_guide/libraries/input.html | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/user_guide/libraries/input.html b/user_guide/libraries/input.html index 552c49afd..844e99ab8 100644 --- a/user_guide/libraries/input.html +++ b/user_guide/libraries/input.html @@ -132,12 +132,32 @@ else<br /> <code>$this->input->post('some_data', TRUE);</code> +<p>To return an array of all POST items call without any parameters.</p> +<p>To return all POST items and pass them through the XSS filter leave the first parameter blank while setting the second parameter to boolean;</p> +<p>The function returns FALSE (boolean) if there are no items in the POST.</p> + +<code> + $this->input->post(); // returns all POST items with XSS filter + <br /> + $this->input->post('', FALSE); // returns all POST items without XSS +</code> + <h2>$this->input->get()</h2> <p>This function is identical to the post function, only it fetches get data:</p> <code>$this->input->get('some_data', TRUE);</code> +<p>To return an array of all GET items call without any parameters.</p> +<p>To return all GET items and pass them through the XSS filter leave the first parameter blank while setting the second parameter to boolean;</p> +<p>The function returns FALSE (boolean) if there are no items in the GET.</p> + +<code> + $this->input->get(); // returns all GET items with XSS filter + <br /> + $this->input->get('', FALSE); // returns all GET items without XSS filtering +</code> + <h2>$this->input->get_post()</h2> <p>This function will search through both the post and get streams for data, looking first in post, and then in get:</p> @@ -167,13 +187,14 @@ Array Method, and Discrete Parameters:</p> <p>Using this method, an associative array is passed to the first parameter:</p> <code>$cookie = array(<br /> - 'name' => 'The Cookie Name',<br /> - 'value' => 'The Value',<br /> - 'expire' => '86500',<br /> - 'domain' => '.some-domain.com',<br /> - 'path' => '/',<br /> - 'prefix' => 'myprefix_',<br /> - );<br /> + 'name' => 'The Cookie Name',<br /> + 'value' => 'The Value',<br /> + 'expire' => '86500',<br /> + 'domain' => '.some-domain.com',<br /> + 'path' => '/',<br /> + 'prefix' => 'myprefix_',<br /> + 'secure' => TRUE<br /> +);<br /> <br /> $this->input->set_cookie($cookie); </code> @@ -188,12 +209,13 @@ zero the cookie will only last as long as the browser is open.</p> <p>For site-wide cookies regardless of how your site is requested, add your URL to the <strong>domain</strong> starting with a period, like this: .your-domain.com</p> <p>The path is usually not needed since the function sets a root path.</p> <p>The prefix is only needed if you need to avoid name collisions with other identically named cookies for your server.</p> +<p>The secure boolean is only needed if you want to make it a secure cookie by setting it to TRUE.</p> <h4>Discrete Parameters</h4> <p>If you prefer, you can set the cookie by passing data using individual parameters:</p> -<code>$this->input->set_cookie($name, $value, $expire, $domain, $path, $prefix);</code> +<code>$this->input->set_cookie($name, $value, $expire, $domain, $path, $prefix, $secure);</code> <h2>$this->input->get_cookie()</h2> |