Hi
I want to clear back button history in browser after log out in php
Thanks in advance
I don't think that's possible. I'd be furious if a website could take control of my browser and delete stuff.
It won't be possible in PHP anyway, because it runs on the server, and not in the browser.
What is your specific problem? sessions not clearing data on logout?
In the logout script, use unset(name_of_session_variable) to invalidate session. Plus, in all pages, before displaying the output, use an if condition and check if the session variable exists.
Example: in logout script,
unset ( $_SESSION ['name'] );
In all other pages,
if(isset($_SESSION['name']))
{
//display data
echo "success";
}
else
{
//redirect to homepage/index page
header('Location: /index.php');
}
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.