homepage Welcome to WebmasterWorld Guest from 107.21.163.227
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Making my own PHP counter
Will this slow things down much?
roldar




msg:1266575
 4:28 pm on Jun 10, 2004 (gmt 0)

I've got a great webhost with good counter software, but since I have multiple domains in the same hosting account the counting is just a big mess. I was wondering if it's feasible for me to create my own php/mysql counter where it just gets the server variable for the ip address, the referring address, the page that was requested, and the date/time - and put them all into a mysql database table. Then I could make a basic php application that reported the total number of pages for which an entry was made into the table and the total number of unique IP address hits. This way I could give potential advertisers the number of hits each page received as well as the number of unique visitors to my site.

Will the fact that I'm writing a few bytes to a mysql code every time I go to a new page affect performance significantly? I probably won't have more than a few thousand hits a month at best, but I don't want to slow people down.

I've heard that AOL and some other ISP's switch the IP addresses of users while they're online. I suppose this could cause a problem because I could count the same person as more than one unique visitor; but the IP certainly wouldn't change every minute or two, would it?

Am I missing something here or do you think this might be suitable for my needs? I really don't need sophisticated analysis of the paths users follow through the site - though I suppose with the information I intend to collect I could manually figure that type of thing out. Thanks in advance for any guidance.

 

corz




msg:1266576
 5:19 pm on Jun 10, 2004 (gmt 0)

Nah, at this volume, the hit would be unnoticable. A simple routine inserted into your page header would do the job, just collect whatever stats you need..


$_SERVER['REMOTE_ADDR']
@$_SERVER['HTTP_USER_AGENT']
@$_SERVER['HTTP_REFERER']
$_SERVER['REQUEST_URI']

stuff like that. and feed them to the database.
the info is there anyway, it takes almost no time to store it.

;o)
(or

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved