Amir
09-03-2007, 10:34 AM
Hey! I have some fully-operating statistics on my website, and there's only a few small problems. I got them off HabboxForum and it says I have a 200 listener radio (which I havent unfortunately) and that it's AceHabbo when there is no DJ on air. These are the codes:
<html>
<head>
<TITLE>", "", $songatime[$r]);
$song[$t] = ereg_replace("</TITLE>
<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">
<link rel=stylesheet href="" type="text/css">
<title>'.$scdef.'</title>
<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>AceHabbo Is Curently Offline</title>
<style type="text/css">
body {
background: transparent;
}
</style>
<style type="text/css">
body {
background: transparent;
}
</style>
</head>
<body style="background-image: url('images/radiostats.gif')">
<?php
// Shoutcast Server Stats
// Parses shoutcasts xml to make an effective stats thing for any website
// Coded by Daniel Brown. Edited by Nick Coates [SharpeHosting.com] [SharpeNews] KEEP THIS INTACT!!!
// 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.' AceHabbo Is Currently 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]>
<p><font color="#FFFFFF">", "", $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(".*</font><SONGHISTORY></songhistory><font color="#FFFFFF">", "", $page);
$pageed = ereg_replace("</font><SONGHISTORY></songhistory><font color="#FFFFFF">.*", "", $pageed);
$songatime = explode("</font><SONG></song><font color="#FFFFFF">", $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">
<link rel=stylesheet href="" type="text/css">
<title>'.$scdef.'</title>
</head>
</font>
<body text="" bgcolor="e9e6f4" style="background-image: url('images/radiostats.gif')">
<font face="verdana" size="1"><b>
<font color="#FFFFFF">DJ</font><font color="#FFFFFF">:</font></b><font color="#FFFFFF"> '.$servertitle.'</font></font><font color="#FFFFFF"></p>
</font>
<font color="black">
<p></p>
<p><font face="verdana" size="1" color="#FFFFFF"><b>Listeners:</b> '.$currentlisteners.'
/ 50</font></p>
<p></p>
<p>
<font face="verdana" size="1" color="#FFFFFF"><b>
Current Song:</b> '.$song[0].'</font></p>
<p></p>
<b>
</body>
</html>
<font color="#FFFFFF">
<p>';
}
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="30;URL=radio_stats.php">
<link rel=stylesheet href="" type="text/css">
<title>AceHabbo Is Curently Offline</title>
</head>
<style type="text/css">
body {
background: transparent;
}
</style>
</head>
<body style="background-image: url('images/radiostats.gif')">
</p>
<div><center>
<p><font face="verdana" size="1">GoRock FM Is Currently Offline
</body>
</html>';
}
?></font> </p>
</body>
Thats the radio stats from Notepad.
AND...
This is the config for the radio from Notepad:
<?php
//////////////////////////////////////////////////////////////////////////////////////////////
// Stats Information
// Grabs the xml from your radio server and displays it in a iframe that refreshes every 30 seconds.
//////////////////////////////////////////////////////////////////////////////////////////////
//Configuration
$scdef = "Oh noes! Go-RockFM is off-air!"; // Default station name to display when server or stream is down
$scip = "simplex-technologies.com"; // ip or url of shoutcast server
$scport = "8004"; // port of shoutcast server
$scpass = "changeme"; // password to shoutcast server
//End configuration
?>
I have original copies of this, so I will save all re-coded files (please post them both even edited or not)
And I will +Rep everyone (who I can) who post ANY help on this thread. Many thanks!
<html>
<head>
<TITLE>", "", $songatime[$r]);
$song[$t] = ereg_replace("</TITLE>
<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">
<link rel=stylesheet href="" type="text/css">
<title>'.$scdef.'</title>
<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>AceHabbo Is Curently Offline</title>
<style type="text/css">
body {
background: transparent;
}
</style>
<style type="text/css">
body {
background: transparent;
}
</style>
</head>
<body style="background-image: url('images/radiostats.gif')">
<?php
// Shoutcast Server Stats
// Parses shoutcasts xml to make an effective stats thing for any website
// Coded by Daniel Brown. Edited by Nick Coates [SharpeHosting.com] [SharpeNews] KEEP THIS INTACT!!!
// 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.' AceHabbo Is Currently 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]>
<p><font color="#FFFFFF">", "", $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(".*</font><SONGHISTORY></songhistory><font color="#FFFFFF">", "", $page);
$pageed = ereg_replace("</font><SONGHISTORY></songhistory><font color="#FFFFFF">.*", "", $pageed);
$songatime = explode("</font><SONG></song><font color="#FFFFFF">", $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">
<link rel=stylesheet href="" type="text/css">
<title>'.$scdef.'</title>
</head>
</font>
<body text="" bgcolor="e9e6f4" style="background-image: url('images/radiostats.gif')">
<font face="verdana" size="1"><b>
<font color="#FFFFFF">DJ</font><font color="#FFFFFF">:</font></b><font color="#FFFFFF"> '.$servertitle.'</font></font><font color="#FFFFFF"></p>
</font>
<font color="black">
<p></p>
<p><font face="verdana" size="1" color="#FFFFFF"><b>Listeners:</b> '.$currentlisteners.'
/ 50</font></p>
<p></p>
<p>
<font face="verdana" size="1" color="#FFFFFF"><b>
Current Song:</b> '.$song[0].'</font></p>
<p></p>
<b>
</body>
</html>
<font color="#FFFFFF">
<p>';
}
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="30;URL=radio_stats.php">
<link rel=stylesheet href="" type="text/css">
<title>AceHabbo Is Curently Offline</title>
</head>
<style type="text/css">
body {
background: transparent;
}
</style>
</head>
<body style="background-image: url('images/radiostats.gif')">
</p>
<div><center>
<p><font face="verdana" size="1">GoRock FM Is Currently Offline
</body>
</html>';
}
?></font> </p>
</body>
Thats the radio stats from Notepad.
AND...
This is the config for the radio from Notepad:
<?php
//////////////////////////////////////////////////////////////////////////////////////////////
// Stats Information
// Grabs the xml from your radio server and displays it in a iframe that refreshes every 30 seconds.
//////////////////////////////////////////////////////////////////////////////////////////////
//Configuration
$scdef = "Oh noes! Go-RockFM is off-air!"; // Default station name to display when server or stream is down
$scip = "simplex-technologies.com"; // ip or url of shoutcast server
$scport = "8004"; // port of shoutcast server
$scpass = "changeme"; // password to shoutcast server
//End configuration
?>
I have original copies of this, so I will save all re-coded files (please post them both even edited or not)
And I will +Rep everyone (who I can) who post ANY help on this thread. Many thanks!