File manager - Edit - /usr/local/cpanel/base/frontend/jupiter/cpguard/directadmin/user/index.html
Back
#!/opt/cpguard/cpg-php-fpm/bin/php <?php /** * DirectAdmin user-level entry for cPGuard. * - Executed as CLI from DA. * - Reconstructs $_GET and $_POST from env vars. * - Sets a flag for "DirectAdmin mode". * - Boots the existing cPGuard UI from /cpguard/index.live.php. */ // Mark that we are in DirectAdmin context (your UI can check this) $directadmin = true; // --------------------------------------------------------------------- // 1. Reconstruct $_GET and $_POST from environment // --------------------------------------------------------------------- function filter_request_array($array) { $return = []; foreach ($array as $key => $value) { if (is_array($value)) { $return[urldecode($key)] = filter_request_array($value); } else { // basic sanitization; adjust if you need raw values $return[urldecode($key)] = filter_var(urldecode($value)); } } return $return; } $_GET = []; $query_string = getenv('QUERY_STRING'); if (!empty($query_string)) { parse_str(html_entity_decode($query_string), $get_array); $_GET = filter_request_array($get_array); } $_POST = []; $post_string = getenv('POST'); if (!empty($post_string)) { parse_str(html_entity_decode($post_string), $post_array); $_POST = filter_request_array($post_array); } // You can also set $_SERVER values your UI expects: $_SERVER['REQUEST_METHOD'] = getenv('REQUEST_METHOD') ?: ($_POST ? 'POST' : 'GET'); $_SERVER['SCRIPT_NAME'] = '/CMD_PLUGINS/cpguard/index.html'; $_SERVER['REQUEST_URI'] = '/CMD_PLUGINS/cpguard/index.html' . (!empty($query_string) ? '?' . $query_string : ''); // --------------------------------------------------------------------- // 2. Include your existing UI front controller // --------------------------------------------------------------------- // Adjust path if needed; __DIR__ = /usr/local/directadmin/plugins/cpguard/user $cpguard_root = dirname(__DIR__) . '/cpguard'; // If your UI needs this as working directory: chdir($cpguard_root); // index.live.php should *echo HTML* only (no HTTP headers/Location redirects) require $cpguard_root . '/index.live.php';
| ver. 1.4 |
Github
|
.
| PHP 8.1.34 | Generation time: 0.03 |
proxy
|
phpinfo
|
Settings