Jump to content


Photo

Killing Sessions (some not all)


  • Please log in to reply
5 replies to this topic

#1 xyn

xyn
  • Members
  • PipPipPip
  • Advanced Member
  • 779 posts
  • LocationNorthampton

Posted 20 September 2006 - 03:10 PM

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...
$_SESSION['FieldDept']
$_SESSION['FieldName']
$_SESSION['FieldMail']


#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 20 September 2006 - 03:15 PM

Use unset, eg
unset($_SESSION['var_name']);


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


#3 xyn

xyn
  • Members
  • PipPipPip
  • Advanced Member
  • 779 posts
  • LocationNorthampton

Posted 20 September 2006 - 03:17 PM

thx :]

#4 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 20 September 2006 - 03:34 PM

To unset all session variables you can use session_unset().

#5 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 20 September 2006 - 03:56 PM

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
<?php
session_destroy();
header("Location: index.php");
?>
The session file associated with that one user is erased, all the others are left alone.

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#6 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 20 September 2006 - 04:04 PM

Umm, xyn wnated to delete a couple of session variables. Not a whole session.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users