I have this program created in PHP using MVC pattern.
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
when the user is relocated to the login.php page and the user logs in it creates another session cookie with the same name. I know this because I checked this on Mozilla firefox's cookie browser.
i dont know if I'm taking the right steps.
please help pplz
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
Code:
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
Comment