Simple Machines Community Forum

Customizing SMF => Bridges and Integrations => Topic started by: ahto on March 18, 2009, 06:33:59 AM

Title: Using SMF sessions in python
Post by: ahto on March 18, 2009, 06:33:59 AM
Hi,

I would like to use smf's sessions in python so that people that are logged in smf are also logged in my python scripts.
In python I need to get the correct ID_MEMBER with sessions timeouts handled correctly.

Currently I fetch the session from db using cookie PHPSESSID's value, unserialize the data column and fetch the id from ban[ID_MEMBER].

But this really isn't as robust as i would need it to be.
For example when I logout from the forum, python doesn't see this change.

What is the process of doing this the right way?
Title: Re: Using SMF sessions in python
Post by: Orstio on March 18, 2009, 02:28:00 PM
Use SMF's integration hooks, and call python code from them.
Title: Re: Using SMF sessions in python
Post by: ahto on March 20, 2009, 04:08:51 AM
So there is now way to do this just inside of mysql?
Title: Re: Using SMF sessions in python
Post by: 青山 素子 on March 21, 2009, 03:02:39 AM
If you use database-driven sessions in SMF, you could look at the sessions table and see if the user still has a valid session, I suppose.