Im having trouble ending sessions for some reason :|

Heres my code. Can anyone see what the problem is?

<?php
include('includes/config.php');
unset($_SESSION['isLogged']);
session_destroy();
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
   "http://www.w3.org/TR/html4/strict.dtd">
<html>
   <head>
      
   </HEAD>
   <BODY>
<?php
echo '<div class="nav">'.$navigation.'</div>';
?>
You have been logged out. 
</body>
</html>

Try the following to destroy the session:

<?php
session_start()
include('includes/config.php');
$_SESSION = array();
if (isset($_COOKIE[session_name()])) {
    setcookie(session_name(), '', time()-42000, '/');
}
session_destroy();
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
   "http://www.w3.org/TR/html4/strict.dtd">
<html>
   <head>
      
   </HEAD>
   <BODY>
<?php
echo '<div class="nav">'.$navigation.'</div>';
?>
You have been logged out. 
</body>
</html>

Thanks for that. I didnt know you had to use sesssion_start() when ending a session.

This question has already been answered. Start a new discussion instead.