The online racing simulator
Stats
Hello,

I'm searchin a PHP script who can display stats about my server, like best drivers and more.

Actually I've a script to display stats about racers but not for the entire server.

Do you know a script who can retrieve some informations for my server ?

Thanks,
You could get info from the LFS server via the hosts file, with a cron task. It would update the server info every 60 seconds. Or you could program something in PHP / C# / Java that will connect to insim and get information that way, then send it to your web server upon request to be parsed.
This is a code for my site...


<?php 
// function to safely trim null-terminated strings
// could just use trim () in this example though
function trim_c_string ($string) {
    
$new "";
    
$len strlen ($string);
    for (
$x=0$x<$len$x++) {
        if (
$string[$x] != "\0"$new .= $string[$x];
        else break;
    }
    return 
$new;
}
// init some vars
$users = array ();
$x 0;
$hostlist "";
// get the hostlist
$hostlist file_get_contents ("http://lfsworld.net/pubstat/get_stat2.php?version=1.3&idk=<YOU ID KEY HERE>&action=hosts");
$len strlen ($hostlist);
if (
$len 52) exit ("Couldn't get hostlist. Quitting...");
// parse the data
while ($x $len) {
    
$hostname "";
    
$nr_racers 0;
    for (
$y=0$y<32$y++) $hostname .= $hostlist[$x++];
    
$hostname trim_c_string ($hostname);
    
$x += 20// skip some host-data
    
$nr_racers ord ($hostlist[$x++]);
    for (
$w=0$w<$nr_racers$w++) {
        
$username "";
        for (
$y=0$y<24$y++) $username .= $hostlist[$x++];
        
$users[trim_c_string ($username)] = $hostname;
    }
}
// printout of gathered data
echo"<table>";
echo
"<tr><td><b><font size = '1' color='#000080'>FULL</font></b></td></tr>";
echo
"<tr><td><font size = '1'>YOU SERVER HERE</font></td></tr>";
foreach (
$users as $user => $host) {
if(
$host == 'YOU SERVER HERE WITH ^'){
    if(
$user == ""){
    echo
"<tr><td>No Players</td></tr>";}else{
    echo
"<tr><td><font color='#FF0000'>$user</font></td></tr>";} }
}
echo
"<p>";
?>


FGED GREDG RDFGDR GSFDG