Hai,
I wrote the code of a user registration script , everything working fine with out the log out page.... I used the header function to goto the another page when visitor hits "Logout" button. And now the problem is when press the 'Back" button of the browser then we can see the previous page with logged in.... Please help me how can cure it...

Thanks
Rajeesh

Recommended Answers

All 3 Replies

Clear cookie or session. If session or cookie is invalid, then redirect user to log-in page.

yes...in every page which are come after login ,in those pages you have to check for user sessions like

if(empty($_SESSION['username']))
 {
  header('location:index.php'); 
 }

...then in your logout page you just clear out your sessions or cookies...
like:

session_unregister('username');
session_destroy();

logout coding using php and mysql

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.