session_destroy(); not working?

Permalink
I am creating a membership site with concrete5 and was able to create a log in script that sets session variables and that all works fine. I am now working on a php script to log people out of my site but it isn't working. My code is:

<?php
session_start();
$_SESSION = array();
if (isset($_COOKIE[session_name()])) {
    setcookie(session_name(), '', time()-42000, '/');
}
session_destroy();
if (isset($_SESSION['memberid'])) {
echo "Unable to Log Out";
} 
else {header ("Location:../index.php"); }
?>


After I run that scripts it goes back to the home page like it's supposed to but it still shows that I'm logged in. Any help would be greatly appreciated. Thanks.