Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Hit Counter

 
Logged in as: Guest
arrSession:exec spGetSession 2,3,28564
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> ASP >> Hit Counter
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Hit Counter - 12/2/2005 6:33:58 AM   
  kgbray

 

Posts: 2
Score: 0
Joined: 12/1/2005
Status: offline
Hello everyone,
  I am new to VBScript, so I hope this question isn't too boring.
I have recently learnt to do a basic Hit Counter for a website I designed and look after, but as I hit it quite often in my design capacity( I dont have a ASP platform on my PC and so use the server to test my pages !) I would like to change the counter so it doesn't count hits from my computer. Is this possible with VBScript or ASP ?
 
 
Post #: 1
 
 RE: Hit Counter - 12/5/2005 2:24:01 AM   
  csamuels


Posts: 42
Score: 0
Joined: 9/26/2005
Status: offline
can you post the code that the server currently uses?

(in reply to kgbray)
 
 
Post #: 2
 
 RE: Hit Counter - 12/6/2005 10:54:46 PM   
  kgbray

 

Posts: 2
Score: 0
Joined: 12/1/2005
Status: offline
This is the code I am using for the hit counter :

<html><head><title>Hit Counter</title></head>
<body bgcolor="white" text="green">
<%
'Dimension variables
Dim fsoObject                            'File System Object
Dim tsObject                              'Text Stream Object
Dim filObject                              'File Object
Dim lngVisitorNumber                 'Holds the visitor number
Dim intWriteDigitLoopCount       'Loop counter to display the graphical hit count
'Create a File System Object variable
Set fsoObject = Server.CreateObject("Scripting.FileSystemObject")
'Initialise a File Object with the path and name of text file to open
Set filObject = fsoObject.GetFile(Server.MapPath("hit_count.txt"))
'Open the visitor counter text file
Set tsObject = filObject.OpenAsTextStream
'Read in the visitor number from the visitor counter file
lngVisitorNumber = CLng(tsObject.ReadAll)
'Increment the visitor counter number by 1
lngVisitorNumber = lngVisitorNumber + 1
'Create a new visitor counter text file over writing the previous one
Set tsObject = fsoObject.CreateTextFile(Server.MapPath("hit_count.txt"))
'Write the new visitor number to the text file
tsObject.Write CStr(lngVisitorNumber)
'Reset server objects
Set fsoObject = Nothing
Set tsObject  = Nothing
Set filObject = Nothing
Response.Write("<div id=label1 style='position:absolute;LEFT:0;TOP:1;WIDTH:125;'>")
Response.Write("<img src='counter_images/visitor.gif'>")
'Loop to display graphical digits
For intWriteDigitLoopCount = 1 to Len(lngVisitorNumber)
   'Display the graphical hit count
    Response.Write("<img src=""counter_images/")
    Response.Write(Mid(lngVisitorNumber, intWriteDigitLoopCount, 1) & ".gif""")
    Response.Write("alt=""" & Mid(lngVisitorNumber, intWriteDigitLoopCount, 1) & """>")
Next
Response.Write("</div>")
%>
</body>
</html>

(in reply to csamuels)
 
 
Post #: 3
 
 RE: Hit Counter - 12/12/2005 11:25:24 AM   
  johnrswanton

 

Posts: 4
Score: 0
Joined: 11/16/2005
Status: offline
if you need a web server on ur own computer to test ur asp scripts then us baby web server
it so easy to us
find it at www.download.com
http://www.download.com/Baby-ASP-Web-Server/3000-2165_4-10394872.html?tag=lst-0-1
Try it
it rocks


*** Some people walk in the rain, others just get wet ***

< Message edited by johnrswanton -- 12/12/2005 11:27:00 AM >

(in reply to kgbray)
 
 
Post #: 4
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> ASP >> Hit Counter Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts