Esempio n. 1
0
function logout_main()
{
    global $gbl, $sgbl, $login, $ghtml;
    initProgram();
    clear_all_cookie();
    $cl = $login->getList("ssession");
    Utmp::updateUtmp($gbl->c_session->nname, $login, "Logout");
    $gbl->c_session->delete();
    $gbl->c_session->was();
    if ($gbl->c_session->ssl_param) {
        $ghtml->print_redirect($gbl->c_session->ssl_param['backurl']);
    } else {
        if ($gbl->c_session->consuming_parent) {
            $ret = $gbl->getSessionV('return_url');
            $ghtml->print_redirect($ret);
        } else {
            $ghtml->print_redirect_self("/login/");
        }
    }
}
Esempio n. 2
0
function addToUtmp($ses, $dbaction)
{
    $nname = implode('_', array($ses->nname, $ses->parent_clname));
    $nname = str_replace(array(",", ":"), "_", $nname);
    $utmp = new Utmp(null, null, $nname);
    if ($dbaction === 'add') {
        $utmp->setFromObject($ses);
        $utmp->dbaction = 'add';
        $utmp->ssession_name = $ses->nname;
        $utmp->logouttime = 'Still Logged';
        $utmp->logoutreason = '-';
    } else {
        $utmp->get();
        $utmp->timeout = $ses->timeout;
        $utmp->setUpdateSubaction();
    }
    $utmp->write();
}
Esempio n. 3
0
function delete_expired_ssessions()
{
    global $gbl, $sgbl, $login, $ghtml;
    $s_l = $login->getList("ssessionlist");
    if (!empty($s_l)) {
        foreach ($s_l as $s) {
            if (!is_object($s)) {
                continue;
            }
            $timeout = $s->last_access + $login->getSpecialObject('sp_specialplay')->ssession_timeout;
            dprint($s->nname);
            if ($timeout < time()) {
                $s->delete();
                Utmp::updateUtmp($s->nname, $login, "Session Expired");
            }
        }
    }
}