Author Topic: Simple Download Monitor problems  (Read 78458 times)

pepak

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 956
    • View Profile
    • Pepak.net
Simple Download Monitor problems
« Reply #45 on: June 25, 2010, 05:31:11 PM »
I see what's the problem: The code you have
Code: [Select]
...is intended for linking to documents and clicks usually result in a browser offering an action (download, open, etc.). The "inline" function of SDM is intended for codes such as
Code: [Select]

These are intended for display within the HTML page itself.

MixMan

  • Guest
Simple Download Monitor problems
« Reply #46 on: July 01, 2010, 01:09:51 PM »
Hi Pepak and thanks for the useful plugin!

In the allowed directories I have put:

 "wp-content/uploads/"

In the allowed extensions:

 "mp3"

In the .htaccess file:

RewriteRule ^(wp-content/uploads/.*) /index.php?sdmon=$1 [L]

Everything works, but the plugin gives me stats for all kind of files, not just .MP3 (jpg, rar, ...)

What's my mistake?

pepak

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 956
    • View Profile
    • Pepak.net
Simple Download Monitor problems
« Reply #47 on: July 01, 2010, 03:38:32 PM »
Interesting. I never thought of it, but I have just tried it and you are correct.

I am at a loss what to do with it - it's not a bug per se, but a rather strange (though logical) behavior. What happens is:

1) User tries to access a file with other than allowed extension.
2) SDMON processes the requests, checks for the existence of file and correctly logs a download attempt.
3) SDMON then checks permissions and because the file doesn't have a permitted extension, it refuses to download it, reporting a "Not found" error instead.

Now the question is, what is the correct behavior? The current one is actually OK, because there was an attempt to download that file and that files did exist. Two alternatives I can think of are:
1) Not log anything because the download didn't even start - it was just an unsuccessful attempt.
2) Log the attempt but put it among the nonexistent files. Which would hide the attempt from main view while still keeping it for tracking purposes, but at the cost of some confusion (why is the access stored among nonexistent files wjhen the file exists?)

Maybe I should change the boolean flag (exists/doesn't exist) to an enumerated type (exist and valid/exists and invalid/doesn't exist)? I'll need to think about it. I'd appreciate an input.

MixMan

  • Guest
Simple Download Monitor problems
« Reply #48 on: July 01, 2010, 04:19:27 PM »
You got me quite confused. I just want to have stats for only mp3 files, isn't the "Allowed extensions" option just for that?

The option doesn't seems to work.

pepak

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 956
    • View Profile
    • Pepak.net
Simple Download Monitor problems
« Reply #49 on: July 01, 2010, 05:20:02 PM »
Quote from: MixMan
You got me quite confused. I just want to have stats for only mp3 files, isn't the "Allowed extensions" option just for that?

The option doesn't seems to work.
The main purpose of the option is to prevent access to files not designated for download.

As I said, I'll need to think about it and about ways of fixing it, if I decide it needs fixing (which it probably does).

MixMan_

  • Guest
Simple Download Monitor problems
« Reply #50 on: July 01, 2010, 06:40:28 PM »
I thought it was for restricting the stat processing to certain file types.

"Only files with extensions matching this regular expressions will be processed."

Sorry, I am not aware of how it actually works, don't have coding abilities.

I just don't want to see statistics for let's say images in my site, although they are actually downloaded on everybody's PC, when they load the page in their browser.

pepak

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 956
    • View Profile
    • Pepak.net
Simple Download Monitor problems
« Reply #51 on: July 01, 2010, 06:55:17 PM »
It was a reasonable assumption and I will need to do something about it. But the primary purpose was security, not file selection - that is done by the .htaccess.

MixMan

  • Newbie
  • *
  • Posts: 2
    • View Profile
Simple Download Monitor problems
« Reply #52 on: July 01, 2010, 09:32:54 PM »
I see. Hm, do you think there's another solution for now? Like altering the .htaccess file to "process" only the desired file types? Or I am dreaming?

pepak

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 956
    • View Profile
    • Pepak.net
Simple Download Monitor problems
« Reply #53 on: July 02, 2010, 05:13:44 AM »
For now? Change the .htaccess line from
Code: [Select]
RewriteRule ^(wp-content/uploads/.*) /index.php?sdmon=$1 [L]to
Code: [Select]
RewriteRule ^(wp-content/uploads/.*\.(pdf|gif|jpe?g|png)$ /index.php?sdmon=$1 [L]That should work.

MixMan

  • Newbie
  • *
  • Posts: 2
    • View Profile
Simple Download Monitor problems
« Reply #54 on: July 02, 2010, 09:05:39 AM »
I changed it and the site started giving me:

INTERNAL SERVER ERROR.

Also, I noticed that when I am using this line in .htaccess:

Code: [Select]
RewriteRule ^(wp-content/uploads/.*) /index.php?sdmon=$1 [L]
the images in my site stopped to show up. So now not only I am getting stats for all these other than MP3 files too (that I don't need, but my images don't work. I think I did a total mess with the settings :)

Switched off the plugin for now.

pepak

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 956
    • View Profile
    • Pepak.net
Simple Download Monitor problems
« Reply #55 on: July 02, 2010, 10:16:24 AM »
Quote from: MixMan
I changed it and the site started giving me:

INTERNAL SERVER ERROR.
I forgot to add an ending parenthesis:
Code: [Select]
RewriteRule ^(wp-content/uploads/.*\.(pdf|gif|jpe?g|png))$ /index.php?sdmon=$1 [L]
Quote from: MixMan
the images in my site stopped to show up. So now not only I am getting stats for all these other than MP3 files too (that I don't need, but my images don't work. I think I did a total mess with the settings :)
That is the expected behavior: You told SDMON to only allow files with mp3 extension, so it dutifully prevents access to files with other extensions. You need to expand the allowed extensions setting to allow for additional file types.

JKirkby

  • Guest
Simple Download Monitor problems
« Reply #56 on: July 25, 2010, 04:37:53 PM »
I'm having the same problem as 'MixMan'

I only want to track MP3 downloads, but if I only track MP3 downloads, images don't appear on my site. If I add images to the "Allowed extensions" section, then image downloads appear in the download stats.

Most images on my site are inside the tag.

I've also added:
RewriteRule ^(wp-content/uploads/.*\.(pdf|gif|jpe?g|png))$ /index.php?sdmon=$1 [L]
to my .htaccess file, but it hasn't made a difference.

Thanks

pepak

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 956
    • View Profile
    • Pepak.net
Simple Download Monitor problems
« Reply #57 on: July 25, 2010, 04:45:52 PM »

JKirkby

  • Guest
Simple Download Monitor problems
« Reply #58 on: July 25, 2010, 05:06:32 PM »
Quote from: pepak
This comment should help you:
http://www.pepak.net/wordpress/simple-download-monitor-plugin/#comment-4729

Thank you! problem solved!

Sean

  • Guest
Simple Download Monitor problems
« Reply #59 on: September 03, 2010, 07:11:05 AM »
pepak -- great plug-in!!   Having slight difficulty getting it work.  

1) Using the 'www.mysite.com/index.php?sdmon=myfolder/myfile.zip' test works (file is registered as downloaded).  
2) Using 'www.mysite.com/myfolder/myfile.zip' doesn't.. file download is not registered.
3) I verified that my webhost supports both user-defined .htaccess files and mod_rewrite.
4) The relevant part of my .htaccess file looks like this:

---
RewriteEngine on
RewriteBase /
RewriteRule ^(myfolder/.*) /index.php?sdmon=$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
-------

5) I verified that no other .htaccess files exists in any subs off the site root.
6) I verified that the extension for my downloadable filetypes (pdf) is included in the allowed extensions settings.
7) I'm puzzled!

Any advice is appreciated!

Sean

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Note: this post will not display until it's been approved by a moderator.
Name: Email:
Verification:
This box must be left blank:

Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture: