Website integrated with SMF via API. How do I logout nicely?

Started by Nic_G, January 21, 2016, 05:40:11 AM

Previous topic - Next topic

Nic_G

I have now integrated SMF with my own login/registration system. SMF members are created automatically in my system and logged in automatically too. I have also disabled the SMF login and register buttons and displayed a message to the user telling them to login via the main website login system.

Now I am kind of stuck with the logout thing? How should I do it nicely?

What I want to do is this:
1) If the user logouts of the main website, he is logged out automatically of forum. That's the easy bit, I will just call smf_logout().
2) If the user logouts from the forum however, then right now it logs me out from the main site (because they share the same session id) and I don't want that at all. It could have bad consequences. It must be avoided at all costs.
You will certainly recommend me to hide the SMF logout button and I am sure this is doable, but then the user can't logout from the forum directly in case the main website window has been closed and its session expired. His only solution would be login again to the main website and logout again. That's really aukward.
The only solution I see now: display a message on forum logout telling the user to logout from the main website (and I think he will understand that he needs to login first if needed). But again that's aukward.

Is it necessary for the forum and the main website to share the same session id? Can't they be separate?


PS: I set the forum session to 24 hours while my main website session is much shorter (2 hours I think).



Nic_G

The more I think of it, the more I think that I need to understand how SMF sessions work. But I can't find anything relevant on this forum.

I read somewhere on this forum "don't use session_start()! SMF manages session itself".

Well I need session_start() for my own website...

There is something missing in my reasoning. What is it?

Advertisement: