';
include('admob.php');
echo '';
function listFiles( $from = '.')
{
if(! is_dir($from))
return false;
$files = array();
$dirs = array( $from);
echo '';
while( NULL !== ($dir = array_pop($dirs)))
{
if( $dh = opendir($dir))
{
while( false !== ($file = readdir($dh)
{
if( $file == '.' || $file == '..' || $file == 'description.txt' || substr($file,0,6) == 'thumb-')
continue;
$path = $dir . '/' . $file;
if( is_dir($path)){
//$size = dirSize($path);
$files['dir'][filemtime($path)] = array($file,$path,substr($path,strrpos($path, ".")+1));
}
else{
$files['files'][filemtime($path)] = array($file,$path,format_size(filesize($path)));
}
}
closedir($dh);
}
}
echo '
';
return $files;
}
/*
:Prem: function profile()
this function calles fileList function to get list of files and directories
:Prem:
*/
function profile( $func, $trydir)
{
$list = $func( $trydir);
//echo 'Finished : '.count($list['files']).' files';
return $list;
}
/*
:Prem: function format_size()
this function convert size from
BYTES to KB, MB, GB, TB
and return
:Prem:
*/
function format_size($size, $round = 2) {
$sizes = array('Byts', 'kb', 'mb', 'gb','TB');
$total = count($sizes)-1;
for ($i=0; $size > 1024 && $i < $total; $i++) $size /= 1024;
return round($size,$round).$sizes[$i];
}
if($_REQUEST['dir'])
$listof = $_REQUEST['dir'];
else
$listof = directoryPath;
//echo ''.str_replace('/',' ',$listof).'
';
$category = explode('/',$listof);
echo ''.$category[count($category)-1].'
';
// calling function to get file lists
if(is_dir($listof))
{
if(is_file($listof.'/description.txt')){
$sfile = $listof.'/description.txt';
$desctiption = implode('
', file($sfile));
echo ''.$desctiption.'
';
}
$list = listFiles($listof);
if(count($list['dir'])){
krsort($list['dir']);
/*
Prem=>contact=>aaaaa@gmail.com:: printing dir list to screen
*/
foreach($list['dir'] as $key){
echo "";
}
}
if(count($list['files'])){
krsort($list['files']);
echo 'Pages('.$_REQUEST['start'].'/'.ceil(count($list['files'])/filesPerPage) .')
';
/*
Prem=>contact=>aaaa@gmail.com:: printing file list to screen
*/
$start = $_REQUEST['start']?$_REQUEST['start']:1;
$display = filesPerPage * ($start-1);
$c=1;
foreach($list['files'] as $key){
if($c>$display && $c<=$display+filesPerPage){
echo "";
if($c%5==0){
echo ''; include('ad2.php'); echo '
';
}
}
$c++;
}
$mLink = $_SERVER['PHP_SELF'] . "?" . $_SERVER['QUERY_STRING'];
$mLink = substr($mLink,0,strpos($mLink, '&start='));
$mLink = $mLink."&start=";
echo '';
include_once('display_no.php');
display_pageno(count($list['files']),$start,$mLink,filesPerPage);
echo '
';
}
}
else
{
echo '
Error: wrong path entered... Script by Prem. Contact me at aaaa@gmail.com
';
}
/*
Prem=>contact=>aaaaa@gmail.com:: Go back to parent dir
*/
if($listof!='files'){
$back = strrpos($listof, "/")?substr($listof,0,strrpos($listof,'/')):'';
$back = strrpos($back, "/")?substr($back,strrpos($back,'/')+1):$back;
echo '';
}
include('ad3.php');
?>
\n";
?>