Hit/Page counter help

Results 1 to 3 of 3

Thread: Hit/Page counter help

  1. #1
    Mmatau Guest

    Default Hit/Page counter help

    I want to display number of people visiting my page. Which means I want to say you are one of 197 active users. Please help

  2. #2
    Join Date
    Dec 1969

    Default RE: Hit/Page counter help

    Are you after how many users are currently logged in or how many people have visited the site?<BR>If it&#039;s the latter, try looking here:<BR>http://www.4guysfromrolla.com/webtech/061600-1.shtml<BR>and improvements on this at:<BR>http://www.4guysfromrolla.com/webtech/070600-1.shtml<BR>or if you don&#039;t like that one, <BR>http://www.asp101.com/samples/counter_db.asp<BR><BR>You&#039;ll find that there are heaps of them out there if you do a search on any of the ASP sites.

  3. #3
    Mmatau Guest

    Default RE: Hit/Page counter help

    I got it guys! In case you were struggling like I did, here is the code<BR><BR><BR>Hit Counter <BR><BR>Paste the following code at the top of the page you want the hit counter on, above any html tags. You can add this code to multiple pages. Just make a different text file to hold the hits for each page. <BR><BR>&#060;%@ Language=VBScript %&#062; <BR><BR>&#060;%<BR>Set FileObject = Server.CreateObject("Scripting.FileSystemObject")< BR>HitsFile = Server.MapPath ("/counter") & "hits.txt"<BR>Set InStream= FileObject.OpenTextFile (HitsFile, 1, false )<BR>OldHits = Trim(InStream.ReadLine)<BR>NewHits = OldHits + 1<BR>Set OutStream= FileObject.CreateTextFile (HitsFile, True)<BR>OutStream.WriteLine(NewHits)<BR>%&#062;<B R><BR>Now paste the below line inside the page where you want the counter shown. <BR><BR>This page has been accessed &#060;%=NewHits%&#062; times. <BR><BR><BR>--------------------------------------------------------------------------------<BR>Create a text file first called "hits.txt" and type a 0 (zero) in the file as the initial hit. The Server.MapPath is the directory under your root where this text file is saved. For example, I have a folder called counter directly under the root directory where my hits.txt is stored (/counter) The codes above read the number in the text file, add it with 1, overwrite the old hit, and display it.<BR><BR>Now you have a hit counter. Pretty simple, huh? <BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts