Jump to content

Killing Sessions (some not all)


xyn

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]
Link to comment
https://forums.phpfreaks.com/topic/21422-killing-sessions-some-not-all/
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]
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.

Archived

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

×
×
  • Create New...

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.