When I'm trying logout with: session_destroy(); then it worked. But the problem is, I have also a shopping cart with sessions. So session_destroy(); isn't a option for me. When I'm using the unset($_SESSION['username']); function it seems working. But when I go back to my accountpage, I'm just back logged in. My logout script looks like this:
<?php
unset($_SESSION['username']);
unset($_SESSION['id']);
header('Location: index?page=home');
?>
I checked with this piece of code of a user is logged in. (Can somebody tell me also or this is safe?)
<?php if (!$_SESSION['username'] && !$_SESSION['id']){ ?>
<?php header ('Location: index?page=home'); ?>
<?php } ?>
This is the info that you need (I think). If you need more, please ask me.
So, my question in the short version: How can I destroy my session without destroying my shopping cart session?
Thanks guys.