PHP code example of nomelodic / file-system-security
1. Go to this page and download the library: Download nomelodic/file-system-security library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
nomelodic / file-system-security example snippets
$security = new FilesSecurity([
'baseDir' => __DIR__,
'.xml'],
'excludeMerge' => ['d|vendor'],
'callback' => function ($status, $diff) {
/* Здесь выполняем необходимые действия */
}
]);
f|*.php // Все файлы с расширением .php
f|*.html // Все файлы с расширением .html
f|.env // Все файлы с именем .env
f|.htaccess // Все файлы с именем .htaccess
f|*.sh // Все файлы с расширением .sh
f|*.bat // Все файлы с расширением .bat
function ($status, $diff) {
/* Здесь выполняем необходимые действия */
}
$security->check();
[
'created' => [ // Список созданных (новых) файлов
'index.html' => [
'new' => [ // Новые значения
'modified' => 1611595416, // Время последнего изменения в UNIX-формате
'size' => 128832, // Размер в байтах
'warnings' => [] // Нежелательных вхождений не обнаружено
],
]
],
'modified' => [ // Список измененных файлов
'controllers/SiteController.php' => [
'old' => [ // Старые значения
'modified' => 1611591377, // Время последнего изменения в UNIX-формате
'size' => 47565 // Размер в байтах
],
'new' => [ // Новые значения
'modified' => 1611598416, // Время последнего изменения в UNIX-формате
'size' => 47832, // Размер в байтах
'warnings' => [ // Список нежелательных вхождений
'key' => 'file_put_contents',
'string' => '...nclude ], 'list' => $files ]; file_put_contents($this->getChecksumPath(), jso...'
'offset' => 1930
]
],
]
],
'deleted' => [ // Список удаленных файлов
'.htaccess' => [
'old' => [ // Старые значения
'modified' => 1565950550, // Время последнего изменения в UNIX-формате
'size' => 84 // Размер в байтах
],
]
]
]