$remember = $gpc->get('remember', int, 1);
    $loc = strip_tags($gpc->get('redirect', none, 'index.php' . SID2URL_1));
    $file = basefilename($loc);
    if ($file == 'log.php') {
        $loc = 'index.php' . SID2URL_1;
    }
    if ($my->vlogin) {
        viscacha_header($loc);
    }
    if ($remember == 1) {
        $remember = true;
    } else {
        $remember = false;
    }
    ($code = $plugins->load('log_login2')) ? eval($code) : null;
    $log_status = $slog->sid_login($remember);
    if (!$log_status) {
        error($lang->phrase('log_wrong_data'), "log.php?action=login&redirect=" . urlencode($loc) . SID2URL_x);
    } else {
        ok($lang->phrase('log_msglogin'), $loc);
    }
} elseif ($_GET['action'] == "logout") {
    if (!$my->vlogin) {
        viscacha_header('Location: log.php');
    } else {
        $loc = strip_tags($gpc->get('redirect', none, 'index.php' . SID2URL_1));
        $file = basefilename($loc);
        if ($file == 'log.php') {
            $loc = 'index.php' . SID2URL_1;
        }
        ($code = $plugins->load('log_logout')) ? eval($code) : null;
            ($code = $plugins->load('admin_include')) ? eval($code) : null;
            if ($error == true) {
                echo head();
                error('admin.php?action=index' . SID2URL_x, 'The page you have requested does not exist.');
            }
        }
    }
} else {
    ($code = $plugins->load('admin_notallowed')) ? eval($code) : null;
    if ($my->p['admin'] == 0 && $my->vlogin) {
        echo head();
        error('index.php' . SID2URL_1, 'You are not allowed to view this page!');
    }
    $addr = rawurldecode($gpc->get('addr', none));
    if ($action == "login2") {
        $log_status = $slog->sid_login(true);
        echo head();
        if ($log_status == false) {
            error('admin.php' . iif(!empty($addr), '?addr=' . rawurlencode($addr)), 'You have entered an incorrect user name or password!');
        } else {
            ok('admin.php' . iif(!empty($addr), '?addr=' . rawurlencode($addr)), 'You have successfully logged in!');
        }
    } else {
        echo head();
        AdminLogInForm();
    }
    echo foot();
}
($code = $plugins->load('admin_end')) ? eval($code) : null;
$slog->updatelogged();
$db->close();
$zeitmessung1 = t1();
$slog = new slog();
$my = $slog->logged();
$lang->init($my->language);
$tpl = new tpl();
$my->p = $slog->Permissions();
if ($_GET['action'] == "login2") {
    $loc = strip_tags($gpc->get('location', none, 'index.php' . SID2URL_1));
    $file = basename($loc);
    if ($file = 'log.php') {
        $loc = 'index.php' . SID2URL_1;
    }
    if ($my->vlogin) {
        viscacha_header($loc);
    }
    if (!$slog->sid_login()) {
        error($lang->phrase('log_wrong_data'), "log.php?action=login&location=" . urlencode($loc) . SID2URL_x);
    } else {
        ok($lang->phrase('log_msglogin'), $loc);
    }
} elseif ($_GET['action'] == "logout") {
    if (!$my->vlogin) {
        viscacha_header('Location: log.php');
    } else {
        $slog->sid_logout();
        $loc = strip_tags($gpc->get('location', none, 'index.php' . SID2URL_1));
        $file = basename($loc);
        if ($file = 'log.php') {
            $loc = 'index.php' . SID2URL_1;
        }
        ok($lang->phrase('log_msglogout'), $loc);