ok awesome... Actually it wouldnt read from a database... but using I think function mime_content_type($filename) to search through all the .mp3's... Listing them in that bold area... The directory would be ./music/
In the mean time I have done this coding (altering) which works but has nothing to do with a FULL mp3 flash music player.... But a single flash player per a song, plus the ability to download the song and file size of song.... BTW I still would like to know how to get this code you have done working right (for what i would like to see)...
Here is the code for single flash mini players per a song...
require("dbconn.php");
echo "<script type=\"text/javascript\" src=\"swfobject.js\"></script>";
if(!function_exists('mime_content_type')) {
function mime_content_type($filename) {
$mime_types = array(
'txt' => 'text/plain',
'htm' => 'text/html',
'html' => 'text/html',
'php' => 'text/html',
'css' => 'text/css',
'js' => 'application/javascript',
'json' => 'application/json',
'xml' => 'application/xml',
'swf' => 'application/x-shockwave-flash',
'flv' => 'video/x-flv',
// images
'png' => 'image/png',
'jpe' => 'image/jpeg',
'jpeg' => 'image/jpeg',
'jpg' => 'image/jpeg',
'gif' => 'image/gif',
'bmp' => 'image/bmp',
'ico' => 'image/vnd.microsoft.icon',
'tiff' => 'image/tiff',
'tif' => 'image/tiff',
'svg' => 'image/svg+xml',
'svgz' => 'image/svg+xml',
// archives
'zip' => 'application/zip',
'rar' => 'application/x-rar-compressed',
'exe' => 'application/x-msdownload',
'msi' => 'application/x-msdownload',
'cab' => 'application/vnd.ms-cab-compressed',
// audio/video
'wma' => 'audio/ x-ms-wma',
'mp3' => 'audio/mpeg',
'qt' => 'video/quicktime',
'mov' => 'video/quicktime',
// adobe
'pdf' => 'application/pdf',
'psd' => 'image/vnd.adobe.photoshop',
'ai' => 'application/postscript',
'eps' => 'application/postscript',
'ps' => 'application/postscript',
// ms office
'doc' => 'application/msword',
'rtf' => 'application/rtf',
'xls' => 'application/vnd.ms-excel',
'ppt' => 'application/vnd.ms-powerpoint',
// open office
'odt' => 'application/vnd.oasis.opendocument.text',
'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
);
$ext = strtolower(array_pop(explode('.',$filename)));
if (array_key_exists($ext, $mime_types)) {
return $mime_types[$ext];
}
elseif (function_exists('finfo_open')) {
$finfo = finfo_open(FILEINFO_MIME);
$mimetype = finfo_file($finfo, $filename);
finfo_close($finfo);
return $mimetype;
}
else {
return 'application/octet-stream';
}
}
}
function mb($s){
$size=filesize($s)/1024/1024;
return (round($size,1)." Mb");
}
function trimmer( $a )
{
$arr = array( '.wma','.mp3', '.', '[_quote2_mark_]', '[_and_]', '[_quote_mark_]','_');
$arr2 = array( '' ,'' , '.', '"' , '&', "'" , ' ');
return( ucwords( str_replace( $arr,$arr2 , $a ) ) );
}
function f_dir( $kvtnev )
{
$kvt = opendir( $kvtnev );
while ( gettype( $fajl = readdir( $kvt ) ) !== "boolean" ) {
/* if this is a folder*/
if ( is_dir( "$kvtnev/$fajl" ) AND $fajl != '.' AND $fajl != '..' )
{
if($fajl==".." OR $fajl==".")
continue;
$rexp_string_filter["csb"]="^[A-Z ][__]*$";
$check=ereg($rexp_string_filter["csb"], $fajl);
if(!$check)
{
$newfilename="";
$newfilename=str_replace(" ","_",$fajl);
$newfilename=str_replace("__","",$newfilename);
$newfilename=strtolower($newfilename);
rename($kvtnev."/".$fajl , $kvtnev."/".$newfilename) or die("Could not rename the file:".$fajl);
$fajl=$newfilename;
}
print '<blockquote><table border="1" bordercolor="#000000" width="485">
<tbody>';
print "\r
<tr>
<td width=\"485\" bgcolor=\"#0000CC\"><div align=\"left\" class=\"gypsybody style8\">
<div align=\"center\"><span class=\"style1\"><strong>".trimmer($fajl)."</strong></span></div>
</div></td>
</tr>
";
f_files("$kvtnev/$fajl");
print '
</tbody>
</table></blockquote>';
}
}
closedir( $kvt );
}
function f_files( $kvtnev )
{
print '<table width="485" bgcolor="#999999">';
print "\r
<tr>
<td width=\"75\" bgcolor=\"#000099\"><div align=\"center\" class=\"gypsybody style1\">Streaming</div></td>
<td width=\"284\" bgcolor=\"#000099\"><div align=\"center\"><span class=\"gypsybody style1\">Title Of Song -</span> <span class=\"gypsybody style2\">click to download </span></div></td>
<td width=\"110\" bgcolor=\"#000099\"><div align=\"center\"><span class=\"gypsybody style1\">File Size </span></div></td>
</tr>";
$color1 = "#cccccc";
$color2 = "#FFFFFF";
$row_count = 0;
$kvt = opendir( $kvtnev );
while ( gettype( $fajl = readdir( $kvt ) ) !== "boolean" )
{
if($fajl==".." OR $fajl==".")
continue;
$rexp_string_filter["csb"]="^[A-Z ]*$";
$check=ereg($rexp_string_filter["csb"], $fajl);
if (!$check) //if it has capital letters, or spaces
{
$newfilename="";
$newfilename=str_replace(" ","_",$fajl);
$newfilename=str_replace("__","",$newfilename);
$newfilename=str_replace("'","[_quote_mark_]",$newfilename);
$newfilename=str_replace('&',"[_and_]",$newfilename);
$newfilename=str_replace('"','[_quote2_mark_]' ,$newfilename);
$newfilename=strtolower($newfilename);
rename($kvtnev."/".$fajl , $kvtnev."/".$newfilename) or die("Could not rename the file:".$fajl);
$fajl=$newfilename;
}
if ( mime_content_type( "$kvtnev/$fajl" )=="audio/mpeg" OR mime_content_type( "$kvtnev/$fajl" )=="audio/ x-ms-wma" )
{
$url = htmlspecialchars( "$kvtnev/$fajl" );
$row_color = ($row_count % 2) ? $color1 : $color2;
// print "==== $fajl<br>";
print "\r
<tr>
<td width=\"75\" bgcolor=\"$row_color\"><div align=\"center\" class=\"gypsybody\"><div id=\"$fajl\">
This text will be replaced by the flash music player.
</div>
<script type=\"text/javascript\">
var so = new SWFObject(\"playerMini.swf\", \"mymovie\", \"75\", \"30\", \"7\", \"#FFFFFF\");
so.addVariable(\"autoPlay\", \"no\");
so.addVariable(\"soundPath\", \"$url\");
so.write(\"$fajl\");
</script></div></td>
<td width=\"284\" bgcolor=\"$row_color\"><div align=\"left\" class=\"gypsybody\">
<div align=\"center\"><a href=\"$url\" class=\"gypsybody style15\">".trimmer($fajl)."</a></div>
</div></td>
<td width=\"110\" bgcolor=\"$row_color\"><div align=\"left\" class=\"gypsybody\">
<div align=\"center\">". mb("$kvtnev/$fajl"). "</div>
</div></td>
</tr>";
$row_count++;
}
}
}
print '<style type="text/css">
<!--
.style1 {color: #FFFFFF}
-->
</style>';
f_dir( "music");