Exemplo n.º 1
0
        $displayForm = false;
        // perform the actual login
        $user = User::getUserByEmail($email);
        if (!$user || is_null($user)) {
            $message = I18n::t('login.err.general');
        } else {
            // save user object to session
            $_SESSION['user'] = $user;
            // determine where to redirect user to
            if (isset($_SESSION['REQUEST_URI']) && !empty($_SESSION['REQUEST_URI'])) {
                $redirectTo = $_SESSION['REQUEST_URI'];
                unset($_SESSION['REQUEST_URI']);
            } else {
                $redirectTo = 'index.php';
            }
            FileFunctions::log("redirecting to {$redirectTo} ..");
            header("location:{$redirectTo}");
        }
        echo $message;
    }
}
// end if isset submitted
// DISPLAY FORM
if ($displayForm) {
    ?>

<p>
  <?php 
    echo I18n::t('login.text');
    ?>
</p>
Exemplo n.º 2
0
<?php

$isRegistered = isset($_SESSION['client']) && $_SESSION['client'] !== null;
if (!$isRegistered) {
    $client = new Client(session_id());
    $success = true;
    if (!Client::isKnown($client)) {
        $success = Client::save($client);
    }
    if ($success) {
        $_SESSION['client'] = $client;
    } else {
        FileFunctions::log('Registration of client failed..');
    }
}