Hello,
I'm attempting to integrate phpFreeChat with an existing authentication system and while at first glance it appears pretty simple to do, there are a few quirks that pop up that I was wondering if there are suggested fixes for. What I want to be able to do is have phpFreeChat fully trust the nickname that I give it, not allow the user to change the nickname, and to always accept the nickname I give it even if it is already in use (it would be fine if the older session is terminated in that case). I get most of the way to this goal by setting the "nick" parameter to the user's nickname and setting "frozen_nick" to true so that the nickname cannot be changed.
The first problem arises when the user logs out of my system and then logs back in under a different name. The first nickname is still used in this case even though I am setting the "nick" parameter to something new. I know this was discussed at http://www.phpfreechat.net/forum/viewtopic.php?id=139 So I took the advice there and removed the "phpfreechat" cookie, but this caused updates to no longer work. I figured this was probably because the AJAX queries need the cookie, so I modified the "server_script_url" parameter to use a different URL where the cookie isn't deleted. That seemed to fix things.
However, now there is a new problem. If the user closes the page with the chat window on it and then comes back shortly thereafter, he is prompted repeatedly to enter his nickname. The nickname that my login system is giving the user via the "nick" parameter isn't accepted. I assume that the problem is that the server thinks that the given nickname is still logged in because the previous session hasn't timed out yet. I'd like to be able to force it to accept the nickname even though there is a conflict and either timeout or ignore the older session at that point.
Is there a way to programmatically log out a nickname on the server? I think that should fix the problem that I'm having. Also, is there a way to programmatically delete a session on the server? I'd prefer that to the cookie deletion hack since the server environment is much better controlled.
Thanks for making phpFreeChat, by the way. It's a very nice product.
- Tim Macinta