<?php
require_once("../php/db_connect.php");

if (session_status() === PHP_SESSION_NONE) {
    session_start();
}

$id = isset($_GET["id"]) ? (int) $_GET["id"] : 0;

$stmt = $conn->prepare("
    UPDATE services
    SET status = 'active'
    WHERE id = ?
");
$stmt->bind_param("i", $id);

if ($stmt->execute()) {
    header("Location: admin.php?page=services&filter=archived&message=restored");
    exit;
} else {
    die("Failed to restore service.");
}