read())) { if ($file != "." && $file != "..") { # Get all the file attributes. #----------------------------- $size = filesize($file); $type = filetype($file); $ext = strrchr($file,'.'); $modified = stat("$file"); $displayname = str_replace (strrchr ($file, "."), "", $file); # If it is a file (not a directory) and the file extention is in $display_list.. #------------------------------------------------------------------------------- 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]); # See if description file exsists. If not, create it. #--------------------------------------------------------------------------- $filedescription = "./file_info/descriptions/$file.0"; if (!file_exists($filedescription)) { $newfile = fopen($filedescription,"w"); $newdescription = "0|No Description Available|http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=$displayname &btnI=I%27m+Feeling+Lucky|".time(); fwrite($newfile, $newdescription); fclose($newfile); $contents = $newdescription; $accesses = 0; } ELSE { # If the file does exist, read its data. #--------------------------------------- $newfile = fopen($filedescription,"r"); $content = fread($newfile, filesize($filedescription)); fclose($newfile); $data = explode("|", $content); $accesses = $data[0]; $upload_date = $data[3]; } # 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"; } if ((!$search) && ($sortorder == "File Size")){ $filename[$totalfiles] = "$size|$displayname|$file|$ext|$size|$filedate|$content|$upload_date"; } if ((!$search) && ($sortorder == "Accesses")){ $filename[$totalfiles] = "$accesses|$displayname|$file|$ext|$size|$filedate|$content|$upload_date"; } if ((!$search) && ($sortorder == "Latest Files")){ $filename[$totalfiles] = "$upload_date|$displayname|$file|$ext|$size|$filedate|$content|$upload_date"; } # Search both File Name and Description. #--------------------------------------- if (($search) && ($C1)){ $searchtext = "Your search for \"$search\" yielded $match result(s):"; $records_per_page = 0; $currentpage = 1; $pos = preg_match ("/$search/i", "$displayname$content"); if ($pos){ $filename[$totalfiles] = "$accesses|$displayname|$file|$ext|$size|$filedate|$content|$upload_date"; $match++; } } # Search File Name Only. #----------------------- if ($search){ $searchtext = "Your search for \"$search\" yielded $match result(s):"; $records_per_page = 0; $currentpage = 1; $pos = preg_match ("/$search/i", "$displayname"); if ($pos){ $filename[$totalfiles] = "$accesses|$displayname|$file|$ext|$size|$filedate|$content|$upload_date"; $match++; } } $totalbytes = $totalbytes + $size; $totalfiles++; } } } # Sort by filename. #------------------ if (($filename) && ($sortorder == "Alphabetical")){ sort ($filename,SORT_REGULAR); reset ($filename); $select1 = "selected"; $select2 = ""; $select3 = ""; $select4 = ""; $match = 1; } # Sort by file Size. #------------------- if (($filename) && ($sortorder == "File Size")){ rsort ($filename,SORT_NUMERIC); reset ($filename); $select1 = ""; $select2 = "selected"; $select3 = ""; $select4 = ""; $match = 1; } # Sort by accesses. #------------------ if (($filename) && ($sortorder == "Accesses")){ rsort ($filename,SORT_NUMERIC); reset ($filename); $select1 = ""; $select2 = ""; $select3 = "selected"; $select4 = ""; $match = 1; } # Sort by Date. #-------------- if (($filename) && ($sortorder == "Latest Files")){ rsort ($filename,SORT_NUMERIC); reset ($filename); $select1 = ""; $select2 = ""; $select3 = ""; $select4 = "selected"; $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. #--------------------------------------------------------- ?> 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"; } # Alternate colors between white and grey (or black and grey) on table entries. #------------------------------------------------------------------------------ if ($color == $color1){ $color = $color2; }ELSE{ $color = $color1; } # Get correct icon file depending on file extention. #--------------------------------------------------- $ext = substr ($fileattr[3], 1, 3); $ext = (strtolower($ext)); $iconfile = "./file_info/thumbs/th_$fileattr[2]"; $nw = 100; $nh = 64; $xtrainfo = "Jpeg image "; if (($ext == "jpg") && (!file_exists($iconfile)) && ($gdlib == 1)){ $ht = thumbnail("$fileattr[2]",100,"./file_info/thumbs/","th_$fileattr[2]"); } # Get the correct icon file if image exists with same name as filename. #---------------------------------------------------------------------- if (($ext <> "jpg") or ($gdlib == 0)){ $xtrainfo = "$ext file"; $iconfile1 = "file_info/icons/$ext.gif"; $iconfile2 = "file_info/thumbs/th_$fileattr[1].jpg"; $nw = 64; $nh = 64; if (file_exists($iconfile2)) { $iconfile = $iconfile2; } else { $iconfile = $iconfile1; } } if ($admin){ $admininfo = "Click Here to edit this entry
"; } # Print html results. #-------------------- ?> " bgColor="" border="0" align="center"> "; print ""; print ""; }ELSE{ print ""; } } print ""; # Display the File Size. #----------------------- if ($display_filesize == 1){ print "\n"; } # Display Accessed. #------------------ if ($display_accessed == 1){ print "\n"; } # Display File Date. #------------------- $file_time = date("m-d-y", $fileattr[9]); if ($display_filedate == 1){ print "\n"; } print "
"; print ""; print ""; # Display the File Name. #----------------------- if ($display_filename == 1){ if ($dnld == 1){ print "$display_filename_tag\n"; print "\n"; print "$fileattr[1]$display_filename_tag_end
\n"; }ELSE{ print "$display_filename_tag\n"; print "\n"; print "$fileattr[1]$display_filename_tag_end
\n"; } } # Display File Description. #-------------------------- if ($display_description == 1){ print "$display_description_tag $fileattr[7] $display_description_tag_end
\n"; } # Display the "More Info" link. #------------------------------ if ($display_moreinfo == 1){ print "$display_moreinfo_tagMore Info$display_moreinfo_tag_end
\n"; } # Display the File Type. #----------------------- if ($display_filetype == 1){ print "$display_filetype_tag$xtrainfo$display_filetype_tag_end\n"; } # If admin flag is set, Print the link to edit entries. #------------------------------------------------------ if ($admin){ print "$display_filetype_tag$admininfo$display_filetype_tag_end\n"; } print "
$display_filesize_tag Size
$size
$display_filesize_tag_end
$display_accessed_tag Accessed
$fileattr[6] Time(s)$display_accessed_tag_end
$display_filedate_tag File Dated
$file_time
$display_filedate_tag_end
\n"; } } } #------------------------------------------------------------------------------------- # End main loop. # Generate page number links. #---------------------------- print "
"; if ($flag == 0){ $previouspage = $currentpage-1; if ($previouspage < 1){ $previouspage = 1; } $nextpage = $currentpage+1; if ($nextpage > $totalpages){ $nextpage = $totalpages; } print "

$display_pagination_tag Back | "; $z = 1; while ($z <= $totalpages){ if ($z == $currentpage){ $size = $display_selected_size; }ELSE{ $size = $display_pagination_size; } print "$z | "; $z++; } print "Next"; print "$display_pagination_tag_end

"; } #.Fix and format Byte Length. #---------------------------- if ($totalbytes < pow(2,10)){ $totalsize = "$totalbytes B"; } if ($totalbytes >= pow(2,10) && $totalbytes < pow(2,20)) { $totalsize = round($totalbytes / pow(2,10), 2)." KB"; } if ($totalbytes >= pow(2,20) && $totalbytes < pow(2,30)) { $totalsize = round($totalbytes / pow(2,20), 2)." MB"; } if ($totalbytes > pow(2,30)) { $totalsize = round($totalbytes / pow(2,30), 2)." GB"; } ?>


PHP Easy Downloader
Total Files Available:
Total Bytes:
Execution time: $exec_time1 sec.
"; ?>