I would like to prevent users from uploading a file that contains more than 4 pipes or less than 2 pipes. The code below prevents users from uploading a file containing more than 4 pipes, but not less than 2 pipes. Should I use awk, ereg, or sed? Thanks
system ("/bin/cat $userfile|/bin/sed -n 's/.*|.*|.*|.*|.*|/&/p'> pipes.txt; $fd =fopen("pipes.txt", 'r'); $pipes5=fgets($fd,50); echo ($pipes5); fclose($fd); if ($pipes5) { print "wrong number of pipes"; } The uploaded file below should not pass but it does: aaaaa|bbbbb|ccccc|ddddd|eeeee aaaaa|bbbbb|ccccc| aaaaa|bbbbb|ccccc|ddddd aaaaa|bbbbb aaaaa|bbbbb|ccccc|ddddd|eeeee __________________________________________________ Do You Yahoo!? Great stuff seeking new owners in Yahoo! Auctions! http://auctions.yahoo.com -- PHP General 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]