IMPORTANT NOTE: It can only be 20 letters long, and may only contain letters (a-z, A-Z) underscores (_) and dashes (-). Any other characters will be ignored. I'd appriciate it if you don't abuse my server.
Just use this image code to use it:
< img src="http://www.LB-Stuff.com/Services/Viewcounters/Myviewcount.php5?ID=PUT-YOUR-ID-HERE!" >
For proof that it works, check out how many people have seen this topic:
haha i thought you were just resetting the counter, but ive been spamming it with a simple mmf app. it was at 10,000 earlier, then it reset. at one point it started counting backwards. might want to look into that.
Whenever the php file is accessed add the ip address and date to a table. When 5 minutes has passed remove the ip address.
If someone tries to access the file again before 5 minutes have passed just refresh the date on their ip, and display the counter without adding 1 to it.
Edit: oh yeah, and if a user tries to create a new counter that doesn't exist make sure they haven't already created one from that ip address. Otherwise you may end up with a huge table from someone who's bored.
Thing is, I don't care if the script it abused. It's a simple viewcounter so you know if you're actually getting attention or not. I'd be glad if you made your own.
Currently the only database I have is for my forums and I can't really do much with databases. I'm only a beginner at php. Plus, my server uses php4 unless I name a file with the extensin ".php5" or something, so it's kind of hard to use advanced tools that have multiple scripts named just ".php", so I can't do easy database cleanups. This is why I don't do databases.
If it counts every visit, then it's not a very efficient way of measuring attention. Over 90% of those views are probably search robots.
But yeah, for what it's supposed to do, it does seem to work. For a more efficient counter, a flood protection and ways of identifying some of the common search bots would need to be added though. I think I did a flood protected counter once, but dunno about bots.
I've got to say, if you're a beginner at PHP then it's a pretty nice script - doesn't have much security but it doesn't seem like you're too bothered, so considering that you've done a good job (it seems to work afterall)!
Nice work I've been doing PHP for years now and I don't think I could've done this when I started out