get_config_vars('EXIT_ADMIN')); user_logout(); header('Location:admin.php'); } if (auth_cookie()) { header('Location:index.php'); exit; } if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'login') { // Авторизация if (! empty($_POST['user_login']) && !empty($_POST['user_pass'])) { if (ADMIN_CAPTCHA) { if (isset($_SESSION['captcha_keystring']) && isset($_POST['securecode']) && $_SESSION['captcha_keystring'] == $_POST['securecode']) $captcha_ok = 1; else { unset($_SESSION['user_id'], $_SESSION['user_pass']); unset($_SESSION['captcha_keystring']); $error = $AVE_Template->get_config_vars('WRONG_CAPTCHA'); $AVE_Template->assign('error', $error); } } else $captcha_ok = 1; if ($captcha_ok) { if (true === user_login($_POST['user_login'], $_POST['user_pass'], 1,(int)(isset($_POST['SaveLogin']) && $_POST['SaveLogin'] == '1'))) { //_echo($_SESSION); if (!empty($_SESSION['redirectlink'])) { header('Location:' . $_SESSION['redirectlink']); unset($_SESSION['redirectlink']); exit; } reportLog($AVE_Template->get_config_vars('LOGIN_ADMIN')); //Перенапрявляем пользователя header('Location:'.get_referer_admin_link().''); exit; } else { reportLog($AVE_Template->get_config_vars('ERROR_ADMIN') . ' - ' . stripslashes($_POST['user_login']) . ' / ' . stripslashes($_POST['user_pass'])); unset($_SESSION['user_id'], $_SESSION['user_pass']); unset($_SESSION['captcha_keystring']); $error = $AVE_Template->get_config_vars('WRONG_PASS'); $AVE_Template->assign('error', $error); } } } } $AVE_Template->assign('captcha', ADMIN_CAPTCHA); $AVE_Template->display('login.tpl'); ?>