ID: 11429 Updated by: sniper Reported By: [EMAIL PROTECTED] Old-Status: Open Status: Bogus Bug Type: Scripting Engine problem Operating system: PHP Version: 4.0.5 Assigned To: Comments: Please submit a new bug report with shortest possible example that can be used to reproduce this. The one here is way too long. Previous Comments: --------------------------------------------------------------------------- [2001-06-12 06:42:02] [EMAIL PROTECTED] Given this script: -=- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html> <head> <title>FTP server info</title> <meta HTTP-EQUIV="REFRESH" CONTENT="60"> </head> <body bgcolor="#FFFFFF"> <h1>Transfers in progress:</h1> <table border="1" align="center" width="100%"> <? $i = 0; $anon = 0; $idleanon = 0; $maxconn = "5"; $types['RETR'] = "downloading"; $types['STOR'] = "uploading"; $inputfile = "/tmp/ftpinfo.txt"; $fp = fopen($inputfile,"r"); fgets($fp, 4096); while($i < 25) { $line = fgets($fp, 4096); if(strstr($line, "Service class")) continue; /* Skip the lead in line */ $bits = explode(" ", $line); if(substr($bits[12], 0, 9) == "anonymous" || substr($bits[7], 0, 9) == "anonymous") { if($bits[1] == '-') { echo "t<tr>"; echo "<td>$bits[11]</td><td> " . $types[$bits[13]] . " " . chop($bits[14]) . "</td>"; $percent_done = substr($bits[7], 1, strlen($bits[7]) - 3); /* Algorithm: speed colour is a factor of 10/3 */ /* Note: since I can't get speed, I just use percent done */ switch($percent_done) { case ($percent_done > 66): echo "<td bgcolor="#FF0000">"; break; case ($percent_done > 33): echo "<td bgcolor="#FFFF00">"; break; default: echo "<td bgcolor="#00FF00">"; break; } /* Leet progress meter. */ print("["); $the_temp = 0; while($the_temp < 5) { if(($the_temp * 20) < $percent_done) { print("*"); } else { print("."); } $the_temp++; } print("]"); echo " (" . $percent_done . "% done)</td>"; echo "</tr>n"; $anon++; } else $idleanon++; } $line = fgets($fp, 4096); $line = fgets($fp, 4096); $i++; } echo "t</table>n"; if($idleanon) echo "t<p>$idleanon user(s) are connected but idle</p>n"; echo "t<p>" . ($anon + $idleanon) . " of $maxconn users connected</p>"; fclose($fp); ?> <p><small>This page will autorefresh every minute.</small></p> </body> </html> -=- I get: -=- dylang@shadowgate:~$ lynx http://thock.com/ftpstats.php Looking up thock.com Making HTTP connection to thock.com Sending HTTP request. HTTP request sent; waiting for response. Alert!: Unexpected network read error; connection aborted. Can't Access `http://thock.com/ftpstats.php' Alert!: Unable to access document. lynx: Can't access startfile -=- Not cool! Commenting out while($the_temp < 5) { ... } makes it work, but there is no logical reason why it should fail. The file it is parsing is the output of ftpwho -v from ProFTPD. --------------------------------------------------------------------------- ATTENTION! Do NOT reply to this email! To reply, use the web interface found at http://bugs.php.net/?id=11429&edit=2 -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]