#!/usr/local/bin/php
Files
 

hostname:
'.$_SERVER['HTTP_HOST'].''; //prints the host address to the page ?>

the absolute path to this folder is:
'; echo substr(__FILE__,0,strrpos(__FILE__,'/')+1); //A substring of the file which is /webtree/...filename, from the first letter up to the "/" including it, FILE is whatever its called from, including includes or function files ?>

current filename:
'.$filename.''; //prints the filename as a link to the file on the server ?>

this folder contains the files:
'; else if($ext=='gif' || $ext =='jpg' || $ext =='jpeg' || $ext =='png') echo '[image] '; else if($ext=='txt' || $ext =='css') echo '[text] '; else if($ext=='zip' || $ext =='rar') echo '[arch] '; else if($ext=='exe' || $ext =='bat') echo '[exe] '; else echo '[generic] '; echo ''.$filename.'
'; echo "\n"; } // the following determines how to display the folder size information if(strlen($totalsize)>3 && strlen($totalsize)<7){ $finalfilesize = substr(($totalsize / 1024),(strrpos($totalsize,'.')),strlen($totalsize)); //converts bytes to kilobytes $bytesize = 'KBytes'; } else if(strlen($totalsize)>6 && strlen($totalsize)<10){ $finalfilesize = substr(($totalsize / 1048576),(strrpos($totalsize,'.')),strlen($totalsize)-3); //converts bytes to megabytes $bytesize = 'MBytes'; } else if(strlen($totalsize)>9){ $finalfilesize = substr(($totalsize / 1073741824),(strrpos($totalsize,'.')),strlen($totalsize)-6); //converts bytes to gigabytes $bytesize = 'GBytes'; } else{ $finalfilesize = $totalsize; //if, it's not kb, mb or gb, it'll just have to be bytes! $bytesize = 'bytes'; } echo '
folder size:   '.$finalfilesize.' '.$bytesize.''; echo '

'; //script functions, the names should make each one self explanatory function getFileExtension ( $name ){ $position = strrpos($name,'.'); if ($position === false) { return ''; } else return strtolower(substr($name,$position + 1)); } function removeFileExtension ( $name ){ $position = strrpos($name,'.'); if ($position === false){ return $name; } return substr($name,0,$position); } function getFileName (){ //Gives the full path and file name or script eg. /home/members/.../name.php strips it and keeps the "/" BUT strips it from the "/" ONWARDS return substr($_SERVER['SCRIPT_FILENAME'],strrpos($_SERVER['SCRIPT_FILENAME'],'/')+1); } ?>