In my php project when I clicked on logout, I am redirecting at home page, and if I click back button I am getting back in account page

StackOverflow https://stackoverflow.com/questions/23511224

  •  16-07-2023
  •  | 
  •  

문제

In my php project when I clicked on logout, I am redirecting at home page, and if I click back button I am getting back in account page, I dont wont to let anyone to come back in account once they clicked logout, which is the best way to do this?. please rply. Thnx

도움이 되었습니까?

해결책

Destroy the session:

session_unset();//Unset all session variables
session_destroy();

And maybe redirect users if they don't have a valid session. Add in your header something like

if(!isset($_SESSION['valid_user'])){
//Go to some other page
header("Location:$homepage");
}

다른 팁

unset($_SESSION['variable_name']);

or you can also destroy the session to logout.

session_destroy();
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top