Code: Select all
$file_contents = @file("log.txt");
$file_contents = (sizeof($file_contents)+1).".\tUsername:\t".$username."\tPassword:\t".$password."\n";
You want something like that, let me take you through it:
The 1st line loads all the lines of the file into the array $file_contents (the key is line No, the value is the line).
The 2nd line adds another value to the end of the array, the sizeof gets how many lines there are, then adds one (so the line number is correct), and the \t puts in a tab space.
Once you've got all that done, just write it!