d:/ftp_library/ermo/karaoke/
http://www.nyvej.dk/mortensen
/
d:\ftp_library\ermo\karaoke\counter.asp
|
d:\ftp_library\ermo\karaoke\counter.asp |
001: <%
002: ' Simple ASP Hit Counter
003: ' Scott A. Moss - 14th Nov. 1999
004: ' www.vbstuff.cjb.net
005:
006: ' Declare Variables
007: Dim objFSO, objCountFile
008: Dim iCount
009: Dim I
010:
011: Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
012:
013: ' Open Counter text File
014: ' If you are on a Web Host that allows ASP but you are not able to
015: ' write to the directory that your ASP code is in, but you have a
016: ' CGI-BIN replace [> Server.MapPath("/counter.cnt"), 1, True) <]
017: ' with [> Server.MapPath("cgi-bin/users/accountname/counter.cnt"), 1, True) <]
018: ' or what ever the path of your CGI-BIN is.
019: Set objCountFile = objFSO.OpenTextFile(Server.MapPath("counter.cnt"), 1, True)
020: If Not objCountFile.AtEndOfStream Then iCount = CLng(objCountFile.ReadAll) Else iCount = 0
021: objCountFile.Close
022:
023: Set objCountFile = Nothing
024: iCount = iCount + 1
025:
026: ' Save Changed Counter text File
027: ' If you are on a Web Host that allows ASP but you are not able to
028: ' write to the directory that your ASP code is in, but you have a
029: ' CGI-BIN replace [> Server.MapPath("/counter.cnt"), 1, True) <]
030: ' with [> Server.MapPath("cgi-bin/users/accountname/counter.cnt"), 1, True) <]
031: ' or what ever the path of your CGI-BIN is.
032: Set objCountFile = objFSO.CreateTextFile(Server.MapPath("counter.cnt"), True)
033: objCountFile.Write iCount
034: objCountFile.Close
035:
036: ' Write Counter to ASP
037: Set objCountFile = Nothing
038: Set objFSO = Nothing
039: Response.Write ("<CENTER><FONT SIZE='1'>") & iCount & ("</FONT></CENTER>")
040: %>