first commit
This commit is contained in:
parent
bbc5ccaaf6
commit
350f0757c5
2 changed files with 79 additions and 41 deletions
|
@ -3,6 +3,13 @@
|
|||
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
|
||||
/*
|
||||
|
@ -23,29 +30,77 @@ echo "GameID: " .$Info['GameID'] . "<br>";
|
|||
echo "<hr>test SQL";
|
||||
*/
|
||||
|
||||
|
||||
// Variables
|
||||
$HostName = $Info['HostName'] ;
|
||||
$Game = $Info['ModDesc'] ;
|
||||
$Version = $Info['Version'] ;
|
||||
$Players = $Info['Players'];
|
||||
$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'] ;
|
||||
$Secure = $Info['Secure'] ;
|
||||
$Map = $Info['Map'];
|
||||
$Os = $Info['Os'] ;
|
||||
$GamePort = $Info['GamePort'] ;
|
||||
$GameID = $Info['GameID'] ;
|
||||
$ping = "666";
|
||||
|
||||
// if server down update sql
|
||||
if (empty($Info['HostName'])) {
|
||||
|
||||
$HostName ="OFFLINE";
|
||||
$Players ="0";
|
||||
$ping ="0";
|
||||
$timeserver="0";
|
||||
$timespeed ="0";
|
||||
$timespeedn="0";
|
||||
$hive ="0";
|
||||
$battleye ="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')";
|
||||
|
||||
if (mysqli_query($con, $insql)) {
|
||||
// echo "New record created successfully";
|
||||
} else {
|
||||
echo "Error: " . $insql . "<br>" . mysqli_error($con);
|
||||
}
|
||||
|
||||
//mysqli_close($con);
|
||||
exit ;
|
||||
}
|
||||
|
||||
|
||||
// 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');
|
||||
// REGEX TIME
|
||||
$regtimsev = "/[0-9]{1,2}[:][0-9]{1,2}/";
|
||||
$result = preg_grep($regtimsev, explode(",", $InfoGT));
|
||||
$timeserver = $result[8];
|
||||
|
||||
$regtimeacd = "/([0-9][.][0-9]{1})/";
|
||||
$result = preg_grep($regtimeacd, explode(",", $InfoGT));
|
||||
$timespeed = $result[5];
|
||||
|
||||
$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];
|
||||
|
||||
// battleye check
|
||||
$regbattle = "/(battleye)/";
|
||||
$result = preg_grep($regbattle, explode(",", $InfoGT));
|
||||
$battleye = $result[0];
|
||||
|
||||
|
||||
// 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','2:20','2','4','battleye','hive','$urlserv','$Secure','666')";
|
||||
$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')";
|
||||
|
||||
// Check if errors with SQL query
|
||||
if (mysqli_query($con, $insql)) {
|
||||
|
@ -54,22 +109,6 @@ if (mysqli_query($con, $insql)) {
|
|||
echo "Error: " . $insql . "<br>" . mysqli_error($con);
|
||||
}
|
||||
|
||||
// if server down update sql
|
||||
if (empty($Info['HostName'])) {
|
||||
$HostName="OFFLINE";
|
||||
$numplayers="0";
|
||||
$players="0";
|
||||
$ping="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','2:20','2','4','battleye','hive','$urlserv','$Secure','666')";
|
||||
|
||||
if (mysqli_query($con, $insql)) {
|
||||
// echo "New record created successfully";
|
||||
} else {
|
||||
echo "Error: " . $insql . "<br>" . mysqli_error($con);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
mysqli_close($con);
|
||||
|
||||
|
||||
|
|
|
@ -10,24 +10,23 @@ error_reporting(E_ALL); // Display all types of error
|
|||
//$myJSON = json_decode(utf8_encode($readjson), true);
|
||||
|
||||
|
||||
include_once('config.php');
|
||||
include_once('../config.php');
|
||||
//include_once('consql.php');
|
||||
|
||||
//var_dump(json_decode($readjson));
|
||||
$urlserv = $ipserv.":".$servport ;
|
||||
|
||||
// librarie SQ - info serv game
|
||||
require 'SQ_/bootstrap.php';
|
||||
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 );
|
||||
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( );
|
||||
|
||||
|
@ -76,10 +75,10 @@ echo "<pre>".$InfoGT."</pre>";
|
|||
echo "<br>";
|
||||
|
||||
$result = explode(",", $InfoGT);
|
||||
$re = '/[^,]...(Hive)/';
|
||||
print_r($result);
|
||||
echo "<br>";
|
||||
echo "<br> 2222222";
|
||||
|
||||
$re = '/[^,]...(Hive)/';
|
||||
$rt = preg_grep($re, array($InfoGT));
|
||||
print_r($rt);
|
||||
echo "<br><hr>";
|
||||
|
|
Loading…
Reference in a new issue