echo "
";
/////////////////////////////////
/////////////////////////////////
// CONFIG
$sitetitle = "SCRIPTS"; // title
$dltitle = "PHP SCRIPTS"; // title
$displaylist = "txt rar zip"; //file yg akan ditampilkan
$fpp = "10"; // files per page
$linkbackURL = "http://anditox.bplaced.net"; //home
$linkbackNAME = "HOME"; // home
/////////////////////////////////
/////////////////////////////////
echo "
$sitetitle
$dltitle
...
";
if ((!$sortorder1) && (!$sortorder2)){
$sortorder = "Alphabetical";
$so = "&so=Alphabetical";
}
# Get current page to be displayed.
#----------------------------------
if ($pagego == "")
{
$currentpage = $_GET["page"];
if ($currentpage < 1 | $currentpage == "")
{
$currentpage = 1;
}
}
else
{
$currentpage = "$pagego";
}
# If no records per page is selected, set the default.
#-----------------------------------------------------
if ($rpp == "") $rpp = "$fpp";
if ((!$rpp1) && (!$rpp2)){
$records_per_page = $rpp;
$rpp3 = "&rpp=$records_per_page";
}
$pmax = "$rpp";
# Read current directory.
#------------------------
$d = dir(".");
while (false !== ($file = $d->read())) {
# Get all the file attributes.
#-----------------------------
$size = filesize($file);
$type = filetype($file);
$ext = strrchr($file,'.');
$modified = stat("$file");
$displayname = str_replace (strrchr ($file, "."), "", $file);
$display_list = "$displaylist";
if (($type == file) && (preg_match ("/$ext/i", $display_list))) {
# Format the Dispayed filename.. replace underscore with a space
# and Change each word to start with an upper case letter.
#---------------------------------------------------------------
$displayname = str_replace("_"," ",$displayname);
$displayname = strtolower($displayname);
$displayname = ucwords($displayname);
$filedate = date("m-d-y",$modified[9]);
# Format the output depending on sort order and search criteria.
#---------------------------------------------------------------
if ((!$search) && ($sortorder == "Alphabetical")){
$filename[$totalfiles] = "$displayname|$displayname|$file|$ext|$size|$filedate|$content|$upload_date";
}
$totalbytes = $totalbytes + $size;
$totalfiles++;
}
}
# Sort by filename.
#------------------
if (($filename) && ($sortorder == "Alphabetical")){
sort ($filename,SORT_REGULAR);
reset ($filename);
$select1 = "selected";
$select2 = "";
$select3 = "";
$select4 = "";
$match = 1;
}
# Pagination Start.
#------------------
if ($records_per_page < 1){
$records_per_page = $totalfiles + 1;
}
If ($totalfiles > $records_per_page){
$totalpages = ceil($totalfiles/$records_per_page);
$flag = 0;
if ($currentpage > $totalpages){
$currentpage = 1;
}
}ELSE{
$flag = 1;
}
# Print out the top of the form and search criteria boxes.
#---------------------------------------------------------
?>
# Start main loop.
#-----------------
if ($match > 0){
while (list ($key, $val) = each ($filename)) {
if ($key >= ($records_per_page-$records_per_page)+(($currentpage-1)*$records_per_page) && $key <= ($records_per_page-1)+(($currentpage-1)*$records_per_page)){
$fileattr = explode("|", $val);
# Fix and format Byte Length
#---------------------------
if ($fileattr[4] < pow(2,10)){
$size = "$fileattr[4]B";
}
if ($fileattr[4] >= pow(2,10) && $fileattr[4] < pow(2,20)) {
$size = round($fileattr[4] / pow(2,10), 2)."KB";
}
if ($fileattr[4] >= pow(2,20) && $fileattr[4] < pow(2,30)) {
$size = round($fileattr[4] / pow(2,20), 2)."MB";
}
if ($fileattr[3] > pow(2,30)) {
$size = round($fileattr[4] / pow(2,30), 2)."GB";
}
$thisfile = "$fileattr[2]";
$thatfile = str_replace(".nth","","$thisfile");
print "$thatfile ($size)
";
}
}
}
#-------------------------------------------------------------------------------------
# End main loop.
# Generate page number links.
#----------------------------
echo "
";
if ($flag == 0){
$previouspage = $currentpage-1;
if ($previouspage < 1){
$previouspage = 1;
}
$nextpage = $currentpage+1;
if ($nextpage > $totalpages){
$nextpage = $totalpages;
}
if ($currentpage > 1) print "[back]";
echo "[$currentpage/$totalpages]";
$z = 1;
while ($z <= $totalpages){
if ($z == $currentpage){
$size = $display_selected_size;
}ELSE{
$size = $display_pagination_size;
}
$z++;
}
if ($currentpage != $totalpages ) print "[next]";
}
#----------------------------
echo '
';
if ($totalbytes < pow(2,10)){
$totalsize = "$totalbytesB";
}
if ($totalbytes >= pow(2,10) && $totalbytes < pow(2,20)) {
$totalsize = round($totalbytes / pow(2,10), 0)."KB";
}
if ($totalbytes >= pow(2,20) && $totalbytes < pow(2,30)) {
$totalsize = round($totalbytes / pow(2,20), 0)."MB
";
}
echo"Total Files : $totalfiles
Total Size : $totalsize
";
echo "
$linkbackNAME
©ANDITOX 2009
";
?>