Hi all
I've a logout button that runs a function to destroy the session and then return to the same page. The location of the logout function within the script means that on the button click the user doesn't return to login prompt as I'd like. A page reload at this point instantly deals with it. I'd rather not rework the flow of the script because this is the last thing I'm doing on the page. How do I force the browser to reload the page from within the logout function?
Thanks, Steve
end session and reload page from within logout function?
Moderator: General Moderators
-
dark_religion
- Forum Newbie
- Posts: 3
- Joined: Sat Dec 06, 2008 3:00 am
Re: end session and reload page from within logout function?
did you try header("Location: http://domain/login.php") ?
Re: end session and reload page from within logout function?
OK I've solved the problem but I don't understand how. I did it by calling the seller_logout function from within itself which has a similar effect to refreshing the page - [insert mixed emotions smiley here]. Can someone explain why this works? Thanks
Code: Select all
<?php
function seller_logout()
{
unset($_SESSION['valid_user']);
session_destroy();
seller_logout ();
}
?>Re: end session and reload page from within logout function?
ps thanks for your reply dark_religion. I mucked around for a while trying to figure out where I was supposed to put it in the function with no success. If I hadn't found the weird workaround above, where would it go?
Thanks, Steve
Thanks, Steve