Parašė dovix· 2009 Kov. 9 18:03:20
<?php
error_reporting(0);
$scdef = "<center>Radijas yra netransliuojamas.</center>"; // Default station name to display when server or stream is down
$scip = "IP"; // ip or url of shoutcast server (DO NOT ADD
HTTP:// don't include the port)
$scport = "PORTAS"; // port of shoutcast server
$scpass = "SLAPTAZODIS"; // password to shoutcast server
$maxusers = "100"; //Kiek vienu sykiu klausosi zmoniu
//End configuration
error_reporting(0);
$scsuccs = NULL;
$page = NULL;
include('config_radio.php'); //you may edit this path to fit your server environment otherwise leave it alone
$scfp = fsockopen("$scip", $scport, &$errno, &$errstr, 30);
if(!$scfp) {
$scsuccs=1;
echo''.$scdef.' ';
}
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", "MAXLISTENERS", "AIM");
$y=0;
while (isset($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") || ($loop[$y] == "AIM"))
$$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 (isset($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++;
}
$daina = str_replace('_',' ',substr ($song[0],0,90));
//end song info
fclose($scfp);
}
//display stats
if($streamstatus == "1"){
switch ($aim) {
case 'Serveris': $aimlogo = "server"; break;
case 'Dj Labas': $aimlogo = "djlabas"; break;
case 'DJ_Gramas': $aimlogo = "Gramas"; break;
case 'Gramas': $aimlogo = "DJ Gramas"; break;
default: $aimlogo = "neradj";
}
$_SESSION['djus'] = $aim;
echo'<div align="center">
<table cellpadding="0" cellspacing="0" width="1">
<!-- MSTa*keiksmai*ype="nolayout" -->
<tr>
<td height="17">
<p align="center">
<font face="admin" style="font-size: 8pt" color="#3E1710"><b><img src="/radijas/dj/'.$aimlogo.'.jpg"></b></font>
<br>
<font face="Arial" style="font-size: 8pt" color="#000000">Dj: '.$aim.'</font></td></p>
</tr>
<tr>
<td height="17" valign="bottom" bgcolor="fffff">
<div align="center">
<table cellpadding="0" cellspacing="0" width="130">
<tr>
<td height="17">
<p align="center">
<font face="Tahoma" style="font-size: 8pt" color="#3E1710"><b>Daina:</b></font>
<marquee behavior="right"><font face="Tahoma" style="font-size: 8pt" color="#000000">'.$song[0].'</font></td></marquee>
</tr>
<tr>
<td height="17">
<p align="center">
<font face="admin" style="font-size: 8pt" color="#3E1710"><b>Klausytojų:</b></font>
<font face="Arial" style="font-size: 8pt" color="#000000">'.$currentlisteners.' / '.$maxlisteners.' </font></td></p>
</tr>
</tr>
</table>
</div>
</td>
</tr>
<tr>
<td>
</td>
</tr>
</table>
</div>
<br>
<center><a href="http://'.$scip.':'.$scport.'/listen.pls"><img src="/winamp.png" width="50" height="50"></a><br>';
}
if($streamstatus == "0")
{
echo'<center><font size="2" face="tahoma" color="#6C6D7B">Radijas yra isjungtas.</font></center>';
}
?>
<html><center>
</html>
<?
closeside_panel();
?>