Temos pavadinimas: WordPress, Shopify ir PHPFusion programuotojų bendruomenė :: Nerodo grajančios dainos

Parašė Gytisz· 2014 Kov. 18 19:03:09
#6

Tavo vietoj daryčiau šitaip:


 
 
<?php
error_reporting(0);
$scdef = "Šiuo metu radija yra."; // Default station name to display when server or stream is down
$scip = "localhost"; // ip or url of shoutcast server (DO NOT ADD <a href='HTTP://' target='_blank'><span style='color:005C5B'>HTTP://</span></a> don't include the port)
$scport = "8000"; // port of shoutcast server
$scpass = "changeme"; // password to shoutcast server
//End configuration
error_reporting(0);
$scsuccs = NULL;
$page = NULL;
$scfp = @fsockopen("$scip", $scport, $errno, $errstr, 30);
if(!$scfp) {
$scsuccs=1;
echo''.$scdef.'išjungta';
}
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", "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]);
$AIM[$t] = ereg_replace(".*<SERVERTITLE>", "", $page);
$AIM[$t] = ereg_replace("</SERVERTITLE>.*", "", $pageed);
$r++;
}
$daina = str_replace('_',' ',substr ($song[0],0,90));
//end song info
 
fclose($scfp);
}
 
//Eterio Foto
if($streamstatus == "1"){
switch ($aim) {
case 'Dj Dede': $aimlogo = "Dede"; break;
case 'dJ BaNgIs': $aimlogo = "BaNgIs"; break;
case 'Dj Montis': $aimlogo = "Montis"; break;
case 'Dj': $aimlogo = "foto pavadinimas"; break;
case 'Dj': $aimlogo = "foto pavadinimas"; break;
case 'Dj': $aimlogo = "foto pavadinimas"; break;
default: $aimlogo = "dj";
}
$_SESSION['djus'] = $aim;
 
// daina groja
echo '<div id="now_playing">';
echo '<div id="now">Now playing:</div>';
echo '<div id="line"></div>';
echo '<div id="playing">';
echo''.$daina.'';
echo '</div></div>';
 
}
if($streamstatus == "0")
{
echo'<font size="2" face="tahoma" color="#6C6D7B">Šiuo metu radija yra išjungta.</font>';
}
?>
 
 


Tada iš dizainos kodo išimam šias eilutes:

<div id="now_playing">
 
<div id="now">Now playing:</div>
 
<div id="line"></div>
 
<div id="playing"><?php include_once "daina.php"; echo $daina ?></div>
</div>
 


ir pakeičiam į


<?php include_once "daina.php"; ?>


beto galbūt neįrašiai serverio duomenų kad nerodo kokia daina groja :] ?

Redagavo Gytisz· 2014 Kov. 18 19:03:29