• Forum
  • Doc
  • Screenshots
  • Download
  • Donate
  • Contributors
  • Contact
  • Follow @phpfreechat
  • DEMO
  • Board index ‹ Version 1.x branch ‹ phpBB, Simple Machines Forum (SMF), and Forum Software (v1.x)
  • Change font size
  • FAQ
  • Register
  • Login

Integration with phpBB3

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

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

Postby alexey_mos » Sun Mar 02, 2008 10:34 am

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
alexey_mos
Member
 
Posts: 17
Joined: Sat Mar 01, 2008 6:01 pm
Top

Postby alexey_mos » Sun Mar 02, 2008 12:59 pm

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/ ... mode=login");
}

$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 ;)
$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
alexey_mos
Member
 
Posts: 17
Joined: Sat Mar 01, 2008 6:01 pm
Top

Postby phreadom » Fri Apr 04, 2008 8:06 pm

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

Code: Select all
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. :)

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: Select all
header("Location: http://" . $_SERVER[SERVER_NAME] ."/forum/ucp.php?mode=login&redirect=/chat/");
Last edited by phreadom on Sat Apr 05, 2008 11:46 pm, edited 1 time in total.
phreadom
Support Team
 
Posts: 13
Joined: Fri Apr 04, 2008 8:03 pm
Top

Postby infojunky » Tue Apr 08, 2008 2:18 am

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: Select all
<?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 on Tue Apr 08, 2008 3:32 am, edited 1 time in total.
infojunky
New member
 
Posts: 1
Joined: Tue Apr 08, 2008 2:11 am
Top

Postby CaptainMonday » Fri Aug 08, 2008 10:41 pm

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: Select all
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: Select all
<?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 :D
CaptainMonday
New member
 
Posts: 2
Joined: Fri Aug 08, 2008 10:25 pm
Top

Postby OldWolf » Sat Aug 09, 2008 8:29 am

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. :)
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 CaptainMonday » Sat Aug 09, 2008 1:55 pm

That didn't work for some reason, so instead I put my Document Root url in its place and now it works!
CaptainMonday
New member
 
Posts: 2
Joined: Fri Aug 08, 2008 10:25 pm
Top

Postby demian » Tue Feb 17, 2009 7:57 am

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 :)
Last edited by demian on Tue Feb 17, 2009 8:27 am, edited 1 time in total.
demian
Member
 
Posts: 14
Joined: Tue Sep 09, 2008 7:40 pm
Top

Postby Alicia » Sun Jul 05, 2009 7:09 pm

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: Select all
<?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
Alicia
New member
 
Posts: 1
Joined: Sun Jul 05, 2009 6:49 pm
Top

Postby OldWolf » Mon Jul 06, 2009 3:56 am

That just wont work. You can't pass sessions between different hosts, it doesn't work that way.
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 kyl10 » Wed Dec 16, 2009 6:51 pm

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: Select all
Чат загружается...
Пожалуйста, подождите

What the heck o.O

Heres a screenshot:
Image

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 :(
Last edited by kyl10 on Wed Dec 16, 2009 6:55 pm, edited 1 time in total.
kyl10
New member
 
Posts: 2
Joined: Wed Sep 16, 2009 11:27 pm
Top

Postby OldWolf » Mon Jan 11, 2010 12:03 am

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:
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 MaleXachi » Tue Jul 27, 2010 1:10 am

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!
MaleXachi
Member
 
Posts: 11
Joined: Tue Jul 27, 2010 1:04 am
Top

Postby todhend » Thu Jul 29, 2010 7:01 pm

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
todhend
Member
 
Posts: 83
Joined: Tue Jan 19, 2010 9:03 pm
Location: Missouri
  • Website
Top

Postby jimmo » Wed Aug 18, 2010 9:05 pm

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.
jimmo
Member
 
Posts: 23
Joined: Wed Aug 18, 2010 3:51 pm
Top

Next

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

Return to phpBB, Simple Machines Forum (SMF), and Forum Software (v1.x)

Who is online

Users browsing this forum: No registered users and 1 guest

  • 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