Esempio n. 1
0
$admin_action = trim(assign($_REQUEST['action']));
$auth_cookie = trim(assign($_COOKIE[$config_cookie_name]));
$admin_routine = trim(assign($_REQUEST['routine']));
$use_zip = trim(assign($_REQUEST['zip'])) == '1';
// filter available action pages
if (array_search($admin_action, array('ftp', 'http', 'stats', 'ping', 'log', 'admin', 'exit', 'help', 'chart', 'reports', 'other')) === false) {
    $admin_action = '';
}
// authentication
if (!$authentication_attempt) {
    $authentication_login = trim(assign($_REQUEST['login']));
    $authentication_password = trim(assign($_REQUEST['password']));
    $authentication_attempt = isset($_REQUEST['login']) && isset($_REQUEST['password']);
}
// try to authenticate
if (strlen($authentication_login) && strlen($authentication_password) && $pony_db->authenticate($authentication_login, $authentication_password)) {
    $authentication_success = true;
    // set cookie on successful authentication
    $cookie_save_password = $authentication_save_password;
    if ($cookie_save_password) {
        $cookie_exp_time = time() + 60 * 60 * 24 * 60;
    } else {
        $cookie_exp_time = 0;
    }
    setcookie($config_cookie_name, $pony_db->auth_cookie, $cookie_exp_time);
} else {
    // authentication failed
    // try to authenticate using cookie
    if ($auth_cookie) {
        $authentication_success = $pony_db->autneticate_cookie($auth_cookie);
        if ($authentication_success) {