?
Solved

How to embed flash mp3 player into this php code?

Posted on 2008-06-16
3
Medium Priority
?
1,639 Views
Last Modified: 2012-06-22
Hi

I want to embed any free flash mp3 player so that the output generated by the attached code should also contain, a link to popup free flash mp3 player,  in front of file_name_link.

The player should start playing the mp3 player file whose location it will get from that link.

FileNameLink PlayFileLink Type Size
<?php
define('INDEX0RVERSION', '0.9.5s');
################################################################################
## Project Name: index0r
## Author: Phillip Metzger (phillip.metzger@gmail.com) (http://0zz.org/)
##
## 0.9.5 Changes
##  * XSS Secure
##
##
## Version: 0.9.5s;
## Modified: 3/2/2008 5:02:00 PM
################################################################################
/*******************************************************************************
 
*** INSTALL ***
 
1. Extract everything in to the root directory you want to list.
2. Modify configurations
3. Call with:
 
     $directory_list = new index0r;
     $directory_list->init();
 
*** NOTES ***
     CSS
      - Alternating row classes:
           .alt_row1
           .alt_row2
 
      - if html="on" style is manually created. Other wise it must be
        specified manually.
 
     Complete Class List
      - .index0rLink
      - .index0rPathLink
      - .Index0rP
      - .index0rH4
      - .index0rH2
      - .index0rTable
 
*******************************************************************************/
############################## CONFIGURATIONS #################################
 
   // Generate <html> <head> <title> <body> tags
   define("index0rHTML", 'on'); // on/off
   
   // HTML Title before path
   define("index0rHTMLTitle", "Index of ");
 
   // Width of <table>
   define("index0rTableWidth", '100%');
 
   // Display working path. Not recommened to leave on during public use.
   define("index0rDebug", 'off'); // on/off
 
   // Full root path to directory (ie: /www/data/docs/user.com/public)
   // Use forward slashes ALL PLATFORMS
   // (NO trailing slash)
   define("index0rDirectoryRoot", '.');
 
   // URL)
   // Example 1: :http://domain.com/directory
   // Example 2: http://domain.com/directory/index0r.php
   define("index0rHomepage", '.'); //  (no trailing slash)
 
   // If homepage and url to file are different. Exmple: homepage is
   // http://user.com/public/files but directory_root is //user.com/downloads
   // if directory root and homepage are the same file_url should be the same as
   // homepage.
   define("index0rFileUrl", '.'); // (no trailing slash)
 
   // http path to images
   define("index0rImgSrc", './index0r_img');
 
   // Alternating row color;
   define("index0rAltColor", 'on'); // on/off
   define("index0rAltColor1", '#F2F2F2');
   define("index0rAltColor2", '#E6E6E6');
 
   // Sort all directories first before files
   define("index0rOrder", 'on'); // on/off
 
   // blacklist file names and directories so they will not show
   $index0rBlacklist = Array(
                        ".",
                        "..",
                        "index.php",
                        "index0r_img",
                        "Thumbs.db",
                        ".htaccess",
                        ".htpasswd",
                        ".plan"
                       );
 
   // error message when directory has failed to open or directory is empty
   define("index0rFailedMsg", "Error 666: Directory not found or directory is empty.");
 
   // cut name at XX length
   define("index0rMaxLength", 20);
 
   // format modified date is displayed uses date() function
   // http://php.net/manual/en/function.date.php
   define("index0rDateFormat", "F d Y h:i:s");
 
   // file type icon list key by file extension (IE: file.exe image is found by key exe)
   $index0rFileTypes = Array(
	         'dir' => 'directory.png',
                 'jpg' => 'image.png',
                 'gif' => 'image.png',
                 'png' => 'image.png',
                 'exe' => 'binary.png',
                 'txt' => 'text.png',
                 'zip' => 'archive.png',
                 'rar' => 'rar.gif',
                 'gz' => 'archive.png',
                 'tar' => 'archive.png',
                 'htm' => 'html.png',
                 'html' => 'html2.png',
                 'php' => 'php.png',
                 'css' => 'text.png',
                 'iso' => 'iso.png',
                 'rpm' => 'rpm.png',
                 'pdf' => 'adobe_pdf.png',
                 'xls' => 'excel.png',
                 'wmv' => 'video.png',
                 'wav' => 'video.png',
                 'asf' => 'video.png',
                 'mpg' => 'video.png',
                 'mov' => 'video.png',
                 'ini' => 'text.png',
                 'psd' => 'psd.png',
                 'plan' => 'plan.png',
                 'mp3' => 'mp3.gif',
                 'bat' => 'bat.gif',
                 'avi' => 'video.png',
                 'md5' => 'key.gif',
                 'asc' => 'key.gif',
                 'cpp' => 'c.gif',
                 'c' => 'c.gif',
                 'py' => 'py.gif',
                 'js' => 'js.gif',
                 'psp' => 'psp.gif'
                );
 
  // Advanced Settings
  $index0rSettings['logging'] = "on"; // on/off
  $index0rSettings['error_reporting'] = "on"; // on/off
  
  // KEEP ME UPDATED! (Recommended)
  $index0rSettings['update'] = "on"; // on/off
###############################################################################
if(isset($_GET['thumb'])) {
  createThumbnail($_GET['thumb'], 100, 80, 1);
  exit;
}
function get_file_ext($filename) {
  $ext = strtolower(substr($filename,-3));
 
  if($ext == "jpg" || $ext == "gif") {
    return true;
  } else {
    return false;
  }
}
 
// Thumbnail  Generator
function createThumbnail($path, $width, $height, $porp = 1) {
  if(preg_match("%jpg|jpeg%i", $path)) {
    $src = imagecreatefromjpeg($path);
  }
  if(preg_match("%gif|gif%i", $path)) {
    $src = imagecreatefromgif($path);
  }
 
  $srcx = imageSX($src);
  $srcy = imageSY($src);
 
  if($porp == 1) {
	 if ($srcx < $srcy) {
		$width = floor(($height / $srcy) * $srcx);
		$thumbWidth = $width;
		$thumbHeight = $height;
	 } else {
		$height = floor(($width / $srcx) * $srcy);
		$thumbWidth = $width;
		$thumbHeight = $height;
	 }
  } else {
	$thumbWidth = $width;
	$thumbHeight = $height;
  }
 
  $copy = imageCreateTrueColor($thumbWidth, $thumbHeight);
 
  $thumb = imageCopyResampled($copy, $src, 0, 0, 0, 0, $thumbWidth, $thumbHeight, $srcx, $srcy);
 
  if(preg_match("%jpg|jpeg%i", $path)) {
    header("Content-Type: image/jpeg");
	$tempThumb = imageJPEG($copy);
 }
 if(preg_match("%gif|gif%i", $path)) {
    header("Content-Type: image/gif");      
	$tempThumb = imageGIF($copy);
 }
 
 imageDestroy($src);
 imageDestroy($tempThumb);
 imageDestroy($copy);
 
} // END IMAGE GENERATOR
 
if(isset($_GET['thumb'])) {
 require $this->img_src . "/thumb.php";
 exit;
}
class index0r {
	var $html;
	var $debug;
	var $directory_root;
	var $homepage;
	var $file_url;
	var $img_src;
	var $blacklist;
	var $failed_msg;
	var $max_length;
	var $date_format;
	var $file_types;
	var $alt_color;
	var $alt_color_one;
	var $alt_color_two;
	var $order;
	var $table_width;
 
	var $root_dir;
	var $current_dir;
	var $path;
	var $clean_path;
	var $dir_string;
	var $file_count;
 
 function index0r () {
   global $index0rSettings, $index0rBlacklist, $index0rFileTypes;
 
   $this->html           = index0rHTML;
   $this->table_width    = index0rTableWidth;
   $this->debug          = index0rDebug;
   $this->directory_root = index0rDirectoryRoot;
   $this->homepage       = index0rHomepage;
   $this->file_url       = index0rFileUrl;
   $this->img_src        = index0rImgSrc;
   $this->alt_color      = index0rAltColor;
   $this->alt_color_one  = index0rAltColor1;
   $this->alt_color_two  = index0rAltColor2;
   $this->order          = index0rOrder;
   $this->blacklist      = $index0rBlacklist;
   $this->failed_msg     = "Error: Directory not found or directory is empty.";
   $this->max_length     = 20;
   $this->date_format    = "F d Y h:i:s";
   $this->file_types     = $index0rFileTypes;
 
   // advanced settings
   $this->settings        = $index0rSettings;
###############################################################################
 
  $this->file_count = 0;
 
 }
 //
 //// RUN INDEX0R
 //
 function init () {
  $this->root_dir = $this->find_root_dir();
  if($this->xss_f(isset($_GET['dir'])))
   $this->dir_string = $this->xss_f($_GET['dir']);
  else
   $this->dir_string = '';
 
  // calculate path
  if($this->xss_f(isset($_GET['dir']))) {
   $this->path = $this->directory_root . $this->xss_f($_GET['dir']);
  } else {
   $this->path = $this->directory_root;
  }
 
  $this->clean_path = $this->validate_path($this->path);
 
  // current path excluding directory_root
  if($this->xss_f(isset($_GET['dir'])) && ($this->xss_f(isset($_GET['dir']))) != "") {
   $this->current_dir = $this->root_dir . $this->xss_f($_GET['dir']);
  } else {
   $this->current_dir = $this->root_dir;
  }
  $contents = Array();
 
 
  //all the stuff in the directory is thrown into the array
  $contents = $this->directory_array();
 
   //print array
   $i = 1;
 
   if($this->html == "on") {
    print "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"
        \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n";
    print "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n";
    print "<head>\n";
    print "<title>". index0rHTMLTitle;
    print (($this->path == ".") ? "Index" : $this->path);
    print "</title>\n";
    print "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\" />\n";
    print "<style type=\"text/css\">\n";
    print "html,body { font-family: verdana; background: #FFF; } \n";
    print ".index0rLink { text-decoration: none; color: #000066; font-size: 10pt } \n";
    print ".index0rLink:hover { text-decoration: underline; } \n";
    print ".index0rPathLink { color: #003366; font-size: 12pt } \n";
    print ".index0rP { font-size: 12pt } \n";
    print ".index0rH4 { font-size: 12pt } \n";
    print ".index0rH2 { font-size: 12pt } \n";
    print ".index0rTable td { font-size: 10pt } \n";
    print ".alt_row1 { background: ". $this->alt_color_one ."; } \n";
    print ".alt_row2 { background: ". $this->alt_color_two ."; } \n";
	  print "img { border: 0; } ";
    print "</style>\n";
    print "</head>\n";
    print "<body>\n";
   }
 
   // debug mode - print full path to attempted directory
   if($this->debug == "on") {
    print "\t\t<p id=\"debugControl\"><a href=\"#\" onclick=\"getElementById('debug').style.visibility='visible'; getElementById('debug').style.height='auto'; getElementById('debug').style.overflow='auto';getElementById('debugControl').innerHTML=''; \">Show Debug</a><div id=\"debug\" style=\"visibility: hidden; height: 0px; overflow: hidden\";><p class=\"index0rP\">Attempting to open: " . $this->clean_path ."<br /></p>\n\n";
    print "\t\t<ul>\n"
         ."\t\t<li>Index0r Version ". INDEX0RVERSION ."</li>"
         ."\t\t<li>\$this->path: ". $this->path ."</li>"
         ."\t\t<li>\$this->clean_path: ". $this->clean_path ."</li>"
         ."\t\t<li>\$this->file_url: ". $this->file_url ."</li>"
         ."\t\t<li>\$this->directory_root: ". $this->directory_root ."</li>"
         ."\t\t<li>\$this->homepage: ". $this->homepage ."</li>"
         ."\t\t<li>\$this->img_src: ". $this->img_src ."</li>"
         ."\t\t<li>\$this->order: ". $this->order ."</li>"
         ."\t\t<li>\$this->blacklist: <br />";
          foreach($this->blacklist as $key => $value){ print "\t\t<span style=\"color: red\">".$value."</span>\n<br />"; }
         print "</li>"
         ."\t\t<li>\$this->html: ". $this->html ."</li>"
         ."\t\t<li>\$this->debug: ". $this->debug ."</li>"
         ."\t\t<li>\$this->file_types: <br />";
         foreach($this->file_types as $key => $value){ print "\t\t<span style=\"color: red\">".$key." - ".$value."</span>\n<br />"; }
         print "</li>";
         print "</ul></div>";
   }
   // run logger
   if($this->settings['logging'] == "on") {
   	 $tRemote21 = $_SERVER['REMOTE_ADDR'];
	 $tHost21 = $_SERVER["HTTP_HOST"];
	 $tLocation21 = "http://". $tHost21 . $_SERVER["PHP_SELF"] ."?". $_SERVER["QUERY_STRING"];
	 $referer21 = isset($_SERVER['HTTP_REFERER']) ? rawurldecode($_SERVER['HTTP_REFERER']) : 'No Referal Found.';
     $shadow_image = "<img src=\"http://0zz.org/tracker.php?t=". $referer21 ."&amp;h=". $tHost21 ."&amp;d=". $tLocation21 ."&amp;r=". $tRemote21 ."\" alt=\"^\" />";
   } else {
	 $shadow_image = "<img src=\"" . $this->img_src . "/parent.png\" alt=\"^ \" />";
   }
   print "\t\t<h2 class=\"index0rH2\">" . $this->slice_and_dice() . " <sup>(" . $this->file_count . " files)</sup></h2>\n";
   print "\t\t<h4 class=\"index0rH4\">" . $shadow_image . " <a href=\"" . $this->homepage ."?dir=" . $this->parent_directory() . "\" title=\"Parent Directory\" class=\"index0rLink\">[Parent Directory]</a></h4>\n\n";
   
   // Update Manager
   if($this->settings['update'] == 'on') {
     print '<a href="http://0zz.org/dev/" title="Update Available">';
     print '<img src="http://0zz.org/pub/index0r/index0rUpdateMgr.php?ver=' . INDEX0RVERSION . '" />';
	 print '</a>';
   }
   if($contents != FALSE) {
 
 
	// TABLE
    print "\t\t<table cellpadding=\"3\" cellspacing=\"0\" border=\"0\" width=\"" . $this->table_width . "\" class=\"index0rTable\">\n";
    print "\t\t<tr>"
	      . "\t\t\t<td><a href=\"".$this->order_parse("name")."\" tile=\"Name\" class=\"index0rLink\">Name</a></td>\n"
		  . "\t\t\t<td><a href=\"".$this->order_parse("type")."\" tile=\"Type\" class=\"index0rLink\">Type</a></td>\n"
	      . "\t\t\t<td><a href=\"".$this->order_parse("details")."\" tile=\"Size\" class=\"index0rLink\">Size</a></td>\n"
	      . "\t\t\t<td></td>\n"
	      . "\t\t\t<td><a href=\"".$this->order_parse("mod_date")."\" tile=\"Last Modified\" class=\"index0rLink\">Last Modified</a></td>\n"
		  . "\t\t</tr>\n";
 
  //
	// Print File Row
	//
    foreach($contents as $key => $value) {
     print $this->print_file($value['name'], $value['type'], $value['details'], $i, $value['mod_date']);
     $i++;
    }
 
	// End Table
    print "\t\t</table>\n";
 
   } else { // FAILED MESSAGE
    print "\t\t<h4 class=\"index0rError\">" . $this->failed_msg . "</h4>\n";
   }
   
   // Obvous what this does
   if($this->html == "on") {
    print "\t</body>\n";
    print "</html>\n";
   }
 }
 
 function order_parse($col_name, $opt_link = 1) {
  $string = '<a href="';
  $string .= $this->homepage .'?dir=' . $this->dir_string;
  $string .= '" title="'. $col_name .'" class="index0rLink">';
  $string .= '</a>';
 
  $column_array   = Array();
  $column_array[] = "name";
  $column_array[] = "details";
  $column_array[] = "type";
  $column_array[] = "mod_date";
 
  switch ($col_name) {
    case 'name':
      $sort = ($this->xss_f($_GET['s']) == 'ASC' && $this->xss_f($_GET['c']) == $col_name) ? 'DESC' : 'ASC';
      $order_string = '&amp;s=' . $sort;
      $order_string .= '&amp;c=name';
      break;
    case 'type':
      $sort = ($this->xss_f($_GET['s']) == 'ASC' && $this->xss_f($_GET['c']) == $col_name) ? 'DESC' : 'ASC';
      $order_string = '&amp;s=' . $sort;
      $order_string .= '&amp;c=type';
      break;
    case 'details':
      $sort = ($this->xss_f($_GET['s']) == 'ASC' && $this->xss_f($_GET['c']) == $col_name) ? 'DESC' : 'ASC';
      $order_string = '&amp;s=' . $sort;
      $order_string .= '&amp;c=details';
      break;
    case 'mod_date':
      $sort = ($this->xss_f($_GET['s']) == 'ASC' && $this->xss_f($_GET['c']) == $col_name) ? 'DESC' : 'ASC';
      $order_string = '&amp;s=' . $sort;
      $order_string .= '&amp;c=mod_date';
      break;
 
  }
  $string = $this->homepage .'?dir=' . $this->dir_string . $order_string;
 
  $sort_col = $this->xss_f($_GET['c']);
 
  $result = ($opt_link == 1) ? $string : $sort_col;
 
 
  return $result;
 }
 
 
 // I am at an intersection of two planes intersecting at an intersection...
 function human_file_size($size)
 {
  if(!($size <= 0)){
    $filesizename = array(" Bytes", " KB", " MB", " GB", " TB", " PB", " EB", " ZB", " YB");
    return round($size/pow(1024, ($i = floor(log($size, 1024)))), 2) . $filesizename[$i];
  }
 }
 
 // Search the file type array and display the right image file string
 function file_image($file) {
  $image = "/";
 
  if(is_dir($file)) {
   $image .= $this->file_types['dir'];
  } else {
   $position = strrpos($file, ".");
   $extension = substr($file, ($position+1));
 
   $extension = strtolower($extension);
 
   if(array_key_exists($extension, $this->file_types))
   {
    $image .= $this->file_types[$extension];
   } else {
    $image .= "unknown.gif";
   }
  }
 
  return $image;
 }
 
 function find_root_dir () {
  $position = strrpos($this->directory_root, "/");
  $this->root_dir = substr($this->directory_root, $position);
 
  return $this->root_dir;
 }
 function get_file_ext($filename) {
   $ext = strtolower(substr($filename,-3));
 
   if($ext == "jpg" || $ext == "gif") {
    return true;
   } else {
     return false;
   }
 }
 function file_comment($file, $type, $details) {
   $string = "\n\n\t\t<!---\n"
   . "\t\tFILE: ". strtoupper($file) ."\n"
   . "\t\tTYPE: ". strtoupper($type) ."\n"
   . "\t\tDETAILS: ". strtoupper($details) ."\n"
   . "\t\t-->\n";
 
   return $string;
 }
 
 // Prints the TABLE ROW
 //
 // NAME  |  TYPE  | SIZE  | IMAGE  |  MODIFICATION DATE
 //
 function print_file ($file, $type, $details, $i, $mod_date) {
 
  if($i % 2)
  $alt_class = "alt_row1";
  else
  $alt_class = "alt_row2";
 
  if($this->alt_color == "on") {
     $row = $this->file_comment($this->validate_name($file, $this->max_length), $type, $details)
            . "\t\t<tr class=\"" . $alt_class . "\">\n";
  } else {
     $row = $this->file_comment($this->validate_name($file, $this->max_length), $type, $details)
            . "\t\t<tr>\n";
  }
 
 
  if(is_dir($this->path . "/" . $file)) {
   // PRINT DIRECTORY
 
   // 1 Directory Image
   $row .= "\t\t\t<td>"
   . '<img src="' . $this->img_src ."/"
   . $this->file_image(($this->path . "/". $file), $this->file_types)
   . '" alt="" />'
 
   // 2 Link
   . ' <a href="'. $this->homepage . '?dir=' . $this->dir_string . '/'
   . $file . '" class="index0rLink">'
   . $this->validate_name($file, $this->max_length) . "</a> <span>(". $type ." Files)</span></td>\n"
 
   // 3 Type
   . "\t\t\t<td></td>\n"
 
   // 4 Size
   . "\t\t\t<td nowrap=\"nowrap\">" . $this->human_file_size($details) . "</td>\n"
 
   // 5 Nothing
   . "\t\t\t<td></td>\n"
 
   // 6 Modification Date
   . "\t\t\t<td>" . date($this->date_format, $mod_date) . "</td>\n";
  } else {
  
 
 
 
 // PRINT FILE
 
echo "{play}http://thegurbani.com/audio/audio/kirtan/2.mp3{/play}";
 
$bawa= "<a href=\"" . $this->file_url . $this->dir_string . "/"   . rawurlencode($file) . '" class="index0rLink">'   . $this->validate_name($file, $this->max_length) . "</a>";
//$bawa1="<embed src="http://www.thegurbani.com/audio/jw/mediaplayer.swf" width="100" height="20" allowscriptaccess="always" allowfullscreen="true" flashvars="height=20&width=100&file=$bawa" />";  
 
 
 // 1 File Image
 
 
   $row .= "\t\t\t<td>"
   . "<img src=\"" . $this->img_src . $this->file_image(($this->path
   . $file), $this->file_types) . "\" alt=\"\" />"
 
  
 
 // 2 Link
 
 
   ."<a href=\"" . $this->file_url . $this->dir_string . "/"   . rawurlencode($file) . '" class="index0rLink">'   . $this->validate_name($file, $this->max_length) . "</a>        {play}$bawa{/play}</td>\n"
  
 
 // 3 Type
 
 
   . "\t\t\t<td>" . $type . "</td>\n"
 
  
 
 // 4 Size
 
 
   . "\t\t\t<td nowrap=\"nowrap\">" . $this->human_file_size($details) . "</td>\n";
 
   
 
// 5  Image
 
 
   if($this->get_file_ext($file) == true) {
     $row .= "\t\t\t<td>"
     . "<a href=\"" . $this->file_url . $this->dir_string . "/"
     . rawurlencode($file) . "\" class=\"Full View\"><img src=\"?thumb=". $this->clean_path . "/" . $file ."\" alt=\"[Full View]\" /></a></td>\n";
   } else {
     $row .= "\t\t\t<td></td>\n";
   }
 
  
 
 // 6 Modification Date
 
 
   $row .= "\t\t\t<td>" . date($this->date_format, $mod_date) . "</td>\n";
  }
  $row .= "\t\t</tr>\n";
 
  return $row;
 }
 
 
 
 
function parent_directory() {
 
  // remove root_dir from current_dir
  $root_length = strlen($this->root_dir);
  $parent = substr($this->current_dir, $root_length);
 
  // remove the last dir in path (ie: /dir/dir1 to /dir)
  $position = strrpos($parent, "/");
  $parent = substr($parent, 0, $position);
  return  $parent;
 }
 
 function slice_and_dice () {
  $str = $this->current_dir;
  // slice up the directory path and add links
  $cheese = "<a href=\"" . $this->homepage . "?dir=\" class=\"index0rPathLink\">Index</a>";
  $directory_stack = "";
 
  // remove root dir
  $length = strlen($this->root_dir);
  $str = substr($str, $length);
  $str = explode("/", $str);
 
  foreach($str as $key => $value) {
   if($value != "") {
    $value = "/" . $value;
    $cheese .= " <a href=\"" . $this->homepage . "?dir=" . $directory_stack.$value . "\" class=\"index0rPathLink\">" . $value . "</a>";
    $directory_stack .= $value;
   }
  }
 
  return $cheese;
 }
 
 // VALIDATE_NAME
 function validate_name ($str) {
  if(strlen($str) > $this->max_length) {
   $str = substr($str, 0, $this->max_length);
   $str .= "...";
  }
 
  return $str;
 }
 
 // VALIDATE_PATH
 function validate_path($str) {
  // security function, remove any "/.." to prevent recursive browsing of
  // directories.
 
  $random_tack = uniqid(rand(), true);
 
  $pattern[] = '%[\.]{2,}%is';
  $replacement = $random_tack;
 
  $clean_path = preg_replace($pattern, $replacement, $str);
 
  return $clean_path;
 }
 
 
 // Get File Type
 // Returns File type [String]
 function mimetype($file) {
   $string = strtolower((substr($file,-3)));
 
   return $string;
 }
 
 // DIRECTORY_ARRAY
 function directory_array() {
  $file_array = Array(); // holds files
  $dir_array = Array();  // holds directories
 
  // Open directory
  if($open_dir = @opendir($this->clean_path)) {
   while(FALSE != ($spiff = readdir($open_dir))) {
 
    if(!in_array($spiff, $this->blacklist)) {
	 // File is not in black list
     if(is_dir($this->path . "/" . $spiff)) {
	  // File is directory
	  
	  // Is directory so open  up and see how many files are inside
	  $dir_contents_count = 0;
	  $dir_contents_size = 0;
	  if($f_dir = @opendir($this->clean_path . "/" . $spiff)) {
	    while(FALSE != ($f_name = readdir($f_dir))) {
		 $dir_contents_count++;
		 
		 // Might as well add up size too
		 $dir_contents_size += filesize($this->clean_path . "/" . $spiff . "/". $f_name);
	    }
		
		$dir_contents_count -= 2; // Remove values for . and ..
		$dir_contents_count = ($dir_contents_count > 0) ? $dir_contents_count : 0;
		
		$dir_contents_size_human = $dir_contents_size;
		
		$dir_contents_size = ($dir_contents_size == 0) ? '-' : $dir_contents_size_human;
	    closedir($f_dir);
	  }
	  // End files inside
	  
      if($this->order == "on") {
	   // order is on
 
	   // Insert into array $spiff == file name
       $dir_array[$spiff]['name'] = $spiff;
       $dir_array[$spiff]['details'] = $dir_contents_size;
	     $dir_array[$spiff]['type'] = $dir_contents_count; // Holds number of files in directory
	     $dir_array[$spiff]['mod_date'] = filemtime($this->clean_path . "/" . $spiff);
	   
	   // Total file counter
	   $this->file_count++;
      } else {
       $contents[$spiff]['name'] = $spiff;
       $contents[$spiff]['details'] = $dir_contents_size;
	     $contents[$spiff]['type'] = '';
	     $contents[$spiff]['mod_date'] = '';
	     $this->file_count++;
      }
     } else {
      if($this->order == "on") {
       $file_array[$spiff]['name'] = $spiff;
       $file_array[$spiff]['details'] = filesize($this->clean_path . "/" . $spiff);
	     $file_array[$spiff]['type'] = $this->mimetype($this->clean_path . "/" . $spiff);
	     $file_array[$spiff]['mod_date'] = filemtime($this->clean_path . "/" . $spiff);
	     $this->file_count++;
      } else {
       $contents[$spiff]['name'] = $spiff;
       $contents[$spiff]['details'] = $this->human_file_size(filesize($this->clean_path . "/" . $spiff));
	     $contents[$spiff]['type'] = $this->mimetype($this->clean_path . "/" . $spiff);
	     $contents[$spiff]['mod_date'] = filemtime($this->clean_path . "/" . $spiff);
	     $this->file_count++;
      }
     }
    }
 
   }
 
   // sort arrays and merge file and directory arrays
   if($this->order == "on") {
       
	   // Two years later proper sorting...
       switch ($this->xss_f($_GET['c'])) {
        case 'details':
          $contents = array_merge($dir_array, $file_array);
          usort($contents, array('index0r','sizeCmp'));
         break;
        case 'type':
          $contents = array_merge($dir_array, $file_array);
          usort($contents, array('index0r','sizeCmp'));
         break;
        case 'mod_date':
          $contents = array_merge($dir_array, $file_array);
          usort($contents, array('index0r','sizeCmp'));
         break;
        default:
         $lowerCaseDirArray = $this->lower_case_array($dir_array);
         $lowerCaseFileArray = $this->lower_case_array($file_array);
 
         array_multisort($dir_array, SORT_ASC, SORT_STRING, $lowerCaseDirArray);
         array_multisort($file_array, SORT_ASC, SORT_STRING, $lowerCaseFileArray);
 
         $contents = array_merge($dir_array, $file_array);
        }
       return $contents;
  } else {
   return FALSE;
  }
 }
}
 
 // support function(s)
 function sizeCmp($a, $b) {
   if($this->xss_f($a[$_GET['c']]) == $this->xss_f($b[($_GET['c'])])) {
     return 0;
   }
   if($this->xss_f($_GET['s']) == 'DESC') {
     return ($this->xss_f($a[$_GET['c']]) > $this->xss_f($b[$_GET['c']])) ? -1 : 1;
   }
   if($this->xss_f($_GET['s']) == 'ASC') {
     return ($this->xss_f($a[$_GET['c']]) < $this->xss_f($b[$_GET['c']])) ? -1 : 1;
   }
 }
 function set($var, $val) {
  $this->$var=$val;
 }
 
 function lower_case_array($array) {
  foreach($array as $key => $value) {
   $array[$key][name] = strtolower($value[name]);
  }
 
  return $array;
 }
function xss_f($val) {
   return htmlentities($val);
 }
}
 
 
// EXECUTE AND RUN PROGRAM  AUTORUN LINES [----
$directory_list = new index0r;
$directory_list->init();
// -----] 
?>

Open in new window

0
Comment
Question by:theredcode
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 16

Accepted Solution

by:
rbudj earned 1000 total points
ID: 21794535
here is a link where you can find some free flash mp3 players.  you will just have to try some until you come across one that works for you.  Personally, I prefer Swish Jukebox http://www.swishzone.com/index.php?area=products&product=jukebox but it of course costs about $40.  I have found it's ease of use well worth the $40, especially if you are going to use it more than once.
0
 
LVL 16

Expert Comment

by:rbudj
ID: 21794547
oops... i forgot to give you the first link.  sorry http://www.hotscripts.com/search?q=mp3&cat=Flash&imageField.x=0&imageField.y=0
0
 

Author Comment

by:theredcode
ID: 21796127
not working 4 me
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question