You are here

function _drupal_session_delete_cookie in Drupal 7

Deletes the session cookie.

Parameters

$name: Name of session cookie to delete.

boolean $secure: Force the secure value of the cookie.

1 call to _drupal_session_delete_cookie()
_drupal_session_destroy in includes/session.inc
Session handler assigned by session_set_save_handler().

File

includes/session.inc, line 519
User session handling functions.

Code

function _drupal_session_delete_cookie($name, $secure = NULL) {
  global $is_https;
  if (isset($_COOKIE[$name]) || !$is_https && $secure === TRUE) {
    $params = session_get_cookie_params();
    if ($secure !== NULL) {
      $params['secure'] = $secure;
    }
    $options = array(
      'expires' => REQUEST_TIME - 3600,
      'path' => $params['path'],
      'domain' => $params['domain'],
      'secure' => $params['secure'],
      'httponly' => $params['httponly'],
    );
    drupal_setcookie($name, '', $options);
    unset($_COOKIE[$name]);
  }
}