Просмотр исходного кода

Adds Panel Settings for Number of Failed Logins Before Banning

own3mall 9 лет назад
Родитель
Сommit
652ceabedb

+ 5 - 0
includes/database_mysql.php

@@ -109,6 +109,11 @@ class OGPDatabaseMySQL extends OGPDatabase
 		while ( $row = mysql_fetch_assoc($result) )
 			$results[$row['setting']] = strip_real_escape_string($row['value']);
 
+		// Default setting values in case one hasn't been set
+		if(!isset($results["login_attempts_before_banned"]) || empty($results["login_attempts_before_banned"]) || !is_numeric($results["login_attempts_before_banned"])){
+			$results["login_attempts_before_banned"] = 6;
+		}
+
 		return $results;
 	}
 

+ 5 - 0
includes/database_mysqli.php

@@ -106,6 +106,11 @@ class OGPDatabaseMySQL extends OGPDatabase
 		while ( $row = mysqli_fetch_assoc($result) )
 			$results[$row['setting']] = strip_real_escape_string($row['value']);
 
+		// Default setting values in case one hasn't been set
+		if(!isset($results["login_attempts_before_banned"]) || empty($results["login_attempts_before_banned"]) || !is_numeric($results["login_attempts_before_banned"])){
+			$results["login_attempts_before_banned"] = 6;
+		}
+
 		return $results;
 	}
 

+ 3 - 2
index.php

@@ -245,7 +245,7 @@ function ogpHome()
 				$login_attempts = 0;
 			}
 			
-			if( $login_attempts == 3 )
+			if( $login_attempts == $settings["login_attempts_before_banned"] )
 			{
 				print_failure("Banned until " . date("r",$banlist_info['0']['banned_until']));
 				echo "%botbody%
@@ -292,9 +292,10 @@ function ogpHome()
 			{
 				print_failure( bad_login );
 				$login_attempts++;
-				if( $login_attempts == 3 )
+				if( $login_attempts == $settings["login_attempts_before_banned"] )
 				{
 					$banned_until = time() + 300; // Five minutes banned from the panel.
+					$banlist_info['0']['banned_until'] = $banned_until;
 					$db->logger( bad_login . " ( Banned until " . date("r", $banned_until) . " ) [ " . login . ": $_POST[ulogin], " . password . ": $_POST[upassword] ]" );
 					$db->query("UPDATE `OGP_DB_PREFIXban_list` SET logging_attempts='$login_attempts', banned_until='$banned_until' WHERE client_ip='$client_ip';");
 					print_failure("Banned until " . date("r",$banlist_info['0']['banned_until']));

+ 3 - 1
lang/Danish/modules/settings.php

@@ -89,6 +89,8 @@ define('recaptcha_secret_key', "Recaptcha Secret Key");
 define('recaptcha_secret_key_info', "The secret key provided to you by Google.");
 define('recaptcha_use_login', "Use Recaptcha on Login");
 define('recaptcha_use_login_info', "If enabled, users will have to solve the Not a Robot Recaptcha when attempting to login.");
+define('login_attempts_before_banned', "Number of failed login attempts before user is banned");
+define('login_attempts_before_banned_info', "If a user tries to login with invalid credentials more than this many times, the user will be banned temporarily by the panel.");
 define('remote_query', "Remote query");
 define('remote_query_info', "Use the remote server (agent) to make queries to the game servers (Only GameQ and LGSL).");
 define('check_expiry_by', "Check expiration using");
@@ -124,4 +126,4 @@ define('custom_tab_target_blank', "Tilpasset Fane-blade henvisning");
 define('custom_tab_target_blank_info', "Sæt alle fane-blade til henvisning. <b style='font-size:10px; font-weight:normal;'>('_self' = Åben links på samme side. '_blank'  =  Åben link på en ny tab tab.)</b>");
 define('bg_wrapper', "Indpaknings Baggrund");
 define('bg_wrapper_info', "Indpaknings baggrunds billed. <b style='font-size:10px; font-weight:normal;'>(Fungere kun på nogle temaer.)</b>");
-?>
+?>

+ 3 - 1
lang/English/modules/settings.php

@@ -89,6 +89,8 @@ define('recaptcha_secret_key', "Recaptcha Secret Key");
 define('recaptcha_secret_key_info', "The secret key provided to you by Google.");
 define('recaptcha_use_login', "Use Recaptcha on Login");
 define('recaptcha_use_login_info', "If enabled, users will have to solve the Not a Robot Recaptcha when attempting to login.");
+define('login_attempts_before_banned', "Number of failed login attempts before user is banned");
+define('login_attempts_before_banned_info', "If a user tries to login with invalid credentials more than this many times, the user will be banned temporarily by the panel.");
 define('remote_query', "Remote query");
 define('remote_query_info', "Use the remote server (agent) to make queries to the game servers (Only GameQ and LGSL).");
 define('check_expiry_by', "Check expiration using");
@@ -124,4 +126,4 @@ define('custom_tab_target_blank', "Custom Tabs Target");
 define('custom_tab_target_blank_info', "Sets all the tabs target. <b style='font-size:10px; font-weight:normal;'>('_self' = Opens link on same page. '_blank'  =  Opens link on new tab.)</b>");
 define('bg_wrapper', "Wrapper Background");
 define('bg_wrapper_info', "The wrappers background image. <b style='font-size:10px; font-weight:normal;'>(Only available on some themes.)</b>");
-?>
+?>

+ 3 - 1
lang/French/modules/settings.php

@@ -89,6 +89,8 @@ define('recaptcha_secret_key', "Clé Secrète Recaptcha");
 define('recaptcha_secret_key_info', "La clé secrète fournie par Google.");
 define('recaptcha_use_login', "Utiliser Recaptcha à l'Authentification");
 define('recaptcha_use_login_info', "Si activé, l&apos;utilisateur devra résoudre le Recaptcha 'Je ne suis pas un Robot' lors de l&apos;authentification.");
+define('login_attempts_before_banned', "Number of failed login attempts before user is banned");
+define('login_attempts_before_banned_info', "If a user tries to login with invalid credentials more than this many times, the user will be banned temporarily by the panel.");
 define('remote_query', "Interrogation à distance");
 define('remote_query_info', "Utiliser le serveur distant (Agent) pour interroger les serveurs de jeu (seulement GameQ et LGSL).");
 define('check_expiry_by', "Vérifier l'expiration en utilisant");
@@ -124,4 +126,4 @@ define('custom_tab_target_blank', "Cible des sous-onglets personnalisés");
 define('custom_tab_target_blank_info', "Définit la cible de tous les onglets. <b style='font-size:10px; font-weight:normal;'>('_self' = le lien s&apos;ouvre dans la même page. '_blank'  =  le lien s&apos;ouvre dans un nouvel onglet.)</b>");
 define('bg_wrapper', "Image de fond du Panneau");
 define('bg_wrapper_info', "L&apos;image de fond du Panneau. <b style='font-size:10px; font-weight:normal;'>(Pas disponible sur tous les thèmes.)</b>");
-?>
+?>

+ 3 - 1
lang/German/modules/settings.php

@@ -89,6 +89,8 @@ define('recaptcha_secret_key', "Recaptcha Secret Key");
 define('recaptcha_secret_key_info', "The secret key provided to you by Google.");
 define('recaptcha_use_login', "Use Recaptcha on Login");
 define('recaptcha_use_login_info', "If enabled, users will have to solve the Not a Robot Recaptcha when attempting to login.");
+define('login_attempts_before_banned', "Number of failed login attempts before user is banned");
+define('login_attempts_before_banned_info', "If a user tries to login with invalid credentials more than this many times, the user will be banned temporarily by the panel.");
 define('remote_query', "Remote query");
 define('remote_query_info', "Use the remote server (agent) to make queries to the game servers (Only GameQ and LGSL).");
 define('check_expiry_by', "Check expiration using");
@@ -124,4 +126,4 @@ define('custom_tab_target_blank', "Custom Tabs Target");
 define('custom_tab_target_blank_info', "Sets all the tabs target. <b style='font-size:10px; font-weight:normal;'>('_self' = Opens link on same page. '_blank'  =  Opens link on new tab.)</b>");
 define('bg_wrapper', "Wrapper Hintergrund");
 define('bg_wrapper_info', "The wrappers background image. <b style='font-size:10px; font-weight:normal;'>(Only available on some themes.)</b>");
-?>
+?>

+ 3 - 1
lang/Hungarian/modules/settings.php

@@ -89,6 +89,8 @@ define('recaptcha_secret_key', "Recaptcha Secret Key");
 define('recaptcha_secret_key_info', "The secret key provided to you by Google.");
 define('recaptcha_use_login', "Use Recaptcha on Login");
 define('recaptcha_use_login_info', "If enabled, users will have to solve the Not a Robot Recaptcha when attempting to login.");
+define('login_attempts_before_banned', "Number of failed login attempts before user is banned");
+define('login_attempts_before_banned_info', "If a user tries to login with invalid credentials more than this many times, the user will be banned temporarily by the panel.");
 define('remote_query', "Remote query");
 define('remote_query_info', "Use the remote server (agent) to make queries to the game servers (Only GameQ and LGSL).");
 define('check_expiry_by', "Check expiration using");
@@ -124,4 +126,4 @@ define('custom_tab_target_blank', "Custom Tabs Target");
 define('custom_tab_target_blank_info', "Sets all the tabs target. <b style='font-size:10px; font-weight:normal;'>('_self' = Opens link on same page. '_blank'  =  Opens link on new tab.)</b>");
 define('bg_wrapper', "Wrapper Background");
 define('bg_wrapper_info', "The wrappers background image. <b style='font-size:10px; font-weight:normal;'>(Only available on some themes.)</b>");
-?>
+?>

+ 3 - 1
lang/Polish/modules/settings.php

@@ -89,6 +89,8 @@ define('recaptcha_secret_key', "Recaptcha Secret Key");
 define('recaptcha_secret_key_info', "The secret key provided to you by Google.");
 define('recaptcha_use_login', "Use Recaptcha on Login");
 define('recaptcha_use_login_info', "If enabled, users will have to solve the Not a Robot Recaptcha when attempting to login.");
+define('login_attempts_before_banned', "Number of failed login attempts before user is banned");
+define('login_attempts_before_banned_info', "If a user tries to login with invalid credentials more than this many times, the user will be banned temporarily by the panel.");
 define('remote_query', "Remote query");
 define('remote_query_info', "Use the remote server (agent) to make queries to the game servers (Only GameQ and LGSL).");
 define('check_expiry_by', "Check expiration using");
@@ -124,4 +126,4 @@ define('custom_tab_target_blank', "Custom Tabs Target");
 define('custom_tab_target_blank_info', "Sets all the tabs target. <b style='font-size:10px; font-weight:normal;'>('_self' = Opens link on same page. '_blank'  =  Opens link on new tab.)</b>");
 define('bg_wrapper', "Wrapper Background");
 define('bg_wrapper_info', "The wrappers background image. <b style='font-size:10px; font-weight:normal;'>(Only available on some themes.)</b>");
-?>
+?>

+ 3 - 1
lang/Portuguese/modules/settings.php

@@ -89,6 +89,8 @@ define('recaptcha_secret_key', "Recaptcha Secret Key");
 define('recaptcha_secret_key_info', "The secret key provided to you by Google.");
 define('recaptcha_use_login', "Use Recaptcha on Login");
 define('recaptcha_use_login_info', "If enabled, users will have to solve the Not a Robot Recaptcha when attempting to login.");
+define('login_attempts_before_banned', "Number of failed login attempts before user is banned");
+define('login_attempts_before_banned_info', "If a user tries to login with invalid credentials more than this many times, the user will be banned temporarily by the panel.");
 define('remote_query', "Remote query");
 define('remote_query_info', "Use the remote server (agent) to make queries to the game servers (Only GameQ and LGSL).");
 define('check_expiry_by', "Check expiration using");
@@ -124,4 +126,4 @@ define('custom_tab_target_blank', "Custom Tabs Target");
 define('custom_tab_target_blank_info', "Sets all the tabs target. <b style='font-size:10px; font-weight:normal;'>('_self' = Opens link on same page. '_blank'  =  Opens link on new tab.)</b>");
 define('bg_wrapper', "Wrapper Background");
 define('bg_wrapper_info', "The wrappers background image. <b style='font-size:10px; font-weight:normal;'>(Only available on some themes.)</b>");
-?>
+?>

+ 3 - 1
lang/Russian/modules/settings.php

@@ -89,6 +89,8 @@ define('recaptcha_secret_key', "Recaptcha Secret Key");
 define('recaptcha_secret_key_info', "The secret key provided to you by Google.");
 define('recaptcha_use_login', "Use Recaptcha on Login");
 define('recaptcha_use_login_info', "If enabled, users will have to solve the Not a Robot Recaptcha when attempting to login.");
+define('login_attempts_before_banned', "Number of failed login attempts before user is banned");
+define('login_attempts_before_banned_info', "If a user tries to login with invalid credentials more than this many times, the user will be banned temporarily by the panel.");
 define('remote_query', "Remote query");
 define('remote_query_info', "Use the remote server (agent) to make queries to the game servers (Only GameQ and LGSL).");
 define('check_expiry_by', "Check expiration using");
@@ -124,4 +126,4 @@ define('custom_tab_target_blank', "Цель пользовательской в
 define('custom_tab_target_blank_info', "Устанавливает цель всех вкладок. <b style='font-size:10px; font-weight:normal;'>('_self' = Открывает ссылку на одной странице. '_blank'  =  Открывает ссылку на новой странице.)</b>");
 define('bg_wrapper', "Задний фон");
 define('bg_wrapper_info', "Картинка заднего фона. <b style='font-size:10px; font-weight:normal;'>(Только для темы Revolution.)</b>");
-?>
+?>

+ 3 - 1
lang/Spanish/modules/settings.php

@@ -89,6 +89,8 @@ define('recaptcha_secret_key', "Clave secreta Recaptcha");
 define('recaptcha_secret_key_info', "La clave secreta que te proporcionó Google.");
 define('recaptcha_use_login', "Usar Recaptcha en el inicio de sesión");
 define('recaptcha_use_login_info', "Si se activa, los usuarios deberán resolver una pregunta a parte de su inicio de sesión habitual. Esto intenta evitar intentos de inicio de sesión automatizados por parte de un programa.");
+define('login_attempts_before_banned', "Number of failed login attempts before user is banned");
+define('login_attempts_before_banned_info', "If a user tries to login with invalid credentials more than this many times, the user will be banned temporarily by the panel.");
 define('remote_query', "Peticiones remotas");
 define('remote_query_info', "Usar el servidor remoto (Agente) para hacer peticiones a los servidores de juegos (Solo GameQ y LGSL).");
 define('check_expiry_by', "Comprobar caducidad por");
@@ -124,4 +126,4 @@ define('custom_tab_target_blank', "Comportamiento de los botones");
 define('custom_tab_target_blank_info', "Ajusta el comportamiento de todos los botones personalizados. <b style='font-size:10px; font-weight:normal;'>('_self' = Abre el enlace en la misma pagina. '_blank'  =  Abre el enlace en una pestaña o ventana nueva.)</b>");
 define('bg_wrapper', "Imagen de fondo");
 define('bg_wrapper_info', "La imagen de fondo del panel. <b style='font-size:10px; font-weight:normal;'>(Solo funciona con algunos temas.)</b>");
-?>
+?>

+ 3 - 2
modules/administration/banlist.php

@@ -25,7 +25,8 @@
 function exec_ogp_module() 
 {
 	echo "<h2>".get_lang('ban_list')."</h2>";
-	global $db;
+	global $db, $settings;
+	
 	if(isset($_POST['unban']))
 	{
 		unset($_POST['unban']);
@@ -39,7 +40,7 @@ function exec_ogp_module()
 	$ban_table = '';
 	foreach($ban_list as $ban)
 	{
-		if($ban['logging_attempts'] >= 3)
+		if($ban['logging_attempts'] >= $settings["login_attempts_before_banned"])
 		{
 			$ban_table .= "<tr><td><input type=checkbox name='".$ban_qty."' value='".$ban['client_ip']."' /></td><td>".$ban['client_ip']."</td><td>".date("r",$ban['banned_until'])."</td></tr>\n";
 			$ban_qty++;

+ 6 - 1
modules/settings/settings.php

@@ -64,7 +64,8 @@ function exec_ogp_module()
 			"check_expiry_by" => $_REQUEST['check_expiry_by'],
 			"recaptcha_site_key" => $_REQUEST['recaptcha_site_key'],
 			"recaptcha_secret_key" => $_REQUEST['recaptcha_secret_key'],
-			"recaptcha_use_login" => $_REQUEST['recaptcha_use_login']);
+			"recaptcha_use_login" => $_REQUEST['recaptcha_use_login'],
+			"login_attempts_before_banned" => $_REQUEST['login_attempts_before_banned']);
 		
 		$db->setSettings($settings);
 		echo "<h2>".get_lang('settings')."</h2>";
@@ -153,6 +154,10 @@ function exec_ogp_module()
 	$ft->add_field('string','recaptcha_site_key',@$row['recaptcha_site_key']);
 	$ft->add_field('string','recaptcha_secret_key',@$row['recaptcha_secret_key']);
 	$ft->add_field('on_off','recaptcha_use_login',@$row['recaptcha_use_login']);
+	
+	$login_attempts_before_banned = (isset($row['login_attempts_before_banned']) and $row['login_attempts_before_banned'] != "" and is_numeric($row['login_attempts_before_banned']))? $row['login_attempts_before_banned'] : "6";
+	$ft->add_field('string','login_attempts_before_banned',$login_attempts_before_banned);
+	
 	$ft->end_table();
 	$ft->add_button("submit","update_settings",get_lang('update_settings'));
 	$ft->end_form();