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!!");
}
?>
br, aldix.