From 316af02a9bfcc36ea097f8aebecea9c710148819 Mon Sep 17 00:00:00 2001 From: Erreur32 Date: Fri, 5 Feb 2021 13:56:01 +0100 Subject: [PATCH] first commit --- SQL/dayz2json_parser_sql.php | 51 ++++++------------------------------ SQL/table.sql | 4 --- config.php | 45 ++++++++++++++++++++++++++++++- consql.php | 2 +- index.php | 5 ++-- 5 files changed, 55 insertions(+), 52 deletions(-) diff --git a/SQL/dayz2json_parser_sql.php b/SQL/dayz2json_parser_sql.php index fa9d065..686512a 100644 --- a/SQL/dayz2json_parser_sql.php +++ b/SQL/dayz2json_parser_sql.php @@ -3,52 +3,17 @@ include_once('./config.php'); include_once('./consql.php'); -// set the default timezone to use. Available since PHP 5.1 -// https://www.php.net/manual/en/timezones.others.php -date_default_timezone_set('Etc/GMT-1'); -//date_default_timezone_set('Europe/Paris'); - -$date = date('Y-m-d H:i:s'); - - -// DEBUG -/* -print_r($Info); -echo "

"; - -echo "InfoGT: " .$InfoGT . "
"; -echo "ModDesc: " .$Info['ModDesc'] . "
"; -echo "Hostname: " .$Info['HostName'] . "
"; -echo "Players: " .$Info['Players'] . "
"; -echo "MaxPlayers: " .$Info['MaxPlayers'] . "
"; -echo "Secure: " .$Info['Secure'] . "
"; -echo "Map: " .$Info['Map'] . "
"; -echo "Os: " .$Info['Os'] . "
"; -echo "Version: " .$Info['Version'] . "
"; -echo "Port: " .$Info['GamePort'] . "
"; -echo "GameID: " .$Info['GameID'] . "
"; -echo "
test SQL"; -*/ - -// Variables -$HostName = $Info['HostName'] ; -$Game = $Info['ModDesc'] ; -$Version = $Info['Version'] ; -$Players = $Info['Players']; -$MaxPlayers = $Info['MaxPlayers'] ; -$Secure = $Info['Secure'] ; -$Map = $Info['Map']; -$Os = $Info['Os'] ; -$GamePort = $Info['GamePort'] ; -$GameID = $Info['GameID'] ; -$ping = "666"; -$mods = "0"; + // set the default timezone to use. Available since PHP 5.1 + // https://www.php.net/manual/en/timezones.others.php + date_default_timezone_set('Etc/GMT-1'); + //date_default_timezone_set('Europe/Paris'); + $date = date('Y-m-d H:i:s'); // if server down update sql if (empty($Info['HostName'])) { $HostName ="OFFLINE"; -$Players ="0"; +$PLayers ="0"; $ping ="0"; $timeserver="0"; $timespeed ="0"; @@ -59,7 +24,7 @@ $mods ="0"; $timespeed ="0"; $timespeedn="0"; -$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')"; +$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"; @@ -99,7 +64,7 @@ $timespeed="2"; $timespeedn="4"; // SQL insert Query. -$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')"; +$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/table.sql b/SQL/table.sql index 3bf961f..2fdc313 100644 --- a/SQL/table.sql +++ b/SQL/table.sql @@ -7,10 +7,6 @@ SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO'; SET NAMES utf8mb4; -DROP DATABASE IF EXISTS `dayzstat`; -CREATE DATABASE `dayzstat` /*!40100 DEFAULT CHARACTER SET utf8mb4 */; -USE `dayzstat`; - DROP TABLE IF EXISTS `StatServer_5`; CREATE TABLE `StatServer_5` ( `id` int(11) NOT NULL AUTO_INCREMENT, diff --git a/config.php b/config.php index 17e80e1..9e032a0 100644 --- a/config.php +++ b/config.php @@ -19,10 +19,17 @@ $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"; +/* + // set the default timezone to use. Available since PHP 5.1 + // https://www.php.net/manual/en/timezones.others.php + date_default_timezone_set('Etc/GMT-1'); + //date_default_timezone_set('Europe/Paris'); + //$date = date('Y-m-d H:i:s'); +*/ // Don't touch below // Don't touch below (or you know what you do) @@ -66,5 +73,41 @@ $Timer = Number_Format( MicroTime( true ) - $Timer, 4, '.', '' ); $InfoGT = $Info['GameTags']; + + + + // DEBUG + /* + print_r($Info); + echo "

"; + + echo "InfoGT: " .$InfoGT . "
"; + echo "ModDesc: " .$Info['ModDesc'] . "
"; + echo "Hostname: " .$Info['HostName'] . "
"; + echo "Players: " .$Info['Players'] . "
"; + echo "MaxPlayers: " .$Info['MaxPlayers'] . "
"; + echo "Secure: " .$Info['Secure'] . "
"; + echo "Map: " .$Info['Map'] . "
"; + echo "Os: " .$Info['Os'] . "
"; + echo "Version: " .$Info['Version'] . "
"; + echo "Port: " .$Info['GamePort'] . "
"; + echo "GameID: " .$Info['GameID'] . "
"; + echo "
test SQL"; + */ + + // Variables + $HostName = $Info['HostName'] ; + $Game = $Info['ModDesc'] ; + $Version = $Info['Version'] ; + $PLayers = $Info['Players']; + $MaxPlayers = $Info['MaxPlayers'] ; + $Secure = $Info['Secure'] ; + $Map = $Info['Map']; + $Os = $Info['Os'] ; + $GamePort = $Info['GamePort'] ; + $GameID = $Info['GameID'] ; + $ping = "666"; +// $mods = "0"; + ?> diff --git a/consql.php b/consql.php index ec5536e..9f9e12b 100644 --- a/consql.php +++ b/consql.php @@ -8,7 +8,7 @@ $userdb = "user"; $pdb = "pass"; $dbname = "database"; - $table = "StatServer_1"; + $table = "StatServer_5"; diff --git a/index.php b/index.php index cb6ac53..35e2044 100644 --- a/index.php +++ b/index.php @@ -508,12 +508,11 @@ $sec = "300";
List players online:
- + - - +
"Survivor" Playtime > Minutes "Survivor" Playtime > Minutes