<?php

include_once("func.php");

if($handle = opendir($_POST['folder']))
{
$xmlReturn = "<data>";
while(false !==($file = readdir($handle))){
if($file !="." && $file!=".."){
$xmlReturn .= '<file name="'.$file.'"/>';
}
}
closedir($handle);
echo($xmlReturn.'</data>');
}


// send data to flex 21-02-2012

$res = new stdClass();

 
$user_id = $_SESSION['userdata']['user_'];
$user_name = $_SESSION['userdata']['username'];


$sel_qry = 'select ImagePath,UserId,TimeCreated  from imageinfo where UserId = "' . $user_name .  '" ORDER BY TimeCreated  DESC ';

$_res = @mysql_query($sel_qry);

while ($row = mysql_fetch_array($_res)) { 

//$img_det = array ( $row['ImagePath'],  $row['TimeCreated'] );

//$imgdetail[] = $img_det;

$imgdetail[] = $row['ImagePath'];

} 


//$res->data->imagename[] = $row['ImagePath'];
//$res->data->imgcreateddate[] = $row['TimeCreated'];

//echo '<pre>';
//print_r($imgdetail);


//$res->data->imagedetails = $imgdetail;


//echo json_encode($res);
$send_data_flex = @implode(",",$imgdetail);

echo json_encode($send_data_flex);






?>