Free Script for Clearing Session / Logout
With this free PHP script, you can either pass an array of session variable names to delete, or pass "true" to remove all session variables set. This is great for a logout page.
<?php
function clearSession($NamesArray) {
if($NamesArray == true){
foreach ($_SESSION as $key => $value){
unset($_SESSION[$key]);
}
}
else{
foreach($NamesArray as $value){
unset($_SESSION[$value]);
}
}
}
?>