query('SELECT * FROM keys'); while ($line = $DatabaseQuery->fetchArray()) { if ($line['keytype'] == 2 && $line['key'] == $_SESSION['key'] && $_SESSION['key'] != "" && $line['key'] != "" && ($enableKeys || $enableKeys == "true")) { $AuthorizedRemoval = 1; $AdminIsPrimary = $line['primaryadmin']; break; } } // not authorized if ($AuthorizedRemoval != 1) { header('Location: /'); die(); } $DatabaseQuery = $Database->query('SELECT * FROM keys'); while ($line = $DatabaseQuery->fetchArray()) { if ($line['id'] == $id && $line['id'] != "" && $id != "" && $Removed != 1 && $line['primaryadmin'] != 1) { // passed ID is a key that exists if ($AuthorizedRemoval == 1 && (($AdminIsPrimary == 1 && $line['id'] == 2) || $line['id'] != 2)) { $Database->exec("DELETE FROM keys WHERE id='$id'"); $Removed = 1; } else { print "You aren't authorized to perform this action."; die(); } break; } } if ($Redirect == "admin") { header("Location: admin.php?action=keys"); } else { header("Location: /"); } ?>