ekimmai Posted August 17, 2011 Share Posted August 17, 2011 Hi Guys Please can you help me as I am trying to get a website setup with music flash files. So far I have the following working code: mymusic.html: <html> <head> <title>Flash</title> </head> <body> <object width="550" height="400"> <embed src="file.php?swf=myflash.swf" quality="high" type="application/x-shockwave-flash" WMODE="transparent" width="360" height="26" pluginspage="http://www.macromedia.com/go/getflashplayer" allowScriptAccess="always" /> </object> </body> </html> file.php: <?php $file = "/home/username/private/"; header('content-type: application/x-shockwave-flash'); readfile($file.$_GET['swf']); ?> This works fine in that I can browse to mymusic.html and it will play the flash file myflash.swf which is stored outside of my root directory. I cannot easily retrieve the music file via "view source" or temp internet files, and I appreciate that I can never prevent the most determined individual from getting hold of the music track and that is fine, I just want to make it difficult enough to deter the average user. So what code should/can I add to make this more secure? I saw in one place that the following was added but will it help?: header("Cache-Control: no-cache, must-revalidate"); header("Expires: Mon, 18 Jan 2010 00:00:00 GMT"); I would really appreciate any assistance/pointers! Thanks Quote Link to comment https://forums.phpfreaks.com/topic/244985-please-help-me-improve-code/ Share on other sites More sharing options...
Genesis730 Posted August 17, 2011 Share Posted August 17, 2011 To help prevent the users from finding the files you could use .htaccess URL rewrite to disguise the URL location as a different one, so when they try to access the folder, it won't exist Quote Link to comment https://forums.phpfreaks.com/topic/244985-please-help-me-improve-code/#findComment-1258442 Share on other sites More sharing options...
ekimmai Posted August 17, 2011 Author Share Posted August 17, 2011 .htaccess file currently sits in "/home/username" folder (i.e. my root directory) and is as follows: AddHandler application/x-httpd-php .swf Can I tell you what I might add? Quote Link to comment https://forums.phpfreaks.com/topic/244985-please-help-me-improve-code/#findComment-1258450 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.