Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CF Counter Script

Status
Not open for further replies.

CFTyrant

Programmer
Mar 25, 2002
13
US
I'm looking for a CF Page Counter that does not add 1 every time you reset the page. I guess I'm looking for something that uses cookies, but I don't know enough about CF and cookies yet to get something like that.

Any suggestions?
 
In the application.cfm you can try something like:

<cfif NOT isDefined(&quot;cookie.pagecounter&quot;) or (isDefined(&quot;cookie.pagecounter&quot;) and NOT listFind(cookie.pagecounter,cgi.script_name)>

--- Update Page Counter
<cfset cookie.pagecounter = ListAppend(cookie.pagecounter, cgi.script_name)>

</cfif>

This should check to see if a user has a cookie called &quot;pagecounter&quot; and if it doesnt exist or if it does exist but the current page you are on is not in the cookie, then update the page counter (insert your code there) and then adds that page to the cookie.

This doesn't take into account users who disable cookies.

HTH,
Tim P.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top