I'm have created a script that uses the fsockopen function. It colors an IP adress. If it's red, the server is offline. When it's green, the server is online.
My Code:
<?php
//first the mySQL stuff, and the while loop
if (!fsockopen($data['IP'], $data['port'], $errno, $errstr, 5)) {
$color = "#FF0000";
} else {
$color = "#66FF00";
}
// later in the code
?>
<font color=<?php echo $color; ?>>
<?php echo $data['IP']; ?></font>
The case is that always colors the IP red(#FF0000);
Could anyone tell me my fault?