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.
This commit is contained in:
Pietro
2018-04-03 02:23:57 +02:00
committed by GitHub
parent a749d74dfb
commit 1108871e9e
+5 -4
View File
@@ -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."";
}
?>