rendered paste body<?
#################################################################
# #
# PHP Easy Downloader V1.5 #
# #
# By Paul Alger #
# webmaster@ironclad.net #
# February 20, 2006 #
# #
#################################################################
# 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 = "ace avi bmp doc exe gif jpg mid mp3 mpg pdf png ppt rar txt ttf wav xls zip mkv mp4 rmvb";
#--------------------------------------------------------------------------
# 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 = "./";
#--------------------------------------------------------------------------
# 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 = 10;
#--------------------------------------------------------------------------
# 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 = 0;
$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 = "<b><i><font color=#FFFFFF>"; # html on tags for "Search Box Description"
$display_search_tag_end = "</font></i></b>"; #------- 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 = "<b>"; #----------- html on tags for "Top 10 Downloads"
$display_top10_tag_end = "</b>"; #------ 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 = "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 = "<b>"; #----------- html on tags for "File Name"
$display_filename_tag_end = "</b>"; #------ 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 = "<b>"; #----------- html on tags for "Description"
$display_description_tag_end = "</b>"; #------ 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 = "<b>"; #----------- html on tags for "More Info"
$display_moreinfo_tag_end = "</b>"; #------ 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 = "<b><i>"; #-------- html on tags for "File Type"
$display_filetype_tag_end = "</i></b>"; #-- 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 = "<b>"; #----------- html on tags for "File Size"
$display_filesize_tag_end = "</b>"; #------ 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 = "<b>"; #------- html on tags for "Accessed"
$display_accessed_tag_end = "</b>"; #-- 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 = "<b>"; #------- html on tags for "File Date"
$display_filedate_tag_end = "</b>"; #-- 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 = "<b>"; #------- html on tags for "Pagination"
$display_pagination_tag_end = "</b>"; #-- 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 <b><font color= $search_color size = $search_size >\"$search\"</font></b> 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 <b><font color= $search_color size = $search_size >\"$search\"</font></b> yielded $match results:";
}
# Search File Name Only.
#-----------------------
if ($search){
#$searchtext = "Your search for <b><font color= $search_color size = $search_size >\"$search\"</font></b> 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 <b><font color= $search_color size = $search_size >\"$search\"</font></b> 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.
#---------------------------------------------------------
?>
<table border="0" width="<? echo "$table_width"; ?>" align = "center">
<form method="POST" action="<? echo "$PHP_SELF?page=$currentpage"; ?>"
<tr>
<td width="33%"><font size="<? echo $display_search_size; ?>" face="<? echo $display_search_font; ?>"><? echo $display_search_tag; ?>Sorting Order:<? echo $display_search_tag_end; ?></font>
<select size="1" name="D1">
<option <? echo $select1; ?>>Alphabetical</option>
<option <? echo $select2; ?>>File Size</option>
<option <? echo $select3; ?>>Accesses</option>
<option <? echo $select4; ?>>Latest Files</option>
</select>
<br><font size="<? echo $display_search_size; ?>" face="<? echo $display_search_font; ?>"><? echo $display_search_tag; ?> Files per Page:<? echo $display_search_tag_end; ?></font> <input type="text" name="D2"
size="7" value="<? echo $records_per_page; ?>"> <input type="submit" value="Go!" name="B1">
</td>
<td width="33%">
<?
if ($display_top10 == 1){
print "<p align=\"center\"><a href=\"$PHP_SELF?page=1&rpp=10&so=Accesses\">$display_top10_tag<font size=\"$display_top10_size\" face=\"$display_top10_font\">Top
10 Downloads!</font>$display_top10_tag_end</a></p>";
}
?>
</td>
<td width="34%">
<p align="right"><font face="<? echo $display_search_font; ?>" size="<? echo $display_search_size; ?>"><? echo $display_search_tag; ?> Search for a File Name <? echo $display_search_tag_end; ?></font><br>
<input type="text" name="T1" size="22"><br>
<input type="checkbox" name="C1" value="ON"><b><font size="<? echo $display_search_size; ?>" face="<? echo $display_search_font; ?>"><? echo $display_search_tag; ?>Search Description. <? echo $display_search_tag_end; ?></font></p>
</td>
</form>
</table>
<center><font size="2" face="Tahoma"><?echo $searchtext; ?></font></center>
<?
# 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";
}
# 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 = "<a href=\"./file_info/admin/edit.php?file=$fileattr[2]\" onClick=\"popup = window.open('./file_info/admin/edit.php?file=$fileattr[2]', 'PopupPage', 'height=350,width=520,scrollbars=yes,resizable=yes'); return false\" target=\"_blank\">Click Here to edit this entry</a><br>";
}
# Print html results.
#--------------------
?>
<table cellSpacing="0" cellPadding="3" width="<? echo "$table_width"; ?>" bgColor="<? echo $color ?>" border="0" align="center">
<tbody>
<tr vAlign="top">
<?
# Display Download Icon.
#-----------------------
if ($display_download_icon == 1){
print "<td align=\"middle\" width=\"12%\">";
print "<a href=\"./index.php?file=$fileattr[2]\" >";
print "<img border=\"0\" src=\"";
print "$iconfile \" ></a></td>";
}
print "<td width=\"50%\" valign=\"top\" align=\"left\">";
# Display the File Name.
#-----------------------
if ($display_filename == 1){
print "$display_filename_tag<font size=\"$display_filename_size\" face=\"$display_filename_font\">\n";
print "<a href=\"./index.php?file=$fileattr[2]\">\n";
print "$fileattr[1]</a>$display_filename_tag_end<br>\n";
}
# Display File Description.
#--------------------------
if ($display_description == 1){
print "<font size=\"$display_description_size\" face=\"$display_description_font\">$display_description_tag $fileattr[7] $display_description_tag_end</font><br>\n";
}
# Display the "More Info" link.
#------------------------------
if ($display_moreinfo == 1){
print "<a href=\"$fileattr[8]\" onClick=\"popup = window.open('$fileattr[8]', 'PopupPage', 'height=480,width=640,scrollbars=yes,resizable=yes'); return false\" target=\"_blank\">$display_moreinfo_tag<font face=\"$display_moreinfo_font\" size=\"$display_moreinfo_size\">More Info</font>$display_moreinfo_tag_end</a><br>\n";
}
# Display the File Type.
#-----------------------
if ($display_filetype == 1){
print "<font face=\"$display_filetype_font\" color=\"$display_filetype_color\" size=\"$display_filetype_size\">$display_filetype_tag$xtrainfo$display_filetype_tag_end</font>\n";
}
# If admin flag is set, Print the link to edit entries.
#------------------------------------------------------
if ($admin){
print "<font face=\"$display_filetype_font\" size=\"$display_filetype_size\">$display_filetype_tag$admininfo$display_filetype_tag_end</font>\n";
}
print "</td>";
# Display the File Size.
#-----------------------
if ($display_filesize == 1){
print "<td align=\"right\" width=\"12%\" valign=\"middle\"><font size=\"$display_filesize_size\" face=\"$display_filesize_font\">$display_filesize_tag Size<br>$size</font>$display_filesize_tag_end</td>\n";
}
# Display Accessed.
#------------------
if ($display_accessed == 1){
print "<td align=\"right\" width=\"12%\" valign=\"middle\"><font size=\"$display_accessed_size\" face=\"$display_accessed_font\">$display_accessed_tag Accesses<br>$fileattr[6] $display_accessed_tag_end</font></td>\n";
}
# Display File Date.
#-------------------
$file_time = date("m-d-y", $fileattr[9]);
if ($display_filedate == 1){
print "<td align=\"right\" width=\"12%\" valign=\"middle\"><font size=\"$display_filedate_size\" face=\"$display_filedate_font\">$display_filedate_tag File Dated<br>$file_time</font>$display_filedate_tag_end</td>\n";
}
print "</tr></tbody></table>\n";
}
}
}
#-------------------------------------------------------------------------------------
# End main loop.
# Generate page number links.
#----------------------------
print "<table border=\"0\" width=\"$table_width\" align =\"center\"><tr><td>";
if ($flag == 0){
$previouspage = $currentpage-1;
if ($previouspage < 1){
$previouspage = 1;
}
$nextpage = $currentpage+1;
if ($nextpage > $totalpages){
$nextpage = $totalpages;
}
print "<center><p><font face=\"$display_pagination_font\" size=\"2\">$display_pagination_tag <a href=\"$PHP_SELF?page=$previouspage$rpp3$so\">Back</a> | ";
$z = 1;
while ($z <= $totalpages){
if ($z == $currentpage){
$size = $display_selected_size;
}ELSE{
$size = $display_pagination_size;
}
print "<font face=\"$display_pagination_font\" size=\"$size\"><b><a href=\"$PHP_SELP?page=$z$rpp3$so\">$z</a><font face=\"$display_pagination_font\" size=\"$display_pagination_size \"> | ";
$z++;
}
print "<font face=\"Tahoma\" size=\"2\"><a href=\"$PHP_SELF?page=$nextpage$rpp3$so\">Next</a>";
print "$display_pagination_tag_end </font></p></center></td></tr><tr><td>";
}
#.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";
}
?>
<p><br><font size="1" face="Tahoma"><a href="http://www.ironclad.net/scripts/">PHP Easy Downloader<a></b></font><br>
<font size="1" face="Tahoma"><b>Total Files Available: <? echo $totalfiles; ?></b></font><br>
<font size="1" face="Tahoma"><b>Total Bytes: <? echo $totalsize; ?></b></font><br>
<?
# End of timed code here.
#------------------------
$exec_time = array_sum(explode(' ', microtime())) - $t_start;
$exec_time1 = (ceil($exec_time * 10000))/10000;
print"<font size=\"1\" face=\"Tahoma\"><b>Execution time: $exec_time1 sec.</b></font><br>";
print "<font size=\"1\" face=\"Tahoma\"><b><a href=\"$PHP_SELF?page=$currentpage$rpp3$so&admin=1\">Admin</a></b></font></td></tr></table>";
# 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;
}
}
?>