コード例 #1
0
ファイル: lib_auth.php プロジェクト: NinjaWars/ninjawars
/**
 * Actual login!  Performs the login of a user using pre-vetted info!
 * Creates the cookie and session stuff for the login process.
 *
 * @return void
 */
function _login_user($p_username, $p_player_id, $p_account_id)
{
    if (!$p_username || !$p_player_id || !$p_account_id) {
        throw new \Exception('Request made to _login_user without all of username, player_id, and account_id being set.');
    }
    $_COOKIE['username'] = $p_username;
    // May want to keep this for relogin easing purposes.
    update_activity_log($p_player_id);
    update_last_logged_in($p_player_id);
    $update = "UPDATE players SET active = 1 WHERE player_id = :char_id";
    query($update, array(':char_id' => array($p_player_id, PDO::PARAM_INT)));
    $session = SessionFactory::getSession();
    $session->set('username', $p_username);
    // Actually char name
    $session->set('player_id', $p_player_id);
    // Actually char id.
    $session->set('account_id', $p_account_id);
}
コード例 #2
0
ファイル: lib_auth.php プロジェクト: reillo/ninjawars
/**
 * Actual login!  Performs the login of a user using pre-vetted info!
 * Creates the cookie and session stuff for the login process.
**/
function _login_user($p_username, $p_player_id, $p_account_id)
{
    if (!$p_username || !$p_player_id || !$p_account_id) {
        throw new Exception('Request made to _login_user without all of username, player_id, and account_id being set.');
    }
    SESSION::commence();
    // Start a session on a successful login.
    $_COOKIE['username'] = $p_username;
    // May want to keep this for relogin easing purposes.
    SESSION::set('username', $p_username);
    // Actually char name
    SESSION::set('player_id', $p_player_id);
    // Actually char id.
    SESSION::set('account_id', $p_account_id);
    update_activity_log($p_player_id);
    update_last_logged_in($p_player_id);
    $up = "UPDATE players SET active = 1 WHERE player_id = :char_id";
    query($up, array(':char_id' => array($p_player_id, PDO::PARAM_INT)));
}