I'm making a "DIR-listing" script that takes all the the following into an array:
pasting start
if (!$path) {
$path ="./";
}
$handle=opendir($path);
$i = 0;
while ($file = readdir($handle)) {
if (($file == ".") || ($hide) || (($file == "..") && (($path == "./") || ($path == ".")))) {
continue;
}
$i++;
$hide_file = substr($file, 0, 3);
$hide = strstr($hide_file, ".ht");
$chk_size = ceil(filesize($file)/1024);
$modified = date( "d-m-Y H:i", filemtime($file));
if (is_dir($file)) {
$dir_array = array(
"$i" => array(
"name" => "$file",
"modi" => "$modified"
)
);
}
else {
$file_array = array(
"$i" => array(
"name" => "$file",
"size" => "$chk_size",
"modi" => "$modified"
)
);
}
}
closedir($handle);
pasting ends
I'm not sure if the above code is correct, but my problem is that I simply don't know how to retrieve the data from the arrays, and then list them.
ie.
$filename[0] $size[0] $last_modified[0]
$filename[1] $size[3] $last_modified[4]
$filename[2] $size[3] $last_modified[4]
Hope this isn't too much tekst, I just hate when I can't see the sourcecode, so that I know what I'm dealing with.
Please help
Brian Schmidt