Saturday, February 19, 2005

Authentication and Request Variables

My first actionscript test was done today. I tried to see how authentication would work as well a getting filenames or variables from the url.

Authentication


The authentication thing is quite easy, create two input boxes (one single line [username_txt] the other password [password_txt]) and make a button for submit in the first frame. Then add a onrelease action for the button as follows:

username = this.username_txt.text;
if (username == "test" & this.password_txt.text == "test")
{
gotoAndStop(2);
}

Next in frame say something like "Welcome test" using a text box [welcome_txt]. I did the following:

this.welcome_txt.text = "Welcome " + username + "\n" + "You have requested " + _root.request;

Fake File Names and Request Variables


What's nice about actionscript is it reads in the request variables automatically. If the url is "http://domain/test.swf?myname=joe&age=45" then the actionscript will automatically have the variable myname and age stored.
The tricky part comes when you want to take the url from html/php file and add it to the swf's address. So what you have to do in your php is add the request query to end using the $_SERVER["QUERY_STRING"] variable. Therefore src="basic-AuthReqVars.swf" ... becomes src="basic-AuthReqVars.swf?" ... .
The other tricky part would be to include a fake filename. For instance, with php I might want to say "http://domain/index.php/289590.jpg" but it really it goes to index.php and the filename is parsed out.
So what i do is in the PHP is create a variable for the new query string and use that to get the filename or id.

if (isset($_REQUEST["id"]))
{
$req = $_SERVER["QUERY_STRING"];
$dot = "";
}
else
{
$dot = "../";
$req = "file=" . substr($_SERVER["PATH_INFO"],1);
}

The $dot variable is important because of the way the html will read where the swf is. If I goto "http://domain/index.php/289590.jpg" it will think that the swf which is referenced at "test.swf" will think it is in the directory index.php but in fact it is in the root.
Then in my src I call it with "src="basic-AuthReqVars.swf?" ..." .
Then in the first frame of the animation, I say:

if (_root.id)
{
request = "id#" + _root.id;
}
else
{
request = "file " + _root.file;
}

In the second frame, I say:

this.welcome_txt.text = "Welcome " + username + "\n" + "You have requested " + _root.request;

If you have any question feel free to post comments.

Thursday, February 17, 2005

Flickr and PBase

Added some more photography examples, reviews, news stories to the Research Section.Also I did a couple of reviews check my take on Flickr and PBase

Flickr


This site definitely has some good ideas to it that I have been thinking about. The one thing I don't like initially is no ability to upload mass photos.
From a practical standpoint, nobody really upload one photo at a time; There should be an ability to upload a zip or rar or tar or bz or gz or whatever compressed archive of their photos.
Most archiving programs are easy enough to use. I may be able to create one at the least.
As far as good features, it includes flash. It is especially nice to see that in a photo presentation suite like this. Try organizing your photos, it has a lot of the same ideas that Picasa uses.
I noticed when it mentions it resizes the photos, that gives me the idea that it caches them at upload, which is what I thought they do. It demand a name and description when it is being used right away, but it isn't nessecary.
There is this idea of "tags". It seems to be for easy searching, which is great for the search and cumbersome for the uploader. It includes invites groups and other facets I might look into, for more detail but this is certainly I good web counterpart for Picasa. I'm also sure I'll find other things to disagree with, especially since it's Beta.

PBase


This is a gallery database for photographers, to share photos online. It is organized by country and photographer.
Some even have a whole set of photos for one object. There is also an interesting listing of the galleries by person sorted by the last update so you can see who has some new photos up.
I like how public albums are available and displayed, but the website is more for professional photographers then a target audience I am thinking of.


Monday, February 14, 2005

First Post

I hope to use this blog, for jotting down ideas and keeping informed on the process throughout.

This page is powered by Blogger. Isn't yours?