diff --git a/config.php b/config.php index 2d10b3dd..cb31b539 100644 --- a/config.php +++ b/config.php @@ -125,7 +125,7 @@ $config = array( 0 => 'Female', 1 => 'Male' ), - + // new character config 'character_samples' => array( // vocations, format: ID_of_vocation => 'Name of Character to copy' //0 => 'Rook Sample', @@ -139,6 +139,11 @@ $config = array( // won't be displayed if there is only one item (rookgaard for example) 'character_towns' => array(1), + // characters lenght + // This is the minimum and the maximum length that a player can create a character. It is highly recommend the maximum lenght be 21. + 'character_name_min_length' => 4, + 'character_name_max_length' => 21 + // list of towns 'towns' => array( 0 => 'No town', @@ -210,10 +215,10 @@ $config = array( // gifts/shop system 'gifts_system' => false, - + // support/system 'bug_report' => true, // this configurable has no effect, its always enabled - + // forum 'forum' => 'site', // link to the server forum, set to "site" if you want to use build in forum system, otherwise leave empty if you aren't going to use any forum 'forum_level_required' => 0, // level required to post, 0 to disable @@ -235,7 +240,7 @@ $config = array( 'experiencetable_columns' => 5, // how many columns to display in experience table page. * experiencetable_rows, 5 = 500 (will show up to 500 level) 'experiencetable_rows' => 100, // till how many levels in one column 'date_timezone' => 'Europe/Berlin', // more info at http://php.net/manual/en/timezones.php - + 'monsters' => array(), 'npc' => array() ); diff --git a/system/pages/account/create_character.php b/system/pages/account/create_character.php index 02238484..59135ee4 100644 --- a/system/pages/account/create_character.php +++ b/system/pages/account/create_character.php @@ -19,12 +19,15 @@ $newchar_town = isset($_POST['town']) ? $_POST['town'] : NULL; $newchar_created = false; $save = isset($_POST['save']) && $_POST['save'] == 1; if($save) { + $minLength = $config['character_name_min_length']; + $maxLength = $config['character_name_max_length']; + if(empty($newchar_name)) $errors['name'] = 'Please enter a name for your character!'; - else if(strlen($newchar_name) > 21) - $errors['name'] = 'Name is too long. Max. lenght 21 letters.'; - else if(strlen($newchar_name) < 4) - $errors['name'] = 'Name is too short. Min. lenght 4 letters.'; + else if(strlen($newchar_name) > $maxLength) + $errors['name'] = 'Name is too long. Max. lenght '.$maxLength.' letters.'; + else if(strlen($newchar_name) < $minLength) + $errors['name'] = 'Name is too short. Min. lenght '.$minLength.' letters.'; else { if(!admin() && !Validator::newCharacterName($newchar_name)) { $errors['name'] = Validator::getLastError();