Is it possible to find a particular Session

Discussion in 'PHP' started by sagsai, Dec 13, 2007.

  1. #1
    Hello, please don't laugh at my naive question. I desperately need to know whether it is possible to fetch/find a particular session(associated with a particular logged-in user) from all the session that the server generates(for all those users who are logged-in) at a particular point of time using the session ID or any other means & perform operations on that session like unset/destroy the session.
     
    sagsai, Dec 13, 2007 IP
  2. l3vi

    l3vi Peon

    Messages:
    375
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    0
    #2
    yes. If you set a session you should be able to get it within the session life. Thats a bit of 101 sessions to check login or whatnot.. Its been awhile, but if you want to go fancy you can dig around shell and dig up all the life sessions in a que, but hell if I remember how to do that.
     
    l3vi, Dec 13, 2007 IP
  3. tonybogs

    tonybogs Peon

    Messages:
    462
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #3
    You can follow these steps:

    - Create a phpinfo() file to display all of your php settings
    - Go down to the session area and look at session.save_path , this is the directory your session variables are saved in. It will show all of you session variables
    - Change to the directory using 'cd' on the command line
    - Try something like this: ls *<sessionid>* . THis will list the session file associated with the session id you have
    - Then: cat <filename> . THis will list the contents of that session

    Hope this helps :)
     
    tonybogs, Dec 13, 2007 IP
  4. sagsai

    sagsai Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thank you for your replies. I have tried the process of deleting the session files. But refreshing the page recreates the session file immediately. Actually I need catch some active sessions using their session IDs & destroy them from outside(some users would be logged in using those sessions already, they needed to be forcibly logged out depending on some criteria).
    Actually I have solved the problem by saving the session related data in a table but wanted to know if there is any way around.
     
    sagsai, Dec 14, 2007 IP