public function setCookie($name, $value, $expires = null, $path = null, $domain = null, $secure = false, $httponly = false) {

        if ($expires !== null) {
            setcookie($name, $value, time() + $expires, $path, $domain, $secure, $httponly);
        } else {
            setcookie($name, $value, 0, $path, $domain, $secure, $httponly);
        }
    }