Missing gaps in AS and PHP for flash gallery

i built this frontend:

http://aaronglazer.com/index2.php

as well as the backend, which controls the title, description and also is the place to name the folder which the admin has uploaded (ie “project6”) which contains a mix of jpgs and flvs in alphanumeric order of load.

I need someone to correct my php so that it reads the directory contents (which could easily be sent as $location-- since that row was just called for the other items, such as title, description, etc.). Thats one part

And then the other part is to get the gallery to play both jpgs and flvs in a slideshow with left and right arrows. Important: when it is an flv, it needs to have clearplayoverseek.swf appear in front. But when it is a jpg, the clearplayoverseek.swf is not visible.

I am really stuck on this and could use some help. I could pay a little money, but I don’t have a lot of budget-- I am doing this for my brother…

Thanks

this is what i am working with for the “targeted” php file. I have it loading in an iframe (which was the easy way out, I know there is a way for it all to load into the same page, but I couldn’t get my head around that!):

====================

<?php

$selection=$_GET[‘location’];

/*

*/
//------------------Edit some Variables----------------------------------
//
//$place = “”;
$dirpath = $selection
//------------------Dont need to edit things below-----------------------

//------------------Now to do the work-----------------------------------
// read through the directory and filter files to an array
//-----------------------------------------------------------------------

$location = “.”;
$filter = “.jpg”;
@$d = dir($location);
if ($d) {
while($entry=$d->read()) {
$ps = strpos(strtolower($entry), $filter);
if (!($ps === false)) {
$items[] = $entry;
}
}
$d->close();
sort($items);
}
//------------------Print Everything to XML Now-------------------------
header(“content-type:text/xml;charset=utf-8”);
echo "<?xml version=‘1.0’?>
";

// I’M NOT SURE WHAT TO PUT HERE-----
// THIS SCRIPT NEEDS TO BUILD LIST OF BOTH JPGS AND MOVIES BASED ON CONTENT
// THEY ALL WILL HAVE FORWARD AND BACK BUTTONS,
// BUT THE FLV WILL HAVE TO HAVE A CLEAROVERSEEK CONTROLLER (which is not visible when it is a jpg)

echo " <image>
"; ///THIS DOESN’T SEEM CORRECT

//---------------------------loop---------------------------------------
for($i=0; $i<sizeof($items); $i++) {

echo “<photo path=’$dirpath$items[$i]’ link=’$place’ />”;

}

//closing tags
echo " </image>
";

?>