(4 * 1024)) { trigger_error( "The cookie {$name} exceeds the specification for the maximum cookie size. Some data may be lost", E_USER_WARNING ); } } // Force value into superglobal if ($force) { $_COOKIE[$name] = $value; } // Set the cookie return setcookie($name, $value, (($expire) ? (time() + (int) $expire) : self::$expire), ($path) ? $path : self::$path, ($domain) ? $domain : self::$domain, ($secure) ? $secure : self::$secure, ($httponly) ? $httponly : self::$httponly); } // Check if the cookie exists public static function exists($name) { return isset($_COOKIE[$name]); } // Get a cookie value public static function get($name) { return (isset($_COOKIE[$name])) ? unserialize(base64_decode($_COOKIE[$name])) : NULL; } // Remove a cookie public static function remove($name, $force = false) { // Check if the cookie isset if (isset($_COOKIE[$name])) { // Remove from superglobal if ($force) { unset($_COOKIE[$name]); } // Remove the cookie return setcookie($name, '', time() - (3600 * 25), self::$path, self::$domain, self::$secure, self::$httponly); } } } Cookie::init(); ?>