#============================================= if($password_protect_all_files){ session_start(); if ($user_pass == "password"){ $pass_message = "
The default USER password is still set.
Change your password NOW!
To change the password, either manually edit the config.php file or
select the \"Configuration\" selection from the \"Admin Main Menu\" and
edit the variables in the Main Config File.
"; $user_value = "user"; $pass_value = "password"; } $username = trim(strip_tags($_REQUEST['username'])); $password = trim(strip_tags($_REQUEST['password'])); if (!isset($_SESSION['username'])){ if (($username == $user_name) && ($password == $user_pass)){ $message = "Loading! Please wait..."; $class = "class = \"green\""; $_SESSION['username'] = "$user"; print""; }else{ if (($username) || ($password)){ $message = "BAD USERNAME OR PASSWORD!"; $class = "class = \"changed\""; } } include ("file_info/skins/$current_skin/header.php"); ?>


size="-2" face="Arial">
Username:
Password:

# Set some defaults. #------------------- $search_results=" "; $color = $color2; $total_pages = 1; $changed = "   "; # Set a default skin if none is chosen # if the skin config file is there, include it. #---------------------------------------------- $skin_config = "file_info/skins/$current_skin/config.php"; if (file_exists("$skin_config")){ include ("$skin_config"); } if ($admin_pass == "admin"){ $changed = "
You need to change the ADMIN password in the Admin Section to make this warning go away!
"; } if ($paypal_seller_email == "your paypal merchant email goes here"){ $changed = "$changed
You need to set up your paypal info in Admin Section or paypal features will not work!
"; } # Get all browser input in a Globals_Off friendly way. #----------------------------------------------------- # Sort order 1=filename 2=popular (accesses) 3=Upload date # 4=filesize (ascending) 5=filesize (decending) 6=rating # 7=extention .. This is subject to change! $input = trim(strip_tags($_REQUEST['sort'])); if ($input){$sort = $input;} if ($sort == 1){$sortfile="$flat_file_location/sort_filename.dat";$selected_sort[1] = "selected";} #---edited by Maarten Buth to add the sort by 'voorganger' #if ($sort == 2){$sortfile="$flat_file_location/sort_popular.dat";$selected_sort[2] = "selected";} if ($sort == 2){$sortfile="$flat_file_location/sort_artist.dat";$selected_sort[2] = "selected";} if ($sort == 3){$sortfile="$flat_file_location/sort_upload.dat";$selected_sort[3] = "selected";} if ($sort == 4){$sortfile="$flat_file_location/sort_filesizea.dat";$selected_sort[4] = "selected";} if ($sort == 5){$sortfile="$flat_file_location/sort_filesized.dat";$selected_sort[5] = "selected";} if ($sort == 6){$sortfile="$flat_file_location/sort_rating.dat";$selected_sort[6] = "selected";} if ($sort == 7){$sortfile="$flat_file_location/sort_ext.dat";$selected_sort[7] = "selected";} # Get the search request input #----------------------------- $input = trim(strip_tags($_REQUEST['search_request'])); if ($input){$search_request = $input;} if ($search_request == "Zoeken naar..."){ $search_request = ''; } #$search_request = preg_replace("Zoeken naar...", "", $search_request); #$search_request = preg_replace("/[?/()*]/", "", $search_request); #$search_request = preg_replace(" +", " ", $search_request); #$search_request = trim(preg_replace("/[^A-Za-z0-9]/, ", " ", $search_request)); # Get the page number (pagination) input #---------------------------------------- $input = trim(strip_tags($_REQUEST['page'])); if ($input){$page = $input;} # Get the Streaming request #-------------------------------- $input = trim(strip_tags($_REQUEST['stream'])); if ($input){$stream = $input;} # Get the download request #------------------------- $input = trim(strip_tags($_REQUEST['file'])); if ($input){$download_file_number = $input;} # Get the paypal Download request #-------------------------------- $input = trim(strip_tags($_REQUEST['dl'])); if ($input){$dl = $input;} # Get the reconcile request #-------------------------------- $input = trim(strip_tags($_REQUEST['recon'])); if ($input){$reconcile = $input;} # Get the year request #-------------------------------- $input = trim(strip_tags($_REQUEST['year'])); if ($input){$year = $input;} # -- Start Download Section -- # If this is a paypal download... #---------------------------------- if($dl){ $download_handler = 2; $sortfile = "file_info/admin/paypal/downloads/$dl.dld"; # If the flat-file exists.. if (file_exists("$sortfile")){ $z=0; $handle = @fopen("$sortfile", "r"); while (!feof($handle)) { $z++; $buffer = fgets($handle, 4096); # Get the first record of the paypal/download file - Thats where the info is we need if ($z == 1){ $file_info = explode ("|",$buffer); # The time() of purchase is now in $file_info[0] $path_to_download = stripslashes($file_info[1]); $file_to_download = stripslashes($file_info[2]); } } # if download is not expired, allow a download. $max_time = $file_info[0] + ($download_expire_time * 3600); $current_time = time(); if ($max_time > $current_time){ # Log the download #------------------- $content = "Downloaded started from ".$_SERVER['REMOTE_ADDR']." on ".date("F j, Y, g:i a", time())."$linefeed"; append_file($sortfile, $content); # Increase download count #------------------------- #$content = read_file("file_info/descriptions/$file_to_download.dsf"); #$fileinfo = explode ("|",$content); #$fileinfo[3] ++; #$content = implode("|", $fileinfo); #save_file("file_info/descriptions/$file_to_download.dsf", $content); # Now send the file to the browser as a download send_file($path_to_download, $file_to_download); }else{ # The download has expired!! #---------------------------- # Log the download attempt $content = "EXPIRED Downloaded attempted from ".$_SERVER['REMOTE_ADDR']." on ".date("F j, Y, g:i a", $current_time)."$linefeed"; append_file($sortfile, $content); # Display the "Sorry - Time Expired" message to user if (file_exists("$header")){ include $header; } if (file_exists("file_info/paypal_expired.php")){ include ("file_info/paypal_expired.php"); }else{ print "


DOWNLOAD EXPIRED!
"; } if (file_exists("$footer")){ include ($footer); } exit; } }else{ # Something must be wrong with the flat-file if (file_exists("$header")){ include $header; } print "

ERROR - Invalid Request


"; die; } } # If it is a regular (non paypal) download #------------------------------------------ if ($download_file_number){ # Check to see flatfile exists # then find download $z=0; if (file_exists("$sortfile")){ $handle = @fopen("$sortfile", "r"); while (!feof($handle)) { $z++; $buffer = fgets($handle, 4096); if ($z == $download_file_number){ $file_info = explode ("|",$buffer); $path_to_download = $file_info[1]; $file_to_download = stripslashes($file_info[2]); } } }else{ if (file_exists("$header")){ include $header; } print "

Toegang is geblokkeerd. Neem contact met ons op via de button contact om toegang aan te vragen.(Sortfile Missing)


"; die; } # Stream the audio file if $stream > 0 #======================================= if ($stream){ stream_file($path_to_download, $file_to_download, $stream_limit); exit; } # Start anti leech Check #$referer = $_SERVER["HTTP_REFERER"]; #$leecher_flag = preg_match("/$my_site/i", "$referer"); # # if ($leecher_flag == 0){ # A leecher!!! Send him to the anti leech page and exit # header("Location: ".$anti_leech_url); # exit; # } # End anti leech # Log the download #------------------- $downloads = "file_info/flat_files/downloads.txt"; $download_info = read_file("file_info/descriptions/$file_to_download.dsf"); $content = $_SERVER['REMOTE_ADDR']."|".date ('Y-m-d H:i:s')."|"."$download_info"."$linefeed"; append_file($downloads, $content); # Increase download count #------------------------- #$content = read_file("file_info/descriptions/$file_to_download.dsf"); #$fileinfo = explode ("|",$content); #$fileinfo[3] ++; #$content = implode("|", $fileinfo); #save_file("file_info/descriptions/$file_to_download.dsf", $content); # Start the download!! (Inline) - No paypal downloads allowed inline. if ($download_handler == 1){ if (file_exists("$header")){ include $header; } if (file_exists($download)){ include ($download); }else{ print "

if the download doesn't start automatically, click here.

"; } if (file_exists("$footer")){ include ($footer); } if ($download_redirect > 0){ print""; } exit; } # Start the download!! (PHP Pass-thru) if ($download_handler == 2){ send_file($path_to_download, $file_to_download); } exit; } # -- End of download section -- # Read the crc file to get old crc value. #---------------------------------------- $crc_file = "$flat_file_location/crc.dat"; if (file_exists("$crc_file")){ $old_crc = read_file("$crc_file"); }else{ $reconcile = 1; } # Read the total files to get old crc value. #---------------------------------------- $total_file = "$flat_file_location/total_files.dat"; if (file_exists("$total_file")){ $total_files = read_file("$total_file"); } if ($directory_checking > 0){ # Be sure the download path exists.. if (!file_exists($path)){ print "
The path listed in file_info/config.php does not exist!
- path listed is $path
- FYI, this path is where your downloads are supposed to reside.
- They not only DOES NOT reside there, the path doesn't even exist!
- Please correct this problem by editing file_info/config.php
- and change the path variable to the right location and try again."; exit; } # Recurse $path and all sub directories to read file types in $display_list # If $recurse = 0 - No recursing will be done. Home directory only #--------------------------------------------------------------------------- $stack[] = './ready'; while ($stack) { $current_dir = array_pop($stack); if ($d = opendir($current_dir)) { while (($file = readdir($d)) != false) { if ($file != '.' && $file != '..') { $current_file = "$current_dir/$file"; if (is_file($current_file)) { $ext = substr(($t=strrchr("$current_file",'.'))!==false?$t:'',1); $ext = str_replace('/', '', $ext); $ext = (strtolower($ext)); if (preg_match ("/$ext/i", $display_list)) { # Start main loop $new_crc = $new_crc + filesize($current_file); #$filesize = sprintf("%u", filesize($current_file)); $total_files1++; # End Main Loop } } elseif (($recurse) && (is_dir($current_file))) { $total_directories ++; $stack[] = $current_file; } } } } } # Format the total size of the database $total_size = format_bytecount($new_crc); # If the old crc and new crc dont match, # then files have been added (or deleted) from # the download directory. Call a reconcile! #--------------------------------------------- If ($old_crc <> $new_crc){ $reconcile = 1; } }else{ $error="$error

"; } # --Start of Reconcile -- if ($reconcile > 0){ # If many downloads are added at once, the script will timeout, # so set timeout value to indefinate. set_time_limit(0); ?> Reconcile!! - Reconciling directory -

\n"; print"Please be patient. If you have many files, this could take a few minutes..

\n"; if ($auto_redirect < 1){ print"Scroll to bottom of page to continue\n"; } # Check for proper directory permissions Print "

Checking for proper permissions.

\n"; $er = $er.$check = check_directory_writable("file_info/thumbs"); $er = $er.$check = check_directory_writable("file_info/descriptions"); $er = $er.$check = check_directory_writable("file_info/flat_files"); $er = $er.$check = check_directory_writable("file_info/id3_artwork"); if ($er){ print "
Please correct the above errors before continuing..

\n"; die; } # Recurse and read directory. #---------------------------- #$stack[] = "."; #while ($stack) { $current_dir = "./$year";{ #array_pop($stack); if ($d = opendir($current_dir)) { while (($file = readdir($d)) != false) { if ($file != '.' && $file != '..') { $current_file = "$current_dir/$file"; if (is_file($current_file)) { $ext = substr(($t=strrchr("$current_file",'.'))!==false?$t:'',1); $ext = str_replace('/', '', $ext); $ext = (strtolower($ext)); if (preg_match ("/$ext/i", $display_list)) { # Start main loop $count = $z + 1; Print "

($count) Checking $file
\n"; $fullpath = "$current_file"; $filesize = filesize("$fullpath"); $filesize1 = sprintf("%u", filesize($fullpath)); $clean_filename = trim(str_replace("_"," ",$file)); $clean_filename = ucwords($clean_filename); $ext1 = substr(strrchr($clean_filename, "."), 0); $clean_filename = str_replace($ext1,'',$clean_filename); $file_info[1] = $current_dir; # Path only - no filename $file_info[2] = $file; # filename and ext only #$file_info[3] = 0; # Number of accesses - 0 for now #$file_info[4] = "No Description"; # File Description #$file_info[5] = ""; # More info link #$file_info[6] = time(); # Unix time stamp $file_info[7] = $ext; # File Extention only #$file_info[8] = $filesize1; # Size of file in bytes #$file_info[9] = ""; # EXIF Artist #$file_info[10] = ""; # EXIF Description #$file_info[11] = ""; # EXIF Copyright $file_info[12] = ""; # ID3 Song $file_info[13] = ""; # ID3 Album $file_info[14] = ""; # ID3 Artist $file_info[15] = ""; # ID3 Genre #$file_info[16] = ""; # ID3 Track #$file_info[17] = ""; # ID3 Duration #$file_info[18] = ""; # ID3 Bitrate #$file_info[19] = ""; # ID3 Year #$file_info[20] = ""; # ID3 Type #$file_info[21] = ""; # UserVar1 #$file_info[22] = ""; # UserVar2 #$file_info[23] = ""; # UserVar3 #$file_info[24] = ""; # UserVar4 #$file_info[25] = ""; # UserVar5 #$file_info[26] = ""; # UserVar6 #$file_info[27] = ""; # UserVar7 #$file_info[28] = ""; # UserVar8 #$file_info[29] = ""; # UserVar9 #$file_info[30] = ""; # UserVar10 #$file_info[31] = ""; # Future #$file_info[32] = ""; # sku #$file_info[33] = "$default_price"; # Price #$file_info[34] = ""; # Rating Accumulator #$file_info[35] = ""; # Total Ratings # Check file for tags. (Id3, Exif, etc) #--------------------------------------- $getID3 = new getID3; $getID3 = new getID3; # had to call this twice or 1st file wasnt parsed sometimes #$id3_mime = ""; #added to fix bug that generated id3 photos for non id3 files. $ThisFileInfo = $getID3->analyze($fullpath); getid3_lib::CopyTagsToComments($ThisFileInfo); #$description = "No description available for this $ext file."; print "

  • Checking for ID3 tags for $fullpath.
  • \n"; # Get ID3 Song Title Tag $file_info[12] = $ThisFileInfo['comments']['title'][0]; # Get ID3 Artist Tag $file_info[14] = $ThisFileInfo['comments']['artist'][0]; # Get ID3 Album Tag $file_info[13] = $ThisFileInfo['comments']['album'][0]; # Get ID3 Genre Tag $file_info[15] = $ThisFileInfo['comments']['genre'][0]; # Get ID3 Track Tag $file_info[16] = $ThisFileInfo['comments']['track'][0]; # Get ID3 comments Tag $comment = $ThisFileInfo['comments']['comment'][0]; if ($comment){ $description = $comment; $description = str_replace($linefeed, "", $description); $description = str_replace("|", "", $description); print "
  • File description added
    - $comment
  • \n"; } # Get ID3 Duration Tag $file_info[17] = $ThisFileInfo['playtime_string']; #$id3_bitrate_mode = $ThisFileInfo['audio']['bitrate_mode']; #$id3_bitrate = $ThisFileInfo['audio']['bitrate']; #$id3_bitrate = ceil($id3_bitrate/1000); #$id3_samplerate = $ThisFileInfo['audio']['sample_rate']; #$id3_samplerate = $id3_samplerate/1000; #if ($id3_bitrate) { # $file_info[18] ="$id3_bitrate K @ $id3_samplerate ($id3_bitrate_mode)"; #} #$id3_photo = $ThisFileInfo['id3v2']['APIC'][0]['data']; #$id3_mime = $ThisFileInfo['id3v2']['APIC'][0]['image_mime']; # Get ID3 Year Tag $file_info[19] = $ThisFileInfo['tags_html']['id3v2']['year'][0]; # Get ID3 Format Tag $$file_info[20] = $ThisFileInfo['fileformat']; # If it has an id3 tag.. #if ($file_info[12]){ # print "
  • ID3 tag is available for $file.
  • \n"; # $file_info[5] = "http://www.amazon.com/gp/search/ref=br_ss_hs/002-9137895-3254437?platform=gurupa&url=index%3Dblended&t=ironmanshome&keywords=$file_info[14]"; # }else{ # #print "
  • No ID3 song title available.
  • \n"; # $file_info[12] = $file; # $file_info[5] = "http://www.amazon.com/gp/search/ref=br_ss_hs/002-9137895-3254437?platform=gurupa&url=index%3Dblended&t=ironmanshome&keywords=$file"; # } $file_info[4] = $description; # If there is artwork in the mp3 tag, copy it to the # mp3 photos directory and then thumbnail it. #---------------------------------------------------- #if ($id3_mime){ # print "
  • Extracting photo from $file.
  • \n"; # write_mp3_photo('file_info/id3_artwork/'.$file.'.jpg', $id3_photo); # $ht = thumbnail_jpg('file_info/id3_artwork/'.$file.'.jpg',$thumb_size,"file_info/thumbs/","$file.jpg"); # } # See if thumbnail file exists if (extension_loaded('gd')) { # If ext is jpg, thumbnail it. #----------------------------- if ($ext == 'jpg'){ print "
  • Thumbnailing jpg for $file.
  • \n"; $ht = thumbnail_jpg($fullpath,$thumb_size,"file_info/thumbs/","$file.jpg"); $description = "No description available for this photo: $file"; } # If ext is gif, thumbnail it. #----------------------------- if ($ext == 'gif'){ print "
  • Thumbnailing gif for $file
  • \n"; $ht = thumbnail_gif($fullpath,$thumb_size,"file_info/thumbs/","$file.jpg"); $description = "No description available for this photo: $file"; } # If ext is png, thumbnail it. #----------------------------- if ($ext == 'png'){ print "
  • Thumbnailing png for $file
  • \n"; $ht = thumbnail_png($fullpath,$thumb_size,"file_info/thumbs/","$file.jpg"); $description = "No description available for this photo: $file"; } } # Check for EXIF tags goes here $content = "|$file_info[1]|$file_info[2]|$file_info[3]|$file_info[4]|$file_info[5]|$file_info[6]|$file_info[7]|$file_info[8]|$file_info[9]|$file_info[10]|$file_info[11]|$file_info[12]|$file_info[13]|$file_info[14]|$file_info[15]|$file_info[16]|$file_info[17]|$file_info[18]|$file_info[19]|$file_info[20]|$file_info[21]|$file_info[22]|$file_info[23]|$file_info[24]|$file_info[25]|$file_info[26]|$file_info[27]|$file_info[28]|$file_info[29]|$file_info[30]|$file_info[31]|$file_info[32]|$file_info[33]|$file_info[34]|$file_info[35]"; # See if description file exsists. If not, create it. #---------------------------------------------------- $filedescription = "file_info/descriptions/$file.dsf"; if (!file_exists($filedescription)) {; #file_put_contents($filedescription, $content); save_file($filedescription, $content); # RSS Feed goes here. We want to add any new files to the feed }ELSE{ # If the file does exist, read its data. #--------------------------------------- $content = read_file($filedescription); } $data = explode("|", $content); $sort_filename[$z] = $clean_filename.$content; #$sort_artist[$z] = $data[14].$content; #$sort_upload[$z] = $data[6].$content; #$sort_popular[$z] = $data[3].$content; #$sort_ext[$z] = $data[7].$content; #$sort_filesize[$z] = $data[8].$content; #if ($data[35]){ # $rating = $data[34]/$data[35]; # }else{ # $rating = "0"; # } # #$sort_rating[$z] = $rating.$content; $totalbytes = $totalbytes + $filesize; $totalfiles1++; $z++; # End Main Loop } } elseif (($recurse) && (is_dir($current_file))) { $total_directories ++; $stack[] = $current_file; } } } } } # Are there any files to index?? #------------------------------- if ($totalfiles1){ if ($sort_filename){ # Sort the filename array. #------------------------- rsort ($sort_filename,SORT_REGULAR); reset ($sort_filename); # Save the "sort by filename" list #--------------------------------- $filename = "$flat_file_location/sort_filename.dat"; $x=0; $newfile = fopen($filename,"a"); while($sort_filename[$x]){ $writedata = "$sort_filename[$x]$linefeed"; fwrite($newfile, $writedata); $x++; } fclose($newfile); $lines = file($filename); $lines1 = array_unique($lines); rsort ($lines1,SORT_REGULAR); reset ($lines1); #Save the "sort by filename" list na bijwerken #--------------------------------------------- $filename = "$flat_file_location/sort_filename.dat"; $x=0; $newfile = fopen($filename,"w+"); while($lines1[$x]){ $writedata = "$lines1[$x]"; fwrite($newfile, $writedata); $totalfiles++; $x++; } } # Sort the artist data array #------------------------------- if ($sort_artist){ # Sort the artist array. #------------------------- rsort ($sort_artist,SORT_REGULAR); reset ($sort_artist); # Save the "sort by artist" list #--------------------------------- $filename = "$flat_file_location/sort_artist.dat"; $x=0; $newfile = fopen($filename,"a"); while($sort_artist[$x]){ $writedata = "$sort_artist[$x]$linefeed"; fwrite($newfile, $writedata); $x++; } fclose($newfile); } # Sort the upload date array. #---------------------------- if ($sort_upload){ rsort ($sort_upload,SORT_NUMERIC); reset ($sort_upload); # Save the "sort by upload date" list #------------------------------------- $x=0; $filename = "$flat_file_location/sort_upload.dat"; $newfile = fopen($filename,"w"); while($sort_filename[$x]){ $writedata = "$sort_upload[$x]$linefeed"; fwrite($newfile, $writedata); $x++; } fclose($newfile); } # Sort the popular date array. #---------------------------- if ($sort_popular){ rsort ($sort_popular,SORT_NUMERIC); reset ($sort_popular); # Save the "sort by popularity" list #------------------------------------- $x=0; $filename = "$flat_file_location/sort_popular.dat"; $newfile = fopen($filename,"w"); while($sort_filename[$x]){ $writedata = "$sort_popular[$x]$linefeed"; fwrite($newfile, $writedata); $x++; } fclose($newfile); } # Sort the ext array. #------------------------- if ($sort_ext){ sort ($sort_ext,SORT_REGULAR); reset ($sort_ext); # Save the "sort by extension" list #------------------------------------- $x=0; $filename = "$flat_file_location/sort_ext.dat"; $newfile = fopen($filename,"w"); while($sort_filename[$x]){ $writedata = "$sort_ext[$x]$linefeed"; fwrite($newfile, $writedata); $x++; } fclose($newfile); } # Sort the filesize (ascending) array. #------------------------------------- if ($sort_filesize){ sort ($sort_filesize,SORT_NUMERIC); reset ($sort_filesize); # Save the "sort by filesize" list #------------------------------------- $x=0; $filename = "$flat_file_location/sort_filesizea.dat"; $newfile = fopen($filename,"w"); while($sort_filename[$x]){ $writedata = "$sort_filesize[$x]$linefeed"; fwrite($newfile, $writedata); $x++; } fclose($newfile); } # Sort the filesize (decending) array. #------------------------------------- if ($sort_filesize){ rsort ($sort_filesize,SORT_NUMERIC); reset ($sort_filesize); # Save the "sort by filesize" list #------------------------------------- $x=0; $filename = "$flat_file_location/sort_filesized.dat"; $newfile = fopen($filename,"w"); while($sort_filename[$x]){ $writedata = "$sort_filesize[$x]$linefeed"; fwrite($newfile, $writedata); $x++; } fclose($newfile); } # Sort the rating array. #------------------------- if ($sort_rating){ rsort ($sort_rating,SORT_NUMERIC); reset ($sort_rating); # Save the "sort by filesize" list #------------------------------------- $x=0; $filename = "$flat_file_location/sort_rating.dat"; $newfile = fopen($filename,"w"); while($sort_filename[$x]){ $writedata = "$sort_rating[$x]$linefeed"; fwrite($newfile, $writedata); $x++; } fclose($newfile); } # Save the "crc value" file #------------------------------------- $x=0; $filename = "$flat_file_location/crc.dat"; save_file($filename, $totalbytes); # Save the "total files" file #------------------------------------- $x=0; $filename = "$flat_file_location/total_files.dat"; save_file($filename, $totalfiles); print "

    Total bytes = $totalbytes
    \n"; print "Total files = $totalfiles
    \n"; print "Reconcile Complete.

    \n"; if ($auto_redirect > 0){ print""; }else{ print"
    Click here to continue
    \n"; } }else{ print "
    There are no files to index - Please upload some files!


    \n"; } if (file_exists("$footer")){ include ($footer); } exit; } # -- End of Reconcile -- # If there is a search request, search the flat file for a match. #----------------------------------------------------------------- if ($search_request){ $len = 1; # Be sure flatfile exists #------------------------- if (file_exists("$sortfile")){ $z=1; $z1=1; $handle = @fopen("$sortfile", "r"); while (!feof($handle)) { $buffer = fgets($handle, 4096); if (preg_match("/$search_request/", $buffer)&& strlen($search_request) >= $len){ $found_items[$z1]=$z; $z1++; } $z++; } }else{ if (!$reconcile){ $error = "$error
    ERROR - Sortfile ($sortfile) is either missing or has wrong permissions set
    "; $error = $error."
    Click here to attempt to rebuild the missing files.

    "; } } $z1 = $z1 - 1; $total_files = $z1; if ($z1 == 0){$search_results = "Uw zoekopdracht naar "$search_request" levert geen resultaten op. - Probeer het opnieuw. De zoekfunctie is hoofdlettergevoelig!

    ";} if ($z1 == 1){$search_results = "Uw zoekopdracht levert $z1 resultaat op.";} if ($z1 > 1){$search_results = "Uw zoekopdracht levert $z1 resultaten op.";} #if ($z1 == 1){$search_results = "Uw zoekopdracht naar "$search_request" levert $z1 resultaat op.";} #if ($z1 > 1){$search_results = "Uw zoekopdracht naar "$search_request" levert $z1 resultaten op.";} } # Figure out which records to display according to page number. # and load each file # into array - $items_to_display #--------------------------------------------------------------- if ($total_files <= $records_per_page){ # Not enough files to paginate - no page numbers needed. #-------------------------------------------------------- $record_start = 1; $record_end = ($total_files); $z=0; while ($z <= $record_end){ if($search_request){ $items_to_display[$z] = $found_items[$z]; }else{ $items_to_display[$z] = $z; } $z++; } }else{ # Page numbers are needed! #------------------------- $total_pages = ceil(($total_files)/$records_per_page); if ($page > $total_pages){ $page=1;} if ($page < 1){ $page=1;} # Calculate which records to display on current page #---------------------------------------------------- $record_start = ((($page-1) * $records_per_page)+1); $record_end = ((($page-1) * $records_per_page) + ($records_per_page)); if ($record_end >= $total_files){ $record_end = ($total_files); } $z = $record_start; $z1 = 1; while ($z <= $record_end){ if($search_request){ $items_to_display[$z1] = $found_items[$z]; }else{ $items_to_display[$z1] = $z; } $z++; $z1++; } } if (($total_files > 0) && ($display_file_message > 0)){ $search_results = "$search_results Displaying files $record_start - $record_end (of $total_files)"; } # Output starts here! #-------------------- if (file_exists("$header")){ include $header; } # If directory contents changed or other items are in $changed, # Print them to the browser. #------------------------------------------------------------- print $changed; # Display the search bar #-------------------------- if (file_exists("$search")){ include $search; } # Read the proper sortfile to build output. #---------------------------------------- $z=0; $z1=1; $handle = @fopen("$sortfile", "r"); if (file_exists("$sortfile")){ while (!feof($handle)) { $buffer = fgets($handle, 4096); if ($buffer){ $z++; if ($z == $items_to_display[$z1]){ # Get the file path from the flat file #------------------------------------- $file_info = explode("|", $buffer); # Read the existing file description file #---------------------------------------- $filename = "file_info/descriptions/$file_info[2].dsf"; $content = read_file($filename); $file_info = explode ("|",$content); # Fix the Clean Filename and get file extension. #----------------------------------------------- $file_info[0] = trim(str_replace("_"," ",$file_info[2])); $file_info[0] = ucwords($file_info[0]); $ext = substr(strrchr($file_info[0], "."), 0); $file_info[0] = str_replace($ext,'',$file_info[0]); $ext = substr($ext, 1); $ext = (strtolower($ext)); # Format the upload date and bytecount #-------------------------------------- #$file_info[6] = date("m-d-y", $file_info[6]); #$file_info[8] = format_bytecount($file_info[8]); # Strip slashes from the description # and any other output that needs it. #------------------------------------ $file_info[4] = stripslashes($file_info[4]); $file_info[5] = stripslashes($file_info[5]); $file_info[9] = stripslashes($file_info[9]); $file_info[10] = stripslashes($file_info[10]); $file_info[11] = stripslashes($file_info[11]); $file_info[12] = stripslashes($file_info[12]); $file_info[13] = stripslashes($file_info[13]); $file_info[14] = stripslashes($file_info[14]); # Create download link and paypal passthru #------------------------------------------ $custom = "$file_info[1]|$file_info[2]|"; $download_link = "$PHP_SELF?file=$z&sort=$sort"; $download_id = "$z"; # Get Background color and alternat between color 1 and 2 #--------------------------------------------------------- if ($color == $color1){$color = $color2;}else{$color = $color1;} # Get proper thumb file #----------------------- $thumb_file=""; if ($show_thumbs > 0){ $thumb_file = "file_info/thumbs/$file_info[2].jpg"; #$thumb_file = htmlspecialchars($thumb_file); } if (!file_exists("$thumb_file")){ $thumb_file = "file_info/icons/$icon_set/$ext.gif"; } if (!file_exists("$thumb_file")){ $thumb_file = "file_info/icons/$icon_set/x.gif"; } # Print the record from the template file #---------------------------------------- if (file_exists("$template")){ # Start of column > 1 pre #-------------------------- if (($columns > 1) && ($z1 == 1)){ print "
    \n"; } if ($columns > 1){ $a = ceil(($z1 - 1)/$columns); $b = (($z1 - 1)/$columns); if (($z1 == 1) or ($a == $b)){ print " \n"; } print "\n"; $a = ceil(($z1)/$columns); $b = (($z1)/$columns); if ($a == $b){ print " \n"; } } if (($columns > 1) && ($z1 == $records_per_page)){ print "
    \n"; } # End of column > 1 Pre # Output the download listing include $template; # Start of column > 1 post #-------------------------- if ($columns > 1){ print "
    \n"; } # End of column > 1 Post }else{ $error = "$error
    ERROR - Template ($template) is either missing or has wrong permissions set
    "; $error = $error."
    Click here to attempt to rebuild the missing files.

    "; } $z1++; } } } }else{ if (!$reconcile){ $error = "$error
    ERROR - Sortfile ($sortfile) is either missing or has wrong permissions set
    "; $error = $error."
    Click here to attempt to rebuild the missing files.

    "; } } # Start pagination # If there are enough files to paginate, create the page links. #-------------------------------------------------------------- if ($total_pages > 1){ ?>
    "; print"\n

    "; print str_pad($z, 2, "0", STR_PAD_LEFT); print " | "; } $z++; } print"\n

    "; }else{ # Too many page links!! - Abbreviate page links. Add next and previous # arrows that move the page links by 10 #---------------------------------------------------------------------- $previous_arrow = $page - 10; If ($previous_arrow < 1){ $previous_arrow = 1; } $next_arrow = $page + 10; if ($next_arrow > $total_pages){ $next_arrow = $total_pages; } If ($page > 1){ print " "; print "<< | "; }else{ print " << | "; } $z = $page; $start_page = $z - 5; if ($start_page <= 1){ $start_offset = abs($start_page); $start_page = 1; } $end_page = $z + 5 + $start_offset; if ($end_page >= $total_pages){ $end_offset = ($end_page - $total_pages); $end_page = $total_pages; } $start_page = ($start_page - $end_offset); for ($z=$start_page; $z<=$end_page; $i++){ if ($z == $page){ print str_pad($z, 2, "0", STR_PAD_LEFT); print " | "; }else{ print ""; print str_pad($z, 2, "0", STR_PAD_LEFT); print " | "; } $z++; } If ($page < $total_pages){ print ""; print ">> "; }else{ print">>"; } print "\n "; print "\n "; } } print "\n\n\n"; print $error; if (file_exists("$footer")){ include $footer; } # Output ends here # --- Start Function List --- # Read complete file #---------------------------- function read_file($file){ if (file_exists("$file")){ $newfile = fopen($file,"r"); if (filesize($file) > 0){ $data = fread($newfile, filesize($file)); } fclose($newfile); }else{ #include ($header); print "

    ERROR - Invalid Request (File $file Missing)


    "; print "
    Click here to reconcile.
    "; die; } return($data); } # Save complete file #---------------------------- function save_file($file, $content){ #if (is_writable($file)) { $newfile = fopen($file,"w"); fwrite($newfile, $content); fclose($newfile); #}else{ # print "

    ERROR - The file \"$file\" is not writeable. Check permissions (Func31)


    "; #} return; } # Append record to end of file # Function used in download.php #---------------------------- function append_file($file, $content){ $newfile = fopen($file,"a"); fwrite($newfile, $content); fclose($newfile); return; } # Fix and format Byte Length. #---------------------------- function format_bytecount($totalbytes) { $totalbytes = abs($totalbytes); 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"; } if (!$totalbytes){ $totalsize = "00 B"; } return ($totalsize); } # JPG thumbnail function. #------------------------------- function thumbnail_jpg($i,$nw,$p,$nn) { if (is_writable($p)) { $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; imageDestroy($img); }else{ print "

    ERROR - \"$p\" directory not writeable. Check permissions (Func88)


    "; } return ($heigth); } # PNG thumbnail function. #------------------------------- function thumbnail_png($i,$nw,$p,$nn) { if (is_writable($p)) { $img=imagecreatefrompng("$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; imageDestroy($img); }else{ print "

    ERROR - \"$p\" directory not writeable. Check permissions (Func111)


    "; } return ($heigth); } # GIF thumbnail function. #------------------------------- function thumbnail_gif($i,$nw,$p,$nn) { if (is_writable($p)) { $img=imagecreatefromgif("$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; imageDestroy($img); }else{ print "

    ERROR - \"$p\" directory not writeable. Check permissions (Func134)


    "; } return ($heigth); } # Write the extracted mp3 photo to a file #----------------------------------------- function write_mp3_photo($filename, $filecontents) { if (!$handle = fopen($filename, 'wb')) { print "

    ERROR - File \"$filename\" not writeable. Check permissions for that directory (Func146)


    "; } if (!fwrite($handle, $filecontents)) { print "

    ERROR - File \"$filename\" not writeable. Check permissions for that directory (Func149)


    "; } fclose($handle); return; } # Send (download) file via pass thru #------------------------------------- function send_file($path, $file){ # Make sure the file exists before sending headers #------------------------------------------------- $mainpath = "$path/$file"; $filesize2 = sprintf("%u", filesize($mainpath)); if(!$fdl=@fopen($mainpath,'r')){ include ("$header"); print "

    Toegang is geblokkeerd. Neem contact met ons op om toegang aan te vragen.


    "; die; }else{ set_time_limit(0); # 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)($filesize2)); header("Content-Transfer-Encoding: binary"); header("Content-Type: audio/mpeg, audio/x-mpeg, audio/x-mpeg-3, audio/mpeg3"); #header("Content-Length: ".$filesize2); #header("Content-Length: $filesize2"); sleep(1); #readfile ($fdl); fpassthru($fdl); } return; } # Stream an audio file via pass thru #------------------------------------- function stream_file($path, $file, $percent){ # Make sure the file exists before sending headers #------------------------------------------------- $mainpath = "$path/$file"; if(!$fdl=@fopen($mainpath,'r')){ #include ("$header"); print "

    Toegang is geblokkeerd. Neem contact met ons op om toegang aan te vragen.


    "; die; }else{ set_time_limit(0); $filesize2 = sprintf("%u", filesize($mainpath)); if ($percent){ $filesize2 = round($filesize2*($percent*.01)); } # Send the headers then send the file #------------------------------------ #header("Content-type: audio/x-ms-wma"); header('Content-Transfer-Encoding: binary'); header('Content-Length: ' . filesize($path)); header('Accept-Ranges: bytes'); readfile($path); header("Content-type: audio/mpeg"); header('Cache-Control: no-cache'); #header("Cache-Control: no-cache, must-revalidate"); #header("Expires: Mon, 01 Jan 1969 00:00:00 GMT"); header("Content-Length: ".$filesize2); header('Content-Transfer-Encoding: binary'); header('Accept-Ranges: bytes'); #header("Content-Disposition: inline; filename=\"$file\""); #header("Cache-Control: private"); #IE Fix $mp3 = @fopen($mainpath,"rb"); @fpassthru($mp3); @fclose($mp3); } return; } # Check if a directory is writable function check_directory_writable($path){ if (!file_exists($path)) { mkdir($path,755); } if (!is_writable($path)) { print "ERROR - \"$path\" directory NOT WRITABLE - chmod 0777 $path
    "; $err = 1; } return ($err); } # --- End Function List --- ?>