otester Posted July 27, 2010 Share Posted July 27, 2010 Basically I want users to use the forum login/register page and get the PHPBB3 session to be effective on external (non-forum pages) so I can control access to other parts of the site for specific user groups. My forum is located in: www.example-domain.com/forum/ Currently following the tutorial: http://www.phpbb.com/kb/article/phpbb3-sessions-integration/ Here's my site code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Testing</title> </head> <body> <?php define('IN_PHPBB', true); $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : '/forum/'; $phpEx = substr(strrchr(__FILE__, '.'), 1); include($phpbb_root_path . 'common.' . $phpEx); // Start session management $user->session_begin(); $auth->acl($user->data); $user->setup(); ?> <?php if ($user->data['user_id'] == ANONYMOUS) { echo 'Please login!'; } else { echo 'Thanks for logging in, ' . $user->data['username_clean']; } ?> </body> </html> I get 3 errors: [27-Jul-2010 22:37:22] PHP Warning: include(/forum/common.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory in /home/punchcom/public_html/testing/test.php on line 13 [27-Jul-2010 22:37:22] PHP Warning: include() [<a href='function.include'>function.include</a>]: Failed opening '/forum/common.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/punchcom/public_html/testing/test.php on line 13 [27-Jul-2010 22:37:22] PHP Fatal error: Call to a member function session_begin() on a non-object in /home/punchcom/public_html/testing/test.php on line 16 Any ideas? Thanks, otester Link to comment https://forums.phpfreaks.com/topic/209048-integrating-phpbb3-session-with-site/ Share on other sites More sharing options...
otester Posted July 28, 2010 Author Share Posted July 28, 2010 Got it to work, hope this helps anyone else that stumbles by this thread. To remove the previous errors I changed the phpbb_root_path from "/forum/" to "../forum/". Also keep the first PHP block on top of everything else. Heres the code: <?php define('IN_PHPBB', true); $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : '../forum/'; $phpEx = substr(strrchr(__FILE__, '.'), 1); include($phpbb_root_path . 'common.' . $phpEx); // Start session management $user->session_begin(); $auth->acl($user->data); $user->setup(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Testing</title> </head> <html> <body> <?php if ($user->data['user_id'] == ANONYMOUS) { echo 'Please login!'; } else { echo 'Thanks for logging in, ' . $user->data['username_clean']; } ?> </body> </html> Link to comment https://forums.phpfreaks.com/topic/209048-integrating-phpbb3-session-with-site/#findComment-1091895 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.