AVE.CMS v3.28
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

99 lines
2.4 KiB

7 years ago
<?php
7 years ago
/**
* AVE.cms
*
* @package AVE.cms
* @version 3.x
* @filesource
* @copyright © 2007-2014 AVE.cms, http://www.ave-cms.ru
*
* @license GPL v.2
*/
7 years ago
7 years ago
define('ACP', 1);
define('ACPL', 1);
define('BASE_DIR', str_replace("\\", "/", dirname(dirname(__FILE__))));
7 years ago
7 years ago
if (! @filesize(BASE_DIR . '/config/db.config.php'))
7 years ago
{
header('Location:/install/index.php');
exit;
}
7 years ago
7 years ago
require(BASE_DIR . '/admin/init.php');
7 years ago
7 years ago
unset ($captcha_ok);
7 years ago
7 years ago
if (isset($_REQUEST['do']) && $_REQUEST['do'] == 'logout')
{
// Завершение работы в админке
reportLog($AVE_Template->get_config_vars('EXIT_ADMIN'));
user_logout();
header('Location:admin.php');
}
7 years ago
7 years ago
if (auth_cookie())
{
header('Location:index.php');
exit;
}
7 years ago
7 years ago
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'login')
7 years ago
{
7 years ago
// Авторизация
if (! empty($_POST['user_login']) && !empty($_POST['user_pass']))
7 years ago
{
7 years ago
if (ADMIN_CAPTCHA)
7 years ago
{
7 years ago
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);
}
7 years ago
}
7 years ago
else
$captcha_ok = 1;
7 years ago
7 years ago
if ($captcha_ok)
7 years ago
{
7 years ago
if (true === user_login($_POST['user_login'], $_POST['user_pass'], 1,(int)(isset($_POST['SaveLogin']) && $_POST['SaveLogin'] == '1')))
7 years ago
{
7 years ago
//_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().'');
7 years ago
exit;
7 years ago
}
else
{
reportLog($AVE_Template->get_config_vars('ERROR_ADMIN') . ' - '
. stripslashes($_POST['user_login']) . ' / '
. stripslashes($_POST['user_pass']));
7 years ago
7 years ago
unset($_SESSION['user_id'], $_SESSION['user_pass']);
unset($_SESSION['captcha_keystring']);
$error = $AVE_Template->get_config_vars('WRONG_PASS');
$AVE_Template->assign('error', $error);
}
7 years ago
}
}
}
7 years ago
$AVE_Template->assign('captcha', ADMIN_CAPTCHA);
$AVE_Template->display('login.tpl');
7 years ago
?>