query($sql); if (!($row = $query->fetchArray())) { die("No such key in database."); } $type = $row['Type']; $value = $row['Val']; $user = $row['User']; if ($type == "Addresses") { $values = json_decode($conn->query("SELECT * FROM Users WHERE User='$user'")->fetchArray()['Addresses'], true); array_push($values, $value); $value = json_encode($values); } $sql = "UPDATE Users SET $type='$value' WHERE User='$user'"; if ($conn->query($sql)) { queue_message(new Message("Successfully activated $type.", "success")); $sql = "DELETE FROM Activations WHERE Activation_key='$key'"; $conn->query($sql); header("Location: ../index.php"); } else { echo "Failed to activate $type. Error: " . $conn->lastErrorMsg(); } } else { ?>
No key specified
Key: