•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 456,534 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,968 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 616 | Replies: 1 | Solved
![]() |
•
•
Join Date: Apr 2004
Location: Brownsville or Austin, TX or Faber, VA
Posts: 59
Reputation:
Rep Power: 5
Solved Threads: 2
Hello everyone, I have an issue that I can't seem to resolve with integrating phpBB into the rest of my site so that login and session can be intact. Well, for the most part, the whole scheme seems to work at first glance. I noticed that pages that have the phpBB root path and includes and other initialization stuff works like a charm. I can pull up $userdata['username'] and what have you very nicely. I do have my own include file that has functions I use to generate menus and other things. These functions don't react to any of the $userdata.
The purpose of my existence is why I am here.
•
•
Join Date: Apr 2004
Location: Brownsville or Austin, TX or Faber, VA
Posts: 59
Reputation:
Rep Power: 5
Solved Threads: 2
He he he he. After reading several pages about integrating phpBB into your main site through it's session capability, I came to realize that the answer was not in the actually integration code. This will solve a lot of headaches for noobs like myself, but if you have a external file of functions that need to use the $userdata that the page including the external file has already established, all you have to do is put into the function "global". This is an example of what I am talking about.
Member only page
Well this is what the external include misc.php will have to look like....
Well, thats the whole idea. I might have made some coding errors or something but
just so that if anyone runs into this problem there is at least something for those new to php like me to hint this, and save an hour or two of needless searching. PS. don't forget to append $userdata['session_id'] to any link that you need to have access to the login credentials. I manually echo it into the address instead of using the append_sid() which works for me, but thats just me.
Thanks you all for your time.
Member only page
<?php
define('IN_PHPBB', true);
$phpbb_root_path = './forum/';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_LOGIN);
init_userprefs($userdata);
//
// End session management
//
$page_title = "Catalog";
include("misc.php"); // <---EXTERNAL FILE
?>
<html>
<head>
<title>Whatever you want</title>
<link href="./mainstyle.css" rel="stylesheet" type="text/css" />
<script type="text/JavaScript" src="mainscript.js"></script>
</head>
<body>PAGE CONTENTS GO HERE !!!!!
<?php generateSomething(); ?>
</body>
</html><?php
$connection = mysql_connect(localhost,db_username,db_password)
or die("Couldn't connect to database!<br>");
$database = "db_name"; //Database containing the tables for the chat logs
$db = mysql_select_db($database,$connection)
or die ("Database not selected!");
function generateSomething(){
global $userdata;
echo "This is all it generates!? Booo.<br />";
if ($userdata['session_logged_in']){
echo "Well this is cool though, Your username is ".$userdata['username']."!!!!";
}
}
?>just so that if anyone runs into this problem there is at least something for those new to php like me to hint this, and save an hour or two of needless searching. PS. don't forget to append $userdata['session_id'] to any link that you need to have access to the login credentials. I manually echo it into the address instead of using the append_sid() which works for me, but thats just me.
Thanks you all for your time. Last edited by world_weapon : Oct 7th, 2007 at 7:24 pm. Reason: Lazy fingers
The purpose of my existence is why I am here.
![]() |
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- php help needed (Tech / IT Consultant Job Offers)
- PhpBB vs VBulletin (Growing an Online Community)
- phpBB to php-nuke integration help (PHP)
- phpBB thread archive (PHP)
Other Threads in the PHP Forum
- Previous Thread: php relocation on $_Get
- Next Thread: PHP Mail Scripting


Linear Mode