Example #1
0
    }
}
/* If the authentication was a success */
if (isset($auth) && $auth['success'] && isset($user)) {
    // $auth->info are the fields specified in the config file
    //   to retrieve for each user
    Session::create($auth);
    // Not sure if it was me or php tripping out,
    //   but naming this 'user' didn't work at all
    $_SESSION['userdata'] = $auth;
    // Record the IP of this person!
    if (AmpConfig::get('track_user_ip')) {
        $user->insert_ip_history();
    }
    if (isset($username)) {
        Session::create_user_cookie($username);
        if ($_POST['rememberme']) {
            Session::create_remember_cookie($username);
        }
    }
    // Update data from this auth if ours are empty
    if (empty($user->fullname) && !empty($auth['name'])) {
        $user->update_fullname($auth['name']);
    }
    if (empty($user->email) && !empty($auth['email'])) {
        $user->update_email($auth['email']);
    }
    if (empty($user->website) && !empty($auth['website'])) {
        $user->update_website($auth['website']);
    }
    $GLOBALS['user'] = $user;