One last PHP Question! Find Lines of a TXT and cut/paste them into an "archive.txt"
Posted on 2004-11-18
I currently have a wonderful IP tracking script that outputs information to a txt file in the following format... (Thanks to Diablo84)
Ip Address: 127.0.0.1 - Date: November 18, 2004 - Time: 11:58
Ip Address: 127.0.0.1 - Date: November 18, 2004 - Time: 11:59
Ip Address: 127.0.0.1 - Date: November 18, 2004 - Time: 12:00
I need a script that will sit on a webpage and appear as a simple Text/Image link.
When activated, the script will search the first text file (ip.txt) and will cut all lines except the last 100 and paste them into a secondary file called archive.txt.
Archive.txt can have infinate entries...
a little explanation here:
The script pastes entries from top to bottom, so the bottom lines will be the most recient activity. Therefore I need all lines cut except the last 100, if there are fewer than 100 lines in ip.txt the script returns a text box, "There are less than 100 Entries in the IP log, no entries have been archived".
If the lines were successfully "archived" a box will apear reading "The Security Log was successfully archived".
I realise I am asking for a full script so I am putting the points high, but it is primarily for my own learning experience... so thanks very much in advance!