Cookie Counter
It uses cookies to count the number of times you've visited this web
site. Below is the main code. You put
that on your main web page. WARNING: you must put the code at the absolute
top, before anything else or it will not function.
<%
'*****************************************
'** Cookie counter v1.0 **
'** copyright 1999 Web-O-Gramming **
'*****************************************
Dim ckyname
ckyname = "foo" '**<--your site name here**
If Request.Cookies(ckyname)("visits") <> "" Then
Response.Cookies(ckyname)("visits")
= Request.Cookies(ckyname)("visits") + 1
Response.Cookies(ckyname).Expires = Date + 365
session("cntuser") = Request.cookies(ckyname)("visits")
Else
Response.Cookies(ckyname)("visits") = 1
Response.Cookies(ckyname).Expires = Date + 365
session("cntuser") = 1
End If
%>
|
Where it says ckyname, put your site name which will be the name of the
cookie stored on the client's comp. Now use this code to print how many
times He/She has visited.
You've visited <b><%
If session("cntuser") <> "" Then
Response.Write session("cntuser")
Else
session("cntuser") = Request.cookies("wog")("visits")
Response.Write session("cntuser")
End If
%></b> times.
|
That code can be used on any page, but the first code should only be
put on the first web page the user sees.