<?php
	
	if (isset($_GET['dir'])) $dir=$_GET['dir'];
	
	function getDirectoryList($directory) {
		$results = array();
		$handler = opendir($directory);
		while ($file = readdir($handler)) {
			if ($file != "." && $file != "..") {
				$results[] = $file;
			}
		}
		closedir($handler);
		sort($results);
		return $results;
	}
	
	$dirs = getDirectoryList($dir);
	for ($i=0;$i<count($dirs);$i++) {
		echo $dirs[$i] . "\n";
	}
	
?>