2) $mypath = "$mypath/$subdir"; // // Set allowed extensions to show user // $molext = array (".xyz", ".mol"); $txtext = array (".inp", ".out", ".sum"); // // Read sorted list of files and directories into array // $filelist = scandir($mypath); // // Set values for icon images // $iconFolder = ""; $iconMol = ""; $iconText = ""; $iconDelete = ""; // // Output list of all directories // if (strlen($subdir) > 2) { echo "
 
"; echo "
"; echo "$iconFolder Home Directory
"; } for ($i=0; $i < count($filelist); $i++) { if (strlen($filelist[$i]) > 2) { if ( strpos($filelist[$i], ".") === false ) { echo "
 
"; echo "
"; echo "$iconFolder $filelist[$i]
"; } } } // // Output list of all files // for ($i=0; $i < count($filelist); $i++) { if (strlen($filelist[$i]) > 2) { // If file is of 'molecule' type, show file for ($j=0; $j < count($molext); $j++) { if (strpos($filelist[$i],$molext[$j]) > 0) { echo "
"; echo "$iconDelete
"; echo "
"; echo "$iconMol $filelist[$i]
"; } } // If file is of allowed 'text' type, show file for ($j=0; $j < count($txtext); $j++) { if (strpos($filelist[$i],$txtext[$j]) > 0) { echo "
"; echo "$iconDelete
"; echo "
"; echo "$iconText $filelist[$i]
"; } } } } // Finished return; ?>