2021-02-04 18:00:02 +01:00
|
|
|
<?php
|
|
|
|
|
2021-02-06 13:32:02 +01:00
|
|
|
include_once('config.php');
|
|
|
|
include_once('consql.php');
|
2021-02-04 20:59:35 +01:00
|
|
|
|
2021-02-05 13:56:01 +01:00
|
|
|
// set the default timezone to use. Available since PHP 5.1
|
2021-02-05 22:26:36 +01:00
|
|
|
// https://www.php.net/manual/en/timezones.others.php
|
2021-02-06 00:17:51 +01:00
|
|
|
|
2021-02-06 13:32:02 +01:00
|
|
|
// date_default_timezone_set('Etc/GMT-1');
|
|
|
|
// date_default_timezone_set('Asia/Bangkok');
|
|
|
|
date_default_timezone_set('Europe/Paris');
|
2021-02-05 22:26:36 +01:00
|
|
|
$date = date('Y-m-d H:i:s');
|
2021-02-05 10:46:47 +01:00
|
|
|
|
|
|
|
// if server down update sql
|
|
|
|
if (empty($Info['HostName'])) {
|
2021-02-04 18:00:02 +01:00
|
|
|
|
2021-02-05 10:46:47 +01:00
|
|
|
$HostName ="OFFLINE";
|
2021-02-05 13:56:01 +01:00
|
|
|
$PLayers ="0";
|
2021-02-05 10:46:47 +01:00
|
|
|
$ping ="0";
|
|
|
|
$timeserver="0";
|
|
|
|
$timespeed ="0";
|
|
|
|
$timespeedn="0";
|
|
|
|
$hive ="0";
|
|
|
|
$battleye ="0";
|
2021-02-05 13:16:04 +01:00
|
|
|
$mods ="0";
|
|
|
|
$timespeed ="0";
|
|
|
|
$timespeedn="0";
|
2021-02-04 18:00:02 +01:00
|
|
|
|
2021-02-05 13:56:01 +01:00
|
|
|
$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')";
|
2021-02-05 10:46:47 +01:00
|
|
|
|
|
|
|
if (mysqli_query($con, $insql)) {
|
2021-02-06 13:32:02 +01:00
|
|
|
echo "New record created successfully";
|
2021-02-05 10:46:47 +01:00
|
|
|
} else {
|
2021-02-06 00:17:51 +01:00
|
|
|
echo "Error: . $insql . <br>" . mysqli_error($con);
|
2021-02-05 10:46:47 +01:00
|
|
|
}
|
|
|
|
|
2021-02-05 13:16:04 +01:00
|
|
|
mysqli_close($con);
|
2021-02-06 13:32:02 +01:00
|
|
|
|
2021-02-05 18:57:23 +01:00
|
|
|
} else {
|
2021-02-05 10:46:47 +01:00
|
|
|
|
2021-02-05 22:26:36 +01:00
|
|
|
// REGEX TIME let's go :)
|
|
|
|
|
|
|
|
// time server
|
2021-02-05 10:46:47 +01:00
|
|
|
$regtimsev = "/[0-9]{1,2}[:][0-9]{1,2}/";
|
|
|
|
$result = preg_grep($regtimsev, explode(",", $InfoGT));
|
2021-02-06 13:32:02 +01:00
|
|
|
foreach ($result as $key => $val) { $timeserver = $val; }
|
2021-02-05 10:46:47 +01:00
|
|
|
|
2021-02-05 22:26:36 +01:00
|
|
|
// speedtime dayz
|
|
|
|
$regtimeacc = "/etm[0-9]{1,2}[.][0-9]{1}/";
|
|
|
|
$result = preg_grep($regtimeacc, explode(",", $InfoGT));
|
|
|
|
foreach ($result as $key => $val) { $timespeed = trim($val,"entm.0"); }
|
2021-02-05 10:46:47 +01:00
|
|
|
|
2021-02-05 22:26:36 +01:00
|
|
|
// speedtime night
|
|
|
|
$regtimeacn = "/entm[0-9]{1,2}[.][0-9]{1}/";
|
2021-02-05 10:46:47 +01:00
|
|
|
$result = preg_grep($regtimeacn, explode(",", $InfoGT));
|
2021-02-05 22:26:36 +01:00
|
|
|
foreach ($result as $key => $val) { $timespeedn = trim($val,"entm.0"); }
|
2021-02-05 10:46:47 +01:00
|
|
|
|
|
|
|
// HIVE
|
|
|
|
$reghive = '/[^,]...(Hive)/';
|
|
|
|
$result = preg_grep($reghive, explode(",", $InfoGT));
|
2021-02-05 22:26:36 +01:00
|
|
|
foreach ($result as $key => $val) { $hive = $val; }
|
2021-02-05 10:46:47 +01:00
|
|
|
|
2021-02-05 22:26:36 +01:00
|
|
|
// battleye
|
2021-02-05 10:46:47 +01:00
|
|
|
$regbattle = "/(battleye)/";
|
|
|
|
$result = preg_grep($regbattle, explode(",", $InfoGT));
|
2021-02-05 22:26:36 +01:00
|
|
|
foreach ($result as $key => $val) { $battleye = $val; }
|
|
|
|
|
|
|
|
// mod
|
|
|
|
$regmod = "/(mod)/";
|
|
|
|
$result = preg_grep($regmod, explode(",", $InfoGT));
|
|
|
|
foreach ($result as $key => $val) { $mods = $val; }
|
2021-02-04 18:00:02 +01:00
|
|
|
|
|
|
|
|
2021-02-04 22:14:31 +01:00
|
|
|
// SQL insert Query.
|
2021-02-06 13:32:02 +01:00
|
|
|
|
2021-02-05 13:56:01 +01:00
|
|
|
$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')";
|
2021-02-04 18:00:02 +01:00
|
|
|
|
2021-02-06 13:32:02 +01:00
|
|
|
|
2021-02-04 22:14:31 +01:00
|
|
|
// Check if errors with SQL query
|
2021-02-06 13:32:02 +01:00
|
|
|
|
2021-02-04 18:00:02 +01:00
|
|
|
if (mysqli_query($con, $insql)) {
|
2021-02-06 13:32:02 +01:00
|
|
|
echo "New record created successfully \n";
|
|
|
|
// echo $insql;
|
|
|
|
} else { echo "SQL to inject: \n" . $insql . "<br>" . mysqli_error($con); }
|
|
|
|
|
|
|
|
mysqli_close($con);
|
2021-02-04 18:00:02 +01:00
|
|
|
|
2021-02-05 18:57:23 +01:00
|
|
|
}
|
2021-02-04 18:00:02 +01:00
|
|
|
|
2021-02-05 10:07:23 +01:00
|
|
|
// end
|
2021-02-04 18:00:02 +01:00
|
|
|
|
|
|
|
?>
|