ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old September 29th, 2003, 07:12 AM
garyjos garyjos is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 6 garyjos User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hit Counter Problem?

Hello


I am new to Web-Design.

I want to make a hit counter for one particular page.
I have code in one separate functions page, I then call this from the page I want to count:-
<!--#include file="tools/functions.asp"-->
<% Totaldownloads() %>


This bit of code is then called:-
<%
Function Totaldownloads()
Application("downloads")=Application("downloads")+1
Totaldownloads = CInt(Application("downloads"))
End Function
%>

However it seems that this code runs by itself allway's updating by 1, even when the Function is not called?
I have other functions with the one stated above which are included on other pages, again using:-
<!--#include file="tools/functions.asp"-->

Surely the code should only run when called, not just included?

Can you please help?


Thanks

Gary.

Reply With Quote
  #2  
Old September 29th, 2003, 11:39 AM
imbrokn imbrokn is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2001
Location: NJ
Posts: 428 imbrokn User rank is Corporal (100 - 500 Reputation Level)imbrokn User rank is Corporal (100 - 500 Reputation Level)imbrokn User rank is Corporal (100 - 500 Reputation Level)imbrokn User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 11 h 34 m 8 sec
Reputation Power: 10
Send a message via AIM to imbrokn
I think that you are over complicating things. If there is only one page that is going to use this function and the only thing that you are doing in the function is incrementing the download counter then why have it a function anyway? Why not take the function out of your include file and on the page that you want to keep track of simply do:
PHP Code:
 Application("TotalDownloads") = Application("TotalDownloads") + 


Also just note, the first time that the server is restarted either because its been updated, or crashed, your counter is going to go back to zero. perhaps you want to save it in a file somewhere (in which case you might want to ue a function)

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > Hit Counter Problem?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway