| | |
Not Another PhpBB Integration
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
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.
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 Syntax (Toggle Plain Text)
<?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 Syntax (Toggle Plain Text)
<?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.
![]() |
Similar Threads
- PhpBB vs VBulletin (Social Media and Online Communities)
- php help needed (Tech / IT Consultant Job Offers)
- 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
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array back beginner binary broken cakephp checkbox class cms code cron curl database date development directory display download dynamic echo email error file files filter folder form forms function functions gc_maxlifetime google host href htaccess html image include insert integration ip java javascript joomla limit link login loop mail memmory memory menu mlm mod_rewrite multiple mysql navigation oop parse parsing paypal pdf php problem query radio random recursion regex remote script search server sessions sms snippet soap source space sql structure syntax system table tutorial update upload url validation validator variable video web xml youtube





