From 1108871e9e3debd0f72b2e6d2a2162da16cb80a4 Mon Sep 17 00:00:00 2001 From: Pietro Date: Tue, 3 Apr 2018 02:23:57 +0200 Subject: [PATCH] Fixed a bug in the hero's mansion You can't assign an empty name to an hero anymore. The new name will be displayed correctly (instead of the old name) after renaming your hero. --- Templates/Build/37_hero.tpl | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Templates/Build/37_hero.tpl b/Templates/Build/37_hero.tpl index f8c2da2e..3fba836d 100644 --- a/Templates/Build/37_hero.tpl +++ b/Templates/Build/37_hero.tpl @@ -12,10 +12,11 @@ include_once("GameEngine/Data/hero_full.php"); global $database; -if (isset($_POST['name'])) { - $_POST['name'] = stripslashes($_POST['name']); - mysqli_query($GLOBALS['link'],"UPDATE ".TB_PREFIX."hero SET `name`='".($database->escape($_POST['name']))."' where `uid`='".$database->escape($session->uid)."' AND dead = 0") or die("ERROR:".mysqli_error($database->dblink)); - echo "".NAME_CHANGED.""; +if (isset($_POST['name']) && !empty($_POST['name'])) { + $_POST['name'] = $database->escape(stripslashes($_POST['name'])); + mysqli_query($GLOBALS['link'],"UPDATE ".TB_PREFIX."hero SET `name`='".$_POST['name']."' where `uid`='".$database->escape($session->uid)."' AND dead = 0") or die("ERROR:".mysqli_error($database->dblink)); + $hero_info['name'] = $_POST['name']; + echo "".NAME_CHANGED.""; } ?>