Re[2]: [PHP] Having problems with a while loop

From: Date: Thu, 01 Jan 2004 17:56:35 +0000
Subject: Re[2]: [PHP] Having problems with a while loop
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-173605@lists.php.net to get a copy of this message
Ok I changed it to look this way but it still is not working $filenum="test"; $fpHt = fopen($filenum, "r"); while(feof($fpHt)) { $fpLine = fgets($fpHt,512); $fpLine = trim($fpLine); $fpData = explode(":", $fpLine); $fpData[0] = trim($fpData[0]); echo $fpData[0]; } And no I am just reading a .htpasswd file to get the user name out of it RD> your fgets should be inside the loop. else you are in an infite loop. RD> ps: are you brute forcing password file ;-) >>Way does this while loop not work. >>It does not read anything in the file. If I add ! in front of feof it >>will just loop forever but still it will not read the next line in the >>file. The file has two lines in it that look like this. >>tester3:$1$09BZpdge$b7TQcsYSsAP1hgiCuCWtS1 >>tester5:$1$5eq3i75D$XK9QzaS.7bHyWVf4bdyJs/ >> >> >>$filenum="test"; >>$fpHt = fopen($filenum, "r"); >>$fpLine = fgets($fpHt,512); >>while(feof($fpHt)) { >>$fpLine = trim($fpLine); >>$fpData = explode(":", $fpLine); >>$fpData[0] = trim($fpData[0]); >>echo $fpData[0]; >>}

« previous php.general (#173605) next »