You can use a web stats script or combination of them to produce usable output, but rather than reinvent the wheel take a look at phpOpenTracker
And also look closely at phpSniff
One gives you visitor stats of a sort, while the other returns browser details.
The trouble is that to deliver useful data you have to implement either sessions or cookies or both in combination, to help recognise repeat visitors and other trip-ups that can 'adjust' site stats out of reality.
As I said, it's a big question and without knowing a bit more about how your site and page(s) are set up, it's impossible to suggest an X, Y, Z solution.
Try and give a bit more detail if you can and I'll see if I can be a bit more specific.