From f8743c9487328ba1d9b439af08de8b6ba464620b Mon Sep 17 00:00:00 2001 From: Jonathan Flueren Date: Wed, 16 Aug 2023 17:02:45 +0200 Subject: [PATCH] Fix remove error message --- website/index.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/website/index.php b/website/index.php index fa84f0a..0c46ed3 100644 --- a/website/index.php +++ b/website/index.php @@ -81,17 +81,16 @@ function remove_identity($mac) if ($identity['mac_hash'] != $hashed_mac) { 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_message'] = 'Identity successfully removed.'; - header("Location: " . $url, true, 303); - exit(); + } else { + $_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); exit(); }