0

I'm writing an app using Zend Framework and I need to be able to logout users on demand. The app will receive a request containing some kind of ID's that are mapped to SessionIds and it will end/expire those sessions. I know how to do the mapping, but what then? How do I end a session having its ID?

I see that there is Zend_Session::setId(), but I don't think this does what I want to do.

I have an idea to just delete files that are associated with given session, since they are named sess_[sessionId], but I guess that is an ugly way to do it.

Maciek
  • 3,174
  • 1
  • 22
  • 26

2 Answers2

2

You can save session info to the database. It would be related by session id. Then create a plugin that checks if the DB row still exists. If not, then execute Zend_Auth::getInstance()->clearIdentity()

The method that logs the user out would delete the session from DB.

Paul Hiemstra
  • 59,984
  • 12
  • 142
  • 149
hopsey
  • 1,383
  • 1
  • 13
  • 23
0

Depending on the structure of your sessions and what exactly you are trying to clear, there are a number of ways to destroy, expire and unset Zend_Sessions. Please refer to http://framework.zend.com/manual/1.12/en/zend.session.html for further information.

If in the future you could provide more detail and perhaps a bit of code illustrating your issue I'm sure the community would be more then happy to provide a better answer.

Good Luck.

RockyFord
  • 8,529
  • 1
  • 15
  • 21