phpFreeChat - Web2.0 AJAX chat server - Forum

phpFreechat related discussions.

You are not logged in.

Announcement

Please make sure to read the following thread BEFORE posting for support: http://www.phpfreechat.net/forum/viewtopic.php?id=4021

#1 2008-03-02 10:34:32

alexey_mos
Member

Integration with phpBB3

Please help to finish the code.

I have phpfreechat-1.0, and phpBB3 forum. So I wanted to make the chat available for the registered users (while unregistered ones could probably have access as guests).

The problem is that chat main page redirects to the phpbb3 login page, and when I am logged in, the chat page redirects me to the phpbb3 index (because it can no longer redirect a logged in user to a login page?).

here is the chat index code:

<?php

define("IN_PHPBB", true);
$phpbb_root_path = "../phpbb/"; //Root to phpBB
$chat_root_phpbbrealtive_path = "../phpfreechat-1.0/"; //Root to chat relative to phpBB root
$phpEx = substr(strrchr(__FILE__, "."), 1);
include($phpbb_root_path . "common." . $phpEx);

$user->session_begin();
$auth->acl($user->data);
$user->setup();
$oog = $user->data[username];

if ($oog = "Anonymous")
header("Location: http://www.survivorsresource.com/phpbb/ … ogin");

require_once dirname(__FILE__)."/src/phpfreechat.class.php";
$params = array();
$params["title"] = "www.survivorsresource.com";
$params["theme"] = "green";
$params["max_msg"] = 0;
$params["max_nick_len"] = 15;
$params["nick"] = $user->data["username"];
$params["language"] = "ru_RU";
$params["isadmin"] = false;
$params["admins"] = array("admin" => "password");
$params["serverid"] = md5(__FILE__);
$params["debug"] = false;

$chat = new phpFreeChat($params);

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>

</head>

<body>

<div class="content">

<?php

$chat->printChat();

?>

</div>

</body></html>



I would like to arrange redirection both to phpBB3 login page and back to the chat.

Alexey

Offline

 

#2 2008-03-02 12:59:36

alexey_mos
Member

Re: Integration with phpBB3

Here is the working code:

<?php

define('IN_PHPBB', true);
$phpbb_root_path = '../phpbb/'; // See phpbb_root_path documentation
$phpEx = substr(strrchr(__FILE__, '.'), 1); // Set the File extension for page-wide usage.
include($phpbb_root_path . 'common.' . $phpEx); // include the common.php file, this is important, especially for database connects.

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('viewforum');

get_username_string ;
$oog = $user->data [username];

// redirect to phpBB logon page if the user is not logged in
if ($oog == "Anonymous")
    {
        header("Location: http://www.survivorsresource.com/phpbb/ … ogin");
    }

$utz = $user->data['user_timezone']; // Get user's time zone information from phpBB3 account settings

require_once dirname(__FILE__)."/src/phpfreechat.class.php";
$params = array();
$params["title"] = "survivorsresources";
$params["nick"]              = $user->data [username];
$params["frozen_nick"]    = true;     // do not allow to change the nickname
$params["isadmin"] = false; // just for debug wink
$params["language"] = "ru_RU";
$params["serverid"] = md5(survivorsresources);
//$params["debug"] = true;
$params["theme_path"]    = dirname(__FILE__)."/themes";
$params["theme"]         = "green";
$params["time_offset"] =  $utz*60*60; // Sets user's time_offset to their timezone

$chat = new phpFreeChat( $params );

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <title>survivorsresource</title>
 
</head>
<body>

<div class="header">
<h1><a href="http://www.survivorsresource.com/index.html">survivorsresource</a></h1>
</div>

<div class="content">
  <?php $chat->printChat(); ?>
</div>

</body></html>



One thing missing is that there is no admin identification, and no redirect from login page to chat. These are minor things.

Notice that the user time zone according to phpbb3 is referenced to chat messages.

Thanks guys for nice work. I really like the phpfreechat software.

Alexey

Offline

 

#3 2008-04-04 21:06:55

phreadom
New member

Re: Integration with phpBB3

Alexey:
An easy way to make the login page redirect back to the chat is to change the login URL like so:

Code:

header("Location: http://www.example.com/phpbb/ucp.php?mode=login&redirect=/phpfreechat/");

The important part to add being the: &redirect=/phpfreechat/

This will set the correct hidden variable in the login form to redirect you wherever you want after you log in. smile

EDIT: I should note that I ran into a problem with my own code last night... I have a domain which I use the .com version internally and the .net version externally... and I had hardcoded the .com version into that redirect which broke the site externally. Switching the code to the following worked to fix it:

Code:

header("Location: http://" . $_SERVER[SERVER_NAME] ."/forum/ucp.php?mode=login&redirect=/chat/");

Last edited by phreadom (2008-04-06 00:46:49)

Offline

 

#4 2008-04-08 03:18:21

infojunky
New member

Re: Integration with phpBB3

I have a similar problem.  When I click the link to go into my chat room, it logs me out for some reason.  If I click 'automatically log me in' it redirects me to the index page.  I won't lie though, I'm no programmer.

Code:

<?php

define('IN_PHPBB', true);
$phpbb_root_path = '/home/landmanb/public_html/untolerable/phpBB3/'; // See phpbb_root_path documentation
$phpEx = substr(strrchr(__FILE__, '.'), 1); // Set the File extension for page-wide usage.
include($phpbb_root_path . 'common.' . $phpEx); // include the common.php file, this is important, especially for database connects.
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('viewforum');

 get_username_string ;
$oog = $user->data [username];

 // redirect to phpBB logon page if the user is not logged in
if ($oog == "Anonymous")
    {
        header("Location: http://www.untolerable.com/phpBB3/ucp.php?mode=login&redirect=/chat/");
    }
require_once dirname(__FILE__)."/src/phpfreechat.class.php";
$params = array();
$params["title"] = "Untolerable";

$params["nick"]              = $user->data [username];
$params["frozen_nick"]    = true;     // do not allow to change the nickname
$params["isadmin"] = false; // just for debug ;)
$params["serverid"] = md5(Untolerable); // calculate a unique id for this chat
//$params["debug"] = true;
$params["theme_path"]    = dirname(__FILE__)."/themes";
$params["theme"]         = "green";
$params["channels"] = array("Main Chat");
$chat = new phpFreeChat( $params );

?>

** EDIT **  Reinstalling the chat software as a subfolder of the forum software solved the problem.

Last edited by infojunky (2008-04-08 04:32:58)

Offline

 

#5 2008-08-08 23:41:57

CaptainMonday
New member

Re: Integration with phpBB3

I hate having to hijack someone elses thread, but I thought it would be a waste to start a new one.

I'm getting this error message when I use this code

Code:

Warning: include(/phpBB3/common.php) [function.include]: failed to open stream: No such file or directory in (directoryname)/chat/index.php on line 6

Warning: include() [function.include]: Failed opening '/phpBB3/common.phpphp' for inclusion (include_path='.:/usr/local/lib/php-5.2.4/lib/php') in (directoryname)phpBB3/chat/index.php on line 6

Fatal error: Call to a member function session_begin() on a non-object in (directoryname)phpBB3/chat/index.php on line 9

here's the complete script:

Code:

<?php

define('IN_PHPBB', true);
$phpbb_root_path = '/phpBB3/'; // See phpbb_root_path documentation
$phpEx = substr(strrchr(__FILE__, '.'), 1); // Set the File extension for page-wide usage.
include($phpbb_root_path . 'common.' . $phpEx); // include the common.php file, this is important, especially for database connects.

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('viewforum');

get_username_string ;
$oog = $user->data [username];

// redirect to phpBB logon page if the user is not logged in
if ($oog == "Anonymous")
    {
        header("Location: http://" . $_SERVER[SERVER_NAME] ."/phpBB3/ucp.php?mode=login&redirect=/chat/");
    }

$utz = $user->data['user_timezone']; // Get user's time zone information from phpBB3 account settings

require_once dirname(__FILE__)."/src/phpfreechat.class.php";
$params = array();
$params["title"] = "Name";
$params["nick"]              = $user->data [username];
$params["frozen_nick"]    = true;     // do not allow to change the nickname
$params["isadmin"] = false; // just for debug wink
$params["language"] = "ru_RU";
$params["serverid"] = md5(Name);
//$params["debug"] = true;
$params["theme_path"]    = dirname(__FILE__)."/themes";
$params["theme"]         = "green";
$params["time_offset"] =  $utz*60*60; // Sets user's time_offset to their timezone

$chat = new phpFreeChat( $params );

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <title></title>
 
</head>
<body>

<div class="content">
  <?php $chat->printChat(); ?>
</div>

</body></html>

Any help would be awesome big_smile

Offline

 

#6 2008-08-09 09:29:16

OldWolf
Project founder

Re: Integration with phpBB3

The error pretty clearly spells out the problem.  You're trying to include a file which doesn't exist at the place your looking.

Normally in php coding, to fix this problem you would edit the include path.  However, since phpbb uses a variable for the root path, you need to change that (or anything else included from this page will also be completely botched up.

Notice that in the original code the root path read:
$phpbb_root_path = '../phpbb/'; // See phpbb_root_path documentation

Then you changed it to:
$phpbb_root_path = '/phpBB3/'; // See phpbb_root_path documentation

What you did, while no doubt trying to rename it to the correct folder (which is good) was lost the very important ".." in the begining of the path (which is bad).  Those dots tell php "don't look in this folder, look one level up".  With you current code, php is searching the phpfreechat folder for a folder called "phpbb3"... which isn't in the phpfreechat folder... so the file can't be found either and it throws an error at you.

Your path should more likely be:
$phpbb_root_path = '../phpBB3/'; // See phpbb_root_path documentation

Assuming that you phpbb folder name is "phpBB3".

Hope that helps you understand. smile


----Signature----
I am presently on leave and will only be able to provide extremely limited support at infrequent intervals.
Read before Posting: Personal Support Policy
Note: I am unable to offer support through PM/e-mail at this time.

Offline

 

#7 2008-08-09 14:55:41

CaptainMonday
New member

Re: Integration with phpBB3

That didn't work for some reason, so instead I put my Document Root url in its place and now it works!

Offline

 

#8 2009-02-17 07:57:30

demian
New member

Re: Integration with phpBB3

I also try to use this script within my phpbb forum, problem i have is after loggin in it is redirected to the root of my site.

It seems that &redirect=/chat/ in the url redirects to the root of the website after login instead of redirecting to /chat/

How can i change the redirect so that is redirects to the right path?

///////

Doesn't matter anymore, in stead of fixing the redirect problem,  i installed phpfreechat in /forum/chat instead of in /chat and than used this :

header("Location: http://" . $_SERVER[SERVER_NAME] ."/forum/ucp.php?mode=login&redirect=chat/index.php");

That worked properly smile

Last edited by demian (2009-02-17 08:27:45)

Offline

 

#9 2009-07-05 20:09:58

Alicia
New member

Re: Integration with phpBB3

I would appreciate some help with this rather unique integration. The forum is located on another server: http://galacticcampaigns.com. And the chat will be located here: http://swrpgrc.com/phpfreechat/
This is the code I have installed on index.php

Code:

<?php

define('IN_PHPBB', true);
$phpbb_root_path = 'http://galacticcampaigns.com/'; // See phpbb_root_path documentation
$phpEx = substr(strrchr(__FILE__, '.'), 1); // Set the File extension for page-wide usage.
include($phpbb_root_path . 'common.php'); // include the common.php file, this is important, especially for database connects.

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('viewforum');

get_username_string ;
$oog = $user->data [username];

// redirect to phpBB logon page if the user is not logged in
if ($oog == "Anonymous")
    {
        header("Location: http://www.galacticcampaigns.com/ucp.php?mode=login&redirect=http://swrpgrc.com/phpfreechat/");
    }

$utz = $user->data['user_timezone']; // Get user's time zone information from phpBB3 account settings

require_once dirname(__FILE__)."/src/phpfreechat.class.php";
$params = array();
$params["title"] = "Chat Room";
$params["nick"] = $user->data [username];
$params["frozen_nick"]    = true;     // do not allow to change the nickname
$params["isadmin"] = false; // just for debug wink
$params["serverid"] = md5(__FILE__);
//$params["debug"] = true;
$chat = new phpFreeChat( $params );

?>
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <title>phpFreeChat- Sources Index</title>
  <link rel="stylesheet" title="classic" type="text/css" href="style/generic.css" />
 </head>
 <body>

<div>
  <?php $chat->printChat(); ?>
  <?php 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>

</body></html>

I get an error message of:
Fatal error: Call to a member function session_begin() on a non-object in /home/swrpgrcc/public_html/phpfreechat/index.php on line 9

Offline

 

#10 2009-07-06 04:56:03

OldWolf
Project founder

Re: Integration with phpBB3

That just wont work.  You can't pass sessions between different hosts, it doesn't work that way.


----Signature----
I am presently on leave and will only be able to provide extremely limited support at infrequent intervals.
Read before Posting: Personal Support Policy
Note: I am unable to offer support through PM/e-mail at this time.

Offline

 

#11 2009-12-16 18:51:26

kyl10
New member

Re: Integration with phpBB3

Someone please help me with this, I followed all the posts for integrating it.. login appears to work just fine.. but instead of loading, in the white box I get this:

Code:

Чат загружается...
Пожалуйста, подождите

What the heck o.O

Heres a screenshot:
http://i274.photobucket.com/albums/jj265/kyl10/Screenshot-phpFreeChat-SourcesIndex.png

Please help, I have tried like everything and this is KILLING me!! D:

edit:
wow im so dumb, just dawned on me it is set to language RUSSIAN instead of ENGLISH ahhahahha.

one problem still, the chat refuses to load! it just stays at that white box forever sad

Last edited by kyl10 (2009-12-16 18:55:35)

Offline

 

#12 2010-01-11 00:03:00

OldWolf
Project founder

Re: Integration with phpBB3

No.  Sessions are unique to each server.  They're stored on the server side and identified by a cookie on the user's end.


----Signature----
I am presently on leave and will only be able to provide extremely limited support at infrequent intervals.
Read before Posting: Personal Support Policy
Note: I am unable to offer support through PM/e-mail at this time.

Offline

 

#13 2010-07-27 02:10:57

MaleXachi
Member

Re: Integration with phpBB3

I have a problem. I try to reconcile with the phpbb3 forum chat, but only problem is that I always get error message that path and file exists, but is there to do. This is how my script looks like:

<?php

define('IN_PHPBB', true);
$phpbb_root_path = '../phpbb/'; // See phpbb_root_path documentation
$phpEx = substr(strrchr(__FILE__, '.'), 1); // Set the File extension for page-wide usage.
include($phpbb_root_path . 'common.' . $phpEx); // include the common.php file, this is important, especially for database connects.


// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup('viewforum');

get_username_string ;
$oog = $user->data [username];

// redirect to phpBB logon page if the user is not logged in
if ($oog == "Anonymous")
    {
        header("Location: http://www.lulmee.nl/forum/chat/ … ogin");
    }

$utz = $user->data['user_timezone']; // Get user's time zone information from phpBB3 account settings

require_once dirname(__FILE__)."/src/phpfreechat.class.php";
$params = array();
$params["title"] = "lulmee";
$params["nick"]              = $user->data [username];
$params["frozen_nick"]    = true;     // do not allow to change the nickname
$params["isadmin"] = false; // just for debug
$params["language"] = "en_US";
$params["serverid"] = md5(lulmee);
//$params["debug"] = true;
$params["theme_path"]    = dirname(__FILE__)."/themes";
$params["theme"]         = "green";
$params["time_offset"] =  $utz*60*60; // Sets user's time_offset to their timezone

$chat = new phpFreeChat( $params );

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <title>Welkom Bij Lulmee.nl Chat!</title>
  <link rel="stylesheet" title="classic" type="text/css" href="style/generic.css" />
  <link rel="stylesheet" title="classic" type="text/css" href="style/header.css" />
  <link rel="stylesheet" title="classic" type="text/css" href="style/footer.css" />
  <link rel="stylesheet" title="classic" type="text/css" href="style/menu.css" />
  <link rel="stylesheet" title="classic" type="text/css" href="style/content.css" /> 
</head>
<body>
<div class="header">
<h1><a href="http://www.lulmee.nl/forum/index.php">lulmee</a></h1>
</div>
<div class="content">
<?php $chat->printChat(); ?>
</div>

<div class="header">
      <img alt="phpFreeChat" src="style/logo.gif" class="logo2" />
</div>

<div class="menu">
      <ul>
        <li class="sub title">General</li>
        <li>
          <ul class="sub">
            <li class="item">
              <a href="demo/">Demos</a>
            </li>
            <?php if (file_exists(dirname(__FILE__)."/checkmd5.php")) { ?>
            <li>
              <a href="checkmd5.php">Check md5</a>
            </li>
            <?php } ?>
            <!--
            <li class="item">
              <a href="admin/">Administration</a>
            </li>
            -->
          </ul>
        </li>
        <li class="sub title">Documentation</li>
        <li>
          <ul>
            <li class="item">
              <a href="http://www.phpfreechat.net/overview">Overview</a>
            </li>
            <li class="item">
              <a href="http://www.phpfreechat.net/quickstart">Quickstart</a>
            </li>
            <li class="item">
              <a href="http://www.phpfreechat.net/parameters">Parameters list</a>
            </li>
            <li class="item">
              <a href="http://www.phpfreechat.net/faq">FAQ</a>
            </li>
            <li class="item">
              <a href="http://www.phpfreechat.net/advanced-configuration">Advanced configuration</a>
            </li>
            <li class="item">
              <a href="http://www.phpfreechat.net/customize">Customize</a>
            </li>
          </ul>
        </li>
      </ul>
      <p class="partner">
        <a href="http://www.phpfreechat.net"><img alt="phpfreechat.net" src="style/logo_88x31.gif" /></a><br/>
      </p>
</div>

<div class="content">
  <?php $chat->printChat(); ?>
  <?php 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>

<div class="footer">
  <span class="partners">phpFreeChat partners:</span>
  <a href="http://www.jeu-gratuit.net">jeux gratuits</a> |
  <a href="http://jeux-flash.jeu-gratuit.net">jeux flash</a> |
  <a href="http://www.pronofun.com">pronofun</a> |
  <a href="http://areno.jeu-gratuit.net">areno</a> |
  <a href="http://www.micropolia.com">micropolia</a> |
  <a href="http://www.zeitoun.net">zeitoun</a> |
  <a href="http://federation.jeu-gratuit.net">federation</a>
</div>
   
</body></html>

This is errors:

Warning: include(../forum/common.php) [function.include]: failed to open stream: No such file or directory in /home/lulmee/domains/lulmee.nl/public_html/phpbb/chat/index.php  on line 6

Warning: include() [function.include]: Failed opening '../forum/common.php' for inclusion (include_path='.:/usr/local/php5/lib/php') in /home/lulmee/domains/lulmee.nl/public_html/phpbb/chat/index.php on line 6

Fatal error: Call to a member function session_begin() on a non-object in /home/lulmee/domains/lulmee.nl/public_html/phpbb/chat/index.php on line 10


I hope you can help me!

Offline

 

#14 2010-07-29 20:01:44

todhend
Support Team

Re: Integration with phpBB3

try changing the path or adding a absolute path to the included files


http://nflpick.net    free football picks
http://tdah.us   free webmail script

Offline

 

#15 2010-08-18 22:05:12

jimmo
Member

Re: Integration with phpBB3

phpbb_root_path is wrong.  You're in the 'chat' subdirectory when this php is interpreted, so the root of your phpbb is "../" not "./" by the looks of it.

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2008 PunBB

©2006-2009 phpFreeChat