Ocena wątku:
  • 0 głosów - średnia: 0
  • 1
  • 2
  • 3
  • 4
  • 5
problem z kodem
#1
At 
Cześć mam do was prośbe.
Mam kod php do statystyk shoutcast :
Kod:
<center>
  <?php
// Shoutcast Server Stats
// Parses shoutcasts xml to make an effective stats thing for any website
// ©2004-2005 Daniel Brown http://www.gmtt.co.uk
// Please refer to the readme file for use.
include('config_radio.php');  //you may edit this path to fit your server environment otherwise leave it alone
$scfp = fsockopen("$scip", $scport, &$errno, &$errstr, 10);
if(!$scfp) {
  $scsuccs=1;
echo''.$scdef.' Server 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", "[genre]");
$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"){
//you may edit the html below, make sure to keep variable intact
echo'
<html>

<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<META HTTP-EQUIV="REFRESH" CONTENT="30;URL=radio_stats.php">
<link rel=stylesheet href="" type="text/css">
<title>'.$scdef.'</title>
</head>

<body text="" bgcolor="">




<p align="center"><center>

<font face="arial" size="2"><b>&nbsp;Audycja:</b>&nbsp;'.$servertitle.'</font></p>



<font face="arial" size="2" color=""><b>

    Teraz gramy:</b> '.$song[0].'</font></p>
    <b>


    <font face="arial" size="2">
    Ostatnio odtwarzane:</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>
</font>
<BR>
</p></p>
</body>

</html>';
}
if($streamstatus == "0")
{
//you may edit the html below, make sure to keep variable intact
echo'
<html>

<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<META HTTP-EQUIV="REFRESH" CONTENT="10;URL=radio_stats.php">
<link rel=stylesheet href="" type="text/css">
<title>Ascaria - radio internetowe</title>
</head>

<body text="" bgcolor="">
<font size="3"><blink>Nikt w tej chwili nie nadaje!</blink></font>

</body>

</html>';
}
?>
</center>

tylko ze tutaj nie ma zeby wyswietlalo prezentera, wiec chcialem dokleić to:
Kod:
// [genre]
$m[0]="Stream Genre:";
$m[1]="Stream URL:";
$mp[0]=strpos($in,$m[0]);
$mp[1]=strpos($in,$m[1]);
$ml[0]=strlen($m[0]);
$ml[1]=strlen($m[1]);

$tmp[1]=trim( substr( $in , $mp[0] + $ml[0] , $mp[1]-$mp[0]-$ml[1]-2 ) );

if( $tmp[1] ) $dat[genre] = $tmp[1];
else $dat[genre] = "err";

a pod tym:
Kod:
<font face="arial" size="2"><b>&nbsp;Audycja:</b>&nbsp;'.$servertitle.'</font></p>
to:
Kod:
<font face="arial" size="2"><b>&nbsp;Prezenter:</b>&nbsp;'.$genre.'</font></p>
ale coś nie pykło i nie chodzi.
co mam zrobic zeby to zadzialalo?
Odpowiedz


Podobne wątki…
Wątek: Autor Odpowiedzi: Wyświetleń: Ostatni post
  Problem z kodem html niewyrzyty777 16 10,981 18-06-2011, 17:19
Ostatni post: niewyrzyty777
  Problem z kodem na karcie produktu dkk 4 3,339 06-01-2011, 03:07
Ostatni post: dkk
  [HTML][CSS] Problem z kodem szablonu allegro dragu 4 3,710 22-10-2010, 18:44
Ostatni post: dragu
  Problem z kodem php kosa574 0 1,474 11-08-2010, 01:52
Ostatni post: kosa574
  Problem z kodem neneth 18 12,912 31-07-2010, 04:27
Ostatni post: Pedro84

Skocz do:


Użytkownicy przeglądający ten wątek:
Sponsorzy i przyjaciele
SeoHost.pl