summaryrefslogtreecommitdiff
path: root/localwebsite/functions.php
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2022-05-27 01:13:40 +0300
committerEvgeny Zinoviev <me@ch1p.io>2022-05-27 01:13:40 +0300
commitf1276e23d8ccf873c4c95f1e01db7f394e82c868 (patch)
treed2f64839262c24d46579ca55f60c4a6e275f5dda /localwebsite/functions.php
parentcf0b9f036b3e3eb218610e7eeececda1320d9f50 (diff)
change auth cookie and some related hls stuff
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