UGN Security Forums
My ProfileMember DirectoryLogin
Search our ForumsView our FAQView our Site Rules
View our CalendarView our Active TopicsGo to our Main Page

UGN Security Store
 

Network Sites UGN Security, The GoNix Initiative, Elite Web Gamers, Back of the Web, EveryDay Helper, VNC Web Design & Development
December
Su M Tu W Th F Sa
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
Sponsored Links
Latest Postings
Latest Reviews
Topic Options
Rate This Topic
#18771 - 04/06/02 01:14 AM Simple ASP counter
Cold Sunn Offline
UGN GFX Whore

Registered: 03/03/02
Posts: 574
Loc: us
First off, I know I should have researched this more before I posted. I know. And i am researching it at webmonkey, but it is hard to sort through all the information in a quick amount of time. So I might as well ask, but i really don't expect much of a response.

I would like a simple counter in asp. What I would like it to do is for every time a certain page is viewed, it add to a number in a .txt. For example, all the contents of counter.txt be just a number. So that number increases by one every time someone views a certain page. If you know how, please post. If you do not, don't go looking for me. Thanks for any help, and if i do find a simple way to do this, i will post it.

Top
Sponsored Links
      
#18772 - 04/06/02 10:11 AM Re: Simple ASP counter
SilentRage Offline
DollarDNS Owner

Registered: 03/04/02
Posts: 1273
Loc: OH, USA
So like, ASP is like VBScript, and yeah, VBScript is like VB. And like, I've been doing VB for like ages... so like, I could do a simple ASP counter sure.

Let's see, I THINK this is the ASP tag...
<%
Set FSO = CreateObject("Scripting.FileSystemObject")
Set FILE = FSO.OpenTextFile("hits.cnt", 1, True)
HitCount = Val(FILE.ReadAll)
FILE.Close
'heh, I dunno if this works:
print HitCount
Set FILE = FSO.OpenTextFile("hits.cnt", 2, False)
FILE.Write HitCount
FILE.Close
%>

Well there you have it. I haven't worked with VBScript for months and months so if I made a bug - SCREW YOU... I don't want to look nothing up to confirm anything; I don't want to test it to see if it works. All I'm doing is giving you the general idea, and general code on how to do it. And if it DOES have bugs, then I'd appreciate somebody who works with VBScript/ASP a lot more than I do to shamelessly correct me.

To find reference material on what I did up there, look up the FileSystemObject and the File object, the ReadAll Method, the Write Method, the OpenTextFile Method, and the CreateObject function if you wanna.
_________________________
Domain Registration, Hosting, Management
http://www.dollardns.net

Top

Moderator:  §intå×, Gremelin 
Featured Member
Registered: 02/28/02
Posts: 7193
Forum Stats
2152 Members
46 Forums
36289 Topics
71459 Posts

Max Online: 1567 @ 04/25/10 05:20 AM
Top Posters
UGN Security 29450
Gremelin 7193
§intå× 3255
SilentRage 1273
Ice 1146
pergesu 1136
Infinite 1041
jonconley 955
Girlie 908
unreal 860
Newest Members
cdefgh368568, HushHush, golqm, Tim050, Gecko666
2151 Registered Users
Who's Online
0 registered (), 247 Guests and 302 Spiders online.
Key: Admin, Global Mod, Mod
Latest News


Donate
  Get Firefox!
Get FireFox!