Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » PHP Serverstatusbox
Re: PHP Serverstatusbox [message #323527 is a reply to message #323408] Sun, 23 March 2008 15:20 Go to previous messageGo to previous message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma:
General (5 Stars)
Use this instead;

<?php

$fileContent = file_get_contents ( "serverstatus/fdsstatus.txt" );
$write = explode ( "\n", $fileContent );

$color = array("green", "green", "yellow", "yellow", "red", "red", "green", "green", "green" );

for ( $i = 0; $i < 9; $i++ )
	echo "<span style=\"color: $color[$i]\">". $write[$i] ."</span><br>";
?>



The problem with your original code is your trying to write the entire thing for every line you read from the file, which ends up with the entire thing being written in green.


http://steamsignature.com/card/1/76561197975867233.png

[Updated on: Sun, 23 March 2008 15:23]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Nickname exploit
Next Topic: Hud quality
Goto Forum:
  


Current Time: Thu Jul 24 03:20:13 MST 2025

Total time taken to generate the page: 0.00952 seconds