Esempio n. 1
0
// 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) {
            $authentication_login = $pony_db->login;
        }
    }
}
// ajax ping code
// should be displayed before authorization form
if ($admin_routine == 'ping' && $admin_action == 'ping' && $authentication_success && $token === assign($_REQUEST['token']) && ($show_domains && ($pony_db->priv_is_admin() || $show_domains_to_users))) {
    $domain_id = trim(assign($_REQUEST['domain_id']));
    $find_domain_result = $pony_db->find_domain($domain_id);
    if (is_array($find_domain_result) && $find_domain_result && count($find_domain_result) == 3) {
        list($ping_url, $ping_time, $ping_status) = $find_domain_result;
        if (curl_ping($ping_url)) {
            $pony_db->update_domain($domain_id, 'OK');
            die("<span class=\"check\"></span>");