Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Added the delete_cookie() function in order to help with the removal of ... #1120

Closed
wants to merge 7 commits into
from
View
@@ -226,6 +226,28 @@ public function cookie($index = '', $xss_clean = FALSE)
// ------------------------------------------------------------------------
/**
+ * Remove cookie
+ *
+ * Accepts the name of the cookie and expires it accordingly
+ *
+ * @param string the name of the cookie
+ * @return bool
+ */
+ public function delete_cookie($name = '')
+ {
+ // Check if the cookie exists, just a failsafe, one never knows.... :)
+ if ( ! empty($name) && $this->cookie($name))
+ {
+ $this->set_cookie($name, '', 0);
+ return TRUE;
+ }
+
+ return FALSE;
+ }
+
+ // ------------------------------------------------------------------------
+
+ /**
* Set cookie
*
* Accepts six parameter, or you can submit an associative