setCookie() public method

Sends a cookie.
public setCookie ( $name, $value, $expire, $path = NULL, $domain = NULL, $secure = NULL, $httpOnly = NULL ) : void
return void
Ejemplo n.º 1
0
 /**
  * Sends the session cookies.
  * @return void
  */
 private function sendCookie()
 {
     if (!headers_sent() && ob_get_level() && ob_get_length()) {
         trigger_error('Possible problem: you are starting session while already having some data in output buffer. This may not work if the outputted data grows. Try starting the session earlier.', E_USER_NOTICE);
     }
     $cookie = $this->getCookieParameters();
     $this->response->setCookie(session_name(), session_id(), $cookie['lifetime'] ? $cookie['lifetime'] + time() : 0, $cookie['path'], $cookie['domain'], $cookie['secure'], $cookie['httponly'])->setCookie('nette-browser', $_SESSION['__NF']['B'], Response::BROWSER, $cookie['path'], $cookie['domain']);
 }
Ejemplo n.º 2
0
 /**
  * Gets the cookie
  *
  * @param string $cookieValue
  */
 protected function createCookie($cookieValue)
 {
     $currentDate = new \DateTime('+1 month');
     // Create cookie object
     $cookie = new Cookie(self::COOKIE_KEY, $cookieValue, $currentDate->format('Y-m-d'));
     // Store cookie in response
     $this->httpResponse->setCookie($cookie->getName(), $cookie->getValue(), $cookie->getExpiresTime(), $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), $cookie->isHttpOnly());
 }
Ejemplo n.º 3
0
	/**
	 * Sends the session cookies.
	 * @return void
	 */
	private function sendCookie()
	{
		$cookie = $this->getCookieParams();
		$this->response->setCookie(
			session_name(), session_id(),
			$cookie['lifetime'] ? $cookie['lifetime'] + time() : 0,
			$cookie['path'], $cookie['domain'], $cookie['secure'], $cookie['httponly']

		)->setCookie(
			'nette-browser', $_SESSION['__NF']['B'],
			Response::BROWSER, $cookie['path'], $cookie['domain']
		);
	}
Ejemplo n.º 4
0
 /**
  * Sends the session cookies.
  * @return void
  */
 private function sendCookie()
 {
     $cookie = $this->getCookieParameters();
     $this->response->setCookie(session_name(), session_id(), $cookie['lifetime'] ? $cookie['lifetime'] + time() : 0, $cookie['path'], $cookie['domain'], $cookie['secure'], $cookie['httponly']);
 }