No bug selected, redirecting to index..."; header('Refresh: 2; URL=index.php'); } else if(!isset($_SESSION['user_id']) || $_SESSION['user_id'] == "") { echo "
Not logged in, redirecting to index...
"; header('Refresh: 2; URL=index.php'); } else { $conn = new PDO($config['db']['dsn'], $config['db']['username'], $config['db']['password']); $query = $conn->prepare("UPDATE bugs SET title=:title, description=:description WHERE id=:id"); $query->bindParam(':title', $_POST['title']); $query->bindParam(':description', $_POST['description']); $query->bindParam(':id', $_GET['id']); if ($query->execute()) { echo "Data is updated\n"; } else { echo "User must have sent wrong inputs\n"; } header("Refresh: 2; URL=view.php?id=$_GET[id]"); } require_once(TEMPLATES_PATH . "/footer.php"); ?>