$ctrackerdir = "/www/htdocs/w00866eb/mafia/ctracker/ctracker.php"; include $ctrackerdir; # Configure the following variables: #-------------------------------------------------------------------------- # List the extentions of the files that you want to be displayed. # If the file extention is not listed below (not in $display_list), # IT WON'T BE LISTED BY THIS SCRIPT!! # The script ignores files with file extentions that are not listed here... #-------------------------------------------------------------------------- $display_list = " rar zip"; #-------------------------------------------------------------------------- # Path to downloads. This path can be outside of the server path insuring no leaching! # Must use a trailing slash "/" # # Here are some examples. # $path = "./"; Downloads live where this file (index.php) lives (Default) # $path = "../../"; Up 2 directories (relative to index.php) # $path = "c:/downloads/public/applications/"; Absolute location. #-------------------------------------------------------------------------- $path = "./downloads/"; #-------------------------------------------------------------------------- # Path to Header and Footer files. #-------------------------------------------------------------------------- $header = "file_info/header.htm"; $footer = "file_info/footer.htm"; #-------------------------------------------------------------------------- # Default number of records per page: # Changing this variable will modify the number of downloads # listed on one page before pagination starts. #-------------------------------------------------------------------------- $defaultrpp = 1000; #-------------------------------------------------------------------------- # Enable JPG Thumbnailing. # 0 if GD library is NOT available. # 1 if GD library is available. # $thumbsize is the horizontal size of the thumb nail in pixels. #-------------------------------------------------------------------------- $gdlib = 1; $thumbsize = "50"; #-------------------------------------------------------------------------- # Background Color set - Alternates background color of download entries. # If you don't want it to alternate colors, make both colors the same value. # For light backgrounds suggested values are: # $color1 = "#efefef"; # $color2 = "#ffffff"; # For dark back grounds suggested values are: # $color1 = "#484848"; # $color2 = "#010101"; # or use your own custom colors. #-------------------------------------------------------------------------- $color1 = "#484848"; $color2 = "#010101"; #-------------------------------------------------------------------------- # Customize html at top of form # # Width of table. # Can be in percent like "100%" # Or can be in pixels like "800" #-------------------------------------------------------------------------- $table_width = "640"; #-------------------------------------------------------------------------- # "Search Box Description" attributes: # You can change the way the "Search Box Description" link looks # with the following variables #-------------------------------------------------------------------------- $display_search_tag = ""; # 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 = "2"; #------------ Font size for "Top 10 Downloads" #-------------------------------------------------------------------------- # when search results are displayed, show the # original search term in this color and size. #-------------------------------------------------------------------------- $search_color = "yellow"; $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 = 1; #------------------- 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 = "yellow"; #------ 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 = 1; #--------------- 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 = 1; #--------------- 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|$filed ate|$content|$upload_date"; } if ((!$search) && ($sortorder == "File Size")){ $filename[$totalfiles] = "$size|$displayname|$file|$ext|$size|$filedate|$co ntent|$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|$filed ate|$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. #--------------------------------------------------------- ?>
"; print ""; print " | "; } 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 the File Type. #----------------------- if ($display_filetype == 1){ print "$display_filetype_ tag$xtrainfo$display_filetype_tag_end\n"; } # Display the File Size. #----------------------- if ($display_filesize == 1){ print " | $display_filesize_ tag Größe $size$display_filesize_tag_end | \n";
}
# Display Accessed.
#------------------
if ($display_accessed == 1){
print "$display_accessed_ tag Downloads $fileattr[6] $display_accessed_tag_end | \n";
}
# Display File Date.
#-------------------
$file_time = date("d-m-y", $fileattr[9]);
if ($display_filedate == 1){
print "$display_filedate_ tag Upload $file_time$display_filedate_tag_end | \n";
}
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";
}
?>
Easy Downloader V1.2 by Scriptzbase © 2007 "; # 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; } } ?> |