Guest Posted March 12, 2008 Posted March 12, 2008 Hi, :-" I have a folder containing mp3 files that are used on a mp3player when you access the product_info.php pages. How can I restrict someone from downloading the mp3 files in this folder outside of the product_info.php pages? Basically I don't want someone to download the mp3 files for free by browsing directly to the folder. Can anyone help? Thanks for your assistance.
germ Posted March 13, 2008 Posted March 13, 2008 Make an index.php file and put it in that folder, and put the code in the box below in the file: <?php header ("Location: http://www.yoursite.com/index.php"); ?> All you have to change is this: yoursite.com/index.php Change that to be the URL of your index.php of your catalog. That might mean it needs to be: yoursite.com/catalog/index.php This isn't the only way to keep people from "snooping" in folders, but it's is one simple way that works. It won't stop them if they know the exact name of a file there. It just stops "aimless-nameless snooping". If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there >
Guest Posted March 13, 2008 Posted March 13, 2008 Hi Germs, Thanks for the info - trying it know. Also, so what can you do to stop someone from accessing a file in a folder if they know the exact address? Make an index.php file and put it in that folder, and put the code in the box below in the file: <?php header ("Location: http://www.yoursite.com/index.php"); ?> All you have to change is this: yoursite.com/index.php Change that to be the URL of your index.php of your catalog. That might mean it needs to be: yoursite.com/catalog/index.php This isn't the only way to keep people from "snooping" in folders, but it's is one simple way that works. It won't stop them if they know the exact name of a file there. It just stops "aimless-nameless snooping".
germ Posted March 13, 2008 Posted March 13, 2008 The only way I know to do that is to password protect the folder with .htaccess (like your osC admin might be protected). If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there >
Recommended Posts
Archived
This topic is now archived and is closed to further replies.