<?php
include('include/headscript.php');
$conn = new mysqli($servername, $username, $password, $database);

if ($conn->connect_error) {
    die("Errore di connessione: " . $conn->connect_error);
}

// Recupera l'ID della pagina da eliminare
$idpages = intval($_GET['idpages']);

// Cancella la pagina dal database
$query = $conn->prepare("DELETE FROM pages WHERE idpages = ?");
$query->bind_param('i', $idpages);

if ($query->execute()) {
    header("Location: page-settings.php?success=1");
} else {
    header("Location: page-settings.php?error=1");
}

$query->close();
$conn->close();
