44 lines
1.2 KiB
PHP
44 lines
1.2 KiB
PHP
|
|
<?php
|
||
|
|
$conn = new mysqli('localhost', 'root', '5z#JaL', 'mz_logs');
|
||
|
|
if ($conn->connect_error) {
|
||
|
|
die('Connection failed: ' . $conn->connect_error);
|
||
|
|
}
|
||
|
|
|
||
|
|
$system = 'e5';
|
||
|
|
$stmt = $conn->prepare("SELECT path FROM php_files_log WHERE system = ?");
|
||
|
|
$stmt->bind_param("s", $system);
|
||
|
|
// loop through stmt results
|
||
|
|
$stmt->execute();
|
||
|
|
$stmt->bind_result($path);
|
||
|
|
while ($stmt->fetch()) {
|
||
|
|
$files[] = $path;
|
||
|
|
}
|
||
|
|
$stmt->close();
|
||
|
|
$conn->close();
|
||
|
|
|
||
|
|
foreach ($files as $file) {
|
||
|
|
// if file starts from /index.php remove it
|
||
|
|
if (strpos($file, '/index.php') === 0) {
|
||
|
|
$file = str_replace('/index.php', '', $file);
|
||
|
|
}
|
||
|
|
|
||
|
|
// if file doesn't have extension (any) leave it
|
||
|
|
if (strpos($file, '.') === false) {
|
||
|
|
continue;
|
||
|
|
}
|
||
|
|
|
||
|
|
// if ! file starts from /var/www add it in front
|
||
|
|
if (strpos($file, '/var/www/crm.e5.pl') !== 0) {
|
||
|
|
$file = '/var/www/crm.e5.pl' . $file;
|
||
|
|
}
|
||
|
|
|
||
|
|
// check if file exists
|
||
|
|
if (!file_exists($file)) {
|
||
|
|
echo 'File does not exist: ' . $file . PHP_EOL;
|
||
|
|
continue;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
exit;
|