I need to develop a counter. The purpose is to record hits. I would like to maintain a table recording the IP's and add to the counter only if it is a new hit and not a repeat hit. Any clues?
Rose,<br> Assuming you want to track each visitor to your site (as opposed to tracking each page) in session_onstart, read the last value from your database, increment it, and write the new value to the database.<br> Tracking users by IP address isn't a good idea, unless you're on an intranet. When people access your site from a site that uses a proxy server, you get the address of the proxy server, not the user's system. That means that everybody that uses that proxy server will show up with the same IP address. <p>nick bulka<br><a href=mailto: > </a><br><a href= > </a><br>
Thank-you Nick. I had thought of this, but didn't know where to code it. Would using a database or a file to record the count be a better idea.<br>I guess what I am asking is: Would a database be a slower access time?<br><br>Thanks.
It's hard to determine which method would be faster, since it depends on how much data you're collecting, how many records there are, and how efficient the code is that you're using to access the file. In my opinion, unless you only have a small amount of data, I'd use a database. <p>nick bulka<br><a href=mailto: > </a><br><a href= > </a><br>
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.