开发者

ActionScript - Loading Assets From Password Protected Directory (.htaccess) Using PHP?

开发者 https://www.devze.com 2023-03-21 05:45 出处:网络
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 whi

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消