"01-01", "year" => null, "age" => 0 ]; if (isset($_GET["age"]) && is_numeric($_GET["age"])) { $toUpdate["birth"]["age"] = (int)$_GET["age"]; } if (isset($_GET["birth"]) && trim($_GET['birth']) !== "" && !!preg_match("/^\d{4}-\d{2}-\d{2}$/m", $_GET['birth'])) { $toUpdate["birth"]["year"] = (int)substr($_GET["birth"],0, 4); $toUpdate["birth"]["date"] = substr($_GET["birth"],5); } if (isset($_GET["membc"])) { $toUpdate["code"] = $_GET['membc']; } $flags = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/flags.json"), true); foreach ($flags as $id => $name) if (!is_array($name)) { if (isset($_GET['flags'][$id])) { $toUpdate[$id] = true; } else { $toUpdate[$id] = false; } } else foreach ($name as $id2 => $_) { if (isset($_GET['flags'][$id][$id2])) { $toUpdate[$id][$id2] = true; } else { $toUpdate[$id][$id2] = false; } } foreach ($toUpdate as $item => $value) { $metadata[$item] = $value; } if (isset($metadata["bitset"])) unset($metadata["bitset"]); if (trim($metadata["species"][1]) === "") unset($metadata["species"][1]); file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $memberID . ".json", json_encode($metadata)); header("Location: /" . $_GET['_']); } else { require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/metadata.inc'; } } exit;