summaryrefslogtreecommitdiff
path: root/localwebsite/functions.php
diff options
context:
space:
mode:
Diffstat (limited to 'localwebsite/functions.php')
-rw-r--r--localwebsite/functions.php15
1 files changed, 15 insertions, 0 deletions
diff --git a/localwebsite/functions.php b/localwebsite/functions.php
index 4757765..4693fc5 100644
--- a/localwebsite/functions.php
+++ b/localwebsite/functions.php
@@ -282,4 +282,19 @@ function from_camel_case(string $s): string {
}
}
return $buf;
+}
+
+function unsetcookie(string $name) {
+ global $config;
+ setcookie($name, null, -1, '/', $config['auth_cookie_host']);
+}
+
+function setcookie_safe(...$args) {
+ global $config;
+ if (!headers_sent()) {
+ if (count($args) == 2)
+ setcookie($args[0], $args[1], time()+86400+365, '/', $config['auth_cookie_host']);
+ else
+ setcookie(...$args);
+ }
} \ No newline at end of file