Jump to content

Archived

This topic is now archived and is closed to further replies.

xyn

Killing Sessions (some not all)

Recommended Posts

Hey Guys.
I basically need some help in deleting 3 sessions.
I dont want to kill ALL sessions because the Members
will be logged out of the area and every other session
used will be killed.

my sessions are...
[code=php:0]$_SESSION['FieldDept']
$_SESSION['FieldName']
$_SESSION['FieldMail'][/code]

Share this post


Link to post
Share on other sites
Use unset, eg
[code=php:0]unset($_SESSION['var_name']);[/code]


If you wnat to delete the session data for fieldDept, fieldName, fieldMail then you can do this:
[code=php:0]unset($_SESSION['FieldDept'], $_SESSION['FieldName'], $_SESSION['FieldMail']);[/code]

Share this post


Link to post
Share on other sites
To unset all session variables you can use [url=http://php.net/session_unset]session_unset()[/url].

Share this post


Link to post
Share on other sites
It doesn't kill all sessions for all user's sessions are user specific.

If user a logs in, and it registers a bunch of sessions, and 4 other people login 2, and oen logs out, and it takes them to 1 page that has nothing but
[code]<?php
session_destroy();
header("Location: index.php");
?>[/code]
The session file associated with that one user is erased, all the others are left alone.

Share this post


Link to post
Share on other sites
Umm, xyn wnated to delete a couple of session variables. Not a whole session.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.