query("SELECT * FROM questions WHERE id = '" . $_GET["q"] . "';")->fetchArray(SQLITE3_ASSOC); if(!$question || !$question["id"]){ echo("Question not found."); } else if($question["user"] != $_SESSION["uid"]){ echo("You're not allowed to perform that task."); } else{ $db->exec("DELETE FROM questions WHERE id = " . $question["id"] . ";"); if($pretty_urls){ header("Location: /user/" . $db->querySingle("SELECT username FROM users WHERE id = " . $question["user"] . ";")); die(); } else{ header("Location: /user.php?q=" . $db->querySingle("SELECT username FROM users WHERE id = " . $question["user"] . ";")); die(); } } }