Posted on 2003-11-18
I'm in the middle of making a PHP script that will parse FTP logs and then add the unique connects, etc into my MySQL DB.
Let's say I have a FTP_logs directory, and the files are labeled as such (also look in subfolders to find these files)...
How would I tell PHP to loop through all those logs, and once PHP has opened the file, find a string like the following:
L 11/16/2003 - 12:07:26: "USERNAME<164><USERNAME_VALIDATING><>" connected, address "184.108.40.206:2767"
Get the address...in my case the IP address of the remote connection, and store it into $connectors_ip, in this case, 220.127.116.11, not the 2767. Also get the USERNAME and store it into $connectors_username.
Then, look for the following through the file,
L 11/16/2003 - 12:07:34: <USERID_0:0:347764><>" USERID validated
Where I need to just get the value after USERID_, in this case 0:0:347764, store it into $connectors_USERID.
Thanks in advance.