mirror of
https://github.com/slawkens/myaac.git
synced 2025-10-13 17:24:54 +02:00
Fixes to character name validation
Admin should be able to create any name Also fixes to config.character_name_min_length being ignored
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
require '../common.php';
|
||||
require SYSTEM . 'functions.php';
|
||||
require SYSTEM . 'init.php';
|
||||
require SYSTEM . 'login.php';
|
||||
|
||||
$error = '';
|
||||
if(isset($_GET['account']))
|
||||
@@ -54,14 +55,24 @@ else if(isset($_GET['email']))
|
||||
}
|
||||
else if(isset($_GET['name']))
|
||||
{
|
||||
$name = strtolower(stripslashes($_GET['name']));
|
||||
$name = $_GET['name'];
|
||||
if(!admin()) {
|
||||
$name = strtolower(stripslashes($name));
|
||||
}
|
||||
|
||||
if(!Validator::characterName($name))
|
||||
error_(Validator::getLastError());
|
||||
|
||||
if(!Validator::newCharacterName($name))
|
||||
if(!admin() && !Validator::newCharacterName($name))
|
||||
error_(Validator::getLastError());
|
||||
|
||||
success_('Good. Your name will be:<br /><b>' . ucwords($name) . '</b>');
|
||||
$player = new OTS_Player();
|
||||
$player->find($name);
|
||||
if($player->isLoaded()) {
|
||||
error_('Character with this name already exist.');
|
||||
}
|
||||
|
||||
success_('Good. Your name will be:<br /><b>' . (admin() ? $name : ucwords($name)) . '</b>');
|
||||
}
|
||||
else if(isset($_GET['password']) && isset($_GET['password2'])) {
|
||||
$password = $_GET['password'];
|
||||
|
Reference in New Issue
Block a user