Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

count the number of download

Status
Not open for further replies.

diarratech

Technical User
Jul 7, 2000
41
0
0
FR
I'd like to count and send the result of the total download to an Access DB each time someone download something on a page.
THANKS
 
U have to create an page witch automatically download the file and before increment the database counter... ________
George, M
 
Thank and could you please explain in details or give some example for this case

Anyway, I'll try with WSH as you advise above
Thank in advance
Nin
 
You can try CLICKCOUNT.PL

I had this query a few months ago...although this solution isn't ASP and doesn't log the # of clickthroughs to a DB, it works just as well (actually, if you're savvy enough you could just re-write the same thing in VBScript and use it for ASP). CLICKCOUNT is a very simple and free Perl script which does provide a very easy-to-understand method of tracking clicks on a given link. For example, I use this to see how many people click on my hyperlink to watch a streaming video presentation I put online. I also use this to track how many times people click on banner ads.


It registers clicks in a text file, which you can then view privately.

Go to:
...and download the "clickcount.pl" source code and have fun!

HTH
 
Thanks everybody. You helped a lot. I found a good code at It works great but there is a stange pb. When you replace your url by a PDF file from your directory, you'll get more records than the click. For instance, if I click once, instead of having one record in the db, I'll get 3 or 4 record total. Any idea?
It does that only with pdf files.



Here it is
<%' Check to see if there is any input
' if not display the form for input
u_input=request.form(&quot;u_input&quot;)
%>
<center>
<form action=&quot;<%= request.servervariables(&quot;script_name&quot;)%>&quot; method=&quot;post&quot;>
<input type=&quot;submit&quot; value=&quot;View&quot;>
<% if u_input <> &quot;&quot; then %>
Clicks by
<% else %>
Select a Report
<% end if %>

<select size=&quot;1&quot; name=&quot;u_input&quot;>
<option <% if u_input=&quot;URL&quot; then response.write &quot;selected &quot; end if %>value=&quot;URL&quot;>URL</option>
<option <% if u_input=&quot;Day&quot; then response.write &quot;selected &quot; end if %>value=&quot;Day&quot;>Day</option>
<option <% if u_input=&quot;Month&quot; then response.write &quot;selected &quot; end if %>value=&quot;Month&quot;>Month</option>
<option <% if u_input=&quot;IP&quot; then response.write &quot;selected &quot; end if %>value=&quot;IP&quot;>IP</option>
</select>
</form>
</center>

<%' When there is input display the data
if u_input <> &quot;&quot; then

' Name of the Access db
accessdb=&quot;clicks&quot;

' Connection to the db
cn=&quot;DRIVER={Microsoft Access Driver (*.mdb)};&quot;
cn=cn & &quot;DBQ=&quot; & server.mappath(accessdb)

' Create a server record set object
set rs = server.createobject(&quot;ADODB.Recordset&quot;)


sql = &quot;Clicks_by_&quot; & u_input

' Execute the sql
rs.Open sql, cn
%>

<table border=3 align=center>
<tr>
<% ' Write out all the elements requested in the
' sql statement as table headers
for each element in rs.fields%>
<th><%= ucase(element.name) %></th>
<% next
' End table headers %>
</tr>
<tr>
<% ' Write out all the values in the record
do while not rs.eof
for each element in rs.fields %>
<td align=left><%= rs(element.name) %></td>
<%
next
' end of record %>
</tr>
<% ' Move to the next record
rs.movenext
' Loop to the beginning
loop%>
</table>

<% end if 'End check for user input %>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top