<!--- start PHP code ---->
<?php
// *****************************************************//
// //
// Author - Marcus S. Xenakis 4/28/99 //
// marcus@xenakis.net //
// //
// This simple PHP script only runs on a UNIX server. //
// It is based on the "du" and "ls" commands. //
// It should reside in your web server root directory //
// //
// This program reads the server root directory and //
// displays total disk usage for each subdirectory. //
// It also will display any MP3 files found on the site //
// which is a violation of TOS for many Web Hosts. //
// This program is disigned to call two other php //
// scripts, //
// directory.php: which displays directories //
// finder.php: which searches a site for files //
// //
// There are two lines that must be modified in order //
// to run. $home and your server root. //
// //
// Clicking on the folder image calls a directory list. //
// //
// *****************************************************//
// Set $home to your home directory on the server.
// MODIFY THE NEXT LINE FOR YOUR SITE
$home = "/home/yourdirectory";
// The following code searches the entire site for MP3 files
echo "<!---- list any mp3s found in bold red ---->";
echo "<font color=\"red\"><pre>";
passthru("find $home -name '*.mp3' ");
echo "</pre></font>";
// Load subdirectories and load them into an array.
// note "/public_html" is appended to $home to identify the server root.
// MODIFY THE NEXT LINE FOR YOUR SITE
exec("ls -la $home/public_html",$lines,$rc);
$count = count($lines) - 1;
for ($i = 1; $i <= $count; $i++) {
$type = substr($lines[$i],0,1);
if ($type == "d") {
$dir[] = substr(strrchr($lines[$i]," "),1);
}
}
$count = count($dir) -1;
?>
<!--- The following are links related utilities >
<hr><br></font>
<font face=arial size=2>
[<u><a href=directory.php>Dir</a></u>]
[<u><a href=finder.php>Find</a></u>]
</font>