Skip to content

Instantly share code, notes, and snippets.

@derekaug
Created September 19, 2014 17:03
Show Gist options
  • Save derekaug/2982efd334af016f0f94 to your computer and use it in GitHub Desktop.
Save derekaug/2982efd334af016f0f94 to your computer and use it in GitHub Desktop.
Ends all active sessions on a site if using default PHP session handler.
<?php
$path = session_save_path();
if ($handle = opendir($path)) {
while (false !== ($entry = readdir($handle))) {
if('sess' == substr($entry, 0, 4)){
$file = $path . '/' . $entry;
unlink($file);
}
}
closedir($handle);
}
exit();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment