proxitok/app/Helpers/Cookies.php
2022-02-20 16:25:15 +01:00

22 lines
566 B
PHP

<?php
namespace App\Helpers;
class Cookies {
const PROXY = ['host', 'port', 'user', 'password'];
static public function get(string $name): ?string {
if (isset($_COOKIE[$name]) && !empty($_COOKIE[$name])) {
return $_COOKIE[$name];
}
return null;
}
static public function exists(string $name): bool {
return isset($_COOKIE[$name]);
}
static public function set(string $name, string $value) {
setcookie($name, $value, time()+60*60*24*30, '/', '', isset($_SERVER['HTTPS']), true);
}
};