From b6c2eb5b4529d9acc411a2264cf7d0a135c3de5b Mon Sep 17 00:00:00 2001 From: Erreur32 Date: Fri, 5 Feb 2021 00:18:56 +0100 Subject: [PATCH] first commit --- GraphPlayer.php | 2 +- SQL/dayz2json_parser_sql.php | 25 +++++++++++++++++ config.php | 45 ++++++++++++++++++++++++++---- consql.php | 7 ++--- index.php | 53 ++++-------------------------------- 5 files changed, 74 insertions(+), 58 deletions(-) diff --git a/GraphPlayer.php b/GraphPlayer.php index 2298db6..894fbf0 100755 --- a/GraphPlayer.php +++ b/GraphPlayer.php @@ -22,7 +22,7 @@ include_once('config.php'); -

☠ Players on

+

☠ Players on

diff --git a/SQL/dayz2json_parser_sql.php b/SQL/dayz2json_parser_sql.php index 66c4447..1549902 100644 --- a/SQL/dayz2json_parser_sql.php +++ b/SQL/dayz2json_parser_sql.php @@ -90,6 +90,31 @@ if (mysqli_query($con, $insql)) { echo "Error: " . $insql . "
" . mysqli_error($con); } + +/* +if ($con->connect_error) { +numplayers="0" +players="0" +ping="0" + + // 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); diff --git a/config.php b/config.php index 5cbb508..63b6042 100644 --- a/config.php +++ b/config.php @@ -2,7 +2,8 @@ // ini_set("allow_url_fopen", 1); - // Need to Edit this +// Need to Edit this + /* $ipserv = "103.58.149.102" ; // IP server game $servport = "2302" ; // Game Server Port @@ -10,7 +11,6 @@ $queryport= "27016" ; // Queryport */ - $ipserv = "82.64.214.194" ; // IP server game $servport = "3201" ; // Game Server Port $modport = "3211" ; // Mod port omega (+10) @@ -19,15 +19,48 @@ $title = "DayZ Stat SERVER Clan | by TOX" ; // Web title page $descript = "Your Clan/server desciption"; // Your clan/server description - $namemap = "chernarusplus"; // choose between: chernarusplus / livonia / namalsk/ +// $namemap = "chernarusplus"; // choose between: chernarusplus / livonia / namalsk/ $logoteam = "logoteam.png"; $imagemap = "chernarus.jpg"; - - // Don't touch below - $urlserv = $ipserv.":".$servport ; + // Don't touch below (or you know what you do) + $urlserv = $ipserv.":".$servport ; + // need to fix if mod = 0 + $json = file_get_contents("http://".$ipserv.":".$modport."/"); // get info from server + $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 + + // 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']; ?> diff --git a/consql.php b/consql.php index fd7f98d..95ad5a2 100644 --- a/consql.php +++ b/consql.php @@ -10,17 +10,16 @@ $dbname = "database"; $table = "StatServer_1"; + $StatServer = $table; $con = new mysqli($servdb, $userdb, $pdb, $dbname); - if ($con->connect_error) { + if ($con->connect_error) { // Display the alert box // echo ''; echo "
...Connection failed with MYSQL
"; // die("Connection failed: " . $con->connect_error); - } - else - { + } else { // echo "Connect Successfully"; } diff --git a/index.php b/index.php index 6c312aa..47f8f42 100644 --- a/index.php +++ b/index.php @@ -10,46 +10,6 @@ $sec = "300"; include_once('./consql.php'); include_once('./config.php'); - // Don't touch below (or you know what you do) - - $urlserv = $ipserv.":".$servport ; - // need to fix if mod = 0 - $json = file_get_contents("http://".$ipserv.":".$modport."/"); - $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 - - // 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']; ?> @@ -197,9 +157,8 @@ $sec = "300"; - - -
+ +
s @@ -581,7 +540,7 @@ $sec = "300";
-
Player last 24 hours
+
Player count last 12 hours
@@ -737,9 +696,9 @@ $sec = "300";