Using phpBB sessions with 3.2 (external pages to board) ?

Do not post support requests, bug reports or feature requests. Discuss phpBB here. Non-phpBB related discussion goes in General Discussion!
Anti-Spam Guide
Post Reply
Lascard
Registered User
Posts: 8
Joined: Tue May 22, 2018 6:23 pm

Using phpBB sessions with 3.2 (external pages to board) ?

Post by Lascard » Tue May 22, 2018 6:33 pm

Hi,

Does this still work with version 3.2 ? the same way or similar code ??

https://www.phpbb.com/support/docs/en/3 ... tegration/

I haven't seen any update to this tutorial and since i need to convert a 3.0.x phpBB board to 3.2 i want to ascertain i can still use sessions on the same site on pages outside the board

Many thanks for your help

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

Re: Using phpBB sessions with 3.2 (external pages to board) ?

Post by kinerity » Tue May 22, 2018 6:41 pm

After a quick look, it may, but since it was wrote for 3.0 some principles may be different. I'd be interested in hearing the outcome if you decide to try it.
Kailey Truscott - Community Team

Lascard
Registered User
Posts: 8
Joined: Tue May 22, 2018 6:23 pm

Re: Using phpBB sessions with 3.2 (external pages to board) ?

Post by Lascard » Tue May 22, 2018 7:31 pm

Thanks Kailey for your feedback.

Since converting the site with the 3.0.x board to 3.2 is no small endeavor, i would need to test on a new forum/ dummy site to see how it goes first.

Unless someone else is already using these phpbb sessions with the 3.2 version successfully ?
Tkx

User avatar
GanstaZ
Registered User
Posts: 534
Joined: Wed Oct 11, 2017 10:29 pm
Location: Zverse

Re: Using phpBB sessions with 3.2 (external pages to board) ?

Post by GanstaZ » Tue May 22, 2018 7:36 pm

It doesn't differ that much, depends on what you want to achieve and how. It worked for me before i switched to extension & front controller development. Don't remember everything in that topic, but it should work til we reach 3.3 or higher.
"When answer lies in the question,.. question becomes redundant!"

Lascard
Registered User
Posts: 8
Joined: Tue May 22, 2018 6:23 pm

Re: Using phpBB sessions with 3.2 (external pages to board) ?

Post by Lascard » Wed May 23, 2018 12:46 pm

Thanks for your feedback.
Right now these phpBB sessions are used on site pages outside the phpBB board so the content is only seen to registered users and/or belonging to one specific group.
I'd like to extend this across the whole site (without using a bridge to another CMS) by just adding the phpBB sessions first in the header of these external pages.

User avatar
GanstaZ
Registered User
Posts: 534
Joined: Wed Oct 11, 2017 10:29 pm
Location: Zverse

Re: Using phpBB sessions with 3.2 (external pages to board) ?

Post by GanstaZ » Wed May 23, 2018 3:11 pm

If forum path is correct in all those files where you want to use session, then there will be no problems.
"When answer lies in the question,.. question becomes redundant!"

Lascard
Registered User
Posts: 8
Joined: Tue May 22, 2018 6:23 pm

Re: Using phpBB sessions with 3.2 (external pages to board) ?

Post by Lascard » Thu May 24, 2018 10:00 am

kinerity wrote:
Tue May 22, 2018 6:41 pm
I'd be interested in hearing the outcome if you decide to try it.
Following GanstaZ feedback, I run a simple test (see below) with a phpbb3.2.2 board version and apparently it works OK

Code (coded with my feet, pls. upgrade !) to get user name, group name and print the relevant content if user belongs to the right group

Code: Select all

<?php 
define('IN_PHPBB', true);
$phpbb_root_path = './forum/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
$user->session_begin();

//$auth->acl($user->data);
//$user->setup();

		
if ($user->data['user_id'] != ANONYMOUS)   
{  
	$usera = ucfirst($user->data['username_clean']);	
	$groupnumber= $user->data['group_id'];
	
//$db->sql_query($sql);

$sql = 'SELECT group_name
			FROM ' . GROUPS_TABLE . '
			WHERE group_id = ' . $groupnumber;
			
		$result = $db->sql_query($sql);
		$row = $db->sql_fetchrow($result);
		$groupname=$row['group_name'];	
		$db->sql_freeresult($result);
		
		
	
	echo ('<h4>Hello  '.$usera.'&nbsp;!</h4><p>You are a member of this group : "'.$groupname.'"</p> ');
		
		
		if ($groupnumber == "number i.e. group_id of your board premium group")
		{echo '<p><h2>Hello premium group member !</h2></p>'; 
		}
		else
		{echo 'You are not allowed to see this page premium content'; 
		}			
}		
else 
{echo '<h4>Please <a href="'.$phpbb_root_path.'ucp.php?mode=login">login</a></h4>'; 
}

?>

Post Reply

Return to “phpBB Discussion”

Who is online

Users browsing this forum: hewmac06 and 18 guests