Last active
October 26, 2018 11:56
-
-
Save NirmalAriyathilake/042138e63bd7b81b2f156e8a2bae9ca8 to your computer and use it in GitHub Desktop.
Synchronizer Token Pattern - logout.php
This file contains 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(); | |
//remove PHPSESSID from browser | |
if ( isset( $_COOKIE[session_name()] ) ) | |
setcookie( session_name(), null, time()-3600, '/' ); | |
//clear session from globals | |
$_SESSION = array(); | |
//clear session from disk | |
session_destroy(); | |
$cookieName = "sessionCookie"; | |
if ( isset( $_COOKIE[$cookieName] ) ) | |
setcookie($cookieName, null, time()-3600, '/'); | |
?> | |
<html> | |
<body> | |
<script> | |
alert("You are Successfully Logged out!"); | |
window.location.href = "index.php"; | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment