"; # html on tags for "Search Box Description" $display_search_tag_end = ""; #------- html "off" tags for "Search Box Description" $display_search_font = "tahoma"; #------------------- Font for "Search Box Description" $display_search_size = "1"; #------------------------ Font size for "Search Box Description" #-------------------------------------------------------------------------- # "Top 10 Downloads" attributes: # You can change the way the "Top 10 Downloads" link looks # with the following variables #-------------------------------------------------------------------------- $display_top10 = 1; #------------------- Display the "Top 10 Downloads" link? 0 = no 1 = yes $display_top10_tag = ""; #----------- html on tags for "Top 10 Downloads" $display_top10_tag_end = ""; #------ html "off" tags for "Top 10 Downloads" $display_top10_font = "tahoma"; #------- Font for "Top 10 Downloads" $display_top10_size = "3"; #------------ Font size for "Top 10 Downloads" #-------------------------------------------------------------------------- # when search results are displayed, show the # original search term in this color and size. #-------------------------------------------------------------------------- $search_color = "black"; $search_size = "2"; #-------------------------------------------------------------------------- # Customize html for download entry # # Display the "Download Icon"? # 0 = no 1 = yes #-------------------------------------------------------------------------- $display_download_icon = 1; #-------------------------------------------------------------------------- # Which icon set do you want to display? # icons1 or icons2 or icons3? # (More icon sets are in the works.) #-------------------------------------------------------------------------- $icons = "icons1"; #-------------------------------------------------------------------------- # "File Name" attributes: # You can change the way the "file name" link looks # with the following variables. #-------------------------------------------------------------------------- $display_filename = 1; #------------------- Display the "File Name" link? 0 = no 1 = yes $display_filename_tag = ""; #----------- html on tags for "File Name" $display_filename_tag_end = ""; #------ html "off" tags for "File Name" $display_filename_font = "tahoma"; #------- Font for "File Name" $display_filename_size = "2"; #------------ Font size for "File Name" #-------------------------------------------------------------------------- # "Description" attributes: # You can change the way the "Description" looks # with the following variables. #-------------------------------------------------------------------------- $display_description = 0; #------------------- Display the "Description"? 0 = no 1 = yes $display_description_tag = ""; #----------- html on tags for "Description" $display_description_tag_end = ""; #------ html "off" tags for "Description" $display_description_font = "tahoma"; #------- Font for "Description" $display_description_size = "1"; #------------ Font size for "Description" #-------------------------------------------------------------------------- # "More Info" attributes: # You can change the way the "More Info" link looks # with the following variables. #-------------------------------------------------------------------------- $display_moreinfo = 0; #------------------- Display the "More Info" link? 0 = no 1 = yes $display_moreinfo_tag = ""; #----------- html on tags for "More Info" $display_moreinfo_tag_end = ""; #------ html "off" tags for "More Info" $display_moreinfo_font = "tahoma"; #------- Font for "More Info" $display_moreinfo_size = "1"; #------------ Font size for "More Info" #-------------------------------------------------------------------------- # "File Type" attributes: # You can change the way the "File Type" looks # with the following variables. #-------------------------------------------------------------------------- $display_filetype = 1; #------------------- Display the "File Type"? 0 = no 1 = yes $display_filetype_tag = ""; #-------- html on tags for "File Type" $display_filetype_tag_end = ""; #-- html "off" tags for "File Type" $display_filetype_font = "tahoma"; #------- Font for "File Type" $display_filetype_size = "1"; #------------ Font size for "File Type" $display_filetype_color = "black"; #------ Font Color for "File type" #-------------------------------------------------------------------------- # "File Size" attributes: # You can change the way the "File Size" looks # with the following variables. #-------------------------------------------------------------------------- $display_filesize = 1; #------------------- Display the "File Size"? 0 = no 1 = yes $display_filesize_tag = ""; #----------- html on tags for "File Size" $display_filesize_tag_end = ""; #------ html "off" tags for "File Size" $display_filesize_font = "tahoma"; #------- Font for "File Size" $display_filesize_size = "1"; #------------ Font size for "File Size" #-------------------------------------------------------------------------- # "Accessed" attributes: # You can change the way the "Accessed" looks # with the following variables. #-------------------------------------------------------------------------- $display_accessed = 0; #--------------- Display the "Accessed"? 0 = no 1 = yes $display_accessed_tag = ""; #------- html on tags for "Accessed" $display_accessed_tag_end = ""; #-- html "off" tags for "Accessed" $display_accessed_font = "tahoma"; #--- Font for "Accessed" $display_accessed_size = "1"; #-------- Font size for "Accessed" #-------------------------------------------------------------------------- # "File Dated" attributes: # You can change the way the "File Dated" looks # with the following variables. #-------------------------------------------------------------------------- $display_filedate = 0; #--------------- Display the "File Date"? 0 = no 1 = yes $display_filedate_tag = ""; #------- html on tags for "File Date" $display_filedate_tag_end = ""; #-- html "off" tags for "File Date" $display_filedate_font = "tahoma"; #--- Font for "File Date" $display_filedate_size = "1"; #-------- Font size for "File Date" #-------------------------------------------------------------------------- # "Pagination" attributes: # You can change the way the "Pagination" looks # with the following variables. #-------------------------------------------------------------------------- $display_pagination_tag = ""; #------- html on tags for "Pagination" $display_pagination_tag_end = ""; #-- html "off" tags for "Pagination" $display_pagination_font = "tahoma"; #--- Font for "Pagination" $display_pagination_size = "1"; #-------- Font size for "Pagination" $display_selected_size = "2"; #---------- Font size for current page in "Pagination" #--------------------------------------------------------------------------- # ---- Do not edit below here ------- # Start timing code. #------------------- $t_start = array_sum(explode(' ', microtime())); # If a download has already been selected, #----------------------------------------- If ($_GET["file"]){ # Get the filename to be downloaded #---------------------------------- $file = $_GET["file"]; $file = stripslashes($file); $file = htmlspecialchars($file); $mainpath = "$path$file"; # Increment download count #------------------------- $filename = "./file_info/descriptions/$file.0"; $newfile = fopen($filename,"r"); $content = fread($newfile, filesize($filename)); fclose($newfile); $fileinfo = explode ("|",$content); $fileinfo[0] ++; # Save the new file count #------------------------ $content = implode("|", $fileinfo); $newfile = fopen($filename,"w"); fwrite($newfile, $content); fclose($newfile); # Translate file name properly for Internet Explorer #--------------------------------------------------- if (strstr($_SERVER['HTTP_USER_AGENT'], "MSIE")){ $file = preg_replace('/\./', '%2e', $file, substr_count($file, '.') - 1); } # Make sure the file exists before sending headers #------------------------------------------------- if(!$fdl=@fopen($mainpath,'r')){ die("Cannot Open File!"); } else { # Send the headers then send the file #------------------------------------ header("Cache-Control: ");# leave blank to avoid IE errors header("Pragma: ");# leave blank to avoid IE errors header("Content-type: application/octet-stream"); header("Content-Disposition: attachment; filename=\"".$file."\""); header("Content-length:".(string)(filesize($mainpath))); sleep(1); fpassthru($fdl); } }else{ # GD Library thumbnail function. #------------------------------- function thumbnail($i,$nw,$p,$nn) { $img=imagecreatefromjpeg("$i"); $ow=imagesx($img); $oh=imagesy($img); $scale=$nw/$ow; $nh=ceil($oh*$scale); $newimg=imagecreateTrueColor($nw,$nh); imagecopyresized($newimg,$img,0,0,0,0,$nw,$nh,$ow,$oh); imagejpeg($newimg, $p.$nn); $heigth = $nh; return ($heigth); } # Get input from user. #--------------------- $admin = $_GET["admin"]; $rpp1 = $_POST["D2"]; #records per page $rpp2 = $_GET["rpp"]; #records per page $sortorder1 = $_GET["so"]; #sort order $sortorder2 = $_POST["D1"]; #sort order $search = $_POST["T1"]; #search term $c1 = $_POST["C1"]; #Checkbox to search thru both filename and description. $match = 0; # Open header file (if it exsists) and display it. #------------------------------------------------- if (file_exists($header)){ $newfile = fopen($header,"r"); $content = fread($newfile, filesize($header)); fclose($newfile); print $content; } $sortorder1 = (ucfirst($sortorder1)); $sortorder2 = (ucfirst($sortorder2)); # Set sort order depending on user input. #---------------------------------------- # Default sort order is Alphabetical. #------------------------------------ if ((!$sortorder1) && (!$sortorder2)){ $sortorder = "Alphabetical"; $so = "&so=Alphabetical"; } # Sort by filesize and date. #--------------------------- if ($sortorder2){ $sortorder = $sortorder2; $so = "&so=$sortorder"; } # Sort by # of times the file has been Accessed. #----------------------------------------------- If ($sortorder1){ $sortorder = $sortorder1; $so = "&so=$sortorder"; } # Get current page to be displayed. #---------------------------------- $currentpage = $_GET["page"]; if ($currentpage < 1){ $currentpage = 1; } # If no records per page is selected, set the default. #----------------------------------------------------- if ((!$rpp1) && (!$rpp2)){ $records_per_page = $defaultrpp; $rpp3 = "&rpp=$records_per_page"; } # Otherwise, set the user defined record per page. #-------------------------------------------------- If ($rpp2){ $records_per_page = $rpp2; $rpp3 = "&rpp=$records_per_page"; } If ($rpp1){ $records_per_page = $rpp1; $rpp3 = "&rpp=$records_per_page"; } # Read current directory. #------------------------ $d = dir($path); while (false !== ($file = $d->read())) { if ($file != "." && $file != "..") { # Get all the file attributes. #----------------------------- $size = filesize("$path$file"); $type = filetype("$path$file"); $ext = strrchr("$path$file",'.'); $modified = stat("$path$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"); $content = "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, $content); fclose($newfile); $data = explode("|", $content); # RSS Feed goes here. We want to add any new files to the feed } 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 these results:"; $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++; } $searchtext = "Your search for \"$search\" yielded $match results:"; } # Search File Name Only. #----------------------- if ($search){ #$searchtext = "Your search for \"$search\" yielded these results:"; $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++; } $searchtext = "Your search for \"$search\" yielded $match results:"; } $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("$path$fileattr[2]",$thumbsize,"./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"; $iconfile = "file_info/icons/$icons/x.gif"; $iconfile1 = "file_info/icons/$icons/$ext.gif"; $iconfile2 = "file_info/thumbs/th_$fileattr[1].jpg"; $nw = 64; $nh = 64; if (file_exists($iconfile1)) { $iconfile = $iconfile1; } if (file_exists($iconfile2)) { $iconfile = $iconfile2; } } if ($admin){ $admininfo = "Click Here to edit this entry
"; } # Print html results. #-------------------- ?> " bgColor="" border="0" align="center"> "; print ""; 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 "
"; # Display the File Name. #----------------------- if ($display_filename == 1){ 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 Accesses
$fileattr[6] $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"; } ?> Total Files Available:
Total Bytes:
Execution time: $exec_time1 sec.
"; // print "Admin"; print '

Soldiers of War is a creation of Epic Films

'; print "
"; # Open footer file and display it (if it exists). #------------------------------------------------ if (file_exists($footer)){ $newfile = fopen($footer,"r"); $content = fread($newfile, filesize($footer)); fclose($newfile); print $content; } } ?>