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