View Full Version : how can calculate total number of hits
hello frineds, i am developing a hosting directory web site on this site there will be the links of hosting websites, i want that when user click on a particular website link it will be recorded in the database how it could be done pls tell me thanks.
08-28-2004, 03:56 PM
Have the links go to a counter and redirect page
the siteid would be the id of the site in the database, so do a query with that in, then increment a field in the database for that site by 1, then redirect to the sites proper url
08-28-2004, 10:43 PM
I wrote this up along time ago for the sake of writing up scripts. This might help you do what you want to do. You might not want to use text documents as your databases.
The way I wrote this code was so I didn't need to manualy create the text file databases. So this code is good just to give you the head start.
Dim FSO, Counter, File, Clicks, IntID
IntID = Request.QueryString("ID")
If IntID = 1 Or IntID = 2 Then
Set FSO = CreateObject("Scripting.FileSystemObject")
Counter = Server.MapPath("db\cc" & IntID & ".txt")
On Error Resume Next
Set File = FSO.OpenTextFile(Counter)
Clicks = CLng(File.ReadLine)
Clicks = Clicks + 1
If Error Then
Clicks = 1
Set File = FSO.CreateTextFile(Counter, True)
If IntID = 1 Then
Response.Redirect("http://link1.com?" & Clicks)
ElseIf IntID = 2 Then
Response.Redirect("http://second.net?" & Clicks)
Response.Write "Add ?ID=1 or 2 to the end of this so that it will work"
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.