Simple Download Monitor problems

Started by pepak, November 04, 2009, 11:46:40 AM

Previous topic - Next topic

pepak

Quote from: Sean1) Using the 'www.mysite.com/index.php?sdmon=myfolder/myfile.zip' test works (file is registered as downloaded).
Good. That means the plugin is installed and set up correctly.

Quote3) I verified that my webhost supports both user-defined .htaccess files and mod_rewrite.
Did you verify that mod_rewrite and .htaccess are supported or that they really work? It might seem like a meaningless distinction, but I have seen webhosts who "support" mod_rewrite provided that one or another condition is met, such as a tech support is contacted to turn the support on for a specific site.

E.g., if you turn on "cool URLs" for your site, do they actually work?

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

Quote6) I verified that the extension for my downloadable filetypes (pdf) is included in the allowed extensions settings.
Did you try the actual .pdf with the /index.php?sdmon=something syntax? Did it work?

What kind of errors do you see? Do you get, e.g., a HTTP 500 error, a 404 error or something else completely?

Sean

>> Did you verify that mod_rewrite and .htaccess are supported or that they really work?

Yep, supported by default according to my web host.

>> if you turn on "cool URLs" for your site, do they actually work?

Works, so mod_rewrite is working.

>>Did you try the actual .pdf with the /index.php?sdmon=something syntax? Did it work?

Works.

I suspect its a simple path issue with my .htaccess file.   After turning on cool-urls, WP altered the .htaccess files which gave me some clues.   Could you email me directly?   I'd like to pass you my full .htaccess file to see if you could shed light on the issue.

Thanks!

Sean

pepak

I could e-mail you, if you provided an e-mail :-)

If you want to send me something, forum at pepak.net will work.

Sean

Working now!   Was a path problem.   Thanks for the great plugin and support Pepak!

Sean

pepak


Raphael

Hi,

I encounter a very strange issue. Forwarding/Path rewriting works like a charm, but instead of offering my a download, FireFox (3.6.10) shows the file's contents. See for instance: http://lmazy.verrech.net/files/js_antics.tar.gz

My PHP verison is 5.1.2. Is a special library/module needed to have the plugin run? (if so, you should check for it)

Raphael

Oh, and the button descriptions "Delete..." are misleasing. There is no reason whatsoever for the plugin not offering an option to delete files (might even be a feature idea?). Please relabel to "Reset ..."

pepak

Raphael:

1) Firefox shows file contents because the file is set up to have content-disposition of "inline". That is caused by the setting "Inline files" in the plugin's config: apparently you set it up so that even js_antics.tar.gz matches it.

2) "Reset" instead of "Delete" sounds quite reasonable. I'll add that to my TODO list.

Raphael

Thanks for pointing me into the right direction. Now I have a bug report for you: if nothing is entered into the inline option box, all files match and are shown inline. This is clearly counterintuitive if not unintended. Please check empty(trim(.)) and/or provide a meaningful default setting.

Thank you for your help and the plugin!

pepak

That would certainly be unintended. I'll look into it.

pepak

Raphael:

Actually, there IS a check for empty "Inline files" setting. My guess is that your setting IS NOT EMPTY. I am reluctant to test for empty(trim(...)), because I do want to be able to use the space, but I'll tighten the setting a little.

Raphael

preg_match et al. are supposed to ignore whitespaces, are they not? I thought that was what \s was for.

Also, I fail to see in which way an empty/whitespace pattern can match everything.

pepak

Quote from: Raphaelpreg_match et al. are supposed to ignore whitespaces, are they not?
Only in the extended mode.

QuoteI thought that was what \s was for.
Nope. "\s" is "any whitespace character", while " " is only a space.

QuoteAlso, I fail to see in which way an empty/whitespace pattern can match everything.
Because PCRE expressions have a form of:
separator - expression - separator - modifiersIf you provide two spaces, a space will be separator and empty string will be expression. And apparently any input matches an empty expression.

I am not sure how do PCRE in PHP behave if you use only one space. I would expect that an error would occur, but maybe not.

Piet

Hi Pepak,

I had your plugin working before, but now it doesn't anymore, so I am trying to figure out what the problem is.

The problem is most likely with my htaccess file, but I cannot discover the culprit.

What I did find out though is that when I do not place an additional htaccess file in the downloads folder all that shows up when I click a download link is gibberish.

I am using nice permalinks, so rewrite is not the problem.

If is use the long url to download the files your plugin registers the download. If I am using my own url site.com/downloads/filename.zip your plugin does not registers the download

My htaccess file contains a few more entries, could that have something to do with it?

# Use PHP5 Single php.ini as default
AddHandler application/x-httpd-php5s .php

# Redirect old PDF files to Tutorials directory (http://www.webweaver.nu/html-tips/web-redirection.shtml)
RedirectMatch 301 (.*)\.pdf$ http://sub.domain.com/folder/

# PROTECT htaccess file

 order allow,deny
 deny from all

#END

# PROTECT wpconfig.php

order allow,deny
deny from all

#END

# BEGIN WordPress

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


# END WordPress

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?domain.com/.*$ [NC]
RewriteRule \.(pdf)$ - [F]

Piet

oh, and the contents of the additional htaccess in the downloads folder are:

# INITIALISE AND ENABLE REWRITE ENGINE
RewriteEngine on
#END

# DISABLE DIRECTORY BROWSING
# For security reasons, Option all cannot be overridden.
#Options All -Indexes
Options ExecCGI  Includes  IncludesNOEXEC  IncludesNOEXEC  MultiViews  SymLinksIfOwnerMatch  Indexes -Indexes
#END

Quick Reply

Note: this post will not display until it has been approved by a moderator.

Name:
Email:
Verification:
Please leave this box empty:
Type the letters shown in the picture
Listen to the letters / Request another image

Type the letters shown in the picture:
Shortcuts: ALT+S post or ALT+P preview