/    Sign up×
Community /Pin to ProfileBookmark

hello , i want to make a counter for my website , but i dont have any idea how i should do it , i dont want any code from you , just some efficient ideas please… (i would like to count a unique ip once a day)
thanx

to post a comment
PHP

7 Comments(s)

Copy linkTweet thisAlerts:
@chestertbJul 21.2007 — read the visitor's ip

search a data file for that ip

if not found, add the ip

run a cron job at midnight to count the values in the data file

store the value in your log record

then empty the file and start over again.

At some point, if you wanted to add some functionality, your cron job could look up the ip's geographic location too.

CTB
Copy linkTweet thisAlerts:
@barantamerauthorJul 21.2007 — can i create cron jobs in windows enviroment ? , because every article i read on the web was about cron jobs on linux ...
Copy linkTweet thisAlerts:
@chestertbJul 22.2007 — Start > All Programs > Accessories > System Tools > Scheduled Tasks

http://support.microsoft.com/kb/308569
Copy linkTweet thisAlerts:
@barantamerauthorJul 22.2007 — ok i understand that , and how can i create cron jobs in php?
Copy linkTweet thisAlerts:
@chestertbJul 23.2007 — php allows you to run a script from the command line.

therefore, in your scheduled tasks set-up, your task should be

C:pathtophpphp.exe c:pathtoyourscriptyourscript.php (assuming php is installed onm your 'c:' hard drive)

the 'start in' setting can be any location on your hard drive, but is only important if you're going to use your document path to, say, write a log file.
Copy linkTweet thisAlerts:
@barantamerauthorJul 24.2007 — thats very helpful , but i dont actually know how to adapt it when i upload this to http server.. any help on that ?
Copy linkTweet thisAlerts:
@chestertbJul 25.2007 — that depends on the operating system and control panel scripting the server's runing.
×

Success!

Help @barantamer spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.25,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...