Results 1 to 3 of 3

Thread: Need a file download counter to my Home Page

  1. #1

    Thread Starter
    Addicted Member Michel Jr's Avatar
    Join Date
    Jan 2000
    Location
    Brazil
    Posts
    175

    Question

    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.

  2. #2
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    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

    Mark
    -------------------

  3. #3
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    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>
    Mark
    -------------------

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width