I'd say go with a pre-made script, you'll get a lot more features. If you get your own domain name sometime in the future, there's a 99% chance you'll get a slew of different statistics scripts. They'll give you graphs, ip addresses, pages most visited/downloaded and tell you what country your visitors come from.
If you want to install a pre-made one, there are plenty at HotScripts (outdated link removed)
- I suggest you make their PHP section a bookmark - in particular, take a look at BBclone (outdated link removed).
If you want to write your own, all you'd need is a simple if() statement. Basically you'd check if the cookie doesn't exist, if so, add one to the hit counter, then print the hit counter out to a file or html page. I can't remember the syntax to set a cookie off the top of my head but I'll post it here later if you like.