• 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

Rooms for guests and members

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

Post a reply
7 posts • Page 1 of 1

Postby StevenK » Sat May 05, 2012 12:47 pm

Hi there,

OK i will explain a little about what im trying to achieve.

I have a website template that shows one thing to people who haven't registered and shows something different when they have registered
in the template i use php code to see if the user is logged in or not
i want to place a chat box in both areas
when a guest is visiting they can only chat in the guest area
when a member is logged in they can chat in the guest area and in the members area

Guests can only chat in the Guest Room
Members can chat in BOTH the Guest Room and Members Area

What i have done so far:

I have used the php to display the chat room (using two different codes)
basically the guests chat is "guest.php" and the members is "members.php"

i have changed the parameters in each file from
$params["serverid"] = md5(__FILE__);
to
$params["serverid"] = md5(1);

this now shows the same on both the guest page and members page

in the "guest.php" i have
$params["channels"] = array("Guest Room");

in the "members.php" i have
$params["channels"] = array("Guest Room", "Members Room");

Now when i load the page as a guest i can only see the Guest Room (this is perfect and just what i want them to see)
but when i login i still only see the Guest Room

How can i change this?
if the user IS NOT logged in they see a chat room on the page with just one room "Guest Room"
if the user IS logged in they see a chat room on the page with two rooms "Guest Room" and "Members Area"

Any help will be greatly appreciated
Thank You
StevenK
New member
 
Posts: 3
Joined: Sat May 05, 2012 12:24 pm
Top

Postby re*s.t.a.r.s.*2 » Sat May 05, 2012 2:13 pm

Hi,

would you like to show your code?

Possible is a session issue not sure...


let us see it..
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 StevenK » Sat May 05, 2012 2:39 pm

Here is parts of the index.php code that checks to see if there logged in or not
Code: Select all
<?php
if(!Auth::LoggedIn())
{
// Show these if they haven't logged in yet
?>
<iframe src="http://#####################/phpchat/demo/guest.php" frameborder="0" height="628" width="600"></iframe>
<?php
}
else
{
// Show these items only if they are logged in
?>
<iframe src="http://#####################/phpchat/demo/member.php" frameborder="0" height="628" width="600"></iframe>
<?php
}
?>

Here is the Guest.php
Code: Select all
<?php
require_once dirname(__FILE__)."/../src/phpfreechat.class.php";
$params["serverid"] = md5(1); // calculate a unique id for this chat
$params["nick"]     = "guest";  // setup the intitial nickname
$params["channels"]        = array("Guest Room");
$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" />
</head>
<body>
<?php $chat->printChat(); ?>
</body>
</html>

and here is the member.php
Code: Select all
<?php
require_once dirname(__FILE__)."/../src/phpfreechat.class.php";
$params["serverid"] = md5(1); // calculate a unique id for this chat
$params["nick"]     = "guest";  // setup the intitial nickname
$params["channels"] = array("Guest Room", "Pilot Lounge");
$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" />
</head>
<body>
<?php $chat->printChat(); ?>
</body>
</html>
Last edited by StevenK on Sat May 05, 2012 2:40 pm, edited 1 time in total.
StevenK
New member
 
Posts: 3
Joined: Sat May 05, 2012 12:24 pm
Top

Postby re*s.t.a.r.s.*2 » Sat May 05, 2012 4:11 pm

Hi,

Just change the application ID, you are using the same Id for both chats instances...

that fixed the issue in my local environment...


Note: I see a problem , since the application isn't the same for guest and registered , registered wont be able to access guest's chat.. that's how phpfreechat handle this situation...


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 StevenK » Sat May 05, 2012 4:45 pm

is there any way i can change it so registered users CAN talk to guests as well?
StevenK
New member
 
Posts: 3
Joined: Sat May 05, 2012 12:24 pm
Top

Postby re*s.t.a.r.s.*2 » Sat May 05, 2012 5:21 pm

StevenK wrote:is there any way i can change it so registered users CAN talk to guests as well?

No that I can see, because the channels gets cached in cache file by phpfreechat or unless when arriving to the chat make a new config file in the cache (redundant)

and when login off, destroy session and again create a new file so the old cache doesn't exit and start fresh from either a logged user or a guest and forth..

sorry, beside as the code it is now, a registered user can just tell the url of the chat a guest user and that guest user would be able to login..

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 Catprog » Wed Jun 06, 2012 3:08 am

The way I did it was to restrict the rooms that Guests could join

For the guests.
Code: Select all
   $params["channels"]        = array("MainChat");
   $params["frozen_channels"]        = array("MainChat");

For the members one
Code: Select all
   $params["channels"]        = array("MainChat","MembersOnly");
Catprog
New member
 
Posts: 4
Joined: Tue May 12, 2009 11:18 am
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 49 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