From f79bec0a161867e3c76954bbaa2dc29781e4a2d0 Mon Sep 17 00:00:00 2001 From: iaretechnician Date: Sun, 23 Nov 2025 17:07:21 -0500 Subject: [PATCH] fix curl issue --- index.php | 22 +++++++++++-------- modules/config_games/server_config_parser.php | 12 ++++++++++ 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/index.php b/index.php index 611a27b2..9db203db 100644 --- a/index.php +++ b/index.php @@ -305,14 +305,19 @@ function ogpHome() $msg = "Admin Login :warning: \nIP:".$client_ip." \nID:".$userInfo['user_id']." \nUser:".$userInfo['users_login']; $json_data = array ('content'=>"$msg"); $make_json = json_encode($json_data); - $ch = curl_init( $webhookurl ); - curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-type: application/json')); - curl_setopt( $ch, CURLOPT_POST, 1); - curl_setopt( $ch, CURLOPT_POSTFIELDS, $make_json); - curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1); - curl_setopt( $ch, CURLOPT_HEADER, 0); - curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1); - $response = curl_exec( $ch ); + if(!function_exists('curl_init')){ + error_log("OGP Discord webhook skipped: PHP curl extension is not loaded."); + }else{ + $ch = curl_init( $webhookurl ); + curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-type: application/json')); + curl_setopt( $ch, CURLOPT_POST, 1); + curl_setopt( $ch, CURLOPT_POSTFIELDS, $make_json); + curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1); + curl_setopt( $ch, CURLOPT_HEADER, 0); + curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1); + $response = curl_exec( $ch ); + curl_close($ch); + } //end WEBHOOK Discord } @@ -500,4 +505,3 @@ function ogpHome() - diff --git a/modules/config_games/server_config_parser.php b/modules/config_games/server_config_parser.php index c5b94f93..c0e85345 100644 --- a/modules/config_games/server_config_parser.php +++ b/modules/config_games/server_config_parser.php @@ -29,6 +29,18 @@ define("XML_SCHEMA","modules/config_games/schema_server_config.xml"); /// \return array containing the elements on success. function read_server_config( $filename ) { + if ( !class_exists('DOMDocument') ) + { + print_failure("PHP DOM extension not found. Install the php-xml package to enable game configuration parsing."); + return FALSE; + } + + if ( !function_exists('simplexml_load_file') ) + { + print_failure("PHP SimpleXML extension not found. Install the php-xml package to enable game configuration parsing."); + return FALSE; + } + $dom = new DOMDocument(); if ( $dom->load($filename) === FALSE ) {