Download Counter/Hits Tracker problem

Results 1 to 2 of 2

Thread: Download Counter/Hits Tracker problem

  1. #1
    Join Date
    Dec 1969

    Default Download Counter/Hits Tracker problem

    I am using a download counter on my website. Everytime users clic a download link, i&#039;m updating the database first then redirecting them into the download link. The script itself it fine, compiled with no error. But recently, my webhost complained that my script is using &#039;EXCESSIVE&#039; resource of server. They said my script is &#039;causing damage to the server resources&#039;. I&#039;ve checked the download script many times and optimize it many times, but still the server complained, and the annoying thing is my site always been taken down when this happens. Please help me out with the script, let me know if i&#039;m using wrong methods or something.<BR><BR>Here is my download counter script :<BR>(This download counter script is used/clicked about 10000 click/day, and as you can see i&#039;m using live update on the database, when someone clicks, the database is updated rightaway, is this a problem ?)<BR><BR>&#060;% ENABLESESSIONSTATE = FALSE <BR>Response.Buffer = TRUE<BR><BR>Conn_String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("cgi-binmydatabase.mdb")<BR><BR>set cn= Server.CreateObject("ADODB.Connection")<BR>set rs = Server.CreateObject("ADODB.Recordset")<BR> (conn_string)<BR><BR>dim url_link<BR>dim click_counter<BR>url_link=request.querystring("url ")<BR><BR>sql = "SELECT count(*) as mytotal FROM software WHERE downloadurl=&#039;" & url_link & "&#039;"<BR> sql, cn, 1, 1<BR><BR>if rs("mytotal")&#062;0 then<BR> <BR> sql = "SELECT * FROM software WHERE downloadurl=&#039;" & url_link & "&#039;"<BR> set rs=cn.execute (sql)<BR><BR> click_counter = rs("hits")<BR> click_counter = click_counter + 1<BR><BR> sql = "UPDATE software SET hits=" & click_counter & " WHERE downloadurl=&#039;" & url_link & "&#039;"<BR> cn.Execute (sql)<BR><BR>end if<BR><BR>rs.close<BR>set rs = nothing <BR>cn.close<BR>set cn = nothing<BR><BR>response.redirect url_link%&#062;

  2. #2
    Join Date
    Dec 1969

    Default RE: Download Counter/Hits Tracker problem

    looks OK to me. seems like your host is getting overly anal-retentive with you.<BR><BR>wanna change hosts? I do full ASP3.0 for $100 per year, no complaints about your code.<BR><BR><BR>j<BR>

Posting Permissions

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