Code Monkey home page Code Monkey logo

Comments (38)

Sebbabas avatar Sebbabas commented on July 17, 2024 1

ok i'm looking at it now, i must have forgotten a file!

from lgsl.

Sebbabas avatar Sebbabas commented on July 17, 2024

Hello,
For Farming Simulator 13/15/17/19, you must add a "code" column in the TABLE.
Create an XML function 'simplexml_load_string'.
exemple : https://gmus.duckdns.org/listserver-d-MTM

ex code : $serverAddress = "http://{$server['b']['ip']}:{$server['b']['q_port']}/feed/dedicated-server-stats.xml?code={$server['b']['code']}";

thank.

from lgsl.

Webby0815 avatar Webby0815 commented on July 17, 2024

?? i cant do this :-(

from lgsl.

Webby0815 avatar Webby0815 commented on July 17, 2024

Can you Help me,in which File Mist i implate this

from lgsl.

Sebbabas avatar Sebbabas commented on July 17, 2024

@Webby0815
Hi,
I add this code in 'lgsl_protocol.php' 'lgsl_protocol.php'
Please note that this works for me, but I am not a professional, please be indulgent.

after line 53 :

"fs2013" => "Farming Simulator 2013",
"fs2015" => "Farming Simulator 15",
"fs2017" => "Farming Simulator 17",
"fs2019" => "Farming Simulator 19",

after line 184 :

"fs2013" => "39",
"fs2015" => "39",
"fs2017" => "39",
"fs2019" => "39",

after line 3994 :

//------------------------------------------------------------------------------------------------------------+
//------------------------------------------------------------------------------------------------------------+
function lgsl_query_39(&$server, &$lgsl_need, &$lgsl_fp){ // Farming Simulator 13/15/17/19 | OK - 26/03/21
$serverAddress = "http://{$server['b']['ip']}:{$server['b']['q_port']}/feed/dedicated-server-stats.xml?code={$server['b']['code']}";
$xml = getServerStatsSimpleXML($serverAddress,$server['b']['type'],$server['b']['q_port']);
$key = array('Big Bud Pack','Platinum Expansion','KUHN Pack','ROPA Pack'); // LIST DLC FS
$m=0;
if($xml){
if($xml["name"] != NULL){$server['s']['name'] = $xml["name"];}else{$server['s']['name'] = "WebInterface ON | Server OFF";}
$server['b']['status'] = 1;
$server['s']['map'] = $xml["mapName"];
$server['s']['playersmax'] = $xml->Slots["capacity"];
$server['s']['players'] = $xml->Slots["numUsed"];
$server['s']['password'] = 0;
$server['e']['Game'] = $xml["game"];
$server['e']['Server'] = $xml["server"];
$server['e']['dedicated'] = "Dedicated";
$server['e']['Platform'] = "Wine";
$server['e']['Version'] = $xml["version"];
$server['e']['Heure_Carte'] = gmdate("H:i:s",($xml['dayTime'] * 1)/1000);
foreach($xml->Mods->Mod as $mod){
if(in_array($mod, $key )){$item_value = '-DLC- /';}else{$item_value = '';}
$server['e']['Mods'] = isset($server['e']['Mods']) ? $server['e']['Mods'] : NULL;
$m++; $server['e']['Mods'] .= $m ." | ".$mod." / ".$item_value." ".$mod["author"]." / ". $mod["version"]."
";
}
$server['e']['Money'] = number_format($xml['money']+0, 0, '','.').' Euros';
if ($xml->Slots["numUsed"] >= 1) {
$slotCount = 1;
foreach ($xml->Slots->Player as $player){
if ($player["isUsed"] == "true") {
$hours = floor($player["uptime"]/60);
$minutes = floor($player["uptime"]-($hours * 60));
$server['p'][$slotCount]['name'] = $player;
$server['p'][$slotCount]['Time'] = $hours . ":" . sprintf("%02d", $minutes) . "h ";
$server['p'][$slotCount]['Adn'] = (($player["isAdmin"] == "true")?"Yes":"No");
}
$slotCount++;
}
}else{$server['p'] = "";}
return TRUE;
}else{
return FALSE;
}
}
//------------------------------------------------------------------------------------------------------------+
//------------------------------------------------------------------------------------------------------------+
//---Fonction Farming Simulator----------------//
function loadFileHTTPSocket($domain, $port, $path, $timeout) {
$fp = fsockopen($domain, $port, $errno, $errstr, $timeout);
if ($fp) {
// Make request
$out = "GET ". $path . " HTTP/1.0\r\n";
$out .= "Host: ". $domain . "\r\n";
$out .= "Connection: Close\r\n\r\n";
fwrite($fp, $out);
// Get response
$resp = "";
while (!feof($fp)){$resp .= fgets($fp, 256);}
fclose($fp);
// Check status is 200
if(preg_match("/HTTP/1.\d\s(\d+)/", $resp, $matches) && $matches[1] == 200) {
// Load xml as object
$parts = explode("\r\n\r\n", $resp);
$temp = "";
for ($i=1;$i<count($parts);$i++) {
$temp .= $parts[$i];
}
return $temp;
}
}
return false;
}
//-----
function getServerStatsSimpleXML($url,$type,$q_port) {
$urlParts = parse_url($url);
$cacheFile = ".cache/dedicated-server-stats-$type-$q_port.cached";
$cacheTimeout = 4*2;
if(file_exists($cacheFile) && filemtime($cacheFile) > (time() - ($cacheTimeout) + rand(0, 10))) {
$xmlStr = file_get_contents($cacheFile);
} else {
error_reporting(0);
$xmlStr = loadFileHTTPSocket($urlParts["host"], $urlParts["port"], $urlParts["path"] . "?" . $urlParts["query"], 4);
error_reporting(E_ALL);
if ($xmlStr) {
$fp = fopen($cacheFile, "w");
fwrite($fp, $xmlStr);
fclose($fp);
}
}
return simplexml_load_string($xmlStr);
}

from lgsl.

Webby0815 avatar Webby0815 commented on July 17, 2024

Parse error: syntax error, unexpected '1' (T_LNUMBER) in /var/www/clients/client1/web19/web/lgsl_files/lgsl_protocol.php on line 4022

this is the line $server['e']['Heure_Carte'] = gmdate("H:i:s",($xml['dayTime']1)/1000);

but what is with the api code ?

from lgsl.

Sebbabas avatar Sebbabas commented on July 17, 2024

Hello
you use the code for which farming simulator?

from lgsl.

Webby0815 avatar Webby0815 commented on July 17, 2024

this code is not functionally , the xml api code was not implate in the code.... has you discord ?

from lgsl.

Sebbabas avatar Sebbabas commented on July 17, 2024

no I have no discord and I am French and do not speak English :(

did you create the .cache directory at the root?

You load the xml file, read it and display the info, with simplexml_load_string function of php (https://www.php.net/manual/fr/function.simplexml-load-string.php).

Do you have the server link like this so that I can test: :
http://192.168.0.20:8090/feed/dedicated-server-stats.xml?code=eaef1e92044c7441a46514773f074ec3

from lgsl.

Webby0815 avatar Webby0815 commented on July 17, 2024

YES , you must insert the ?code=eaef1e92044c7441a46514773f074ec3 by registriatrion a server ...where is that form ? thas my problem :-(

from lgsl.

Sebbabas avatar Sebbabas commented on July 17, 2024

There,
It is this column 'code' that I added in the table after 's_port'.
Please note that another page must be modified afterwards.

code={$server['b']['code']}

from lgsl.

Webby0815 avatar Webby0815 commented on July 17, 2024

can you send me the modify files please , i think iam too stupid :-(

from lgsl.

Sebbabas avatar Sebbabas commented on July 17, 2024

Do you know PhpMyAdmin?

from lgsl.

Webby0815 avatar Webby0815 commented on July 17, 2024

yes ,thats row have a set , i need the files ,ikl. the add page :-(

from lgsl.

Sebbabas avatar Sebbabas commented on July 17, 2024

is the 'lgsl_add.php' page causing you a problem?

from lgsl.

Webby0815 avatar Webby0815 commented on July 17, 2024

no , thats row :

$server['e']['Heure_Carte'] = gmdate("H:i:s",($xml['dayTime']1)/1000);

i think the 1 iss the problem ... the error is delete , but how becam i the key form
in the add page

from lgsl.

Sebbabas avatar Sebbabas commented on July 17, 2024

Yes it is missing '*'

sorry I did not see :(
line 4022 ,4034

$server['e']['Heure_Carte'] = gmdate("H:i:s",($xml['dayTime']*1)/1000);
$minutes = floor($player["uptime"]-($hours * 60));

from lgsl.

Webby0815 avatar Webby0815 commented on July 17, 2024

okay ,and the form for the api key code ?

from lgsl.

Sebbabas avatar Sebbabas commented on July 17, 2024

Page lgsl_add.php ?

from lgsl.

Webby0815 avatar Webby0815 commented on July 17, 2024

yes ...

from lgsl.

Sebbabas avatar Sebbabas commented on July 17, 2024

Can you wait 5 minutes have to modify it because I don't use it.
Did you create the "code" column in the table?

from lgsl.

Webby0815 avatar Webby0815 commented on July 17, 2024

yes ....

from lgsl.

Webby0815 avatar Webby0815 commented on July 17, 2024

more than 5 mins ;-)

from lgsl.

Sebbabas avatar Sebbabas commented on July 17, 2024

Sorry for the delay,
I modified all the files, I even advise you to do a reinstallation like that even the BDD will be Good.
Or Rename column "code" in "g_code" !

Exemple : https://farming-simulator.gmus.fr/

https://uptobox.com/8z1zm7s1z27q ( update 23/11/21-23h10)

from lgsl.

Webby0815 avatar Webby0815 commented on July 17, 2024

this works half ;-/
look : https://g-tracker.de/index.php?s=21

from lgsl.

Sebbabas avatar Sebbabas commented on July 17, 2024

Hello
Since I don't have an fs22 server, I don't know how the xml file is constructed so that I can adapt the code.

from lgsl.

Webby0815 avatar Webby0815 commented on July 17, 2024

no , the image stats dont works
@ other servers too
error 500 : https://g-tracker.de/userbar.php?s=19

from lgsl.

Sebbabas avatar Sebbabas commented on July 17, 2024

Update : https://uptobox.com/4ztsl6lofj80 (24/11/21-19h20) Update image + game fs2022 👍

Attention I noticed that if a port or g_code is at "0", the banner does not work. [put a value (ex: 1) ]

https://farming-simulator.gmus.fr/userbar.php?s=1

from lgsl.

Webby0815 avatar Webby0815 commented on July 17, 2024

good , now works the chats.php not :-(

from lgsl.

Sebbabas avatar Sebbabas commented on July 17, 2024

charts.php
line 43 replace :

$server = lgsl_query_cached($lookup['type'], $lookup['ip'], $lookup['c_port'], $lookup['q_port'], $lookup['s_port'], "s");

to :

$server = lgsl_query_cached($lookup['type'], $lookup['ip'], $lookup['c_port'], $lookup['q_port'], $lookup['s_port'], $lookup['g_code'], "s");

from lgsl.

Webby0815 avatar Webby0815 commented on July 17, 2024

Great , its works ! i wait for the chart updates ....big thanks to you

from lgsl.

Sebbabas avatar Sebbabas commented on July 17, 2024

lgsl_protocol.php
line 4029 replace :

if($type != 'fs2022'){

to :

if($server['b']['type'] != 'fs2022'){

thank.

update : https://uptobox.com/yqbq7rs0lmne (24/11/21-20h00)

from lgsl.

Webby0815 avatar Webby0815 commented on July 17, 2024

Cool ,thanks,
can i do it , the uipdate only from rcon ,the page speed is not to fast

from lgsl.

Sebbabas avatar Sebbabas commented on July 17, 2024

Hello,
I use it and I have no problem.

from lgsl.

Webby0815 avatar Webby0815 commented on July 17, 2024

https://g-tracker.de/
some servers show nothing and the page is a bit slow. I would like to update the whole thing via cron job

from lgsl.

Sebbabas avatar Sebbabas commented on July 17, 2024

Hello
lgsl_protocol.php
line 4092 replace :

$cacheTimeout = 4*2;

to :

$cacheTimeout = 25*2;

bye.

from lgsl.

Webby0815 avatar Webby0815 commented on July 17, 2024

the side is slowly , can i remove update per view @ index ...

from lgsl.

TacTicTow avatar TacTicTow commented on July 17, 2024

How did you add the player bargraph bubble in the list.php?

from lgsl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.