<?php
    session_start();
	if ( empty($_SESSION['login']) ) {
        header( 'Location: login.php' );
        die;
	}

    include 'include/database.php';

    $connection = connect($database);

    $canDelete = canDeleteValues($connection, $_SESSION['login']);
    
    if ($canDelete) {
        $room_id = getRoomId($connection, $_POST['campus'], $_POST['building'], $_POST['room']);
        deleteRoom($connection, $room_id);
    }

    $connection = null;
?>