On Nov 26, 2007 12:45 AM, Chris <[EMAIL PROTECTED]> wrote:

> Ronald Wiplinger wrote:
> > If my user wants to logout, I want that the session will be destroyed
> > and that he must start with the first page again (index.php) and a new
> > session.
> >
> > Whatever I try he always gets the old sessions or he does not come to
> > the first page.
>
> What code do you have?
>


A very crude way to do this....

$_SESSION = array();

However, this will destroy EVERY variable within the session. This is bad if
you have multiple sites on one server. To organize your session variables,
you may try storing them as......

$_SESSION['aSiteName']['is_logged_in'],
$_SESSION['aSiteName']['var1'], $_SESSION['aSiteName']['var2'],
etc

To destroy all variables within this site ('aSiteName' being this example),
do...

$_SESSION['aSiteName'] = array();

OR

unset ($_SESSION['aSiteName']);

HTH
~Philip

Reply via email to