note 37833 deleted from function.fgets by sniper

From: Date: Sat, 03 Jan 2004 02:46:01 +0000
Subject: note 37833 deleted from function.fgets by sniper
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-62823@lists.php.net to get a copy of this message
Note Submitter: delannoy@univ-lemans.fr ---- I had problems with EOL on Macintosh : reading a file with pairs (login:passwd) my program, running fine with only one line, don' run with a second : the second login is recognized, but not the first... due to the 'EOL' character included in the $out by : while (!feof($file)) { $line = fgets($file); $ordre++; echo $line."/"; if (eregi($user.":(.*)", $line, $out)) { $passwd = $out[1]; $num_user=$ordre; echo $passwd."/"; break;} } /* fin lecture fichier */ And unfortunately i can *NOT* act on php_ini on the server, and i try to publish my script.. So the solution i found is to put explicitely the 'EOL' in the regex : ... if (eregi($user.":(.*)\n", $line, $out)) ... and it's work Hope that Help PAUL

« previous php.notes (#62823) next »