DayZ-Stat-Server/config.php

61 lines
1.8 KiB
PHP
Raw Normal View History

2021-01-31 13:16:02 +01:00
<?php
2021-02-01 14:30:33 +01:00
ini_set("allow_url_fopen", 1);
2021-01-31 13:16:02 +01:00
2021-02-01 14:38:33 +01:00
// Edit this ->
2021-01-31 13:16:02 +01:00
2021-02-01 14:30:33 +01:00
$ipserv = "103.58.149.102" ; // IP server game
2021-02-01 14:33:27 +01:00
$portserv = "2302" ; // Game Server Port
2021-02-01 14:38:33 +01:00
$modport = "2312" ; // Mod port omega (+10)
$queryport= "27016" ; // Queryport
$title = "DayZ Stat SERVER Clan | by TOX" ; // Web title page
$descript = "Your Clan/server desciption"; // Your clan/server description
2021-02-01 14:30:33 +01:00
$namemap = "MAP CHERNARUS"; // you can put what you want.
2021-01-31 13:16:02 +01:00
2021-02-01 14:38:33 +01:00
// Don't touch below (or you know what you do)
2021-01-31 13:16:02 +01:00
2021-02-01 14:30:33 +01:00
$urlserv = $ipserv.":".$portserv ;
// need to fix if mod = 0
2021-01-31 16:31:37 +01:00
$json = file_get_contents("http://".$ipserv.":".$modport."/");
2021-01-31 13:16:02 +01:00
$objhigher=json_decode($json); //converts to an object
2021-01-31 16:11:09 +01:00
$objlower = $objhigher[0]; // if the json response its multidimensional this lowers it
$objlower=json_decode($json); //converts to an array of objects
2021-01-31 13:16:02 +01:00
2021-02-01 14:38:33 +01:00
// librarie SQ - info serv game
2021-01-31 13:16:02 +01:00
require 'SQ_/bootstrap.php';
use xPaw\SourceQuery\SourceQuery;
2021-01-31 16:11:09 +01:00
define( 'SQ_SERVER_ADDR', "${ipserv}" ); // IP server
2021-01-31 13:16:02 +01:00
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'];
?>