One Time Download Plugin

Discussion in 'Troubleshooting' started by everbatim, May 6, 2009.

  1. everbatim

    everbatim Member

    Joined:
    Dec 19, 2007
    Messages:
    65
    I purchased the "One Time Download" plugin with the hopes that it would be smart enough to recognize the "file" I want to limit access to is a PHP (HTML) file and not a file that one would typically download. However, that doesn't seem to be the case. The protection works (meaning it limits the number of times the file can be downloaded) its just that I don't want the file to be downloaded, I want it to be opened in a new browser window.

    So, for example, I've got a file, test.php, that I only want each member to have access to 3 times. I set the download amount to 3, put in the full unix path, and it only lets them access that page 3 times. Thats what I want.

    Does anyone know if this is possible or how it might be accomplished? I've got a ticket into support, but I'd like to keep my options open here.
  2. everbatim

    everbatim Member

    Joined:
    Dec 19, 2007
    Messages:
    65
    I figured this out for anyone that cares to implement it as well. In /aMember/plugins/protect/onetime_download/d.php:

    Changes lines 11 & 12 from this:

    if (preg_match('/\.pdf$/i', $file)){
    header("Content-Type: application/pdf");

    to this:

    if (preg_match('/\.php$/i', $file)){
    header("Content-Type: text/html; charset=iso-8859-1");

    It will allow the protected file to open up (instead of being forced to download) while still preserving the protected "link" that aMember displays in the address bar. In contrast, you could add an additional "IF" statement so that PDF files and PHP files open up instead of download, but for my purpose, I'll never be protecting PDF files so it didn't matter.
  3. powerkeys

    powerkeys Member

    Joined:
    Aug 29, 2006
    Messages:
    192
    This is good to know. Thanks for posting it.

Share This Page