From bcbfe55e24bdd8d8cd44aca9270b9fb68e3b8df5 Mon Sep 17 00:00:00 2001 From: SamBrishes Date: Tue, 16 Jun 2020 00:32:08 +0200 Subject: [PATCH] Allow to remove Session & Cookie Items Allow to remove Session & Cookie Items --- bl-kernel/helpers/cookie.class.php | 7 ++++++- bl-kernel/helpers/session.class.php | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/bl-kernel/helpers/cookie.class.php b/bl-kernel/helpers/cookie.class.php index 45b7ef42..00b139e8 100644 --- a/bl-kernel/helpers/cookie.class.php +++ b/bl-kernel/helpers/cookie.class.php @@ -20,10 +20,15 @@ class Cookie { $expire = time()+60*60*24*$daysToExpire; setcookie($key, $value, $expire); } + + public static function remove($key) + { + unset($_COOKIE[$key]); + setcookie($key, null, time()-3600); + } public static function isEmpty($key) { return empty($_COOKIE[$key]); } - } \ No newline at end of file diff --git a/bl-kernel/helpers/session.class.php b/bl-kernel/helpers/session.class.php index 1a0271d3..993c340e 100644 --- a/bl-kernel/helpers/session.class.php +++ b/bl-kernel/helpers/session.class.php @@ -73,4 +73,11 @@ class Session { } return false; } + + public static function remove($key) + { + $key = 's_'.$key; + + unset($_SESSION[$key]); + } }