<?
/*
* This is the PHP file that generates the XML page
*/

ob_start();
session_start();
include 'find.class.php';

$dir = $_GET[dir];
$fil = $_GET[fil];

$find = new find($fil, $dir);

$filer = $find->ex2();

echo "<xmlresponse>";
$antal = 0;
	foreach ($find->ex() AS $hvor){
		if(is_dir($hvor."/".$filer[$antal])){
			echo '<type>dir</type>';
		} else {
			echo '<type>file</type>';
		}
		echo ' <file>'.$filer[$antal].'</file>';
		echo ' <messages>'.$hvor.'</messages>';
		$antal++;
	}
	if ($antal == 0){
		echo ' <messages>Nothing found</messages>';
	}

echo "</xmlresponse>";
ob_end_flush();
?>