views:

192

answers:

1

I want to Zend_Auth and Zend_Session to save user sessions and logins information

whats the easy and best way for implements following items:

1-Disallow multiple concurrent logins for the specific user

2-List all of all user currently logged in 

3-Admin could logout of specific user or destroy specific session

Is there any special ZF or PHP API or library that can do the above?

thanks

+1  A: 

The easiest way is to use Zend_Session_SaveHandler_DbTable or create your custom session SaveHandler implementing Zend_Session_SaveHandler_Interface.

You may activate it in application.ini:

resources.session.saveHandler.class = "Zend_Session_SaveHandler_DbTable"
resources.session.saveHandler.options.name = "session"
resources.session.saveHandler.options.primary.session_id = "session_id"
resources.session.saveHandler.options.primary.save_path = "save_path"
resources.session.saveHandler.options.primary.name = "name"
resources.session.saveHandler.options.primaryAssignment.sessionId = "sessionId"
resources.session.saveHandler.options.primaryAssignment.sessionSavePath = "sessionSavePath"
resources.session.saveHandler.options.primaryAssignment.sessionName = "sessionName"
resources.session.saveHandler.options.modifiedColumn = "modified"
resources.session.saveHandler.options.dataColumn = "session_data"
resources.session.saveHandler.options.lifetimeColumn = "lifetime"

See Session Application resource docs for more info.

takeshin