Jump to content


Photo

Destroying a session started by someone else


  • Please log in to reply
1 reply to this topic

#1 Gast

Gast
  • Members
  • PipPipPip
  • Advanced Member
  • 131 posts
  • LocationSouth East England

Posted 27 July 2006 - 03:32 PM

I want to be able to destroy a session from another user, i.e. An administrator can log other users out. Is it possible to use the session ID to do this as i have this stored?
OS and Internet Specs:
Windows XP (with SP2), 1680x1050, PHP 4, MySQL 3, Internet Explorer 6 &7 /FireFox 2.0/Opera 9.2

Tutorials:
Simple Introduction to AJAX and XMLHttpRequest
Creating Live Data with AJAX Making a Google Suggest like application

#2 bltesar

bltesar
  • Members
  • PipPipPip
  • Advanced Member
  • 109 posts

Posted 27 July 2006 - 03:50 PM

The following code should do it:


//end any open sessions
session_write_close();

//start session to be destroyed
session_id($id_of_session_to_destroy);
session_start();

//dstroy the session
$_SESSION=array();
session_destroy();







0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users