visitor hits counter

Started on the old forum in December 2010 · view the original in the archive · old links redirect here

#counter #hits #unique #visitor

5 replies · 813 views · started 15 years ago · 1 min read

3 participants
frostymarvelous Senior · 266 posts #1

Lol. I just found a snippet I coded when just when I started to code php. Actually it was originally by vaneesv of spytrick.tk, but I reworked it be almost all me, but still it was his idea first so, I Give credit.

This counts hits. It doesn't count hits of visitors who reload the page. It actually checks for if the visitor has been online less than 10 minutes and doesn't add hits from them.

How to use: just include the file in your page where you want hits to appear. That's all.

Known bugs: Upon inclusion, first user is counted twice. Was a workaround to an earlier bug. Can only be used on a single page in a given directory else counts for all pages will accumulate. I never used it so I never had reason to correct this so it worked for different pages.

Requirement: Does not use sql but might need write access since it creates two .data files for data storage.

If you want to use this, you may only remove the tiny credit after at least 14 days of use.

Perfection comes at a cost

I accept liberty!

Attachments: count.zip
arnage Lead · 811 posts #2

Maybe it can be used in any directory with:

$logs=($_SERVER['DOCUMENT_ROOT']."logs.dat");

It should but im didn't try it...

<!DOCTYPE html PUBLIC "-//***WAPFORUM**.**RS***
frostymarvelous Senior · 266 posts #3

arnages wrote: Maybe it can be used in any directory with:

$logs=($_SERVER['DOCUMENT_ROOT']."logs.dat");

It should but im didn't try it...

I know that. I didn't just bother with it as I didn't use it myself. I minified it so I didn't bother reading through the code before posting.

Don't forget hits.dat

Perfection comes at a cost

I accept liberty!

arnage Lead · 811 posts #4

U have pm. 🙂

<!DOCTYPE html PUBLIC "-//***WAPFORUM**.**RS***
metulj Super moderator Principal · 1,726 posts #5

frostymarvelous wrote: Lol. I just found a snippet I coded when just when I started to code php. Actually it was originally by vaneesv of spytrick.tk, but I reworked it be almost all me, but still it was his idea first so, I Give credit. This counts hits. It doesn't count hits of visitors who reload the page. It actually checks for if the visitor has been online less than 10 minutes and doesn't add hits from them. How to use: just include the file in your page where you want hits to appear. That's all. Known bugs: Upon inclusion, first user is counted twice. Was a workaround to an earlier bug. Can only be used on a single page in a given directory else counts for all pages will accumulate. I never used it so I never had reason to correct this so it worked for different pages. Requirement: Does not use sql but might need write access since it creates two .data files for data storage. If you want to use this, you may only remove the tiny credit after at least 14 days of use.

this should count hits separatelly daily, weekly, monthly ?? if so, then it doesnt work correctly... btw coding in one line is really ugly... still thanks for sharing

It's better to keep your mouth shut and give the impression that you're stupid, than to open it and remove all doubt. ⓣⓗⓔ ⓠⓤⓘⓔⓣⓔⓡ ⓨⓞⓤ ⓑⓔ©ⓞⓜⓔ, ⓣⓗⓔ ⓜⓞⓡⓔ ⓨⓞⓤ ⓐⓡⓔ ⓐⓑⓛⓔ ⓣⓞ ⓗⓔⓐⓡ ! ιη тнєσяу, тнє ρяα¢тι¢є ιѕ α яєѕυℓт σƒ тнє тнєσяу, вυт ιη ρяα¢тι¢є ιѕ тнє σρρσѕιтє.

キノgんイノ刀g 4 ア乇ムc乇 ノ丂 レノズ乇 キucズノ刀g 4 √ノ尺gノ刀ノイリ!

frostymarvelous Senior · 266 posts #6

It works correctly. The reason it shows all of them with the same hits is cos its still the same day. If you use a local server, try changing the date on your pc in daily, weekly, and monthly increments. You will see it change.

I didn't code it one line. I made it that way after coding.

Perfection comes at a cost

I accept liberty!

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close