I am using sessions for the program.
I am starting the session in bootstrap which is straight after the index.php
the session name is changed before starting session in bootstrap ... getting to the question after slight more info.
I wanted to know how to delete session cookie.
when someone logs in a session is created with specific name
when they logout I use this code to log the user out
Expand|Select|Wrap|Line Numbers
- class LogoutController
- {
- public static function logout()
- {
- // Unset all of the session variables.
- $_SESSION = array();
- // If it's desired to kill the session, also delete the session cookie.
- // Note: This will destroy the session, and not just the session data!
- if (ini_get("session.use_cookies"))
- {
- $params = session_get_cookie_params();
- setcookie( session_name(), '', time() - 42000, $params["path"], $params["domain"], $params["secure"], $params["httponly"]
- );
- }
- // Finally, destroy the session.
- session_destroy();
- header("location:login.php");
- }
- }
- ?>
i dont know if I'm taking the right steps.
please help pplz