diff -r 3e240fd7ef13 -r 83cee005d2d9 www/includes/db_profile_mash.php --- a/www/includes/db_profile_mash.php Sat Jan 26 22:27:28 2019 +0100 +++ b/www/includes/db_profile_mash.php Sun Jan 27 17:39:26 2019 +0100 @@ -26,12 +26,25 @@ $sql .= " `profile_mash` SET name='" . mysqli_real_escape_string($connect, $_POST['name']); $sql .= "', notes='" . mysqli_real_escape_string($connect, $_POST['notes']); $array = $_POST['steps']; - foreach($array as $key => $item){ - foreach ($disallowed as $disallowed_key) { - unset($array[$key]["$disallowed_key"]); - } + $comma = FALSE; + $steps = '['; + foreach($array as $key => $item) { + /* + * Manual encode to json. This eliminates the wrong UTF-8 encodings + * but also removes the unwanted fields. + */ + if ($comma) + $steps.= ','; + $steps .= '{"step_name":"' . str_replace($rescapers,$rreplacements,$item['step_name']); + $steps .= '","step_type":' . $item['step_type']; + $steps .= ',"step_temp":' . $item['step_temp']; + $steps .= ',"end_temp":' . $item['end_temp']; + $steps .= ',"step_time":' . $item['step_time']; + $steps .= ',"ramp_time":' . $item['ramp_time'] . '}'; + $comma = TRUE; } - $sql .= "', steps='" . str_replace($rescapers,$rreplacements,json_encode($array)); + $steps .= ']'; + $sql .= "', steps='" . $steps; if (isset($_POST['insert'])) { $sql .= "';"; }