Hmm...got it so it doesn't return any errors, but all its doing is echoing either a 2 or a 1 instead of the tags. Any ideas?
<table id="music">
<tr>
<th>Preview</th>
<th>Name</th>
<th>Artist</th>
<th>Album</th>
<th>Filename</th>
<th>Delete?</th>
</tr>
<tbody>
<?php
if ($dir = opendir( TEMPLATEPATH . "/flash/music/" )) {
$files = array();
while (false !== ($file = readdir($dir))) {
$files[] = $file;
}
sort($files);
foreach($files as $file) {
if ($file != "." && $file != "..") {
$myfile = TEMPLATEPATH . "/flash/music/" .$file;
$id3v23 = array("TIT2","TALB","TPE1","TRCK","TDRC","TLEN","USLT");
$id3v22 = array("TT2","TAL","TP1","TRK","TYE","TLE","ULT");
$fsize = filesize($myfile);
$musicfile = fopen($myfile,"r");
$tag = fread($musicfile,$fsize);
$tmp = "";
fclose($musicfile);
if (substr($tag,0,3) == "ID3") {
$result['FileName'] = $file;
$result['TAG'] = substr($tag,0,3);
$result['Version'] = hexdec(bin2hex(substr($tag,3,1))).".".hexdec(bin2hex(substr($tag,4,1)));
}
if($result['Version'] == "4.0" || $result['Version'] == "3.0"){
for ($i=0;$i<count($id3v23);$i++){
if (strpos($tag,$id3v23[$i].chr(0))!= FALSE){
$pos = strpos($tag, $id3v23[$i].chr(0));
$len = hexdec(bin2hex(substr($tag,($pos+5),3)));
$result = substr($tag, $pos, 9+$len);
for ($a=0;$a<strlen($result);$a++){
$char = substr($result,$a,1);
if($char >= " " && $char <= "~") $tmp.=$char;
}
if(substr($tmp,0,4) == "TIT2") $result['Title'] = substr($tmp,4);
if(substr($tmp,0,4) == "TALB") $result['Album'] = substr($tmp,4);
if(substr($tmp,0,4) == "TPE1") $result['Author'] = substr($tmp,4);
if(substr($tmp,0,4) == "TRCK") $result['Track'] = substr($tmp,4);
if(substr($tmp,0,4) == "TDRC") $result['Year'] = substr($tmp,4);
if(substr($tmp,0,4) == "TLEN") $result['Lenght'] = substr($tmp,4);
if(substr($tmp,0,4) == "USLT") $result['Lyric'] = substr($tmp,7);
$tmp = "";
}
}
}
if($result['Version'] == "2.0"){
for ($i=0;$i<count($id3v22);$i++){
if (strpos($tag,$id3v22[$i].chr(0))!= FALSE){
$pos = strpos($tag, $id3v22[$i].chr(0));
$len = hexdec(bin2hex(substr($tag,($pos+3),3)));
$result = substr($tag, $pos, 6+$len);
for ($a=0;$a<strlen($result);$a++){
$char = substr($result,$a,1);
if($char >= " " && $char <= "~") $tmp.=$char;
}
if(substr($tmp,0,3) == "TT2") $result['Title'] = substr($tmp,3);
if(substr($tmp,0,3) == "TAL") $result['Album'] = substr($tmp,3);
if(substr($tmp,0,3) == "TP1") $result['Author'] = substr($tmp,3);
if(substr($tmp,0,3) == "TRK") $result['Track'] = substr($tmp,3);
if(substr($tmp,0,3) == "TYE") $result['Year'] = substr($tmp,3);
if(substr($tmp,0,3) == "TLE") $result['Lenght'] = substr($tmp,3);
if(substr($tmp,0,3) == "ULT") $result['Lyric'] = substr($tmp,6);
$tmp = "";
}
}
}
echo "<tr>";
echo "<td><div class=\"ui360\" style=\"float:left;display:inline;margin-right:16px\"><a href=\"";?><?php bloginfo('template_directory'); ?><?php echo "/flash/music/".rawurlencode($file)."\" title=\"360 demo: Angry Cow Sound\" class=\"norewrite exclude button-exclude inline-exclude\"></a></div></td>";
echo "<td>" . $result["Title"] . "</td>";
echo "<td>" . $result["Author"] . "</td>";
echo "<td>" . $result["Album"] . "</td>";
echo "<td><a href=\""; ?><?php bloginfo('template_directory'); ?><?php echo "/flash/music/".rawurlencode($file)."\">$file</a></td>";
echo "<td>
<form action=\"#\" method=\"POST\">
<input type=\"hidden\" name=\"filename\" value=\"$file\">
<input type=\"hidden\" name=\"delete\" value=\"true\">
<input type=\"hidden\" name=\"_submit_delete_check\" value=\"1\"/>
<input type=\"submit\" value=\"Delete\">
</form>
</td>
";
echo "</tr>";
}
}
}
?>
</tbody>
</table>