Procházet zdrojové kódy

Merge pull request #517 from own3mall/master

Ban Time Setting
OwN-3m-All před 5 roky
rodič
revize
58b45a1323
3 změnil soubory, kde provedl 6 přidání a 2 odebrání
  1. 1 1
      index.php
  2. 2 0
      lang/English/modules/settings.php
  3. 3 1
      modules/settings/settings.php

+ 1 - 1
index.php

@@ -292,7 +292,7 @@ function ogpHome()
 				$login_attempts++;
 				$login_attempts++;
 				if( $login_attempts == $settings["login_attempts_before_banned"] )
 				if( $login_attempts == $settings["login_attempts_before_banned"] )
 				{
 				{
-					$banned_until = time() + 300; // Five minutes banned from the panel.
+					$banned_until = time() + (array_key_exists("login_ban_time" , $settings) && !empty($settings["login_ban_time"]) && is_numeric($settings["login_ban_time"]) ? $settings["login_ban_time"] : 300); // Five minutes or user defined setting.
 					
 					
 					if( !$banlist_info )
 					if( !$banlist_info )
 						$db->query("INSERT INTO `OGP_DB_PREFIXban_list` (`client_ip`) VALUES('$client_ip');");
 						$db->query("INSERT INTO `OGP_DB_PREFIXban_list` (`client_ip`) VALUES('$client_ip');");

+ 2 - 0
lang/English/modules/settings.php

@@ -145,4 +145,6 @@ define('OGP_LANG_reset_game_server_order', "Reset Game Server Ordering");
 define('OGP_LANG_reset_game_server_order_info', "Resets game server ordering back to the default of using the server ID");
 define('OGP_LANG_reset_game_server_order_info', "Resets game server ordering back to the default of using the server ID");
 define('OGP_LANG_regex_invalid_file_name_chars', "Invalid File Name Characters Regex");
 define('OGP_LANG_regex_invalid_file_name_chars', "Invalid File Name Characters Regex");
 define('OGP_LANG_regex_invalid_file_name_chars_info', "Change this regex pattern if you want to allow a different set of characters in file names.");
 define('OGP_LANG_regex_invalid_file_name_chars_info', "Change this regex pattern if you want to allow a different set of characters in file names.");
+define('OGP_LANG_login_ban_time', "Failed Login Ban Time (Seconds)");
+define('OGP_LANG_login_ban_time_info', "Time in seconds that an IP address is banned from attempting to login to the panel after a defined number of failed login attempts.");
 ?>
 ?>

+ 3 - 1
modules/settings/settings.php

@@ -70,7 +70,8 @@ function exec_ogp_module()
 			"default_game_server_home_path_prefix" => $_REQUEST['default_game_server_home_path_prefix'],
 			"default_game_server_home_path_prefix" => $_REQUEST['default_game_server_home_path_prefix'],
 			"use_authorized_hosts" => $_REQUEST['use_authorized_hosts'],
 			"use_authorized_hosts" => $_REQUEST['use_authorized_hosts'],
 			"allow_setting_cpu_affinity" => $_REQUEST['allow_setting_cpu_affinity'],
 			"allow_setting_cpu_affinity" => $_REQUEST['allow_setting_cpu_affinity'],
-			"regex_invalid_file_name_chars" => addslashes($_REQUEST['regex_invalid_file_name_chars'])
+			"regex_invalid_file_name_chars" => addslashes($_REQUEST['regex_invalid_file_name_chars']),
+			"login_ban_time" => $_REQUEST['login_ban_time']
 		);
 		);
 		
 		
 		$db->setSettings($settings);
 		$db->setSettings($settings);
@@ -172,6 +173,7 @@ function exec_ogp_module()
 	
 	
 	$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";
 	$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->add_field('string','login_attempts_before_banned',$login_attempts_before_banned);
+	$ft->add_field('string','login_ban_time', array_key_exists("login_ban_time", $row) && !empty($row["login_ban_time"]) && is_numeric($row["login_ban_time"]) ? $row["login_ban_time"] : '');
 	
 	
 	$ft->add_field('string','custom_github_update_username',@$row['custom_github_update_username']);
 	$ft->add_field('string','custom_github_update_username',@$row['custom_github_update_username']);