PHP relay to fix AS3 security sandbox

Source: Internet
Author: User
Tags php server requires domain access

AS3 security can be further enhanced AH, has not let me access the other fields under the things.

Officially, the server needs to be licensed and crossdomain.xml, but of course we can't put something in someone else's server (at least not my level)!

After discussing with Harry, because PHP has no Cross-domain concept (requires server permission), it can be relayed through PHP to enable Cross-domain access. (asp,jsp is similar, here is not to talk about, because I will not)

Because this evening also has the class, therefore first hastily writes the approximate idea.
This thing can only call JPG files, PHP server-side need GD library.
Other things have time to do later.

PHP Side:

 $imgPath = 

The security of the AS3 can be further enhanced AH, no longer let me access the things under the other domain.

Officially, the server needs to be licensed and crossdomain.xml, but of course we can't put something in someone else's server (at least not my level)! The

is discussed with Harry because PHP has no Cross-domain concept (requires server permission), so it can be relayed through PHP to enable Cross-domain access. (Asp,jsp is also similar, here is not to talk about, because I do not  )

Because of the class tonight, so the first cursory write about the idea.
This thing can only call JPG files, PHP server-side need GD library.
Other things have time to do later.

php-side:

 ___fckpd___0 
post[' url ';
Function Imagecreatefromjpegex ($file)
{
$data = file_get_contents ($file);
$im = @imagecreatefromstr ING ($data);
$i = 0;
while (! $im)
{
$data = Substr_replace ($data, "", -3,-2);
$im = @imagecreatefromstring ($data);
}
return $im;
}
$im = Imagecreatefromjpegex ($imgPath);
Imagejpeg ($im);

Flash calls methods:

Function Loadimg (e:mouseevent): void
{
//imgmovieclip for movieclip that need to load pictures. At present, it seems not possible to use the built-in component Uiloader to read ...
var imgurlrequest:urlrequest = new URLRequest (' get_images.php ');
var imgurlloader:urlloader = new Urlloader (imgurLrequest);
var imgloader:loader = new Loader ();
var imgurl:string = Url_input.text;
var imgurlvariable:urlvariables = new Urlvariables ();
//
Imgurlvariable.url = Imgurl
//imgurl is the URL that requires a cross domain access to the picture
//
Imgurlrequest.data = imgurlvariable;
Imgurlrequest.method = Urlrequestmethod.post;
//urlrequestmethod to use post
//
Imgloader.load (imgurlrequest);
Imgmovieclip.addchild (Imgloader);
}









Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.