View Single Post
Old 05-10-2006, 06:50 AM  
Naughty
Confirmed User
 
Industry Role:
Join Date: Jul 2001
Location: Utopia
Posts: 6,484
Att.: scriptfreaks - Removing empty lines from textfile w/php

Hi,

We have a script that is adding new lines for no apparent reason at this time. I want to get rid of the empty lines and re-order the text file every time somebody ads her/his name.

The file is pretty simple, just lines, like this:
line1
...
...
line2
...
line1001
...

I want to loose the ... lines and have it all nicely formatted, like this
line1
line2
line1001


I use this script to add lines:
PHP Code:
        $FileName $path."/lists/names.php";
        
$list file($FileName);
        
$newitem $_POST["name"]."|^|".$_POST["enterpass"]."|^|".$_POST["enteremail"]."|^|";
        
$FilePointer fopen($FileName"a+");
        
fwrite($FilePointer"\n".$newitem);
        
fclose($FilePointer); 
Who knows how I can change that little piece of code and make it as wanted?

Thanks,
Paul
__________________
seks.ai for sale - ping me
Naughty is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote