<?php
require_once "{$_SERVER['DOCUMENT_ROOT']}/dependencies.php";

use Respect\Validation\Validator as v;

// only requre POST ['action' => 'desconectar' | 'sign-out']
methods([
    'GET' => v::alwaysValid()
]);

switch ($_GET['action']) {
    case 'desconectar':
        unset($_SESSION['page'], $_SESSION['moodle_db']);
        break;

    case 'sign-out':
        session_destroy();
        break;
}
header('Location: /');
