• Forum
  • Doc
  • Screenshots
  • Download
  • Donate
  • Contributors
  • Contact
  • Follow @phpfreechat
  • DEMO
  • Board index ‹ Version 1.x branch ‹ General Support (v1.x)
  • Change font size
  • FAQ
  • Register
  • Login

Connecting fails when nick\'s are frozen

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

Post a reply
19 posts • Page 1 of 2 • 1, 2

Postby skl99999 » Sat Mar 31, 2012 7:13 am

Hello,

I am pretty much a newbie here, so chances are I did something wrong and this is not a bug, but I did check all the documents and google the error message, to no avail.

The issue is that with frozen_nick = true I can not seem to connect more than one user, because the second user seems to first be connected under the nick of the first, and changing it fails. The debug log for this process is

Code: Select all
handleResponse: nick-notallowed-MrBlue
handleResponse: connect-ko-MrGreen
handleResponse: nick-notallowed-MrBlue
sendRequest: /connect "MrGreen"

and the error message is
Code: Select all
Chosen nickname is not allowed

I want to connect as MrGreen in this instance (from Safari), and MrBlue has been connected before (from Firefox). Cookies and caches have been cleared. In my testing environment (here the bare minimum page that produces the error) I am simulating dynamically generated pages by having two slightly different version of the same page on the server.
http://www.iqcicle.com/chat/chat_green.php (requested by FireFox on a Mac)
Code: Select all
<?php
 
require_once "../phpFreeChat/src/phpfreechat.class.php"; // adjust to your own path
$params["serverid"]       = "Chat07";  // unique id for this chat
$params["isadmin"]        = true;      // for testing purposes, everyone is admin

$params["nick"]           = "MrGreen";  // setup the intitial nickname
$params["frozen_nick"]    = true;      // do not allow to change the nickname
$params["dyn_params"]     = array ("nick");   // just in case is matters; it does not

$params["debug"]          = true;     // activate debug console

$chat = new phpFreeChat($params);
 
?>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <title>My Chat - #3</title>
      <?php $chat->printJavascript(); ?>
    <?php $chat->printStyle(); ?>

  </head>
 
  <body>
      <?php $chat->printChat(); ?>
  </body>
 
  </html>

http://www.iqcicle.com/chat/chat_blue.php is almost the same, just the nick is different (this is requested by Safari on a Mac)
Code: Select all
...
$params["nick"]           = "MrBlue";  // setup the intitial nickname
...

Any help is much appreciated!!!
skl99999
New member
 
Posts: 9
Joined: Sat Mar 31, 2012 7:07 am
Top

Postby re*s.t.a.r.s.*2 » Sat Mar 31, 2012 5:26 pm

Hi,

That's supposed to happen because you are setting the same nicks in the same server instance, you need to setup another index document with a different ID in order for it work as you really want..

Code: Select all
$params["serverid"]       = "Chat07";  // unique id for this chat

both nicks wants to join same server which is not allowed...

best regards
Free Singles Chat Rooms No Registration Required
Text and Chat Singles no need to register or app required
Sala De Bate Papo Online Grátis E Sem Cadastro
re*s.t.a.r.s.*2
Support Team
 
Posts: 612
Joined: Wed Sep 24, 2008 4:04 pm
Location: los angeles CA
  • Website
Top

Postby skl99999 » Sat Mar 31, 2012 6:02 pm

Thanks for the answer - I unfortunately do not quite understand it.

This is meant to be one chat, and two people - MrGreen and MrBlue - are meant to join this same chat, hence the two different files where the only difference is
Code: Select all
$params[nick] = "MrBlue" / "MrGreen"

respectively. So it is set up to be the same chat, but different nicks.

The issue is that despite the second one trying to join as MrGreen, somehow the system thinks that he wants to join as MrBlue, at least that is what I can gather from the debug
Code: Select all
handleResponse: nick-notallowed-MrBlue
handleResponse: connect-ko-MrGreen
handleResponse: nick-notallowed-MrBlue
sendRequest: /connect "MrGreen"

As an aside - it work perfectly fine if you do not freeze the nick's, ie if you use
Code: Select all
$params["frozen_nick"]    = false;

then it behaves as it should, ie both MrGreen and MrBlue are connected in Chat07 via their respective browsers
skl99999
New member
 
Posts: 9
Joined: Sat Mar 31, 2012 7:07 am
Top

Postby re*s.t.a.r.s.*2 » Sat Mar 31, 2012 6:31 pm

HI,

http://www.iqcicle.com/chat/chat_green.php
http://www.iqcicle.com/chat/chat_blue.php


Then I dont understand, why the URLs then?

regards
Free Singles Chat Rooms No Registration Required
Text and Chat Singles no need to register or app required
Sala De Bate Papo Online Grátis E Sem Cadastro
re*s.t.a.r.s.*2
Support Team
 
Posts: 612
Joined: Wed Sep 24, 2008 4:04 pm
Location: los angeles CA
  • Website
Top

Postby skl99999 » Sat Mar 31, 2012 6:41 pm

poor man's php backbone; the idea is that the chat will be part of a bigger system where the people log in, and the page chat.php will fill the $params[nick] value depending on the logged in user. I am simply not there yet, and I am currently evaluating feasibility of PFC in this context, and hence rather than having one .php page I used two pages that would correspond to the respective users.

In my system, I will have unique nicknames for the people, so there is no need for them to choose. Actually, I don't want them to be able to change them in the chat because this would be confusing.
Last edited by skl99999 on Sat Mar 31, 2012 6:42 pm, edited 1 time in total.
skl99999
New member
 
Posts: 9
Joined: Sat Mar 31, 2012 7:07 am
Top

Postby re*s.t.a.r.s.*2 » Sat Mar 31, 2012 6:46 pm

So,

you want to split 2 files with same server ID and hard coding the the nicks,
My guest is that the nick is cached as parameter and that's why the other document is getting the first nick that's logged..

but this behavior doesn't occurs if you use only want document and login using the DHTML form...

hope I get this time.
Free Singles Chat Rooms No Registration Required
Text and Chat Singles no need to register or app required
Sala De Bate Papo Online Grátis E Sem Cadastro
re*s.t.a.r.s.*2
Support Team
 
Posts: 612
Joined: Wed Sep 24, 2008 4:04 pm
Location: los angeles CA
  • Website
Top

Postby re*s.t.a.r.s.*2 » Sat Mar 31, 2012 6:50 pm

Get it,

You dont need to care about that the nick parameter will pickup your user nick variable, just set it up and any person logged will get the nick picked up by the chat..

and you only need on document.. index.php

regards.
Free Singles Chat Rooms No Registration Required
Text and Chat Singles no need to register or app required
Sala De Bate Papo Online Grátis E Sem Cadastro
re*s.t.a.r.s.*2
Support Team
 
Posts: 612
Joined: Wed Sep 24, 2008 4:04 pm
Location: los angeles CA
  • Website
Top

Postby skl99999 » Sat Mar 31, 2012 6:54 pm

"you want to split 2 files with same server ID and hard coding the the nicks" - yes that's right, for testing purposes I want to do that

"My guest is that the nick is cached as parameter and that's why the other document is getting the first nick that's logged." - yeah, I am afraid that this is what happens; this is why I set the parameter that should avoid that caching from happening, but to no avail

"but this behavior doesn't occurs if you use only want document and login using the DHTML form..." - I am not sure I understand this; I havent tried any DHTML type solution yet, so I dont know whether it works, but my guess is it would not because ultimately as far as PFC is concerned the two solutions are equivalent; what I know what works is to allow users to change their nickname, then everything goes as it should.

My guess that there is indeed some caching going on, so when MrGreen connects after MrBlue, he first is assumed to be MrBlue and then his nick is changed - except it cant be changed because it is not allowed to. Hence he stays MrBlue, and of course this does not work...

"You dont need to care about that the nick parameter will pickup your user nick variable, just set it up and any person logged will get the nick picked up by the chat.. and you only need on document.. index.php" - exactly right
Last edited by skl99999 on Sat Mar 31, 2012 6:58 pm, edited 1 time in total.
skl99999
New member
 
Posts: 9
Joined: Sat Mar 31, 2012 7:07 am
Top

Postby re*s.t.a.r.s.*2 » Sat Mar 31, 2012 7:11 pm

I am not sure I understand this; I havent tried any DHTML type solution yet, so I dont know whether it works, but my guess is it would not because ultimately as far as PFC is concerned the two solutions are equivalent; what I know what works is to allow users to change their nickname, then everything goes as it should.

The DHTML form is the guest login Form where you type your nick..

So you are saying that when frozen nick is enable and a user that's logged in your application and then login to the chat, then want to log in with a different user in your application without destroying the previous session and sending a quit command to the chat , the chat picks the old nick Session?
Free Singles Chat Rooms No Registration Required
Text and Chat Singles no need to register or app required
Sala De Bate Papo Online Grátis E Sem Cadastro
re*s.t.a.r.s.*2
Support Team
 
Posts: 612
Joined: Wed Sep 24, 2008 4:04 pm
Location: los angeles CA
  • Website
Top

Postby re*s.t.a.r.s.*2 » Sat Mar 31, 2012 7:20 pm

Yeah,

You need to send a quit command so the phpfreechat session is destroyed..
Free Singles Chat Rooms No Registration Required
Text and Chat Singles no need to register or app required
Sala De Bate Papo Online Grátis E Sem Cadastro
re*s.t.a.r.s.*2
Support Team
 
Posts: 612
Joined: Wed Sep 24, 2008 4:04 pm
Location: los angeles CA
  • Website
Top

Postby skl99999 » Sat Mar 31, 2012 8:01 pm

this is not quite what I want I believe;

Imagine I have two people who are logged into my application, one Mr Green, and one Mr Blue, as identified by their session cookies. What I want is that they can both direct their respective browsers to the same URL http://www.iqcicle.com/chat/index.php, and they are automatically logged into the chat room under their respective names and that they can start chatting right away, without having to identify themselves
skl99999
New member
 
Posts: 9
Joined: Sat Mar 31, 2012 7:07 am
Top

Postby re*s.t.a.r.s.*2 » Sat Mar 31, 2012 8:10 pm

Hi,,

Sorry if I dont understand, you dont need a second document then, if the user is logged in redirect to chat index , there the nick parameter will pick both nicks from whatever variable you are using to set your nicks from the session...

Very simple.. doesnt matter if you got , frozen nick parameter enabled or disabled..

regards
Free Singles Chat Rooms No Registration Required
Text and Chat Singles no need to register or app required
Sala De Bate Papo Online Grátis E Sem Cadastro
re*s.t.a.r.s.*2
Support Team
 
Posts: 612
Joined: Wed Sep 24, 2008 4:04 pm
Location: los angeles CA
  • Website
Top

Postby skl99999 » Sat Mar 31, 2012 8:16 pm

See, this is what I don't believe. I'll go down that route, but doing
Code: Select all
$params[nick] = $nick_obtained_from_the_URL_parameter

in index.php is pretty much equivalent what I have done - whether I call index_green.php, or index.php?nick=green should not make a difference, as the code executed by the server is ultimately the same. I will certainly try it, but I can't see how those two options would not be equivalent.

Would you maybe have a working code snippet for this situation at hand?
skl99999
New member
 
Posts: 9
Joined: Sat Mar 31, 2012 7:07 am
Top

Postby re*s.t.a.r.s.*2 » Sat Mar 31, 2012 8:20 pm

Hi,

first the GET parameter doesnt work with this chat...

if you are collecting the nick by GET parameter is a dead end...

that is just use the session..
Free Singles Chat Rooms No Registration Required
Text and Chat Singles no need to register or app required
Sala De Bate Papo Online Grátis E Sem Cadastro
re*s.t.a.r.s.*2
Support Team
 
Posts: 612
Joined: Wed Sep 24, 2008 4:04 pm
Location: los angeles CA
  • Website
Top

Postby skl99999 » Sat Mar 31, 2012 8:24 pm

Sorry, I dont understand your answer. I would in reality probably have the nick in a cookie rather than as ?nick=MrGreen, but why is the latter a problem? Can't I just extract the nickname from the URL?
skl99999
New member
 
Posts: 9
Joined: Sat Mar 31, 2012 7:07 am
Top

Next

Post a reply
19 posts • Page 1 of 2 • 1, 2

Return to General Support (v1.x)

Who is online

Users browsing this forum: No registered users and 23 guests

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