summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
authorPhil Sturgeon <email@philsturgeon.co.uk>2011-02-16 18:23:16 +0100
committerPhil Sturgeon <email@philsturgeon.co.uk>2011-02-16 18:23:16 +0100
commitd8d1e24eee56d2466c91ecd72b3c8932eb3d0639 (patch)
treef9a78a5640393b74851eef4d1465e2ccbcc3bd37 /system
parentf2b9c911bcee47166f3fdc8f2f57d1cafeade006 (diff)
Secure cookies can now be made with the set_cookie() helper and Input Class method.
Diffstat (limited to 'system')
-rw-r--r--system/core/Input.php7
-rw-r--r--system/helpers/cookie_helper.php4
2 files changed, 6 insertions, 5 deletions
diff --git a/system/core/Input.php b/system/core/Input.php
index 16b295546..3957aa63d 100644
--- a/system/core/Input.php
+++ b/system/core/Input.php
@@ -208,13 +208,14 @@ class CI_Input {
* @param string the cookie domain. Usually: .yourdomain.com
* @param string the cookie path
* @param string the cookie prefix
+ * @param bool true makes the cookie secure
* @return void
*/
- function set_cookie($name = '', $value = '', $expire = '', $domain = '', $path = '/', $prefix = '')
+ function set_cookie($name = '', $value = '', $expire = '', $domain = '', $path = '/', $prefix = '', $secure = FALSE)
{
if (is_array($name))
{
- foreach (array('value', 'expire', 'domain', 'path', 'prefix', 'name') as $item)
+ foreach (array('value', 'expire', 'domain', 'path', 'prefix', 'name', 'secure') as $item)
{
if (isset($name[$item]))
{
@@ -245,7 +246,7 @@ class CI_Input {
$expire = ($expire > 0) ? time() + $expire : 0;
}
- setcookie($prefix.$name, $value, $expire, $path, $domain, 0);
+ setcookie($prefix.$name, $value, $expire, $path, $domain, $secure);
}
// --------------------------------------------------------------------
diff --git a/system/helpers/cookie_helper.php b/system/helpers/cookie_helper.php
index 7701d503f..7cee02827 100644
--- a/system/helpers/cookie_helper.php
+++ b/system/helpers/cookie_helper.php
@@ -44,11 +44,11 @@
*/
if ( ! function_exists('set_cookie'))
{
- function set_cookie($name = '', $value = '', $expire = '', $domain = '', $path = '/', $prefix = '')
+ function set_cookie($name = '', $value = '', $expire = '', $domain = '', $path = '/', $prefix = '', $secure = FALSE)
{
// Set the config file options
$CI =& get_instance();
- $CI->input->set_cookie($name, $value, $expire, $domain, $path, $prefix);
+ $CI->input->set_cookie($name, $value, $expire, $domain, $path, $prefix, $secure);
}
}