• Forum
  • Doc
  • Screenshots
  • Download
  • Donate
  • Contributors
  • Contact
  • Follow @phpfreechat
  • DEMO
  • Board index ‹ Version 1.x branch ‹ phpBB, Simple Machines Forum (SMF), and Forum Software (v1.x)
  • Change font size
  • FAQ
  • Register
  • Login

Need an interface to \"logout\" a user from chat

Moderators: OldWolf, re*s.t.a.r.s.*2

Post a reply
3 posts • Page 1 of 1

Postby jimmo » Wed Aug 18, 2010 4:20 pm

Hi folks...

I have a site with phpbb3 and pfc. I've integrated the login process for user accounts successfully, so that chat is only available to logged in users and their nickname is automatically set to their forum user name. This is easy because I can interrogate the phpbb session to verify the user has logged in and to determine their forum user name...its just a matter of setting the chat $nick to the user name, or denying access if they're not logged in. Cool!

However, I have a problem with integrating the logout functionality. If a user logs out of the forum without first issuing a "/quit" from chat, their chat presence remains. For example, imagine I have two PC's and I'm logged in and chatting on one. I logout of the forum and move to another PC and login but cannot connect to chat because my nickname is still in use (it's still in a stale chat session because the forum logout on the first PC didn't log me out of chat). Eventually a regular user will time out but - gasp! - if you were logged in as an admin user, it won't time out and you're boned. :)

I'm trying to figure out how to interface with pfc from the logout function of the forum but I can't find any clean way to do this. The current PFC architecture provides no form of "logout(username)" interface. Worse still, it seems that one has to either construct an entire client-side pfc context to fake up a call to pfc.sendRequest("/quit") which is really clumsy and cumbersome, or somehow write some gnarly code pulling in src/*cla

I guess an alternative approach could be throwing some code together to clean up the nickid-to-metadata etc. information in the backend container to achieve the same net effect. I'm experimenting with this now.

Has anyone successfully integrated logout functionality?

Cheers!
jimmo
Member
 
Posts: 23
Joined: Wed Aug 18, 2010 3:51 pm
Top

Postby jimmo » Wed Aug 18, 2010 6:51 pm

Update: the following seems to work for me (mysql container)...

Get the unique nickid for the user name:

SELECT `leafvalue` from yourtable where `group`='metadata-to-nickid' AND `leaf`='username'

The result row will contain the nickid. Then blow away all table entries referencing that unique nickid...

DELETE from yourtable WHERE `subgroup`='nickid' OR `leafvalue`='nickid' OR `leaf`='nickid';

It's ugly but seems to work and it was easy enough to include the PHP equivalent of the above in the logout handling within PHPbb3's ucp.php

Note that I know something is still missing because when you login again after this method, it doesn't "notice" that you've joined the channel. You just reappear and can continue chatting. Also, if you create a channel - your channel will be restored when you log back in again on the same machine (but not on another machine).

I'm guessing there's some client-side state caching going on somewhere - I need to do a whole lot more grubbing around. Still, its progress!

Edit: D'oh! I forgot the session_destroy(). That's why there is that state caching!
Last edited by jimmo on Thu Aug 19, 2010 7:27 am, edited 1 time in total.
jimmo
Member
 
Posts: 23
Joined: Wed Aug 18, 2010 3:51 pm
Top

Postby ozled » Thu Jan 12, 2012 3:30 pm

I solved a similar problem by creating a logout.php script that destroys the session created by the chat.
The site logout process redirects to such script as the last thing to be done.
ozled
New member
 
Posts: 7
Joined: Sat Dec 10, 2011 6:14 pm
Top


Post a reply
3 posts • Page 1 of 1

Return to phpBB, Simple Machines Forum (SMF), and Forum Software (v1.x)

Who is online

Users browsing this forum: No registered users and 2 guests

  • Board index
  • The team • Delete all board cookies • All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
cron
Sign in
Wrong credentials
Sign up I forgot my password
.
jeu-gratuit.net | more partners
Fork me on GitHub