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

    include 'include/database.php';

    $connection = connect($database);

    $canAdmin = canAdministrate($connection, $_SESSION['login']);
    $canEdit = canEditValues($connection, $_SESSION['login']);

    if ($canAdmin && $canEdit) {
        insertCommandProcessor($connection, $_POST['name']);
    } else {
        header( 'Location: /' );
        $connection = null;
        die;
    }

    $connection = null;
?>