Citation :
<HTML>
<BODY bgcolor=black text=white>
<?php
$fichier = "xmms_stats.xml";
$is_time = 0;
function gestionnaire_texte($id_analyseur, $texte)
{ global $is_time;
global $is_unix_time;
if (!($texte== "\n" )){
if($is_time==0)
print $texte;
else if ($is_time==1){
print (intval($texte/1000/60))."m ".(($texte/1000)%60)."s";
$is_time=0;
}
else if ($is_time==2){
echo gmdate("M d Y H:i:s", $texte);
$is_time=0;
}
}
}
function startElement($parser, $name, $attrs) {
global $is_time;
if($name == "SONG" )
print "<TR>\n";
else if($name == "LENGTH" || $name == "LISTENTIME" ){
$is_time=1;
print "<TD><CENTER><font size=1>";
}
else if($name == "HITS" ){
print "<TD><CENTER><font size=1>";
}
else if($name == "TITLE" )
print "<TD><font size=1>";
else if($name == "LAST" ){
$is_time=2;
print "<TD><CENTER><font size=1>";
}
}
function endElement($parser, $name) {
if($name == "/SONG" )
print "</TR>\n";
else if($name == "/LENGTH" || $name == "/HITS" )
print "</FONT></CENTER></TD>";
else if($name == "/TITLE" )
print "</FONT></TD>";
}
$id_fichier = fopen($fichier,"r" );
$donnee_XML = fread($id_fichier, filesize($fichier));
$id_analyseur = xml_parser_create();
xml_parser_set_option($id_analyseur, XML_OPTION_CASE_FOLDING, true);
xml_set_character_data_handler($id_analyseur, "gestionnaire_texte" );
xml_set_element_handler($id_analyseur,"startElement", "endElement" );
print "<TABLE border=0>\n";
print "<TR>\n<TD><CENTER>Titre<BR><BR></CENTER></TD><TD> Nombre d'écoute <BR><BR></TD><TD>Durée<BR><BR></TD><TD>Temps d'écoute<BR><BR></TD><TD>Derniere écoute<BR><BR></TD></TR>";
xml_parse($id_analyseur, $donnee_XML, feof($id_fichier));
print "</TABLE>\n";
xml_parser_free($id_analyseur);
?>
<p align="right"><a href="http://oute.org/mystuff/xmms_stats_stuff.php">Powered by xmms-stats</a></font></p>
</BODY></HTML>
|