Esempio n. 1
0
if (isset($_GET['logout'])) {
    if (isset($_SESSION['token']) && $_SESSION['token'] == $_GET['token']) {
        session_destroy();
        header('Location:./');
    }
}
if (isset($_POST['register'])) {
    $o = new UsersController();
    if ($o->create($_POST["username"], $_POST["lastname"], $_POST["firstname"], $_POST["email"], $_POST["password"], $_POST["confirm_password"], $_POST["email"])) {
        $o->connection($_POST['username'], $_POST['password']);
    }
    $error_sign_up = $o->getError();
}
if (isset($_POST['connection'])) {
    $o = new UsersController();
    $o->connection($_POST['log'], $_POST['password']);
    $error_sign_in = $o->getError();
    header('Location: ./?page=panel');
}
$connected = UsersController::isConnected();
if (isset($_GET["page"])) {
    switch ($_GET["page"]) {
        case 'connection':
            include './views/menu.php';
            include './views/connect.php';
            break;
        case 'home':
            include './views/menu.php';
            include './views/home.php';
            break;
        case 'panel':