Thread: HTTPd
View Single Post
Old 02-04-2004, 09:01 AM  
darkone
Disabled
 
darkone's Avatar
 
Join Date: Dec 2001
Posts: 2,230
Default

Simple vfs listing looks following:

Code:
	# Open userfile
	$uhandle = io_user_open(0);

	# Open mount table
	$mtable = io_mtable_open('d:\\ioFTPD\\etc\\default.vfs');

	# Resolve root path
	$path = io_mtable_query($mtable, '/', $uhandle, 1);
	$c_path = count($path);

	if ($c_path > 1) {
		# Show mounts under current path
		$link = io_mtable_query_mounts($mtable, $path[0]);
		if ($link) {
			$c_link = count($link);
			for ($i=0;$i<$c_link;$i+=2) {
				# Open file vfs attributes
				$file = io_fs_open($link[$i+1]);

				# Test access
				if ($file && io_fs_access($file, $uhandle)) {
					$finfo = io_fs_query($file);
					echo "$finfo[0]:$finfo[1] $link[$i]<br>";
				}
				io_fs_close($file);
			}
		}

		# Go through result path array
		for ($i=1;$i<$c_path;$i++) {
			$hfind = io_fs_find_first($path[$i]);
			# Show files
			if ($hfind) {
				do {
					if (io_fs_access($hfind, $uhandle)) {
						$finfo = io_fs_query($hfind);
						$fname = io_fs_query_filename($hfind);
						echo "$finfo[0]:$finfo[1] $fname<br>";
					}

				} while (io_fs_find_next($hfind));
				io_find_close($hfind);
			}
		}
	} else {
		echo "Could not access requested directory<br>";
	}
	

	io_mtable_close($mtable);
	io_user_close($uhandle);
darkone is offline   Reply With Quote