示例#1
0
<?php

//only visitors who are not logged in are allowed to continue
if (SessionController::userIsLoggedIn()) {
    gtRequire("scripts/redirect.php");
}
示例#2
0
<?php

require $_SERVER['DOCUMENT_ROOT'] . "/resources/scripts/initialize.php";
gtRequire("scripts/requireNoLogin.php");
function addVisibleStyle($errName)
{
    global $errors;
    if (isset($errors) && isset($errors[$errName])) {
        print 'style="display:inline"';
    }
}
//prepare form-action return url
$returnURL = isset($_GET['returnURL']) ? $_GET['returnURL'] : "";
$returnURLAddition = "";
//part that is added to form action
if ($returnURL != "") {
    $returnURLAddition = "?returnURL={$returnURL}";
}
//get data from either frmLogin or login
if (isset($_POST['frmLoginBtn']) || isset($_POST['btnLogin'])) {
    extract($_POST);
    //gets $username and $password
    $result = SessionController::login($username, $password);
    if (is_array($result)) {
        //there were problems logging in
        $errors = $result;
    } else {
        //login successful
        gtInclude("scripts/redirect.php");
    }
}