first commit
This commit is contained in:
parent
21d30b24f2
commit
b5efefbcf1
19 changed files with 359 additions and 281 deletions
|
@ -1,17 +1,15 @@
|
|||
<?php
|
||||
|
||||
//ini_set('display_errors', 'on');
|
||||
ini_set('display_errors', 'on');
|
||||
|
||||
include('./consql.php');
|
||||
include_once('config.php');
|
||||
|
||||
// MYSQL table
|
||||
|
||||
// $StatServer = "StatServer_20"; // set in consql.php
|
||||
|
||||
$queryP = "SELECT date, numplayers FROM ".$StatServer." ORDER BY id DESC LIMIT 80";
|
||||
$queryP = "SELECT date, players FROM ".$StatServer." ORDER BY id DESC LIMIT 80";
|
||||
$arrPlay = $con->query($queryP);
|
||||
|
||||
?>
|
||||
|
||||
<head>
|
||||
|
@ -24,12 +22,12 @@ include_once('config.php');
|
|||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h3>☠ Players on <?php echo $namemap ;?></h3>
|
||||
|
||||
<div id="graph32"></div>
|
||||
|
||||
<script>
|
||||
var day_data = [<?php while($row = mysqli_fetch_assoc($arrPlay)){ echo "{'Date': '".$row["date"]."', 'Players': ".$row["numplayers"]."}, "; } ?> ];
|
||||
var day_data = [<?php while($row = mysqli_fetch_assoc($arrPlay)){ echo "{'Date': '".$row["date"]."', 'Players': ".$row["players"]."}, "; } ?> ];
|
||||
|
||||
Morris.Line({
|
||||
element: 'graph32',
|
||||
|
|
|
@ -30,13 +30,16 @@ Inspired by Omega namager template.
|
|||
- Omega manager (to check mod only)
|
||||
|
||||
- mysql database (to store status server for graph)
|
||||
> Schema database is not ready yet.
|
||||
Create dayzstat database first + user privilege.
|
||||
> Schema database is in table.sql
|
||||
|
||||
- put *statserverjson.sh* in crontab like this for mysql insert & creation of json file. (for shell bash only)
|
||||
> */5 * * * * /bin/sh /your/path/statserver_json.sh
|
||||
OR
|
||||
## JSON creation file
|
||||
> */5 * * * * /usr/local/bin/php -f /your/path/dayz2json.php > /your/path/server.json
|
||||
|
||||
## for SQL insert
|
||||
> */5 * * * * /usr/local/bin/php -f /your/path/dayz2json_parser_sql.php 2>&1
|
||||
|
||||
|
||||
### TODO
|
||||
|
|
|
@ -8,12 +8,13 @@
|
|||
$portserv = "2302" ; // Game Server Port
|
||||
$modport = "2312" ; // Mod port omega (+10)
|
||||
$queryport= "27016" ; // Queryport
|
||||
|
||||
*/
|
||||
|
||||
$ipserv = "82.64.214.194" ; // IP server game
|
||||
$portserv = "3201" ; // Game Server Port
|
||||
$modport = "3211" ; // Mod port omega (+10)
|
||||
$queryport= "27001" ; // Queryport*/
|
||||
$queryport= "27001" ; // Queryport
|
||||
|
||||
|
||||
$title = "DayZ Stat SERVER Clan | by TOX" ; // Web title page
|
||||
|
@ -23,5 +24,8 @@
|
|||
$imagemap = "chernarus.jpg";
|
||||
|
||||
|
||||
$urlserv = $ipserv.":".$portserv ;
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
<?php
|
||||
|
||||
# Change to our need
|
||||
|
||||
$servdb = "localhost";
|
||||
$userdb = "user";
|
||||
$pdb = "pass";
|
||||
$dbname = "database";
|
||||
$table = "StatServer_1";
|
||||
|
||||
$table = "StatServer_5";
|
||||
|
||||
$StatServer = $table;
|
||||
|
||||
$con = new mysqli($servdb, $userdb, $pdb, $dbname);
|
||||
|
||||
if ($con->connect_error) {
|
||||
|
|
60
dayz2json_obj_full.php
Normal file
60
dayz2json_obj_full.php
Normal file
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
|
||||
|
||||
ini_set('display_errors', 1);
|
||||
error_reporting(E_ALL); // Display all types of error
|
||||
set_time_limit ( 4 ); // Max execution time is set to 4 seconds
|
||||
|
||||
// Read JSON file
|
||||
$readjson = file_get_contents('./server.json');
|
||||
$myJSON = json_decode(utf8_encode($readjson), true);
|
||||
|
||||
/*
|
||||
echo "<h2>var dump: </h2><br>"; var_dump($myJSON);
|
||||
echo "<hr>";
|
||||
|
||||
echo "<h2>JSON ARRAY:</h2><br> ";
|
||||
print_r($myJSON);
|
||||
|
||||
echo "<h2>var_dump(json_decode: </h2><br>";
|
||||
|
||||
*/
|
||||
|
||||
var_dump(json_decode($readjson));
|
||||
|
||||
//$sname = $readjson->{'server1'};
|
||||
//echo $sname;
|
||||
|
||||
/*
|
||||
echo "<hr>";
|
||||
$InfoGT = $Info['GameTags'];
|
||||
echo $InfoGT;
|
||||
|
||||
echo "<br>";
|
||||
$sname = $Info['HostName'] ;
|
||||
$Players = $Info['Players'] ;
|
||||
$MaxPlayers = $Info['MaxPlayers'] ;
|
||||
$Secure = $Info['Secure'] ;
|
||||
$Map = $Info['Map'] ;
|
||||
$Os = $Info['Os'] ;
|
||||
$Version = $Info['Version'] ;
|
||||
$GamePort = $Info['GamePort'] ;
|
||||
|
||||
$game = "Dayz" ;
|
||||
$ping = "666" ;
|
||||
|
||||
echo "Hostname: " .$sname . "<br>";
|
||||
echo "Players: " .$Players . "<br>";
|
||||
echo "MaxPlayers: " .$MaxPlayers . "<br>";
|
||||
echo "Secure: " .$Secure . "<br>";
|
||||
echo "Map: " .$Map . "<br>";
|
||||
echo "Os: " .$Os . "<br>";
|
||||
echo "Version: " .$Version . "<br>";
|
||||
echo "Port: " .$GamePort . "<br><hr>";
|
||||
*/
|
||||
|
||||
//preg_grep('/keywords \z map/', explode("\n", $readjson));
|
||||
|
||||
|
||||
?>
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
<?php
|
||||
|
||||
include_once('./config.php');
|
||||
|
||||
// Don't touch below (or you know what you do)
|
||||
|
||||
$urlserv = $ipserv.":".$portserv ;
|
||||
|
||||
// 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'];
|
||||
|
||||
|
||||
|
||||
echo $Info['Players'] ;echo "<br>";
|
||||
echo $Info['MaxPlayers'] ;echo "<br>";
|
||||
echo $Info['MaxPlayers'] ;echo "<br>";
|
||||
echo $Info['MaxPlayers'] ;echo "<br>";
|
||||
echo $Info['MaxPlayers'] ;echo "<br>";
|
||||
echo $Info['MaxPlayers'] ;echo "<br>";
|
||||
echo $Info['MaxPlayers'] ;echo "<br>";
|
||||
echo $Info['MaxPlayers'] ;echo "<br>";
|
||||
echo $Info['MaxPlayers'] ;echo "<br>";
|
||||
echo $Info['MaxPlayers'] ;echo "<br>";
|
||||
echo $Info['MaxPlayers'] ;echo "<br>";
|
||||
echo $Info['MaxPlayers'] ;echo "<br>";
|
||||
echo $Info['MaxPlayers'] ;echo "<br>";
|
||||
echo $Info['MaxPlayers'] ;echo "<br>";
|
||||
echo $Info['MaxPlayers'] ;echo "<br>";
|
||||
echo $Info['MaxPlayers'] ;echo "<br>";
|
||||
echo $Info['MaxPlayers'] ;echo "<br>";
|
||||
echo $Info['MaxPlayers'] ;
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
90
dayz2json_parser_sql.php
Normal file
90
dayz2json_parser_sql.php
Normal file
|
@ -0,0 +1,90 @@
|
|||
<?php
|
||||
|
||||
include_once('./config.php');
|
||||
include_once('./consql.php');
|
||||
// Don't touch below (or you know what you do)
|
||||
|
||||
$urlserv = $ipserv.":".$portserv ;
|
||||
|
||||
// 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'];
|
||||
|
||||
|
||||
print_r($Info);
|
||||
echo "<br><hr>";
|
||||
|
||||
echo "InfoGT: " .$InfoGT . "<br>";
|
||||
echo "ModDesc: " .$Info['ModDesc'] . "<br>";
|
||||
echo "Hostname: " .$Info['HostName'] . "<br>";
|
||||
echo "Players: " .$Info['Players'] . "<br>";
|
||||
echo "MaxPlayers: " .$Info['MaxPlayers'] . "<br>";
|
||||
echo "Secure: " .$Info['Secure'] . "<br>";
|
||||
echo "Map: " .$Info['Map'] . "<br>";
|
||||
echo "Os: " .$Info['Os'] . "<br>";
|
||||
echo "Version: " .$Info['Version'] . "<br>";
|
||||
echo "Port: " .$Info['GamePort'] . "<br>";
|
||||
echo "GameID: " .$Info['GameID'] . "<br>";
|
||||
|
||||
echo "<hr>test SQL";
|
||||
|
||||
$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'] ;
|
||||
|
||||
|
||||
// set the default timezone to use. Available since PHP 5.1
|
||||
date_default_timezone_set('UTC+1');
|
||||
|
||||
$date = date('Y-m-d H:i:s');
|
||||
|
||||
$insql = "INSERT INTO $table (date,name,game,map,version,players,maxplayers,ping,timeserver,hive,battleye,connect,secure) VALUES ('$date','$HostName', '$Game', '$Map', '$Version', '$Players', '$MaxPlayers', '0', '2:20', 'hive', 'battleye', '$urlserv', '$Secure')";
|
||||
|
||||
if (mysqli_query($con, $insql)) {
|
||||
echo "New record created successfully";
|
||||
} else {
|
||||
echo "Error: " . $insql . "<br>" . mysqli_error($con);
|
||||
}
|
||||
|
||||
mysqli_close($con);
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
BIN
favicon.ico
Normal file
BIN
favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
BIN
favicon.png
Normal file
BIN
favicon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
|
@ -61,7 +61,8 @@ $sec = "300";
|
|||
<title><?php echo "$title"; ?></title>
|
||||
<meta name='description' content='<?php echo "$descript"; ?>'>
|
||||
<meta name="author" content="Erreur32">
|
||||
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
|
||||
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico">
|
||||
<link rel="icon" type="image/png" href="/favicon.png"/>
|
||||
<meta name="keyword" content="tox,server,dayz,map,namalsk,namalsk island">
|
||||
<link id="theme-style" href="css/style_dark.css" rel="stylesheet">
|
||||
|
||||
|
@ -582,7 +583,6 @@ $sec = "300";
|
|||
<div class="card">
|
||||
<div class="card-header">Player last 24 hours</div>
|
||||
<div class="card-body">
|
||||
<!-- // not ready yet -->
|
||||
<?php include('./GraphPlayer.php'); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -30,7 +30,7 @@ if (!$file) quit("File read error with $filanme");
|
|||
$data = json_decode($file, true);
|
||||
$sql = "";
|
||||
foreach($data as $obj) {
|
||||
// $keys = implode('`,`', array_map('addslashes', array_keys($obj)));
|
||||
$keys = implode('`,`', array_map('addslashes', array_keys($obj)));
|
||||
$values = implode("','", array_map('addslashes', array_values($obj)));
|
||||
$sql .= "INSERT INTO `$table` (`$keys`, `Dates`) VALUES ('$values', '$date');\n";
|
||||
}
|
||||
|
@ -39,3 +39,6 @@ $out = pathinfo($filename, PATHINFO_FILENAME) . ".sql";
|
|||
if(!file_put_contents($out, $sql)) quit("Could not write contents to $out");
|
||||
|
||||
quit("Written SQL data to $out");
|
||||
|
||||
|
||||
// php -f json2sql.php StatServer_5 server.json
|
||||
|
|
128
mod_server.php
128
mod_server.php
|
@ -1,128 +0,0 @@
|
|||
<?php
|
||||
//ini_set("allow_url_fopen", 1);
|
||||
|
||||
|
||||
include_once('./config.php');
|
||||
|
||||
|
||||
$json = file_get_contents('http://<?php echo $ipserv.":".queryport; ?>');
|
||||
$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 ?>
|
||||
|
||||
|
||||
<center>
|
||||
|
||||
<p class="before-list">
|
||||
<span style="padding: 5px 0px 2px 20px;"><?php echo count($objlower); ?> MODS </span>
|
||||
<span style="padding: 5px 0px 2px 20px;"> IP: <span style="color: orange;"><?php echo $urlserv; ?></span> </span>
|
||||
<br>
|
||||
<span style="padding: 5px 0px 2px 20px;"> <em><i>(clic to join) </i> </em>
|
||||
<a style="text-decoration:none;" href='steam://connect/<?php echo $urlserv; ?>/'><span class='label label-success'> </span></a></span>
|
||||
</p>
|
||||
|
||||
|
||||
<div class="mod-list">
|
||||
|
||||
<center>
|
||||
<table class="table_ table-bordered_ table-striped_" style="">
|
||||
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="text-align:left;"><span class='label label-info'>MOD Name</span></th>
|
||||
<th><span class='label label-info'>steamWorkshopId</span></th>
|
||||
<th><span class='label label-info'>Taille </span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<tr><td><br></td><td></td><br></tr>
|
||||
<?php
|
||||
//$objlower=json_decode($json); //converts to an array of objects
|
||||
foreach( $objlower as $item ) { ?>
|
||||
<tr>
|
||||
<td><?php echo $item->name; ?></td>
|
||||
<td><a href="http://steamcommunity.com/sharedfiles/filedetails/?id=<?php echo $item->steamWorkshopId?>" data-type="Link"><?php echo $item->steamWorkshopId; ?> </td>
|
||||
<td>
|
||||
<div id="loading">
|
||||
<?php
|
||||
|
||||
$getcontents = "https://steamcommunity.com/sharedfiles/filedetails/?id=" . "$item->steamWorkshopId";
|
||||
$data_scrapped = file_get_contents($getcontents);
|
||||
|
||||
$thestart = explode('<div class="detailsStatsContainerRight">', $data_scrapped);
|
||||
$theend = explode('</div>',$thestart[1]);
|
||||
echo $theend[0];
|
||||
|
||||
?>
|
||||
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
</center>
|
||||
|
||||
|
||||
</div>
|
||||
<br>
|
||||
</center>
|
||||
|
||||
<style>
|
||||
|
||||
|
||||
|
||||
|
||||
hr {
|
||||
border: 5px solid green;
|
||||
border-radius: 5px;
|
||||
width: 40%;
|
||||
}
|
||||
|
||||
a,a:visited {
|
||||
color: green;
|
||||
text-decoration: none;
|
||||
}
|
||||
a:hover {
|
||||
color: orange;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
|
||||
.from-steam {
|
||||
padding: 10px 30px 3px 0;
|
||||
color: #449EBD;
|
||||
}
|
||||
.from-local {
|
||||
color: gray;
|
||||
}
|
||||
|
||||
th, td {
|
||||
font: 100%/1.3 Roboto, Segoe UI, Tahoma, Arial, Helvetica, sans-serif;
|
||||
}
|
||||
|
||||
td {
|
||||
padding: 3px 30px 3px 0;
|
||||
}
|
||||
|
||||
h1 {
|
||||
padding: 20px 20px 0 20px;
|
||||
color: white;
|
||||
font-weight: 200;
|
||||
font-family: segoe ui;
|
||||
font-size: 3em;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
em {
|
||||
font-variant: italic;
|
||||
color:silver;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -4,7 +4,7 @@ ini_set('display_errors', 1);
|
|||
set_time_limit ( 4 ); // Max execution time is set to 4 seconds
|
||||
|
||||
// Read JSON file
|
||||
$readjson = file_get_contents('../statserver.json');
|
||||
$readjson = file_get_contents('statserver.json');
|
||||
|
||||
$data = json_decode($readjson);
|
||||
// class
|
137
regex_statserver_json.php
Normal file
137
regex_statserver_json.php
Normal file
|
@ -0,0 +1,137 @@
|
|||
<?php
|
||||
|
||||
|
||||
ini_set('display_errors', 1);
|
||||
error_reporting(E_ALL); // Display all types of error
|
||||
|
||||
//set_time_limit ( 4 ); // Max execution time is set to 4 seconds
|
||||
|
||||
// Read JSON file
|
||||
//$readjson = file_get_contents('./server.json');
|
||||
//$myJSON = json_decode(utf8_encode($readjson), true);
|
||||
|
||||
|
||||
include_once('config.php');
|
||||
//include_once('consql.php');
|
||||
|
||||
//var_dump(json_decode($readjson));
|
||||
$urlserv = $ipserv.":".$portserv ;
|
||||
|
||||
// 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'];
|
||||
|
||||
print_r($Info);
|
||||
|
||||
echo "<hr><h1> RESULTS </h1>";
|
||||
|
||||
$sname = $Info['HostName'] ;
|
||||
$Players = $Info['Players'] ;
|
||||
$MaxPlayers = $Info['MaxPlayers'] ;
|
||||
$Secure = $Info['Secure'] ;
|
||||
$Map = $Info['Map'] ;
|
||||
$Os = $Info['Os'] ;
|
||||
$Version = $Info['Version'] ;
|
||||
$GamePort = $Info['GamePort'] ;
|
||||
|
||||
echo "Hostname: " .$sname . "<br>";
|
||||
echo "Players: " .$Players . "<br>";
|
||||
echo "MaxPlayers: " .$MaxPlayers . "<br>";
|
||||
echo "Secure: " .$Secure . "<br>";
|
||||
echo "Map: " .$Map . "<br>";
|
||||
echo "Os: " .$Os . "<br>";
|
||||
echo "Version: " .$Version . "<br>";
|
||||
echo "Port: " .$GamePort . "<br><hr>";
|
||||
|
||||
echo "<h1>Payes ta regex</h1>";
|
||||
echo "<pre>".$InfoGT."</pre>";
|
||||
echo "<br>";
|
||||
|
||||
$result = explode(",", $InfoGT);
|
||||
$re = '/[^,]...(Hive)/';
|
||||
print_r($result);
|
||||
echo "<br>";
|
||||
|
||||
$rt = preg_grep($re, array($InfoGT));
|
||||
print_r($rt);
|
||||
echo "<br><hr>";
|
||||
|
||||
$regtimsev = "/(battleye)/";
|
||||
$result = preg_grep($regtimsev, explode(",", $InfoGT));
|
||||
//print_r($result);
|
||||
echo $result[0];
|
||||
echo "<br><hr>";
|
||||
|
||||
$result = preg_grep($re,explode(",", $InfoGT));
|
||||
//print_r( preg_grep($re, array($InfoGT)));
|
||||
echo $result[2];
|
||||
echo "<br><hr>";
|
||||
|
||||
$regtimsev = "/[0-9]{1,2}[:][0-9]{1,2}/";
|
||||
$result = preg_grep($regtimsev, explode(",", $InfoGT));
|
||||
//print_r($result);
|
||||
echo $result[8];
|
||||
echo "<br><hr>";
|
||||
|
||||
$regtimeacc = "/([0-9][.][0-9]{1})/";
|
||||
$result = preg_grep($regtimeacc, explode(",", $InfoGT));
|
||||
//print_r($result);
|
||||
echo $result[5];
|
||||
echo "<br><hr>";
|
||||
|
||||
$regtimeacn = "/([0-9][.][0-9]{1})/";
|
||||
$result = preg_grep($regtimeacn, explode(",", $InfoGT));
|
||||
//print_r($result);
|
||||
echo $result[6];
|
||||
|
||||
echo "<br><hr>";
|
||||
|
||||
echo "<h1>Payes ton explode</h1>";
|
||||
$retest = explode(",", $InfoGT);
|
||||
echo $retest[0] . "|".$retest[2]. "|". $retest[3]. "|". $retest[4]. "|". $retest[8]. "|". $retest[5]. "|". $retest[6];
|
||||
|
||||
/*
|
||||
$regtimsev = "[0-9]{1,2}[:][0-9]{1,2}";
|
||||
$reghive = "[^,]...(Hive)";
|
||||
$regtimeacc = "[^,etm][0-9][.][0-9]{1}";
|
||||
//$regtimeacn = "[^,entm][0-9][.][0-9]{1}";
|
||||
$regtimeacn = "([0-9][.][0-9]{1})";
|
||||
//echo preg_grep('/[0-9]{1,2}[:][0-9]{1,2}/', explode("\n", $InfoGT));
|
||||
|
||||
echo preg_grep('/$regex/', $InfoGT);
|
||||
|
||||
$fl_array = preg_grep("/[^,entm][0-9][.][0-9]{1}/", $InfoGT);
|
||||
echo $fl_array;
|
||||
*/
|
||||
|
||||
?>
|
||||
|
1
server.sql
Normal file
1
server.sql
Normal file
|
@ -0,0 +1 @@
|
|||
INSERT INTO `StatServer_5` (`dedicated`,`game_descr`,`game_dir`,`game_id`,`gq_address`,`gq_dedicated`,`gq_gametype`,`gq_hostname`,`gq_joinlink`,`gq_mapname`,`gq_maxplayers`,`gq_mod`,`gq_name`,`gq_numplayers`,`gq_online`,`gq_password`,`gq_port_client`,`gq_port_query`,`gq_protocol`,`gq_transport`,`gq_type`,`hostname`,`keywords`,`map`,`max_players`,`num_bots`,`num_players`,`os`,`password`,`players`,`port`,`protocol`,`secure`,`steam_id`,`steamappid`,`teams`,`version`, `Dates`) VALUES ('d','DayZ','dayz','221100','82.64.214.194','d','DayZ','[ TOX 1 #Expansion ] Chernarus Gloom HeroMOD | Summer | FR/EN','steam://connect/82.64.214.194:3201/','ChernarusPlusGloom','60','dayz','DayZ Standalone','0','1','0','3201','27001','source','udp','dayz','[ TOX 1 #Expansion ] Chernarus Gloom HeroMOD | Summer | FR/EN','battleye,external,privHive,shard,lqs0,etm2.000000,entm5.500000,mod,07:51','ChernarusPlusGloom','60','0','0','w','0','','3201','17','1','90142623158817801','0','','1.10.153598', '2021-02-04 15:32:07');
|
|
@ -1,53 +0,0 @@
|
|||
<?php
|
||||
|
||||
ini_set('display_errors', 1);
|
||||
//error_reporting(E_ALL); // Display all types of error
|
||||
set_time_limit ( 4 ); // Max execution time is set to 4 seconds
|
||||
|
||||
// Read JSON file
|
||||
$readjson = file_get_contents('./server.json');
|
||||
|
||||
$myJSON = json_decode(utf8_encode($readjson), true);
|
||||
|
||||
//echo $expansion_gq['gq_numplayers'];
|
||||
|
||||
echo "JSON ARRAY:<br> ";
|
||||
print_r($myJSON);
|
||||
|
||||
echo "<hr>";
|
||||
echo "RecursiveArrayIterator: <br>";
|
||||
$jsonIterator = new RecursiveIteratorIterator(
|
||||
new RecursiveArrayIterator(json_decode($readjson, TRUE)),
|
||||
RecursiveIteratorIterator::SELF_FIRST);
|
||||
|
||||
foreach ($jsonIterator as $key => $val) {
|
||||
if(is_array($val)) {
|
||||
echo "$key:\n";
|
||||
} else {
|
||||
echo "$key => $val\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
echo "<hr>";
|
||||
echo "var dump: <br>"; var_dump($readjson);
|
||||
echo "<hr>";
|
||||
|
||||
echo "Parsing data by using PHP Object <br/>";
|
||||
$objhigher=json_decode($readjson); //converts to an object
|
||||
$objlower = $objhigher[0]; // if the json response its multidimensional this lowers it
|
||||
$objlower = json_decode($readjson); //converts to an array of objects
|
||||
|
||||
echo $objlower->hostname;
|
||||
echo $obj->gq_address;
|
||||
|
||||
//echo $myJSON['hostname'];
|
||||
//echo $myJSON[2];
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
17
table.sql
17
table.sql
|
@ -11,30 +11,29 @@ DROP DATABASE IF EXISTS `dayzstat`;
|
|||
CREATE DATABASE `dayzstat` /*!40100 DEFAULT CHARACTER SET utf8mb4 */;
|
||||
USE `dayzstat`;
|
||||
|
||||
DROP TABLE IF EXISTS `StatServer_1`;
|
||||
CREATE TABLE `StatServer_1` (
|
||||
DROP TABLE IF EXISTS `StatServer_5`;
|
||||
CREATE TABLE `StatServer_5` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`date` datetime DEFAULT NULL,
|
||||
`date` datetime DEFAULT NULL ON UPDATE current_timestamp(),
|
||||
`name` varchar(74) NOT NULL DEFAULT 'Offline',
|
||||
`numplayers` varchar(4) NOT NULL DEFAULT '0',
|
||||
`timeserver` varchar(12) DEFAULT NULL,
|
||||
`players` varchar(32) NOT NULL DEFAULT '0',
|
||||
`maxplayers` varchar(4) DEFAULT NULL,
|
||||
`map` varchar(19) DEFAULT NULL,
|
||||
`game` varchar(4) DEFAULT NULL,
|
||||
`maxplayers` varchar(4) DEFAULT NULL,
|
||||
`requiredVersion` varchar(15) DEFAULT NULL,
|
||||
`version` varchar(15) DEFAULT NULL,
|
||||
`timeserver` varchar(12) DEFAULT NULL,
|
||||
`timespeed` varchar(5) DEFAULT NULL,
|
||||
`timespeedn` varchar(5) DEFAULT NULL,
|
||||
`battleye` tinytext DEFAULT NULL,
|
||||
`hive` varchar(11) DEFAULT NULL,
|
||||
`connect` varchar(32) DEFAULT NULL,
|
||||
`secure` tinytext DEFAULT NULL,
|
||||
`ping` varchar(3) NOT NULL DEFAULT '0',
|
||||
`ping` varchar(3) DEFAULT '0',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `timeserver` (`timeserver`),
|
||||
KEY `date` (`date`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
-- 2021-02-02 14:33:07
|
||||
|
||||
|
||||
|
|
30
test.php
Normal file
30
test.php
Normal file
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
ini_set('display_errors', 'on');
|
||||
error_reporting(E_ALL); // Display all types of error
|
||||
|
||||
$re = '/[0-9]{1,2}[:][0-9]{1,2}/m';
|
||||
$str = 'battleye,external,privHive,shard,lqs0,etm2.000000,entm5.500000,mod,23:17';
|
||||
|
||||
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
|
||||
|
||||
// Print the entire match result
|
||||
//var_dump($matches);
|
||||
|
||||
echo '<pre>'; print_r($matches); echo '</pre>';
|
||||
|
||||
echo "<br>";
|
||||
|
||||
$encode = json_encode($matches);
|
||||
echo $encode;
|
||||
echo "<br>";
|
||||
|
||||
//echo $matches[0];
|
||||
$output = implode(",", array($str));
|
||||
echo $output;
|
||||
echo "<br>";
|
||||
$output1 = implode(",", array($matches));
|
||||
echo $output1;
|
||||
echo "<br>";
|
||||
|
||||
?>
|
Loading…
Reference in a new issue