Click to See Complete Forum and Search --> : ! Logging Help !


Jick
06-22-2003, 11:47 PM
I know I have posted alot to the php forum but this one will be my last question for a while!

I have this php file that logs info about the user to a log.txt file and each user has a seperate line in the log.txt file so if there were 6 users to my page on that day it would have 6 lines in the log.txt file with those users info!

What I want is to have another php script that will look in the log.txt file and count the number of lines and then post that number to a page.

So if there were 6 lines in the text file it would write 6 on the page. So basicly it would be counting the number of users to my page since it would be posting the number of lines from the log.txt file.

Someone told me I would have to use "Crons" but unfourtunatly I do not have access to "Crons" on my server. Could someone possibly reccomend a script that would do what I want without having to use "Crons"? Any help is appriciated. Thanks! :)

pyro
06-23-2003, 07:15 AM
When you write to the file, separate where you want new lines with the new line charaacter: \n

Then, reading the file with $contents = file("filename); will make $contents an an array of all the lines, so you can figure out how many lines there are with something like this: $num_lines = count($contents);