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

    include 'include/database.php';

    $connection = connect($database);

    $canAdmin = canAdministrate($connection, $_SESSION['login']);
    
    if ($canAdmin) {
        $room_id = getRoomId($connection, $_POST['campus'], $_POST['building'], $_POST['room']);
        $proc_id = getCommandProcessorId($connection, $_POST['proc']);
        updateRoomCommandProcessor($connection, $room_id, $proc_id);
        updateRoomArguments($connection, $room_id, $_POST['arguments']);
    }
?>