Make phpBB Sessions Work on Pages Outside of phpBB Root

This forum is now closed as part of retiring phpBB2.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

This forum is now closed due to phpBB2.0 being retired.
User avatar
Lumpy Burgertushie
Registered User
Posts: 66921
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: Make phpBB Sessions Work on Pages Outside of phpBB Root

Post by Lumpy Burgertushie » Thu Feb 21, 2008 4:24 am

legohalflife2man wrote:Well, is there a way to use session switches in a php file?
that is not how it works, you create the switch in the php file then you use it in the tpl file or maybe a html file ( not sure about the html file ).

if you want to use phpbb's sessions in a page outside of phpbb, you just have to add the phpbb code to the top of the page with the correct path to phpbb and make it a php file.


robert
I'm baaaaaccckkkk. still doing work on donation basis. PM your needs.

Premium phpBB 3.2 Styles by PlanetStyles.net

If a tree falls in the forest and nobody is there, does it make a sound?

User avatar
Tom
Former Team Member
Posts: 2665
Joined: Tue Jun 20, 2006 2:12 am
Name: Tom Catullo
Contact:

Re: Make phpBB Sessions Work on Pages Outside of phpBB Root

Post by Tom » Thu Feb 21, 2008 10:19 pm

I know. But how do I make it where people who are logged in to the forum see something different on the web page than people who are not logged into the forum? That's what I'm trying to get at.
Tom Catullo - Former Moderator Team Member
phpBB3 Smiley Pak Generator | Legend Repositioning MOD | My GitHub | My Site

User avatar
drathbun
Former Team Member
Posts: 12204
Joined: Thu Jun 06, 2002 3:51 pm
Location: TOPICS_TABLE
Contact:

Re: Make phpBB Sessions Work on Pages Outside of phpBB Root

Post by drathbun » Fri Feb 22, 2008 6:23 am

Look at the index page, specifically the combination of index.php and index_body.tpl. You will see how the login form is displayed for users that are not logged in, while it's hidden from users that are logged in. As stated, there is a combination of php and template code. The php code is responsible for checking the status of the user (easiest way is to use $userdata['session_logged_in'] to verify) and then a template switch in the index_body.tpl that surrounds the code you want to show or hide.
I blog about phpBB: phpBBDoctor blog
Still using phpbb2? So am I! Click below for details
Image

User avatar
Dog Cow
Registered User
Posts: 2495
Joined: Fri Jan 28, 2005 12:14 am
Contact:

Re: Make phpBB Sessions Work on Pages Outside of phpBB Root

Post by Dog Cow » Sat Feb 23, 2008 5:30 pm

legohalflife2man wrote:Well, is there a way to use session switches in a php file?
Yes, use

Code: Select all

if ( $userdata['session_logged_in'] )
{
    echo('you are logged in');
}
else
{
    echo('you are not logged in');
}
Moof!
Mac GUI Vault: Retro Apple II & Macintosh computing archive.
Inside Allerton bookMac GUIMac 512K Blog

User avatar
Tom
Former Team Member
Posts: 2665
Joined: Tue Jun 20, 2006 2:12 am
Name: Tom Catullo
Contact:

Re: Make phpBB Sessions Work on Pages Outside of phpBB Root

Post by Tom » Sun Mar 16, 2008 5:11 pm

Thanks a lot, Dog Cow! That is exactly what I needed.
Tom Catullo - Former Moderator Team Member
phpBB3 Smiley Pak Generator | Legend Repositioning MOD | My GitHub | My Site

Post Reply

Return to “[2.0.x] MOD Writers Discussion”