Need some help with sessions

This is an archive of the phpBB 2.0.x support forum. Support for phpBB2 has now ended.
Forum rules
Following phpBB2's EoL, this forum is now archived for reference purposes only.
Please see the following announcement for more information: viewtopic.php?f=14&t=1385785
Seelmeister
Registered User
Posts: 72
Joined: Sun Jan 11, 2004 3:43 pm
Contact:

Need some help with sessions

Post by Seelmeister » Tue Jul 26, 2005 3:24 pm

I am creating a website that uses both phpBB and a CMS, with both sharing the same database.

I would like to use the phpBB members tables for the whole site, so I could provide a login on the other pages, as well as require that users be logged in to post comments etc, but I do not want to be re-directed to the forums when I log in.

I had a look at the sessions.php file and there is a lot I don't understand in there, I'm fairly knew to all this so when do I start?

Also, in the cms there is already a members system for admins, I would like if possible to use the phpBB members system for this as well, because at present I have two accounts which I would like to combine into one. There are two classes of admins in the cms, the superadmin, which is me, and can perform any function in the admin control panel, and other administrators (which corresponds with the moderators in my forums) and have access to a limited array of functions in the control panel.

Would it be possible to achieve this?

fumbalah
Registered User
Posts: 2000
Joined: Sat Jan 24, 2004 3:02 pm
Location: Lexington, Kentucky
Contact:

Post by fumbalah » Tue Jul 26, 2005 4:16 pm

Take a look at This. which should help you with integrating sessions, but you are on your own in integrating phpBB into a CMS.
Last edited by fumbalah on Tue Jul 26, 2005 4:19 pm, edited 1 time in total.

gasteropod
Registered User
Posts: 270
Joined: Thu Mar 24, 2005 10:37 am
Location: Hampshire, UK

Post by gasteropod » Tue Jul 26, 2005 4:17 pm

You probably want this article from the knowledge base:

http://www.phpbb.com/kb/article.php?article_id=143
Use the Support Request Template when asking for help.

Seelmeister
Registered User
Posts: 72
Joined: Sun Jan 11, 2004 3:43 pm
Contact:

Post by Seelmeister » Tue Jul 26, 2005 8:12 pm

Hmm, I followed the first step of that article, entering code at the top of the pages I want to intergrate, and I get this rather huge error message;

Warning: Cannot modify header information - headers already sent by (output started at /home/gami2674/public_html/index.php:2) in /home/gami2674/public_html/forum/includes/sessions.php on line 329

Warning: Cannot modify header information - headers already sent by (output started at /home/gami2674/public_html/index.php:2) in /home/gami2674/public_html/forum/includes/sessions.php on line 330

Warning: init_userprefs(language/lang_english/lang_main.): failed to open stream: No such file or directory in /home/gami2674/public_html/forum/includes/functions.php on line 280

Warning: init_userprefs(language/lang_english/lang_main.): failed to open stream: No such file or directory in /home/gami2674/public_html/forum/includes/functions.php on line 280

Warning: init_userprefs(): Failed opening 'language/lang_english/lang_main.' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/gami2674/public_html/forum/includes/functions.php on line 280

Warning: init_userprefs(./includes/lang_extend_mac.): failed to open stream: No such file or directory in /home/gami2674/public_html/forum/includes/functions.php on line 294

Warning: init_userprefs(./includes/lang_extend_mac.): failed to open stream: No such file or directory in /home/gami2674/public_html/forum/includes/functions.php on line 294

Warning: init_userprefs(): Failed opening './includes/lang_extend_mac.' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/gami2674/public_html/forum/includes/functions.php on line 294

Warning: message_die(language/lang_english/lang_main.): failed to open stream: No such file or directory in /home/gami2674/public_html/forum/includes/functions.php on line 738

Warning: message_die(language/lang_english/lang_main.): failed to open stream: No such file or directory in /home/gami2674/public_html/forum/includes/functions.php on line 738

Warning: message_die(): Failed opening 'language/lang_english/lang_main.' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/gami2674/public_html/forum/includes/functions.php on line 738
phpBB :

Could not query database for theme info

DEBUG MODE

SQL Error : 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3

Seelmeister
Registered User
Posts: 72
Joined: Sun Jan 11, 2004 3:43 pm
Contact:

Post by Seelmeister » Tue Jul 26, 2005 11:53 pm

Anyone know why I'm getting this error?

geocator
Registered User
Posts: 16242
Joined: Fri Jan 09, 2004 11:56 pm
Location: On dry land
Contact:

Post by geocator » Tue Jul 26, 2005 11:59 pm

You got several issues. First make sure there are no spaces, blank lines or anything else before the <?php in index.php. Second it seems you did not include extension.inc in your script.

Seelmeister
Registered User
Posts: 72
Joined: Sun Jan 11, 2004 3:43 pm
Contact:

Post by Seelmeister » Wed Jul 27, 2005 1:09 am

I fiddled around a little with the code any my error message now reads
Warning: main(db/mysql4.php): failed to open stream: No such file or directory in /home/gami2674/public_html/forum/includes/db.php on line 35

Warning: main(db/mysql4.php): failed to open stream: No such file or directory in /home/gami2674/public_html/forum/includes/db.php on line 35

Warning: main(): Failed opening 'db/mysql4.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/gami2674/public_html/forum/includes/db.php on line 35

Fatal error: Cannot instantiate non-existent class: sql_db in /home/gami2674/public_html/forum/includes/db.php on line 60



EDIT- my code now reads:
define('IN_PHPBB', true);

include('forum/extension.inc');
include('forum/common.php');
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//

geocator
Registered User
Posts: 16242
Joined: Fri Jan 09, 2004 11:56 pm
Location: On dry land
Contact:

Post by geocator » Wed Jul 27, 2005 2:48 am

For this to work you absolutley must have this chunk of code:

Code: Select all

define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
No exceptions. You have to edit the root path to work correctly. There is no alternative to that.

Seelmeister
Registered User
Posts: 72
Joined: Sun Jan 11, 2004 3:43 pm
Contact:

Post by Seelmeister » Wed Jul 27, 2005 2:55 am

Yeah I saw where that was going when I opened the db.php file.

I edited the code so that $phpBB_root_path is defined correctly, and now my error message has changed again, to this;

Warning: main(../forum/extension.inc): failed to open stream: No such file or directory in /home/gami2674/public_html/templates/global_header.inc.php on line 6

Warning: main(../forum/extension.inc): failed to open stream: No such file or directory in /home/gami2674/public_html/templates/global_header.inc.php on line 6

Warning: main(): Failed opening '../forum/extension.inc' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/gami2674/public_html/templates/global_header.inc.php on line 6

Warning: main(../forum/common.php): failed to open stream: No such file or directory in /home/gami2674/public_html/templates/global_header.inc.php on line 7

Warning: main(../forum/common.php): failed to open stream: No such file or directory in /home/gami2674/public_html/templates/global_header.inc.php on line 7

Warning: main(): Failed opening '../forum/common.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/gami2674/public_html/templates/global_header.inc.php on line 7

Fatal error: Call to undefined function: session_pagestart() in /home/gami2674/public_html/templates/global_header.inc.php on line 12


Which seems to suggest that I still have the path wrong. My forums reside in a folder called "forum" so I've defnied the root value as
$phpbb_root_path = '../forum/';


Is this correct?

geocator
Registered User
Posts: 16242
Joined: Fri Jan 09, 2004 11:56 pm
Location: On dry land
Contact:

Post by geocator » Wed Jul 27, 2005 3:01 am

Where is this file in relation to the forum directory.

Seelmeister
Registered User
Posts: 72
Joined: Sun Jan 11, 2004 3:43 pm
Contact:

Post by Seelmeister » Wed Jul 27, 2005 3:04 am

The file in question is my index file, which is in the root directory of the site.

geocator
Registered User
Posts: 16242
Joined: Fri Jan 09, 2004 11:56 pm
Location: On dry land
Contact:

Post by geocator » Wed Jul 27, 2005 3:06 am

Then you should use

Code: Select all

$phpbb_root_path = './forum/';
Note only one dot.

Seelmeister
Registered User
Posts: 72
Joined: Sun Jan 11, 2004 3:43 pm
Contact:

Post by Seelmeister » Wed Jul 27, 2005 3:20 am

Okay changed to one dot, the error message is now:

Warning: Cannot modify header information - headers already sent by (output started at /home/gami2674/public_html/index.php:2) in /home/gami2674/public_html/forum/includes/sessions.php on line 206

Warning: Cannot modify header information - headers already sent by (output started at /home/gami2674/public_html/index.php:2) in /home/gami2674/public_html/forum/includes/sessions.php on line 207

Warning: init_userprefs(language/lang_english/lang_main.): failed to open stream: No such file or directory in /home/gami2674/public_html/forum/includes/functions.php on line 280

Warning: init_userprefs(language/lang_english/lang_main.): failed to open stream: No such file or directory in /home/gami2674/public_html/forum/includes/functions.php on line 280

Warning: init_userprefs(): Failed opening 'language/lang_english/lang_main.' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/gami2674/public_html/forum/includes/functions.php on line 280

Warning: init_userprefs(./includes/lang_extend_mac.): failed to open stream: No such file or directory in /home/gami2674/public_html/forum/includes/functions.php on line 294

Warning: init_userprefs(./includes/lang_extend_mac.): failed to open stream: No such file or directory in /home/gami2674/public_html/forum/includes/functions.php on line 294

Warning: init_userprefs(): Failed opening './includes/lang_extend_mac.' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/gami2674/public_html/forum/includes/functions.php on line 294

Warning: message_die(language/lang_english/lang_main.): failed to open stream: No such file or directory in /home/gami2674/public_html/forum/includes/functions.php on line 738

Warning: message_die(language/lang_english/lang_main.): failed to open stream: No such file or directory in /home/gami2674/public_html/forum/includes/functions.php on line 738

Warning: message_die(): Failed opening 'language/lang_english/lang_main.' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/gami2674/public_html/forum/includes/functions.php on line 738
phpBB :

Could not query database for theme info

DEBUG MODE

SQL Error : 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3

geocator
Registered User
Posts: 16242
Joined: Fri Jan 09, 2004 11:56 pm
Location: On dry land
Contact:

Post by geocator » Wed Jul 27, 2005 3:31 am

Thats really wierd, I wonder why it is not picking up extension.in, but everything else includes correctly.

Perhaps a direct path fir extension.inc to get it to load.

Seelmeister
Registered User
Posts: 72
Joined: Sun Jan 11, 2004 3:43 pm
Contact:

Post by Seelmeister » Wed Jul 27, 2005 3:37 am

Nope, thats making no difference I'm afraid.

Locked

Return to “2.0.x Support Forum”