##############################################################
## MOD Title: your site auth with bpbBB
## MOD Author: baa-lamb < more_then_spam(a)mail.ru > (Nikita V Postnikov) http://n-postnikov.narod.ru
## MOD Description: Adds phpBB authentification to your site.
## MOD Version: 0.0.1a
##
## Installation Level: Easy
## Installation Time: 1 minutes
## Files To Edit: includes/page_header.php
## templates/subSilver/overall_header.tpl
## Included Files: n/a
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD’s not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/
##############################################################
## Author Notes:
##
## This MOD has been tested on phpBB 2.0.19.
##
##############################################################
##
## MOD History:
##
## 2006-01-20 - Version 0.0.1a
## - Initial release
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#—–[ OPEN ]——————————————
#
includes/page_header.php
#
#—–[ FIND ]——————————————
#
‘U_SEARCH_UNANSWERED’ => append_sid(’search.’.$phpEx.’?search_id=unanswered’),
#
#—–[ BEFORE, ADD ]————————————
#
‘U_SCRIPT_PATH’ => $board_config[’script_path’],
#
#—–[ OPEN ]——————————————
#
templates/subSilver/overall_header.tpl
#
#—–[ FIND ]——————————————
# You must find all affiliations
@import url(”templates/
#
#—–[ REPLACE WITH ]——————————————
# You must replace all affiliations
@import url(”{U_SCRIPT_PATH}templates/
#
#—–[ FIND ]——————————————
# You must find all affiliations
@import url(”{U_SCRIPT_PATH}templates/
<a href=”{#
#
#—–[ REPLACE WITH ]——————————————
# You must replace all affiliations
<a href=”{U_SCRIPT_PATH}{
#
#—–[ FIND ]——————————————
# You must find all affiliations
<img src=”templates/#
#
#—–[ REPLACE WITH ]——————————————
# You must replace all affiliations
<img src=”{U_SCRIPT_PATH}templates/
#
#—–[ SAVE/CLOSE ALL FILES ]——————————————
#
# EoM
Далее в начале страницы на кторой требуется аутентификация (про функцию include() рассказывать не буду) вставляем:
Код:
/******************************************************************************************************************/
$access_group_id = 6; //идентификатор группы, которой разрешён доступ к странице.
/******************************************************************************************************************/
define(’IN_PHPBB’, true);
$phpbb_root_path = $_SERVER[’DOCUMENT_ROOT’].’/forum/’; //ну или где у вас там болтается форум
include($phpbb_root_path . ‘extension.inc’);
include($phpbb_root_path . ‘common.’.$phpEx);
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//
/******************************************************************************************************************/
/* всех, кто не залогинился перенаправляем на страницу логина */
if ( !$userdata[’session_logged_in’] )
{
redirect(append_sid(”login.$phpEx”, true));
}
/******************************************************************************************************************/
/* Выдёргиваем информацию */
$user_id = $userdata[’user_id’];
/******************************************************************************************************************/
//
// Get group_id for this user_id
//
$sql = “SELECT ug.group_id
FROM ” . USER_GROUP_TABLE . ” ug
WHERE ug.user_id = $user_id
AND ug.group_id = $access_group_id”;
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, ‘Could not select info from user/user_group table’, ”, __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
$group_id = $row[’group_id’];
$db->sql_freeresult($result);
/**************************************************************************************************************/
/* У группы, в которую включен пользователь нет прав доступа */
if ( empty($group_id) )
{
message_die(GENERAL_ERROR, ‘Доступ не разрешён. Обратитесь к администратору.’, ”, ”, ”, ”);
}
/**************************************************************************************************************/
источник:http://phpbbguru.net/community/topic5618.html
Popularity: 5% [?]