Lon3sWolf_VtG8
Mitglied
Das kann daran liegen das die else schleife vergessen wurde , jedoch keine panik:
Probier dies mal, es müsste klappen.
Mit Freundlischen Grüßen
Lon3sWolf_VtG8
PHP:
<?php
// Shoutcast Server Stats
// Nimmt die xml-datei von deinem radio server und zeigt sie in einem iframe der alle 30 sekunden refresht.
// ©[-D3bian-]|VtG8| & Lones_Wolf www.loneswolf.com
include('config_radio.php');
$scfp = fsockopen("$scip", $scport, &$errno, &$errstr, 30);
if(!$scfp) {
$scsuccs=1;
echo''.$scdef.' is Offline';
}
if($scsuccs!=1){
fputs($scfp,"GET /admin.cgi?pass=$scpass&mode=viewxml HTTP/1.0\r\nUser-Agent: SHOUTcast Song Status (Mozilla Compatible)\r\n\r\n");
while(!feof($scfp)) {
$page .= fgets($scfp, 1000);
}
#################################################################################################### ##################
/////////////////////////part 1 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//define xml elements
$loop = array("STREAMSTATUS", "BITRATE", "SERVERTITLE", "CURRENTLISTENERS");
$y=0;
while($loop[$y]!=''){
$pageed = ereg_replace(".*<$loop[$y]>", "", $page);
$scphp = strtolower($loop[$y]);
$$scphp = ereg_replace("</$loop[$y]>.*", "", $pageed);
if($loop[$y]==SERVERGENRE || $loop[$y]==SERVERTITLE || $loop[$y]==SONGTITLE || $loop[$y]==SERVERTITLE)
$$scphp = urldecode($$scphp);
// uncomment the next line to see all variables
//echo'$'.$scphp.' = '.$$scphp.'<br>';
$y++;
}
//end intro xml elements
#################################################################################################### ##################
#################################################################################################### ##################
/////////////////////////part 2\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
//get song info and history
$pageed = ereg_replace(".*<SONGHISTORY>", "", $page);
$pageed = ereg_replace("<SONGHISTORY>.*", "", $pageed);
$songatime = explode("<SONG>", $pageed);
$r=1;
while($songatime[$r]!=""){
$t=$r-1;
$playedat[$t] = ereg_replace(".*<PLAYEDAT>", "", $songatime[$r]);
$playedat[$t] = ereg_replace("</PLAYEDAT>.*", "", $playedat[$t]);
$song[$t] = ereg_replace(".*<TITLE>", "", $songatime[$r]);
$song[$t] = ereg_replace("</TITLE>.*", "", $song[$t]);
$song[$t] = urldecode($song[$t]);
$dj[$t] = ereg_replace(".*<SERVERTITLE>", "", $page);
$dj[$t] = ereg_replace("</SERVERTITLE>.*", "", $pageed);
$r++;
}
//end song info
fclose($scfp);
}
//display stats
if($streamstatus == "1"){
//Hier kannst du den HTML Code noch verändern, passt nur auf das di Variablen intakt bleiben
echo'
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<META HTTP-EQUIV="REFRESH" CONTENT="30;URL=hier kommt der name deiner .php seite rein">
<link rel=stylesheet href="" type="text/css">
<title>'.$scdef.'</title>
</head>
<body text="" bgcolor="">
<p align="center"><center>
<font face="arial" size="2"><b> Server Name:</b> '.$servertitle.'</font></p>
<font face="arial" size="2"><b> Listeners:</b> '.$currentlisteners.' / 30</font></p>
<font face="arial" size="2"><b> Bitrate:</b> '.$bitrate.'</font></p>
<font face="arial" size="2" color=""><b>
Current Song:</b> '.$song[0].'</font></p>
<b>
<font face="arial" size="2">
Past Songs:</font></b>
<font color=""><font face="arial" size="2">
<p align="center">
<b>1.</b> '.$song[1].'<BR>
<b>2.</b> '.$song[2].'<BR>
<b>3.</b> '.$song[3].'<BR>
<b>4.</b> '.$song[4].'<BR>
<b>5.</b> '.$song[5].'<BR>
<b>6.</b> '.$song[6].'<BR>
</font>
<BR>
</p></p>
</body>
</html>';
}
elseif($streamstatus == "0"){
echo'
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<META HTTP-EQUIV="REFRESH" CONTENT="30;URL=hier kommt der name deiner .php seite rein">
<link rel=stylesheet href="" type="text/css">
<title>'.$scdef.'</title>
</head>
<body text="" bgcolor="">
<p align="center">'.$scdef.'<center>
</body>
</html>';
}
?>
Probier dies mal, es müsste klappen.
Mit Freundlischen Grüßen
Lon3sWolf_VtG8
Zuletzt bearbeitet: