From fde908ba275c29348eaede9fd39cb301f69bf24b Mon Sep 17 00:00:00 2001 From: rsgrinko Date: Fri, 3 Dec 2021 15:05:59 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=B7=D0=B0=D1=89=D0=B8=D1=82=D0=B0=20=D0=BE?= =?UTF-8?q?=D1=82=20=D0=B7=D0=B0=D0=BF=D1=83=D1=81=D0=BA=D0=B0=20=D0=B1?= =?UTF-8?q?=D0=B5=D0=B7=20=D0=BF=D0=BE=D0=B4=D0=BA=D0=BB=D1=8E=D1=87=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=20=D1=8F=D0=B4=D1=80=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inc/bootstrap.php | 1 + inc/footer.php | 21 +++++++++++++-------- inc/header.php | 9 +++++++++ 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/inc/bootstrap.php b/inc/bootstrap.php index 262c2ed..bccddf5 100644 --- a/inc/bootstrap.php +++ b/inc/bootstrap.php @@ -8,6 +8,7 @@ */ session_start(); define('START_TIME', microtime(true)); // засекаем время старта скрипта +define('CORE_LOADED', true); // флаг корректного запуска require_once __DIR__ . '/config.php'; // подключаем конфигурационный файл require_once DIR.'/inc/lib/CMail.class.php'; // отправка почтовых сообщений require_once DIR.'/inc/lib/CCache.class.php'; // кэширование diff --git a/inc/footer.php b/inc/footer.php index 933e527..6fcd0be 100644 --- a/inc/footer.php +++ b/inc/footer.php @@ -5,15 +5,20 @@ E-mail: rsgrinko@gmail.com Сайт: https://it-stories.ru */ -?> -Использовано памяти: '.round(memory_get_usage() / 1024 / 1024, 2).' МБ / Время обращений к базе: '.round($DB::$workingTime, 3).' сек / Сгенерировано за '.$delta.' сек'; +/** + * Защита от запуска файла без подключения ядра + */ +if(!defined(CORE_LOADED) or CORE_LOADED !== true) { + die(); +} + +$finish_time = microtime(true); +$delta=round($finish_time - START_TIME, 3); +if ($delta < 0.001) { + $delta = 0.001; +} +echo 'Использовано памяти: '.round(memory_get_usage() / 1024 / 1024, 2).' МБ / Время обращений к базе: '.round($DB::$workingTime, 3).' сек / Сгенерировано за '.$delta.' сек'; ?> diff --git a/inc/header.php b/inc/header.php index 0526cdb..825e76d 100644 --- a/inc/header.php +++ b/inc/header.php @@ -5,6 +5,15 @@ E-mail: rsgrinko@gmail.com Сайт: https://it-stories.ru */ + + +/** + * Защита от запуска файла без подключения ядра + */ +if(!defined(CORE_LOADED) or CORE_LOADED !== true) { + die(); +} + if(!CUser::is_user() and $_SERVER['REQUEST_URI'] !== '/login.php') { header("Location: login.php"); die();