Created
January 25, 2018 16:37
-
-
Save flourigh/79e7a6f527b2bcd0d552d8a94cba0888 to your computer and use it in GitHub Desktop.
The best logout page for real security for your user.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php session_start(); | |
$siteprot = $_SERVER['REQUEST_SCHEME'] . '://'; | |
$sitehost = $_SERVER['HTTP_HOST']; | |
$siteuri = $_SERVER['REQUEST_URI']; | |
if(!$_COOKIE['SITEINDEX']) { | |
setcookie('SITEINDEX', max(explode('/', dirname($_SERVER['PHP_SELF'])))); | |
$siteindex = '/' . max(explode('/', dirname($_SERVER['PHP_SELF']))) . '/'; | |
} else { | |
$siteindex = '/' . $_COOKIE['SITEINDEX'] . '/'; } | |
$siteurl = $siteprot . $sitehost . $siteindex; ?> | |
<?php $_SESSION = array(); | |
if($_COOKIE[session_name()]) { | |
setcookie(session_name(), '', time()-42000, '/'); } | |
foreach($_SESSION as $unset_session => $unset_value) { | |
$_SESSION[$unset_session] = $unset_value; } | |
foreach($_COOKIE as $unset_cookie => $unset_value) { | |
setcookie($unset_cookie, $unset_value, time()-42000, '/'); } | |
session_destroy(); | |
header('Location: ' . $siteurl); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment