first commit

This commit is contained in:
Erreur32 2021-02-05 10:07:23 +01:00
parent 448701492c
commit bbc5ccaaf6

View file

@ -3,42 +3,6 @@
include_once('./config.php'); include_once('./config.php');
include_once('./consql.php'); include_once('./consql.php');
// Don't touch below (or you know what you do)
$urlserv = $ipserv.":".$servport ;
// 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'];
// DEBUG // DEBUG
/* /*
@ -90,34 +54,25 @@ if (mysqli_query($con, $insql)) {
echo "Error: " . $insql . "<br>" . mysqli_error($con); 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)) {
if ($con->connect_error) { // echo "New record created successfully";
numplayers="0" } else {
players="0" echo "Error: " . $insql . "<br>" . mysqli_error($con);
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); mysqli_close($con);
// end
?> ?>