Kill All Active Sessions

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

TheMoose wrote:
Everah wrote:

Code: Select all

<?php
$sql = "DELETE FROM `sessions` WHERE `session_id` = '$session_id' AND `user_id` = $user_id";
?>
[nitpick]
You wouldn't know the session id, so you would only be able to delete the session based off the user id
[/nitpick]

;)
If you write a management module that tells you the session id (and other user information) then you can easily delete that session from the management console. ;)
User avatar
TheMoose
Forum Contributor
Posts: 351
Joined: Tue May 23, 2006 10:42 am

Post by TheMoose »

Everah wrote:
TheMoose wrote:
Everah wrote:

Code: Select all

<?php
$sql = "DELETE FROM `sessions` WHERE `session_id` = '$session_id' AND `user_id` = $user_id";
?>
[nitpick]
You wouldn't know the session id, so you would only be able to delete the session based off the user id
[/nitpick]

;)
If you write a management module that tells you the session id (and other user information) then you can easily delete that session from the management console. ;)
I suppose it could. :teach:
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

ole wrote:Why do you say that is dangerous?
Well, for one, you would be blindly unlinking files in a directory which may be shared with other instances of PHP that are not yours to manipulate. Two, you were never meant to touch those files directly.
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post by Ollie Saunders »

OK yeah. For some reason I thought you meant it was dangerous from a security standpoint.
Post Reply