Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Page Counter
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Page Counter

 Post Reply Post Reply
Author
Misty View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 February 2002
Location: United States
Status: Offline
Points: 711
Post Options Post Options   Thanks (0) Thanks(0)   Quote Misty Quote  Post ReplyReply Direct Link To This Post Topic: Page Counter
    Posted: 14 May 2003 at 12:00am

I need some help with fixing a page counter. It worked on my web site when I was with another web hosting company. I've been messing with the code. Please take a look at the code below. Please look at the code that is in blue. I need help with fixing this.

 

<%

Dim strPath, File, file2, x,liCount, j ,resfile, d, i ,fl, FileName

'strPath = "counter.txt"

   'Set connection details
    'strPath = Server.MapPath(".")
    'strPath = Replace(strPath,"html","database")
    'FileName = "counter.txt"

   

strPath = "D:\www\database\counter.txt"

Set File = Server.CreateObject("Scripting.FileSystemObject")

set file2=File.OpenTextFile(strPath)

x=file2.readline

 

set resfile = File.createTextFile (strPath)

resfile.writeline(x+1)

liCount=Cstr(x+1)

j = Len(liCount)

d=9 - j

%>

<%

        For i=1 to d step 1

         Response.Write ("<IMG SRC='/digits/0.gif'>")

        Next

  For  i=1 to j step 1

   fl="" + Mid(liCount, i , 1) + ".gif"

   Response.Write ("<IMG SRC=") & (fl) & ">"

 Next

%>

Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post Posted: 14 May 2003 at 10:04am
What happens... an error, broken images?
Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post Posted: 14 May 2003 at 10:06am

IF its a broken image try

fl="""" + Mid(liCount, i , 1) + """.gif"

   Response.Write ("<IMG SRC=") & (fl) & ">"

Back to Top
Misty View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 February 2002
Location: United States
Status: Offline
Points: 711
Post Options Post Options   Thanks (0) Thanks(0)   Quote Misty Quote  Post ReplyReply Direct Link To This Post Posted: 14 May 2003 at 10:34am

I am sorry that I was not specific enough. Here's the error message that I got:

Microsoft VBScript runtime error '800a004c'

Path not found

/count.asp, line 11

My text file is in a database folder. There are HTML and database folders.  

 



Edited by Misty
Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post Posted: 14 May 2003 at 11:25am

You have commented out these lines

'strPath = "counter.txt"

   'Set connection details
    'strPath = Server.MapPath(".")
    'strPath = Replace(strPath,"html","database")
    'FileName = "counter.txt"

 change that block of code to:

strPath = "counter.txt"

  'Set connection details 
    strPath = Server.MapPath(".")
    strPath = Replace(strPath,"html","database")
    FileName = "counter.txt"

Back to Top
Misty View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 February 2002
Location: United States
Status: Offline
Points: 711
Post Options Post Options   Thanks (0) Thanks(0)   Quote Misty Quote  Post ReplyReply Direct Link To This Post Posted: 15 May 2003 at 5:43pm

I've worked on this page counter. Please look at the code of line in blue. Everything works except for one thing. This is strange, but I get a broken image for numbers that are above 0. The zeros will show up. I got the code from http://www.programmersresource.com/articles/counter.asp.

Here's my new code:

<%

Dim strPath, File, file2, x,liCount, j ,resfile, d, i ,fl

'strPath = "counter.txt"

strPath = "D:\inetpub\wwwroot\anywhere.com\database\counter.txt"

Set File = Server.CreateObject("Scripting.FileSystemObject")

set file2=File.OpenTextFile(strPath)

x=file2.readline

 

set resfile = File.createTextFile (strPath)

resfile.writeline(x+1)

liCount=Cstr(x+1)

j = Len(liCount)

d=7 - j

%>

<%

        For i=1 to d step 1

         Response.Write ("<IMG SRC='/images/Num0.gif'>")

        Next

  For  i=1 to j step 1

   fl="Num" + Mid(liCount, i , 1) + ".gif"

   Response.Write ("<IMG SRC=") & (fl) & ">"

 Next

%>

 

Back to Top
Misty View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 February 2002
Location: United States
Status: Offline
Points: 711
Post Options Post Options   Thanks (0) Thanks(0)   Quote Misty Quote  Post ReplyReply Direct Link To This Post Posted: 15 May 2003 at 5:56pm

You can ignore this posting. I just put the images in the folder that the html page was in. I removed the images from the code of line. It works now.

However, I still need help to fix the code in the "New Page Counter". It's a different page counter from this one.



Edited by Misty
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.