• 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

Nick name is the member (logged in) by default

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

Post a reply
7 posts • Page 1 of 1

Postby infogeek » Sat Nov 06, 2010 6:10 pm

Hello,

I just started using this smart small chat, but I wish to use it for a specific aim by a specific way, I explain:

I want to make the user of the chat (guest) is the member who is logged in my website by default, so, there won't be any nick name, just who logged-in can see and use the chat box.

All what I need, not to give me the ready script, but to indicate the functions, the variables and the files that should be edited to do what I want to do.

I liked your product and I'll like it more and keep it if you help me to do the purpose.

See you soon.
infogeek
New member
 
Posts: 4
Joined: Sat Nov 06, 2010 5:47 pm
Top

Postby OldWolf » Sat Nov 06, 2010 8:24 pm

If I understand what your asking, it's pretty easy. Let me first check that I understand:
You want to make it so that only users who are logged into your website have access to the chat, and they will use the nicknames they have for your website?

If so, all it really takes is two parameters and an if statement.
$params['nick'] = whatever you use on your website to generate their nick name.
$params['frozen_nick'] = true;

Then create an if/else statement where the chat is created (it's the second bit of php found in the index.php file), checking if the user is logged in. If not, you could echo a login statement, or just leave it blank.
Signature:
Read before Posting: Forum Rules
Note: I am unable to offer support through PM/e-mail at this time.
OldWolf
Site Admin
 
Posts: 1918
Joined: Sun Sep 23, 2007 5:48 am
Top

Postby infogeek » Sat Nov 06, 2010 9:14 pm

Thank you bro,

I did as you said, I gave to the parameter: $params["nick"] the pseudo which is stored within a cookie so:
$params["nick"] = $_COOKIE['pseudo'];

but the chat still generate randoms guests, I thinks that there's a problem in the other parameters, so take a look to my piece of script:

<?php
require_once dirname(__FILE__)."/phpfreechat-1.3/src/phpfreechat.class.php";
$params = array();
$params["title"] = "Quick chat";
$params["nick"] = $_COOKIE['pseudo'];// setup the intitial nickname
$params['frozen_nick'] = true;
$params['firstisadmin'] = true;
//$params["isadmin"] = true; // makes everybody admin: do not use it on production servers ;)
$params["serverid"] = md5(__FILE__); // calculate a unique id for this chat
$params["debug"] = false;
$chat = new phpFreeChat( $params );
?>

and I set an if statement in my page in which I use the chat as follow (I didn't understand what did u mean by the second bit of php found ...):
<div class="content">

<?php if(isset ($_COOKIE['pseudo'])) {
$chat->printChat();
if (isset($params["isadmin"]) && $params["isadmin"]) { ?>
<p style="color:red;font-weight:bold;">Warning: because of "isadmin" parameter, everybody is admin. Please modify this script before using it on production servers !</p>
<?php } } ?>
</div>

Notice that this my first use of the script.
I wait for ya.
infogeek
New member
 
Posts: 4
Joined: Sat Nov 06, 2010 5:47 pm
Top

Postby OldWolf » Sat Nov 06, 2010 9:24 pm

Your parameters are fine, I suspect it's an issue with the cookie (which is an insecure and unstable way of storing a nick). Are you familiar with sessions? I would recommend trying sessions if you are, that should produce the results you're looking for.
Signature:
Read before Posting: Forum Rules
Note: I am unable to offer support through PM/e-mail at this time.
OldWolf
Site Admin
 
Posts: 1918
Joined: Sun Sep 23, 2007 5:48 am
Top

Postby infogeek » Sat Nov 06, 2010 9:37 pm

I guess so, coz, when I log out a member and log in with another, the nick name of my chat keeps the first one, and I can't use the new pseudo until I restart my browser.
I take in consideration your advice about using sessions, but I built my website from zero using cookies to store pseudo names, so, it will be better if I found a solution to this problem using cookies rather than rebuild the whole think using sessions, I'll be glad if you help me to solve the problem around my current environment (namely, using cookies).
But if u r sure that the cookies won't do the purpose, then I use sessions.
I'm appreciate for your support OldWolf.
infogeek
New member
 
Posts: 4
Joined: Sat Nov 06, 2010 5:47 pm
Top

Postby OldWolf » Sun Nov 07, 2010 5:42 am

Well, let me put it this way: I know that sessions works, many, many people have done so. I'm not sure what about your cookie situation is causing that problem, and to be honest, I can't guess. :/
Signature:
Read before Posting: Forum Rules
Note: I am unable to offer support through PM/e-mail at this time.
OldWolf
Site Admin
 
Posts: 1918
Joined: Sun Sep 23, 2007 5:48 am
Top

Postby infogeek » Sun Nov 07, 2010 6:18 pm

No problem mate, in some sort, it's not a problem when each member has right to use only one membership, so if he opens another membership, then, this is his problem to cannot be able to use another pseudo in chat box, but, whatever, we try to provide a complete and correct product.

And about the way I use cookies, is to create them carrying the pseudo entered in login form once a member logs in and the period until expiring is a yea (for example).
infogeek
New member
 
Posts: 4
Joined: Sat Nov 06, 2010 5:47 pm
Top


Post a reply
7 posts • Page 1 of 1

Return to General Support (v1.x)

Who is online

Users browsing this forum: No registered users and 7 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