Esempio n. 1
0
    if (isset($login_response['response']['auth']['sessionid'])) {
        $_SESSION['sessionid'] = $login_response['response']['auth']['sessionid'];
        // Get the users information
        $user_details = $c->sendRequest('api/user/info', array('accessid' => $_POST['accessid']));
        // Save the basic information about this user
        $_SESSION['user_details'] = $user_details['response']['user'];
        // Set the user message
        Flash('Welcome back ' . $_SESSION['user_details']['first_name'] . '!', 'success');
    } else {
        // Set the user error message
        Flash('Incorrect AccessID/password. Please try again', 'error');
    }
    //Pre($login_response);
}
// if trying to logout
if (isset($_GET['logout'])) {
    // Set the user message
    Flash('See you next time ' . $_SESSION['user_details']['first_name'] . '!', 'success');
    // Unset the session
    unset($_SESSION['sessionid']);
    unset($_SESSION['user_details']);
    // Redirect to homepage
    header('Location:' . PATH);
    die;
}
// Set the sessionID if in the session
if (isset($_SESSION['sessionid'])) {
    $c->setSession($_SESSION['sessionid']);
}
// Setup defaults
$page_title = 'Home';