Exemple #1
0
 /**
  * nastavovani hodnoty cookie
  *
  * @throws ExceptionCore
  * @param string name jmeno klice cookie
  * @param string value hodnota pro dany klic
  * @param int time cas expirace
  * @param string path cesta pro cookie
  * @param string domain domena pro cookie
  * @param bool secure pouzivane v https rezimu
  * @param bool httpOnly posilani pouze v http hlavicce
  * @return void
  */
 public static function setCookie($name, $value, $time, $path = null, $domain = null, $secure = null, $httpOnly = null)
 {
     if (headers_sent($file, $line)) {
         throw new ExceptionCore('nelze odeslat hlavicky, via: ' . $file . ', ' . $line);
     }
     $cookiePath = '/';
     $cookieDomain = '';
     $cookieSecure = false;
     $cookieHttpOnly = true;
     setcookie($name, $value, $time ? DateAndTime::from($time)->format('U') : 0, is_null($path) ? $cookiePath : $path, is_null($domain) ? $cookieDomain : $domain, is_null($secure) ? $cookieSecure : $secure, is_null($httpOnly) ? $cookieHttpOnly : $httpOnly);
 }