<?php
if(session_status() === PHP_SESSION_NONE) session_start();
require "../../config/config.php";
if(!defined("APPURL"))  define("APPURL",  "http://localhost/hotel-booking/");
if(!defined("ADMINURL")) define("ADMINURL", "http://localhost/hotel-booking/admin/");
if(!isset($_SESSION['admin_username'])){ header("location: " . ADMINURL . "login.php"); exit; }

$id     = (int)$_GET['id'];
$status = (int)$_GET['status'];
$upd    = $conn->prepare("UPDATE rooms SET status = :status WHERE id = :id");
$upd->execute([':status' => $status, ':id' => $id]);
header("location: index.php?success=Room status updated");
exit;
