note 45775 deleted from function.readdir by aidan

From: Date: Thu, 30 Sep 2004 09:11:35 +0000
Subject: note 45775 deleted from function.readdir by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-77611@lists.php.net to get a copy of this message
Note Submitter: barron dot james at gmail dot com ---- I made this for my control panel. It will list all directories and tell how much space is being used. <? if ( $_POST ) { $base = "/home/santium/public_html/"; /* Change this */ $dir = $_POST['dir']; $place = $base.$dir; $d = cd $place && du -sh; echo "Disk space used in ".$place.":"; echo str_replace(" .", "",$d); echo "<p><p>"; } else { echo "<form action=\"t.php\" method=\"post\">\n"; $g = "/home/santium/public_html"; /* Change this */ echo "<select name=\"dir\">\n"; if ($handle = opendir($g)) { while (false !== ($file = readdir($handle))) { $completepath="$g/$file"; if ($file != "." && $file != "..") { if (is_dir($completepath)) { echo "<option value=\"$file\">$file\n"; } } } closedir($handle); } echo "</select><br>\n"; echo "<input type=\"submit\" value=\"Submit\">"; } ?>

« previous php.notes (#77611) next »