|
-
Aug 15th, 2000, 06:37 AM
#1
Thread Starter
Addicted Member
Hi,
I would like to add a counter at my Home Page to know how many times a file was downloaded.
How to do this or where can I find it?
Thanks a lot...
Michel Jr.
-
Aug 15th, 2000, 08:03 AM
#2
Frenzied Member
I may be wrong but I think some ISPs provide this service.
Alternatively you could write an Active Server Page which logs each time the file is downloaded
-
Aug 15th, 2000, 05:02 PM
#3
Frenzied Member
OK i've just knocked this up. It needs polishing up a bit.
database dload.mdb has a table called table1 with two fields in it
Filename and count
count is Number data type.
Code:
<%@ Language=VBScript %>
<!--
Written by Mark Sreeves
-->
<BODY>
<%
dim Fname
dim conn
dim rst
Fname = request("Filename")
if Fname <> "" then
'open the connection to the database
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=C:\dload.mdb")
strSQL = "Update Table1 set count = count+1 where filename='" & Fname & "';"
conn.execute strsql
response.write "<SCRIPT LANGUAGE='JavaScript'>" & vbcrlf
response.write "window.location='" & Fname & "';" & vbcrlf
response.write "</SCRIPT>"
end if
%>
<form name="frm1"action="download.asp">
<A HREF="javascript:document.frm1.submit()">Download Myfile.zip</A>
<input name="Filename" type="hidden" value="Myfile.zip">
</form>
</BODY>
</HTML>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|