|
session_get_cookie_params
Get the session cookie parameters
(PHP 4, PHP 5)
Code Examples / Notes » session_get_cookie_paramspowerlord
This function is quite handy when it comes to expiring session cookies... since Session cookies don't automatically get destroyed (see the session_destroy page). For instance, here's what I plan to use to expire session cookies: $CookieInfo = session_get_cookie_params(); if ( (empty($CookieInfo['domain'])) && (empty($CookieInfo['secure'])) ) { setcookie(session_name(), '', time()-3600, $CookieInfo['path']); } elseif (empty($CookieInfo['secure'])) { setcookie(session_name(), '', time()-3600, $CookieInfo['path'], $CookieInfo['domain']); } else { setcookie(session_name(), '', time()-3600, $CookieInfo['path'], $CookieInfo['domain'], $CookieInfo['secure']); } session_destroy(); It doesn't check to see if the path part of the session cookie is set because the defaults in php.ini have this set already, unlike domain and secure. |
Change Languagesession_cache_expire session_cache_limiter session_commit session_decode session_destroy session_encode session_get_cookie_params session_id session_is_registered session_module_name session_name session_regenerate_id session_register session_save_path session_set_cookie_params session_set_save_handler session_start session_unregister session_unset session_write_close |