EmperorJazzy Posted March 31, 2011 Share Posted March 31, 2011 Afternoon all, Quick query; On the index.php page I have a hyperlink entitled LOGOUT. This allows the users to log out of their current session. The hyperlink directs to a logout.php page with the following contents: <?php session_end(); ?> <html> <head></head> <body> <?php header('Location: index.php'); ?> </body> </html> Essentially; the code should end the session and redirect the browser back to the main page. Currently, the hyperlink does redirect to the logout.php page, but; - it doesn't return to the index.php page - if I click the back button, the session is still alive Can anyone assist? Is there a better way of doing this? This isn't something that hasn't been done before, but finding the topic in the forums has been difficult. Thanks in advance. Quote Link to comment Share on other sites More sharing options...
btherl Posted March 31, 2011 Share Posted March 31, 2011 This manual page has sample code for finishing a session: http://php.net/manual/en/function.session-destroy.php Quote Link to comment Share on other sites More sharing options...
EmperorJazzy Posted March 31, 2011 Author Share Posted March 31, 2011 Thanks for viewing. Solution found via a post in the forum at the same time as myself. Cheers all. Quote Link to comment Share on other sites More sharing options...
INeedAGig Posted March 31, 2011 Share Posted March 31, 2011 What are you using to write your code? I just solved the same issue in one of my scripts. It was caused by a BOM (Byte Order Mark) which is an invisible line of code before the initial <?php. PHP will know it's there and process it, which will cause header errors. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.