From bbc5ccaaf64939bfa92e46e9295f4a7e538f051d Mon Sep 17 00:00:00 2001 From: Erreur32 Date: Fri, 5 Feb 2021 10:07:23 +0100 Subject: [PATCH] first commit --- SQL/dayz2json_parser_sql.php | 71 +++++++----------------------------- 1 file changed, 13 insertions(+), 58 deletions(-) diff --git a/SQL/dayz2json_parser_sql.php b/SQL/dayz2json_parser_sql.php index 1549902..d2100b2 100644 --- a/SQL/dayz2json_parser_sql.php +++ b/SQL/dayz2json_parser_sql.php @@ -3,42 +3,6 @@ include_once('./config.php'); include_once('./consql.php'); - // Don't touch below (or you know what you do) - - $urlserv = $ipserv.":".$servport ; - - // librarie SQ - info serv game - require 'SQ_/bootstrap.php'; - use xPaw\SourceQuery\SourceQuery; - - define( 'SQ_SERVER_ADDR', "${ipserv}" ); // IP server - define( 'SQ_SERVER_PORT', "${queryport}" ); // YOUR QUERY PORT - define( 'SQ_TIMEOUT', 3 ); - define( 'SQ_ENGINE', SourceQuery::SOURCE ); - - $Timer = MicroTime( true ); - $Query = new SourceQuery( ); - - $Info = Array( ); - $Players = Array( ); - - try - { - $Query->Connect( SQ_SERVER_ADDR, SQ_SERVER_PORT, SQ_TIMEOUT, SQ_ENGINE ); - - $Info = $Query->GetInfo( ); - $Players = $Query->GetPlayers( ); - } - catch( Exception $e ) - { - $Exception = $e; - } - - $Query->Disconnect( ); - - $Timer = Number_Format( MicroTime( true ) - $Timer, 4, '.', '' ); - - $InfoGT = $Info['GameTags']; // DEBUG /* @@ -90,34 +54,25 @@ if (mysqli_query($con, $insql)) { echo "Error: " . $insql . "
" . mysqli_error($con); } +// if server down update sql +if (empty($Info['HostName'])) { +$HostName="OFFLINE"; +$numplayers="0"; +$players="0"; +$ping="0"; +$insql = "INSERT INTO $table (date,name,players,maxplayers,map,game,version,timeserver,timespeed,timespeedn,battleye,hive,connect,secure,ping) VALUES ('$date','$HostName','$Players','$MaxPlayers','$Map','$Game','$Version','2:20','2','4','battleye','hive','$urlserv','$Secure','666')"; -/* -if ($con->connect_error) { -numplayers="0" -players="0" -ping="0" + if (mysqli_query($con, $insql)) { + // echo "New record created successfully"; + } else { + echo "Error: " . $insql . "
" . mysqli_error($con); + } - // die("Connection failed: " . $con->connect_error); - } - else - { - // echo "Connect Successfully"; - } - -insert_mysql_down() { -numplayers="0" -players="0" -ping="0" -mysql --host=$DB_SERV --user=$DB_USER --password=$DB_PASSWD --database=$DB_NAME << EOF - SET NAMES utf8; - insert into $TABLE (\`date\`,\`name\`,\`game\`,\`map\`,\`version\`,\`requiredVersion\`,\`numplayers\`,\`players\`,\`maxplayers\`,\`ping\`,\`timeserver\`,\`hive\`,\`battleye\`,\`connect\`,\`secure\`) VALUES - ("$datesql","OFFLINE","$game","$map","$version","$requiredVersion","$numplayers","$players","$maxplayers","$ping","$timeserver","$hive","$battleye","$connect","$secure"); } -*/ mysqli_close($con); - +// end ?>