<?
static $exclude = array(
"." , "..", "player.php", "counter", "index.php", "mwm_flmx_88_31.gif", "readme.txt", "abstract.php", "paginate.php", "ad.flv", "popup.php", "320x240.swf", "listing_example.jpg", "flv.jpg", "popup.swf", "iframe.php", "flash_detection.swf", "alternate.html", "320x240.fla", "popup.fla", "alternate.gif"
);
function dir_count() {
global $exclude ; $num = 0 ;
$handle=opendir(".");
while ($file = readdir($handle)) {
if(in_array($file, $exclude)) continue;
else $num++;
}
closedir($handle);
return $num;
}
$props = array(
'itemsperpage'=> $items_per_page,
'file'=>basename($_SERVER[PHP_SELF]),
'delimiter'=>' <span style="font-size: 20pt; vertical-align: absmiddle;">·</span> ',
'link_active' => 'font-weight: bold; font-family: Arial, Verdana; color: #FF0000; font-size: 12pt;',
'link_inactive' => 'font-weight: bold; font-family: Arial, Verdana; color: #FF0000; font-size: 12pt;'
);
$pm = paginate(dir_count(),'p',$props);
$range = $pm->get_range();
function directory(&$range) {
global $exclude; $cnt = 0;
$handle=opendir(".");
while ($file = readdir($handle)) {
$fsizebyte = filesize($file);
// Correctly parse the filesize
if ($fsizebyte > 1000) {
$fsizeraw = ($fsizebyte/1000);
$fsizefin = round($fsizeraw, 2);
$fsize = $fsizefin.' <FONT COLOR=#000000>kb</FONT>';
}
if ($fsizebyte > 1048576) {
$fsizeraw = ($fsizebyte/1048576);
$fsizefin = round($fsizeraw, 2);
$fsize = $fsizefin.' <B>mb</B>';
}
if ($fsizebyte < 1024) {
$fsize = $fsizebyte.' bytes';
}
if(in_array($file, $exclude)) {
continue;
}
else {
if(in_array($cnt, $range))
$result .= "<li><TABLE border=0 cellspacing=0 cellpadding=0 align=center width=440><TR><TD valign="top" align="left" width="65%"><a href="player.php?url=$file&p=".(isset($_REQUEST[p])?$_REQUEST[p]:1).""><img src="flv.jpg" border="0" align="absmiddle" alt="File Name $file"></a> <B>Video:</B> <a href="player.php?url=$file&p=".(isset($_REQUEST[p])?$_REQUEST[p]:1)."">$file</a></td><TD valign="top" align="left" width="35%"><B>File Size:</B> <FONT COLOR="#FF0D0D">$fsize</FONT></td></tr></table><hr>n";
$cnt++;
}
}
closedir($handle);
return $result;
}
?> <ol start="<?=($range[0]+1)?>">
<?
echo directory($range); ?>
</ol>
<?=$pm->show();?>
|
|