Would this be right? Cause its not showing my online status?
foreach ($LfsUsers as $LfsUser => $LfsHost) {
switch (strtolower($LfsUser)) {
case "[M.B]Budman Pootie":
case "team member LFS Name":
case "team member elecc":
case "team member LFS Name":
case "team member LFS Name":
case "team member LFS Name":
$LfsUser = remove_colour_codes($LfsUser);
$LfsHost = remove_colour_codes($LfsHost);
echo "<tr bgcolor='#FFFFFF'>";
echo "<td>$LfsUser</td>";
echo"<td>$LfsHost</td></tr>";
$TeamMembers + 1;
Full not much changed,just so that someone with knowledge can have a look see
<?
// 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;
}
/* Function to remove the colour code data from a string */
function remove_colour_codes($String){
$ColCodes = array("^0","^1","^2","^3","^4","^5","^6","^7","^8","^9");
$NewString = str_replace($ColCodes, "",$String);
return $NewString;
}
// init some vars
$LfsUsers = array ();
$x = 0;
$LfsHostList = "";
// get the hostlist
$LfsHostList = file_get_contents ("http://lfsworld.net/pubstat/get_stat2.php?action=hosts");
$len = strlen ($LfsHostList);
if ($len < 52) exit ("Couldn't get hostlist. Quitting...");
// parse the data
while ($x < $len) {
$LfsHostName = "";
$nr_racers = 0;
for ($y=0; $y<32; $y++) $LfsHostName .= $LfsHostList[$x++];
$LfsHostName = trim_c_string ($LfsHostName);
$x += 20; // skip some host-data
$nr_racers = ord ($LfsHostList[$x++]);
for ($w=0; $w<$nr_racers; $w++) {
$LfsUserName = "";
for ($y=0; $y<24; $y++) $LfsUserName .= $LfsHostList[$x++];
$LfsUsers[trim_c_string ($LfsUserName)] = $LfsHostName;
}
}
/* Set the variable to count the members online */
$TeamMembers = 0;
/* Create table to hold data */
echo "<center><br>";
echo "<table border='1' bordercolor='C0C0C0' cellpadding='4' cellspacing='0' style='border-collapse: collapse' style='font-family: Verdana; font-size: 10pt'>";
echo "<tr bgcolor='#CCCCCC' align='center'><th>Team Racer</th><th>On Server</th></tr>";
/* search through the file for Team Members and add a row to the */
/* table showing the name and server they are on */
foreach ($LfsUsers as $LfsUser => $LfsHost) {
switch (strtolower($LfsUser)) {
case "[M.B]Budman Pootie":
case "team member LFS Name":
case "team member LFS Name":
case "team member LFS Name":
case "team member LFS Name":
case "team member LFS Name":
$LfsUser = remove_colour_codes($LfsUser);
$LfsHost = remove_colour_codes($LfsHost);
echo "<tr bgcolor='#FFFFFF'>";
echo "<td>$LfsUser</td>";
echo"<td>$LfsHost</td></tr>";
$TeamMembers + 1;
break;
}
}
/* Display this row only if no members are online */
if($TeamMembers == 0){
echo "<tr bgcolor='#FFFFFF' align='center'><td>No Members</td><td>Are Online</td></tr>";
}
/* Close the table */
echo "</table></center><br>";
?>