Fix remove error message

This commit is contained in:
Jonathan Flueren 2023-08-16 17:02:45 +02:00
parent ab31b191a9
commit f8743c9487

View file

@ -81,17 +81,16 @@ function remove_identity($mac)
if ($identity['mac_hash'] != $hashed_mac) { if ($identity['mac_hash'] != $hashed_mac) {
array_push($new_identities, $identity); array_push($new_identities, $identity);
} }
}
file_put_contents(IDENTITIES_FILE, json_encode($new_identities));
file_put_contents(IDENTITIES_FILE, json_encode($new_identities)); if (count($identities) > count($new_identities)) {
$_SESSION['form_success'] = true; $_SESSION['form_success'] = true;
$_SESSION['form_success_message'] = 'Identity successfully removed.'; $_SESSION['form_success_message'] = 'Identity successfully removed.';
header("Location: " . $url, true, 303); } else {
exit(); $_SESSION['form_success'] = false;
$_SESSION['form_success_message'] = 'Identity not found.';
} }
$_SESSION['form_success'] = false;
$_SESSION['form_success_message'] = 'Identity not found.';
header("Location: " . $url, true, 303); header("Location: " . $url, true, 303);
exit(); exit();
} }