From 1f1489237b83b228bb0cc6a2964243c823397ac6 Mon Sep 17 00:00:00 2001 From: Erreur32 Date: Fri, 5 Feb 2021 13:16:04 +0100 Subject: [PATCH] first commit --- SQL/dayz2json_parser_sql.php | 23 +++++++++++------------ SQL/regex_statserver_json.php | 6 +++--- SQL/table.sql | 4 ++-- config.php | 12 ++++++++---- consql.php | 1 + index.php | 2 -- 6 files changed, 25 insertions(+), 23 deletions(-) diff --git a/SQL/dayz2json_parser_sql.php b/SQL/dayz2json_parser_sql.php index 896eeba..fa9d065 100644 --- a/SQL/dayz2json_parser_sql.php +++ b/SQL/dayz2json_parser_sql.php @@ -42,6 +42,7 @@ $Os = $Info['Os'] ; $GamePort = $Info['GamePort'] ; $GameID = $Info['GameID'] ; $ping = "666"; +$mods = "0"; // if server down update sql if (empty($Info['HostName'])) { @@ -54,8 +55,11 @@ $timespeed ="0"; $timespeedn="0"; $hive ="0"; $battleye ="0"; +$mods ="0"; +$timespeed ="0"; +$timespeedn="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','$timeserver','$timespeed','$timespeedn','$battleye','$hive','$urlserv','$Secure','$ping')"; +$insql = "INSERT INTO $table (date,name,players,maxplayers,map,game,version,timeserver,timespeed,timespeedn,mods,battleye,hive,connect,secure,ping) VALUES ('$date','$HostName','$Players','$MaxPlayers','$Map','$Game','$Version','$timeserver','$timespeed','$timespeedn','$mods','$battleye','$hive','$urlserv','$Secure','$ping')"; if (mysqli_query($con, $insql)) { // echo "New record created successfully"; @@ -63,12 +67,10 @@ $insql = "INSERT INTO $table (date,name,players,maxplayers,map,game,version,time echo "Error: " . $insql . "
" . mysqli_error($con); } -//mysqli_close($con); -exit ; +mysqli_close($con); +//exit ; } - - // REGEX TIME $regtimsev = "/[0-9]{1,2}[:][0-9]{1,2}/"; $result = preg_grep($regtimsev, explode(",", $InfoGT)); @@ -82,13 +84,7 @@ $regtimeacn = "/([0-9][.][0-9]{1})/"; $result = preg_grep($regtimeacn, explode(",", $InfoGT)); $timespeedn = $result[6]; -// DEBUG -$timespeed="2"; -$timespeedn="4"; - - // HIVE -//$result = explode(",", $InfoGT); $reghive = '/[^,]...(Hive)/'; $result = preg_grep($reghive, explode(",", $InfoGT)); $hive = $result[2]; @@ -98,9 +94,12 @@ $regbattle = "/(battleye)/"; $result = preg_grep($regbattle, explode(",", $InfoGT)); $battleye = $result[0]; +// DEBUG +$timespeed="2"; +$timespeedn="4"; // SQL insert Query. -$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','$timeserver','$timespeed','$timespeedn','$battleye','$hive','$urlserv','$Secure','$ping')"; +$insql = "INSERT INTO $table (date,name,players,maxplayers,map,game,version,timeserver,timespeed,timespeedn,mods,battleye,hive,connect,secure,ping) VALUES ('$date','$HostName','$Players','$MaxPlayers','$Map','$Game','$Version','$timeserver','$timespeed','$timespeedn','$mods','$battleye','$hive','$urlserv','$Secure','$ping')"; // Check if errors with SQL query if (mysqli_query($con, $insql)) { diff --git a/SQL/regex_statserver_json.php b/SQL/regex_statserver_json.php index 6df4b2d..6729727 100644 --- a/SQL/regex_statserver_json.php +++ b/SQL/regex_statserver_json.php @@ -74,9 +74,9 @@ echo "

Payes ta regex

"; echo "
".$InfoGT."
"; echo "
"; -$result = explode(",", $InfoGT); -print_r($result); -echo "
2222222"; +//$result = explode(",", $InfoGT); +//print_r($result); +echo "
"; $re = '/[^,]...(Hive)/'; $rt = preg_grep($re, array($InfoGT)); diff --git a/SQL/table.sql b/SQL/table.sql index 9570499..3bf961f 100644 --- a/SQL/table.sql +++ b/SQL/table.sql @@ -24,6 +24,7 @@ CREATE TABLE `StatServer_5` ( `timeserver` varchar(12) DEFAULT NULL, `timespeed` varchar(5) DEFAULT NULL, `timespeedn` varchar(5) DEFAULT NULL, + `mod` varchar(5) DEFAULT NULL, `battleye` tinytext DEFAULT NULL, `hive` varchar(11) DEFAULT NULL, `connect` varchar(32) DEFAULT NULL, @@ -34,6 +35,5 @@ CREATE TABLE `StatServer_5` ( KEY `date` (`date`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; --- 2021-02-02 14:33:07 - +-- 2021-02-05 10:22:08 diff --git a/config.php b/config.php index 63b6042..17e80e1 100644 --- a/config.php +++ b/config.php @@ -4,18 +4,18 @@ // Need to Edit this -/* + $ipserv = "103.58.149.102" ; // IP server game $servport = "2302" ; // Game Server Port $modport = "2312" ; // Mod port omega (+10) $queryport= "27016" ; // Queryport -*/ +/* $ipserv = "82.64.214.194" ; // IP server game $servport = "3201" ; // Game Server Port $modport = "3211" ; // Mod port omega (+10) $queryport= "27001" ; // Queryport - +*/ $title = "DayZ Stat SERVER Clan | by TOX" ; // Web title page $descript = "Your Clan/server desciption"; // Your clan/server description @@ -29,10 +29,14 @@ $urlserv = $ipserv.":".$servport ; // need to fix if mod = 0 $json = file_get_contents("http://".$ipserv.":".$modport."/"); // get info from server + if (!$json) { + //echo "The variable is not empty"; $objhigher = json_decode($json); //converts to an object $objlower = $objhigher[0]; // if the json response its multidimensional this lowers it $objlower = json_decode($json); //converts to an array of objects - + } else { + $mods = ""; + } // librarie SQ - info serv game require 'SQ_/bootstrap.php'; use xPaw\SourceQuery\SourceQuery; diff --git a/consql.php b/consql.php index 95ad5a2..ec5536e 100644 --- a/consql.php +++ b/consql.php @@ -11,6 +11,7 @@ $table = "StatServer_1"; + $StatServer = $table; $con = new mysqli($servdb, $userdb, $pdb, $dbname); diff --git a/index.php b/index.php index 47f8f42..cb6ac53 100644 --- a/index.php +++ b/index.php @@ -131,11 +131,9 @@ $sec = "300"; $time = $time[1] + $time[0]; $start = $time; - if (empty($Info['HostName'])) { $Info['HostName'] = "

OFF LINE

" ; } - ?>