Skip to main content

User login

What is OpenID?
  • Log in using OpenID
  • Cancel OpenID login
  • Create new account
  • Request new password
Register
  • Home
  • Browse
    • 2D Art
    • 3D Art
    • Concept Art
    • Textures
    • Music
    • Sound Effects
    • Documents
    • Featured Tutorials
  • Submit Art
  • Collect
    • My Collections
    • Art Collections
  • Forums
  • FAQ
  • Leaderboards
    • All Time
      • Total Points
      • Comments
      • Favorites (All)
      • Favorites (2D)
      • Favorites (3D)
      • Favorites (Concept Art)
      • Favorites (Music)
      • Favorites (Sound)
      • Favorites (Textures)
    • Weekly
      • Total Points
      • Comments
      • Favorites (All)
      • Favorites (2D)
      • Favorites (3D)
      • Favorites (Concept Art)
      • Favorites (Music)
      • Favorites (Sound)
      • Favorites (Textures)
  • ❤ Donate

Download counters are back.

bart
Wednesday, March 12, 2014 - 12:27
bart's picture

I just wrote some custom download counter code, and it appears to be working fine.  I've imported all of the data from the old counter into the new one (although I can't guarantee perfect accuracy of the old data, which was broken anyway).

The new counter uses javascript and ajax, which has the advantage of not requiring messy links (no more "/.../pubdlcnt.php" junk), but on the downside, it won't work on the off chance that someone isn't running JavaScript.

  • bart's blog
  • Log in or register to post comments

Comments

Sharm
joined 13 years 6 months ago
Thursday, March 13, 2014 - 09:55
Sharm's picture

Thank you, it's working much better than the old one already!

  • Log in or register to post comments
Bertram
joined 14 years 7 months ago
Friday, March 14, 2014 - 02:57
Bertram's picture

Thanks for the improvement! :)

  • Log in or register to post comments
pbondoer
joined 11 years 1 month ago
Tuesday, March 18, 2014 - 16:48
pbondoer's picture

Nice, although a right-click on the link adds a download.

As a suggestion, maybe you could write a custom script, use mod-rewrite to hook any files to it, and count downloads through there instead? This will have the advantage of not having any weird scripts visible to the public, and will count the link rights (instead of relying on user click input).

In any case, nice work on this site! :)

  • Log in or register to post comments
bart
joined 13 years 10 months ago
Tuesday, March 25, 2014 - 11:38
bart's picture

Nice, although a right-click on the link adds a download.

Yeah, there isn't really a way to do this with javascript and avoid that.  Unfortunately, javascript can't tell if you right click and hit "save as", so I have to detect right clicks when they happen and assume that they indicate an intent to download a file.  It's not perfect, but since some file types require that they be right clicked to download them, I have to do it that way.

As a suggestion, maybe you could write a custom script, use mod-rewrite to hook any files to it, and count downloads through there instead? This will have the advantage of not having any weird scripts visible to the public, and will count the link rights (instead of relying on user click input).

It can't work quite like that, because I don't want to incur the processor overhead of streaming files through a download script.  The best I could do is change the file download links to point to a script that counts the download and then redirects the browser to the actual download link, but the trouble there is that it would probably open a new page every time someone downloads a file, which is annoying from the user side.  If I'm wrong and there's some way to do it without either of these problems (and without the downloader having to rename the file, which was really irritating), then I'm open to suggestions. :)

  • Log in or register to post comments
pbondoer
joined 11 years 1 month ago
Tuesday, March 25, 2014 - 14:27
pbondoer's picture

Hello!

Yeah I actually forgot that you had to stream files through PHP for it to work, silly me! You're probably right too.

The way I'd handle it is the way you had it before, with links to a PHP script that counts and redirects: download.php?id=file.mp3
Of course I'm assuming if you changed it is because it caused problems/you didn't like it?

In any case, I don't know. I don't really know of any other way than streaming the file (with a buffer of course~!) or redirecting :(

Good luck!

  • Log in or register to post comments
MoikMellah
joined 14 years 4 weeks ago
Wednesday, March 26, 2014 - 07:15
MoikMellah's picture

Any way to do it creatively on the back end with mod_perl?  I'd think you could do something like this example, where you create a custom perl script to update the database, and then reference it with PerlLogHandler inside a Files or FilesMatch directive so it's only invoked for image files.  No redirection or funky renaming on the browser side, and you avoid any overhead you may incur from streaming the download through PHP.

  • Log in or register to post comments
Beast
joined 14 years 2 months ago
Wednesday, March 26, 2014 - 11:12
Beast's picture

You could backtrack a access log file without feeding the download through php.

  • Log in or register to post comments