setTimestamp($present["timestamp"]);
if ($_SERVER['REQUEST_METHOD'] == "POST") {
if (
preg_match($name_pattern, $_POST['name']) != 1 ||
preg_match($mac_pattern, $_POST['mac'] != 1)
) {
http_response_code(400);
die("Bad data");
}
$name = $_POST['name'];
$normalized_mac = str_replace('-', ':', strtolower($_POST['mac']));
$hashed_mac = hash('sha256', $normalized_mac);
$identities = json_decode(file_get_contents($identities_file), true);
foreach ($identities as $identity) {
if (
$identity['name'] == $name ||
$identity['mac_hash'] == $hashed_mac
) {
// TODO show error to user
die("Duplicate data");
}
}
// TODO store new identity
header("Location: /", true, 303);
exit();
}
?>
Jetzt gerade im CZI (letztes Update von format('H:i:s d.m.Y'); ?>)