integration user group access to external site.

Discussion forum for Extension Writers regarding Extension Development.
Post Reply
aldix5
Registered User
Posts: 1
Joined: Tue Jan 24, 2017 5:32 am

integration user group access to external site.

Post by aldix5 »

Hey there,
here is what i need help for integraion phpbb user group acces to my website.

forum and site location:
forum : htdocs/forum
site : htdocs/forum/site

in user setting forum, one user has multiple group.
example:
Group1
Group2
Group3
Group4
Group5
Group6
etc

what i need is :
login validation using name, password and group phpbb user db, so who can login to my site only user has group 1-2 and 8.
And in site i have special menu can only access for user has login and has group 3.
so,
user 1 ->group 1 & group 3 --- Can login and can access special menu
user 2 ->group 2 & group 3 --- Can login and can access special menu
user 2 ->group 8 & group 3 --- Can login and can access special menu
user 3 ->group 1 & group 4 --- Can login and can't access special menu
user 4 ->group 1 & group 5 --- Can login and can't access special menu
user 5 ->group 6 & group 7 --- Can't login and can't access special menu
user 5 ->group 6 & group 3 --- Can't login and can't access special menu
user 6 ->group 1 & group 3 & group 7 --- Can login and can access special menu

in my site login page<login.php>

Code: Select all

<?php 
	error_reporting(E_ALL ^ E_NOTICE);
	define('IN_PHPBB', true);
	$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : '../';
	$phpEx = substr(strrchr(__FILE__, '.'), 1);
	require($phpbb_root_path . 'common.' . $phpEx);

	// Start session management
	$user->session_begin();
	$auth->acl($user->data);
	$user->setup();

	if ($user->data['user_id'] == ANONYMOUS)
	{
		?>
		//html design login form
		<?php
	}
	else
	{
		header("location:index.php?web=Error&error=You already log in");		
	}
?>

In index.php:

Code: Select all

<?php
	define('IN_PHPBB', true);
	$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : '../';
	$phpEx = substr(strrchr(__FILE__, '.'), 1);
	require($phpbb_root_path . 'common.' . $phpEx);
	require($phpbb_root_path . 'includes/functions_user.' . $phpEx);

	// Start session management
	$user->session_begin();
	$auth->acl($user->data);
	$user->setup();
	$sgp = mysql_query('SELECT group_id FROM ' . USER_GROUP_TABLE . ' WHERE user_id = '. (int) $user->data['user_id']);
	$rs = mysql_fetch_array($sgp);    <<<<---- fail in user7 example
	//$rs = mysql_num_rows($result); <<<<---- fail in all user example
	
	if ($user->data['user_id'] == ANONYMOUS)
	{
		header("location:login.php?web=Error&error=You must login first!!");
	}
	else if ($user->data['is_bot'])
    	{
		header("location:/forum/index.php?web=Error&error=You can't access that page!!");
	}
	else if($rs['group_id'] == '1' || $rs['group_id'] == '2' )
	{
		?>
		//design index page
		<?php
	}
	else
	{
		header("location:/forum/index.php?web=Error&error=You can't access that page!!");
	}
?>
can anyone help with this problem? thank you
br, aldix.
User avatar
stevemaury
Support Team Member
Support Team Member
Posts: 52768
Joined: Thu Nov 02, 2006 12:21 am
Location: The U.P.
Name: Steve
Contact:

Re: integration user group access to external site.

Post by stevemaury »

This is quite a bit beyond the scope of this forum, which is support for basic phpBB 3.2.x. I will move it to Extension writer's discussion.
I can stop all your spam. I can upgrade or update your Board. PM or email me. (Paid support)
pkbarbiedoll
Registered User
Posts: 94
Joined: Sat Dec 01, 2007 12:10 am

Re: integration user group access to external site.

Post by pkbarbiedoll »

Did you get this sorted, aldix5?
Post Reply

Return to “Extension Writers Discussion”