示例#1
0
function login()
{
    require_once 'DBConnect.php';
    require_once 'DBCalls.php';
    require_once 'secSession.php';
    sec_session_start();
    $username = isset($_SESSION['username']) ? $_SESSION['username'] : false;
    $userType = isset($_SESSION['userType']) ? $_SESSION['userType'] : false;
    if ($userType == "reader") {
        $con = new DBConnect('marketplace');
    } else {
        if ($userType == "author") {
            $con = new DBConnect('workbench');
        } else {
            $con = false;
        }
    }
    if ($con) {
        $calls = new DBCalls();
        $loggedIn = $calls->loginCheck($con);
    } else {
        $loggedIn = false;
    }
    $GLOBALS['username'] = $username;
    $GLOBALS['userType'] = $userType;
    return $loggedIn;
}
示例#2
0
sec_session_start();
$redirectURL = isset($_GET['redirectURL']) ? $_GET['redirectURL'] : false;
$username = isset($_SESSION['username']) ? $_SESSION['username'] : false;
$userType = isset($_SESSION['userType']) ? $_SESSION['userType'] : false;
if ($userType == "reader") {
    $con = new DBConnect('marketplace');
} else {
    if ($userType == "author") {
        $con = new DBConnect('workbench');
    } else {
        $con = false;
    }
}
if ($con) {
    $calls = new DBCalls();
    $loggedIn = $calls->loginCheck($con);
} else {
    $loggedIn = false;
}
if ($loggedIn) {
    // logged in
    if ($userType == "reader") {
        new HTMLTemplate('readerHomepage', array('{curUser}', '{curType}'), array($username, $userType));
    } else {
        if ($userType == "author") {
            new HTMLTemplate('authorHomepage', array('{curUser}', '{curType}'), array($username, $userType));
        }
    }
} else {
    new HTMLTemplate('readerHomepage', false, false);
}