Using phpbb login for my entire website

Do not post support requests, bug reports or feature requests. Discuss phpBB here. Non-phpBB related discussion goes in General Discussion!
Suggested Hosts
Locked
bars999
Registered User
Posts: 3
Joined: Sat Jan 19, 2008 7:07 pm

Using phpbb login for my entire website

Post by bars999 »

I want to have a web site with a phpbb message board integrated into it.
The thing is I want to be able to have a login for the entire site, not just the forum.

I was wondering if I could somehow integrate the phpBB login/authentication code into my other web pages or else add additional web pages to the phpBB forum. Which one is better and how would exactly I do it?

Your help would be VERY greatly appreciated!

- Andrew
User avatar
A_Jelly_Doughnut
Former Team Member
Posts: 34457
Joined: Sat Jan 18, 2003 1:26 am
Location: Where the Rivers Run
Contact:

Re: Using phpbb login for my entire website

Post by A_Jelly_Doughnut »

Yes, and it is fairly easy to do. See this tutorial :)
A Donut's Blog
"Bach's Prelude (Cello Suite No. 1) is driving Indiana country roads in Autumn" - Ann Kish
Stuiterbal
Registered User
Posts: 5
Joined: Sat Jan 19, 2008 8:02 pm

Re: Using phpbb login for my entire website

Post by Stuiterbal »

I had something similar in mind. I want to integrate PHPBB3 in my website, with a normal page, a link to a forum (target="_blank") but NOT the normal forum header.

So something like:

------
Login
username []
password []
-------

NEWS

------
Latest topics from newsforum
------


I made this so far: http://robinj.gethost.nl/oldskool/index2.php
So i'd like to have that banner removed and make customise it with my own layout.
Is it possible to make a custom login with the phpbb3 database, verify the usergroup (only a few users can see this site) and when clicked on forumindex going on with the same session?

I don't know if this is possible and I am a beginner in PHP.

Thanks in advance.
User avatar
eruckus
Registered User
Posts: 14
Joined: Sat Jan 19, 2008 5:39 pm

Re: Using phpbb login for my entire website

Post by eruckus »

i have been searching these forums and was looking for something similar as well...

i have a friend that im helping out with some code. i am looking to have a regular homepage on my site, something that doesn't necessarily resemble the style of my forum. on that homepage i wanted to have a custom login_box() or something similar that will log me into the forums and carry the session around my site as well.

furthermore i wanted certain groups that would be defined in phpbb to have access to certain forums and not others. that is pretty easy and i know how to accomplish that, but i also wanted these same groups to have access to certain parts of my site and not others. i wanted to know if once i get phpbb to carry the session across my site is there a way i can call a function or variable to tell me what group the user is a part of so i can direct them to certain parts of my site and keep them out of others.

im running phpbb 3.0.0, apache 2, mysql 5, php 4.4.3 and im pretty ok with php...just in case anyone wanted to know.

thanks in advance!! :D :D
la la laaa...
Stuiterbal
Registered User
Posts: 5
Joined: Sat Jan 19, 2008 8:02 pm

Re: Using phpbb login for my entire website

Post by Stuiterbal »

Stuiterbal wrote:
So i'd like to have that banner removed and make customise it with my own layout.
I know how to accomplish this now.
Still, I have no idea how to realise the following:
Stuiterbal wrote: Is it possible to make a custom login with the phpbb3 database, verify the usergroup (only a few users can see this site) and post the text listed in the NEWS forum.
bars999
Registered User
Posts: 3
Joined: Sat Jan 19, 2008 7:07 pm

Re: Using phpbb login for my entire website

Post by bars999 »

eruckus wrote:i have been searching these forums and was looking for something similar as well...

i have a friend that im helping out with some code. i am looking to have a regular homepage on my site, something that doesn't necessarily resemble the style of my forum. on that homepage i wanted to have a custom login_box() or something similar that will log me into the forums and carry the session around my site as well.

furthermore i wanted certain groups that would be defined in phpbb to have access to certain forums and not others. that is pretty easy and i know how to accomplish that, but i also wanted these same groups to have access to certain parts of my site and not others. i wanted to know if once i get phpbb to carry the session across my site is there a way i can call a function or variable to tell me what group the user is a part of so i can direct them to certain parts of my site and keep them out of others.

im running phpbb 3.0.0, apache 2, mysql 5, php 4.4.3 and im pretty ok with php...just in case anyone wanted to know.

thanks in advance!! :D :D
This is what I wanted to. I don't really want the rest of my site to resemble the phpbb board. But I do want it to have a phpBB login.
Stuiterbal
Registered User
Posts: 5
Joined: Sat Jan 19, 2008 8:02 pm

Re: Using phpbb login for my entire website

Post by Stuiterbal »

does anyone know?
User avatar
eruckus
Registered User
Posts: 14
Joined: Sat Jan 19, 2008 5:39 pm

Re: Using phpbb login for my entire website

Post by eruckus »

well im working on something that will work, but im having trouble getting files outside of phpbb recognize phpbb's sessions. i am currently using an adapted version of cafepixie's idea to meet my needs. you can check it out on my server here. no hacking, please. ;)

this method uses phpbb's cookies instead of phpbb's sessions, but ive been told its a better idea to use sessions, so thats where i am now. if you can look past the ugly design of the site, you'll be able to see the potential this idea has. if anyone is interested in seeing the code for that site, just PM me. if anyone has any input that could help me, its very much appreciated! thanks!

you might also want to see my post about phpbb sessions here. thanks again!

-e.ruckus
la la laaa...
User avatar
eruckus
Registered User
Posts: 14
Joined: Sat Jan 19, 2008 5:39 pm

Re: Using phpbb login for my entire website

Post by eruckus »

well i reciently figured this out and thought i should share with the thread...

first off, just like everyone tells you, you need to add this at the top of all your pages outside your forum directory that you want phpbb to have session control over:

Code: Select all

<?php
define('IN_PHPBB', true);
$phpbb_root_path = './forums/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
 
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
?>
make sure you change the $phpbb_root_path variable to match your path to phpbb from the site you are pasting that code into. if phpbb cant find the correct directory the sessions will fail to work correctly throughout your site. also, this code should come at the very top of your page. if there is any HTML markup before this code, phpbb's sessions wont work correctly throughout your site.

secondly, check your cookie settings. the cookie path should be the path to your root directory (for example: /). if it is anything other than that, change it. this will make phpbb cookies work sitewide.

thirdly, you'll need a login form so visitors can log into your site as well as the forums at the same time. Kber had a solution that worked for me and hopefully it can work for you too. check out this thread.

hopefully ive helped someone out!
la la laaa...
majjk99
Registered User
Posts: 238
Joined: Sun Dec 07, 2003 10:36 pm
Location: EU

Re: Using phpbb login for my entire website

Post by majjk99 »

eruckus wrote:well i reciently figured this out and thought i should share with the thread...

first off, just like everyone tells you, you need to add this at the top of all your pages outside your forum directory that you want phpbb to have session control over:

Code: Select all

<?php
define('IN_PHPBB', true);
$phpbb_root_path = './forums/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
 
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
?>
make sure you change the $phpbb_root_path variable to match your path to phpbb from the site you are pasting that code into. if phpbb cant find the correct directory the sessions will fail to work correctly throughout your site. also, this code should come at the very top of your page. if there is any HTML markup before this code, phpbb's sessions wont work correctly throughout your site.

secondly, check your cookie settings. the cookie path should be the path to your root directory (for example: /). if it is anything other than that, change it. this will make phpbb cookies work sitewide.

thirdly, you'll need a login form so visitors can log into your site as well as the forums at the same time. Kber had a solution that worked for me and hopefully it can work for you too. check out this thread.

hopefully ive helped someone out!

I get the following error message when following these instructions:

Code: Select all

Fatal error: Call to a member function on a non-object in /home/stuff/public_html/includes/cache.php on line 51
any ideas what the problem could be?
User avatar
eruckus
Registered User
Posts: 14
Joined: Sat Jan 19, 2008 5:39 pm

Re: Using phpbb login for my entire website

Post by eruckus »

well it could be a number of different things, but as long as correctly included the snippet of code to the top of the script, and you have correctly edited your cookie settings its probably an error with your script. or possibly the phpbb session and some part of your script arent playing well together...

whats on/around line 51?
la la laaa...
majjk99
Registered User
Posts: 238
Joined: Sun Dec 07, 2003 10:36 pm
Location: EU

Re: Using phpbb login for my entire website

Post by majjk99 »

never mind. me doing silly things... didn't include the code on the very top of the script. now put it on top, and it seems to work. thanks anyway.
User avatar
RoiDanton
Registered User
Posts: 9
Joined: Sun Feb 10, 2008 7:16 pm
Name: Roi Danton

Re: Using phpbb login for my entire website

Post by RoiDanton »

Hi all,

I know it's old but I still have this problem :)

I tried this on a test page but the page always showed up. I've just the code an a text sting in my index.php.
Any suggestions what I'm missing here?

Thanks for any help!

Roi
User avatar
KaileyT
Community Team Member
Community Team Member
Posts: 2845
Joined: Mon Sep 01, 2014 1:00 am
Location: sudo rm -rf /
Name: Kailey Truscott
Contact:

Re: Using phpbb login for my entire website

Post by KaileyT »

Please start a new topic in our phpBB Custom Coding forum instead of rehashing an 11½ year old topic. Thanks!
Kailey Truscott - Community Team
Locked

Return to “phpBB Discussion”