<?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) {
        $building_id = getBuildingId($connection, $_POST['campus'], $_POST['building']);
        deleteBuilding($connection, $building_id);
    }

    $connection = null;
?>