Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
08-28-2004, 09:33 AM #1
- Join Date
- Aug 2004
- Thanked 0 Times in 0 Posts
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, 02:56 PM #2
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, 09:43 PM #3
- Join Date
- Jun 2002
- Ontario, Canada Remaining Brain Cells: 6
- Thanked 1 Time in 1 Post
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.
Code:<% 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 File.Close If Error Then Clicks = 1 End If Set File = FSO.CreateTextFile(Counter, True) File.WriteLine(Clicks) File.Close End If If IntID = 1 Then Response.Redirect("http://link1.com?" & Clicks) ElseIf IntID = 2 Then Response.Redirect("http://second.net?" & Clicks) Else Response.Write "Add ?ID=1 or 2 to the end of this so that it will work" End If %>