Drupal refresh
Мод предназначен для ограничения количества соединений с одного IP-адреса и ограничения числа сессий. В администраторской панели, в настройках конфигурации можно указывать количество соединений с одного IP и максимально возможное количество сессий. Если вы выставите всего лишь одно соединение для одного IP адреса, то в этом случаи при попытке зайти под вторым никнаймом на форум или еще одном соединении – появляется окно, в котором говорится о невозможности соединения.
В целом, мод для безопасности.
Сейчас у меня в его использовании отпала необходимость и я бы хотел произвести удаление его.
Так как мод использует обновление базы данных, то помимо физического удаления кодов микропрограммы потребуется удалить соответствующие таблицы из bd.
Вопрос к разбирающимся в этом людям: удалять нужно из таблицы :: phpbb***config
max_sessions и max_sessions_ip – вот эти данные?
Код: Выделить всё
'INSERT INTO '. CONFIG_TABLE . ' (config_name, config_value) VALUES ("max_sessions", "50")',
'INSERT INTO '. CONFIG_TABLE . ' (config_name, config_value) VALUES ("max_sessions_ip", "8")'
Код: Выделить всё
##############################################################
## MOD Title: Max sessions
## MOD Author: Niels < ncr@db9.dk > (Niels Chr. Rшd) http://mods.db9.dk
## MOD Description: This mod will prevent users of connecting
## to the site, if there is currently the
## maximal accepted connections.
## MOD Version: 0.9.2
## MOD Compatibility: 2.0.2->2.0.6
##
## Installation Level: Easy
## Installation Time: 5 Minutes (1mn by EasyMOD of Nuttzy)
## Files To Edit: 4
## admin/admin_board.php
## includes/sessions.php
## language/lang_english/lang_admin.php
## templates/subSilver/admin/board_config.tpl
##
## Included Files: 1
## max_sessions_db_update.php
##
##############################################################
## 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:
##
## 1. Full MOD description
## -----------
## This mod will prevent users of connecting to the site, if
## there is currently the maximal accepted connections. Users
## will have to wait, until other users "disaper" from the session
## table (5 min).
## You will also be able to disallow same IP having more connections.
## Note: A connection is in current version kept for 1 min -
## so if a user close one of his/her browsers, the connection
## is kept for 1 min.
## This can be seen if max number of connections is reached and
## the client is closing some of the open windows (browsers),
## he/she will only get access again after aprox 1 min.
## Same apply for overall connections, it counts all connections
## back for 1 min.
##
## 2. EasyMOD
## -----------
## This MOD is compatible and can be installed by EasyMOD
## of Nuttzy (but is not officially EasyMOD Compliant)!
## http://area51.phpbb.com/phpBB22/viewforum.php?sid=&f=15
##
## However, on alpha releases of EM and meanwhile beta or
## final release some actions are NOT performed.
## You'll have to do them manually !
##
## 2.1 SQL commands are not performed
## -----------
## This MOD need a database update.
## Then, in any case if you install this MOD manually or using
## an alpha release of EM, please copying the *_db_update.php
## in your phpBB root directory, run it with your navigator,
## and then delete it from the phpBB root directory.
##
## Please, do it NOW! Before editing phpBB files by EM or manually!!!
## Otherwise, you may have an error message during your next
## connection.
##
## 2.2 Translation are not managed
## -----------
## Moreover, EM can not already manage actions for any other
## language than English (but language intructions are proceed
## to all installed languages in order to prevent errors).
## So the translations provided with this MOD must be installed
## manually if you need them.
##
## 3. Official last version link
## -----------
## Meanwhile the phpBB group validation and as the MOD is not yet
## in the phpBB MOD database, check this official link for updates...
## http://mods.db9.dk/viewtopic.php?t=704
##
##############################################################
## MOD History:
##
## 2004-01-05 - Version 0.9.2
## - phpBB template & EasyMOD compliance enhancement
## - Deutsch, Dutch, French, Italian & Spanish
## translations now provide with the MOD
##
## ????-??-?? - Version 0.9.1
## - fixed a bug in the template
##
## ????-??-?? - Version 0.9.0
## - initial BETA
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ COPY ]------------------------------------------------
#
copy max_sessions_db_update.php to max_sessions_db_update.php
#
# This MOD need a database update.
# Then, as you must have now copied the max_sessions_db_update.php file
# in your phpBB root directory, run it with your navigator...
# http://www.yourWebSite.xxx/phpbbRootDir/max_sessions_db_update.php
#
# ...and then delete it from the phpBB root directory!!!
#
# Please, do it NOW! Before editing phpBB files by EM or manually!!!
# Otherwise, you may have an error message during your next
# connection.
#
#
#-----[ OPEN ]------------------------------------------------
#
admin/admin_board.php
#
#-----[ FIND ]------------------------------------------------
#
"L_ENABLE_PRUNE" =>
#
#-----[ AFTER, ADD ]------------------------------------------
#
// Start add - Max sessions MOD
'L_MAX_SESSIONS' => $lang['Max_sessions'],
'L_MAX_SESSIONS_EXPLAIN' => $lang['Max_sessions_explain'],
'L_MAX_SESSIONS_IP' => $lang['Max_sessions_ip'],
'L_MAX_SESSIONS_IP_EXPLAIN' => $lang['Max_sessions_ip_explain'],
// End add - Max sessions MOD
#
#-----[ FIND ]------------------------------------------------
#
"PRUNE_NO" =>
#
#-----[ AFTER, ADD ]------------------------------------------
#
// Start add - Max sessions MOD
'MAX_SESSIONS' => $new['max_sessions'],
'MAX_SESSIONS_IP' => $new['max_sessions_ip'],
// End add - Max sessions MOD
#
#-----[ OPEN ]------------------------------------------------
#
includes/sessions.php
#
#-----[ FIND ]------------------------------------------------
#
if ( !$db->sql_query($sql) || !$db->sql_affectedrows() )
{
#
#-----[ AFTER, ADD ]------------------------------------------
#
// Start add - Max sessions MOD
$sql = "SELECT user_id FROM ".USERS_TABLE." u, ".SESSIONS_TABLE." s
WHERE s.session_time >= ".( time() - 90 ) . "
AND u.user_id = s.session_user_id
GROUP BY s.session_ip, u.username";
if( !($result = $db->sql_query($sql)) )
{
message_die(CRITICAL_MESSAGE, 'Could not obtain user/online information', '', __LINE__, __FILE__, $sql);
}
$total_users = $db->sql_numrows($result);
if ( $total_users >= $board_config['max_sessions'] )
{
message_die(CRITICAL_MESSAGE, sprintf('Max connections reatched, (%d) please try again later',$board_config['max_sessions']), '', __LINE__, __FILE__, $sql);
}
$sql = "SELECT session_user_id FROM ".SESSIONS_TABLE."
WHERE session_time >= ".( time() - 90 ) . "
AND session_ip='".$user_ip."'". (($user_id == ANONYMOUS) ? "" :" AND session_user_id='".$user_id."'" ) ;
if( !($result = $db->sql_query($sql)) )
{
message_die(CRITICAL_MESSAGE, 'Could not obtain users online information'.$sql, '', __LINE__, __FILE__, $sql);
}
$total_users = $db->sql_numrows($result);
if ( $total_users >= $board_config['max_sessions_ip'] )
{
message_die(CRITICAL_MESSAGE, sprintf('Max connections per IP reatched, (%d) please use fewer open windows',$board_config['max_sessions_ip']), '', __LINE__, __FILE__, $sql);
}
// End add - Max sessions MOD
#
#-----[ OPEN ]------------------------------------------------
#
language/lang_english/lang_admin.php
#
#-----[ FIND ]------------------------------------------------
#
?>
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
// Start add - Max sessions MOD
$lang['Max_sessions'] = 'Max sessions allowed';
$lang['Max_sessions_explain'] = 'This is the max number of sessions, the forum accept';
$lang['Max_sessions_ip'] = 'Max sessions allowed per IP';
$lang['Max_sessions_ip_explain'] = 'This is the max number of sessions per IP, the forum accept';
// End add - Max sessions MOD
#
#-----[ OPEN ]------------------------------------------------
#
# Make sure to edit this file for every theme your admin uses
#
templates/subSilver/admin/board_config_body.tpl
#
#-----[ FIND ]------------------------------------------------
#
{S_DISABLE_BOARD_YES}
</tr>
#
#-----[ AFTER, ADD ]------------------------------------------
#
<!-- Start add - Max sessions MOD -->
<tr>
<td class="row1">{L_MAX_SESSIONS}<br /><span class="gensmall">{L_MAX_SESSIONS_EXPLAIN}</span></td>
<td class="row2"><input type="text" size="6" maxlength="5" name="max_sessions" value="{MAX_SESSIONS}" /></td>
</tr>
<tr>
<td class="row1">{L_MAX_SESSIONS_IP}<br /><span class="gensmall">{L_MAX_SESSIONS_IP_EXPLAIN}</span></td>
<td class="row2"><input type="text" size="6" maxlength="5" name="max_sessions_ip" value="{MAX_SESSIONS_IP}" /></td>
</tr>
<!-- End add - Max sessions MOD -->
#
#-----[ SAVE/CLOSE ALL FILES ]--------------------------------
#
# EoM
max_sessions_db_update
Код: Выделить всё
<?
#########################################################
## SQL commands to phpBB2
## Author: Niels Chr. Rшd
## Nickname: Niels Chr. Denmark
## Email: ncr@db9.dk
##
## Ver 1.0.7
##
## phpBB2 database update script for mods
## this file is intended to use with phpBB2, when installing mods
## after so you may delete this file, but only admin can use so it really doesen't matter
## The script will look what prefix you are using, and use the existing DB defined by congig.php
## The execution of this script's included SQL is harmless, so you can run it as meny times you like
## note, though that the users last visit, will be set back to his/her last login,
## but that is a minor cosmetic isue, that will correct it self next time the use logs in
##
## the following example are from my mods, and you can add some self, for other mods if you like
## you will after execution get a list over those commands that are run with succes and those with warnings !
## delete the sample lines if you are using it only for other mods
##
#########################################################
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'includes/functions_selects.'.$phpEx);
###################################################################################################
##
## put the SQL commands below here, the SQL commands listed below are only exampels, substitude them with the one you need ##
##
###################################################################################################
$sql=array(
'INSERT INTO '. CONFIG_TABLE . ' (config_name, config_value) VALUES ("max_sessions", "50")',
'INSERT INTO '. CONFIG_TABLE . ' (config_name, config_value) VALUES ("max_sessions_ip", "8")'
);
$mods = array (
'max sessions mod','max sessions mod',
);
############################################### Do not change anything below this line #######################################
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//
if ($userdata['user_level']!=ADMIN)
message_die(GENERAL_ERROR, "You are not Authorised to do this");
$n=0;
$message="<b>This list is a result of the SQL queries needed for mod</b><br/><br/>";
while($sql[$n])
{
$message .= ($mods[$n-1] != $mods[$n]) ? '<p><b><font size=3>'.$mods[$n].'</font></b><br/>' : '';
if(!$result = $db->sql_query($sql[$n]))
$message .= '<b><font color=#FF0000>[Already added]</font></b> line: '.($n+1).' , '.$sql[$n].'<br />';
else $message .='<b><font color=#0000fF>[Added/Updated]</font></b> line: '.($n+1).' , '.$sql[$n].'<br />';
$n++;
}
message_die(GENERAL_MESSAGE, $message);
?>