without having to hardcode a use开发者_StackOverflowrname / password in my .swf file (very easy to decompile!), is it possible to send a URLRequest
for some file (perhaps .php?) to a loader object which can load assets that reside in password protected directories?
my PHP skills are weak at best, so if calling a .php script is the solution to this problem some sample code would be greatly appreciated.
This syntax may be a little off, so please forgive me if it doesn't work without a little tweak.
Outside the protected dir, you can have a file, say "secret.php". In it:
<?php
header('Content-type: image/png'); //Change to whatever filetype
echo file_get_contents('/path/to/file/image.png');
?>
This works because it's reading the file on the file system instead of through the server which invokes auth.
You can set up parameters to input a filename (be super careful!!!! people could access stuff you dont want) and to handle the content-type.
Yes, you can load password protected files using PHP. However, the permissions on the file must be so that your webservice can read them.
精彩评论