You should be checking if a session variable exists to grant access to users. To log out from your site, simply destroy the session, this will prevent access effectively ‘logging’ the user out:
session_start()
session_destroy(); //destroy sessions but session data will still be avail on same page so redirect is needed after this
header('location:index.php'); // redirect to login or index page or logout success page
exit;
OR
session_start();
unset($_SESSION); //will destroy session superglobal on current and subsequent pages
echo $_SESSION['adminuser']; //will echo nothing at this point
header('location:index.php'); // redirect to login or index page or logout success page if you want
exit;
6
solved Log out from site [closed]