Archive for the 'PHP' Category

Great webinar on using ZendAMF with Flash Builder 4

Ok when I say great I may be a little biased because I’m the one who presented it, but nonetheless I think it came out great. The main reason for this is that all of the demos and features worked smoothly without any hiccups. In this one hour session I cover the basics of using the new data features in Flash Builder 4 to install and utilize the ZendAMF library for PHP. The examples show how easy it is now to retrieve and display database content without writing even a single line of code. Go on over and watch it and let me know what you thought of it.

Lee

Great AMF benchmarking tool

I just finished the final webinar in my 3-part series on PHP and the Flash Platform. You can watch parts one and two and today’s recording should be available soon. Today I showcased a great tool that was created by fellow evangelist James Ward which lets you see the performance gains when using AMF and Flex over things like AJAX and regular XML integration.

I have known about this tool for a while but I wanted to make sure that the rest of the Flash community was aware of it. Your really see the performance gains of AMF when you are dealing with large data sets. For instance, you can load and display 20,000 rows of data using AMF in half the time that it takes to do 5,000 rows with standard XML. Wow!

Lee

New video tutorial on using ZendAMF

I just finished uploading a new tutorial that shows you the basics of using the new ZendAMF framework. As you’ll see, the workflow is almost identical to the workflow for AMFPHP so it shouldn’t take long to make the switch. In this example I show how to retrieve database content and read it into Flash using the NetConnection class. Check it out at http://www.gotoandlearn.com.

Lee

An overview of ZendAMF

This week I attended the Zend/PHP Conference where we officially announced the addition of AMF into the Zend Framework. I thought it would helpful to give an overview of what this means to Flash developers, especially those who are not familiar with Zend.

What is Zend?
Zend is a company that develops a wide array of solutions for PHP developers. They make Zend Studio, which is an Eclipse-based IDE for doing PHP development. We also announced that we are working with Zend so developers will be able to install the Flex 3 Eclipse plug-in into Zend Studio for tight integration. The Zend Framework is a combination of an MVC framework in addition to a wide variety of utilities for doing everything from connecting to Flickr to database interaction. I just started using the Zend MVC framework for gotoAndLearn and so far I like it a lot. There is a little bit of a learning curve if you are not completely familiar with MVC concepts.

What is ZendAMF?
ZendAMF is essentially the addition of AMF support into the Zend Framework. You do not have to use the MVC framework to use the new AMF features. The workflow is very similar to the one used in AMFPHP. This is no accident, as both implementations are being done by Wade Arnold. Essentially you create a PHP class with methods that can be called directly from Flash or Flex. Take a look at my tutorials on AMFPHP for more on how to do this. I’ll let you know when the first stable release of ZendAMF hits the streets. It should only be a matter of days now.

So what about AMFPHP?
Wade will continue to run this project but using ZendAMF will be the only method that will be officially supported by both Adobe and Zend. This means that it will be thoroughly tested and potentially more reliable than AMFPHP. Again, the difficulty level of working with either is about the same. Look for a tutorial on ZendAMF very soon.

Lee

Video of me integrating PHP and Flex

About month ago I went up to the city to record some video demos for the Adobe site. These are more polished than the ones I do at gotoAndLearn() and are even shot against a green screen. In this video I show how to integrate PHP and Flex together using XML. It’s not often that I do stuff in Flex but I do open it from time to time.

Lee

AMFPHP Security Basics

As I mentioned in my last video tutorial on AMFPHP, I want to take a few minutes and talk about the steps you can take to make it as secure as possible. Most of what I’m going to share was taken from a blog post written by Wade Arnold. One important thing to note right off the bat is that I will be talking about security as it relates to AMFPHP 1.9 and higher. If you are using an earlier version you will want to check elsewhere for the details for you specific version. So without further adieu, here are the steps to better AMFPHP security:

Delete the Service Browser
If you’ve watched my tutorials you know that the Service Browser is that Flex application that allows you, or anyone else for that matter, to see all of the services and methods you have available. For obvious reasons you will want to delete this on your production machine. You don’t want random people seeing all the goodies that you have exposed. To get rid of it simply delete the browser folder that is located in your AMFPHP root directory.

Delete the DiscoveryService service
The DiscoveryService service is included when you install AMFPHP. When you go to the Service Browser for the first time you will see it as the one and only service. This service exposes methods that give all the details about the services and methods you have available. In that sense it is very much like the Service Browser itself and should be deleted for the same reasons. From your AMFPHP root directory, go into the services folder. From there either delete the entire amfphp folder or just the DiscoveryService.php file which is located inside of it.

Set the PRODUCTION_SERVER property
The PRODUCTION_SERVER property is located in the gateway.php file which is located in the root AMFPHP folder. This property is set to false by default but should be set to true in production environments. This will disable things like remote tracing and debugging headers. Open gateway.php and set the property like so:

1
2
//define("PRODUCTION_SERVER", false);
define("PRODUCTION_SERVER", true);

Run over SSL if possible
I’m definitely not a server geek so don’t ask me how you would do this. But the idea is that the data going back and forth between Flash and AMFPHP will not be plain text and this would of course make it much harder for people to be able sniff out the actual data.

Running the beforeFilter
In AMFPHP 1.9 there is a new feature which will allow you to authenticate the calling client to make sure they have the right access level to call the service. Basically you define a function in your service class named beforeFilter using the signature below:

1
public function beforeFilter($function_called)

This function will be called before your service method which was called by the client. If this function returns true, then the service method is called. If not, then a security error is thrown. It is inside this function that you can do some type of authentication. Joshua Ostrom has a nice blog post that goes into more details on this.

General PHP security
Since AMFPHP and all of the services you expose with it are nothing more than PHP files, you will want to familiarize yourself with some basic PHP security guidelines. Preventing SQL injection is one of the biggest areas that you need to make sure you protect against. There are many good articles on the web that explain how to prevent this attack. If you do a lot of PHP work, do yourself a favor and pick up a book like Essential PHP Security to make sure that you are being safe.

Lee

Introduction to AMFPHP 2 tutorial is live

I just finished uploading the second part of the AMFPHP tutorial. In this one I show you how you can directly return a MySQL result set to Flash CS3. It’s amazing how much easier it is than writing out a bunch XML. I also go into the basics of using the Flash CS3 debugger to view and parse the ArrayCollection that AMFPHP returns. Go and check it out at http://www.gotoandlearn.com and let me know what you think.

One thing I neglected to mention in the tutorial is that when you debug your movie in Flash you will get the “Your SWF is attempting to access the internet” window. You will need to go to the Flash settings page add it to the allowed list.

Lee

Next Page »