Jump to content

phppbo

New Members
  • Posts

    3
  • Joined

  • Last visited

phppbo's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Isn't the pretty much the same issue as mine? Is there a way for me to do the same thing but without the security issues mentioned above by Jacques? http://forums.phpfreaks.com/topic/286117-how-to-sucure-a-folder-but-still-accessable/?hl=%2Baccess+%2Bfile+%2Boutside+%2Bwebroot#entry1468540
  2. I forgot to mention that I am a newbie. I found this code on the internet somewhere and was trying to make it work. I guess, no more php coding for me. Since that is out of the way, one more related question then - what I was trying to do with the above code was to prevent direct url access to my files. Based on what I have read on several forums, it is best to move the files outside of the root directory to prevent hotlinking and direct access. Do you have any recommendations on how to make the files available for paid members only on my site? I am planning on using either memberpress or membermouse as the membership plugin. I have looked at Wordpress Download Manager, WP Document Revisions, etc but they don't work for me as each of my courses is saved into multiple files in a data folder and a .html file that refers to all the files in the data folder. Thanks.
  3. I have some files saved outside the webroot and need to allow posts in WordPress to be able to access the files. Following is the location of one of the files: /home1/Mathone/TESTS/Test1/index1.html I created a Download.php file with the following code and saved it to public_html of my site: <?php $path = '/home1/Mathone/TESTS/'. $_GET['filename']; $mm_type="application/octet-stream"; header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: public"); header("Content-Description: File Transfer"); header("Content-Type: " . $mm_type); header("Content-Length: " .(string)(filesize($path)) ); header('Content-Disposition: attachment; filename="'.basename($path).'"'); header("Content-Transfer-Encoding: binary\n"); readfile($path); // outputs the content of the file exit(); ?> Next, I created a post in wordpress with the following link: <a href="www.mysite.com/download.php?filename=Test1/index1.html">download</a> I am getting an error This is somewhat embarrassing, isn’t it? It seems we can’t find what you’re looking for. Perhaps searching can help. Can anyone tell me what I am doing wrong? Thank you
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.