PDA

View Full Version : Radio stats



-Adam
19-12-2008, 08:36 PM
Could somebody supply me with a decent radio stats script, And a tutorial on how to instal.. +rep.

-Adam
19-12-2008, 08:50 PM
Btw, I know all my radio details.

RyanDOT
19-12-2008, 08:52 PM
http://www.habboring.com/hr2-webscripts.htm

-Adam
19-12-2008, 09:00 PM
Iv already looked at them, I cant get any of them working thats why I need a tutorial

RyanDOT
19-12-2008, 09:06 PM
I install a DJ panel with the script with it for free, cos im bored...?

-Adam
19-12-2008, 09:07 PM
I already have the DJ panel setup, And cant be bothered installing another as i have already timetable and requests and stuf on the page, Also it didnt come with the script.

RyanDOT
19-12-2008, 09:14 PM
Create a file called:

config_radio.php


<?php

//Configuration
$scip = "127.0.0.1"; // ip or url of shoutcast server
$scport = "8000"; // port of shoutcast server
$scpass = "changeme"; // password to shoutcast server
//End configuration

?>

Add the codes to the pages. Change the details to your radio stuff.

And create this file:

stats.php


<head>
<META HTTP-EQUIV="REFRESH" CONTENT="30">
</head>
<?php

include('config_radio.php');
$scfp = @fsockopen("$scip", $scport, &$errno, &$errstr, 10);
if(!$scfp) {
$scsuccs=1;
echo'<strong>Server is offline</strong>';
}
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);
}
$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);

//echo'$'.$scphp.' = '.$$scphp.'<br>';
$y++;
}
$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++;
}

fclose($scfp);
}

if($streamstatus == "1"){
echo'
<strong>Current DJ</strong>: '.$servertitle.'<br/>
<strong>Current Listeners</strong>: '.$currentlisteners.'<br/>
<strong>Current Song</strong>: '.$song[0].';
}
if($streamstatus == "0")
{
echo'<strong>Radio is offline</strong>;
}
?>

http://www.habboxforum.com/showpost.php?p=4805281&postcount=3

Thanks to Jack120

Robbie
19-12-2008, 09:21 PM
Although it's possible fsockopen is disabled on your hosting

-Adam
19-12-2008, 09:30 PM
Isnt workin
Fsocket functions
Enabled

Robbie
19-12-2008, 09:33 PM
Change stats.php to


<head>
<META HTTP-EQUIV="REFRESH" CONTENT="30">
</head>
<?php

include('config_radio.php');
$scfp = fsockopen("$scip", $scport, &$errno, &$errstr, 10);
if(!$scfp) {
$scsuccs=1;
echo'<strong>Server is offline</strong>';
}
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);
}
$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);

//echo'$'.$scphp.' = '.$$scphp.'<br>';
$y++;
}
$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++;
}

fclose($scfp);
}

if($streamstatus == "1"){
echo'
<strong>Current DJ</strong>: '.$servertitle.'<br/>
<strong>Current Listeners</strong>: '.$currentlisteners.'<br/>
<strong>Current Song</strong>: '.$song[0].';
}
if($streamstatus == "0")
{
echo'<strong>Radio is offline</strong>;
}
?>

and whats the error.

iUnknown
19-12-2008, 09:37 PM
Read this: http://www.habboxforum.com/showthread.php?t=513298

Very likely the problem is number 4, it gives an error to do with fsockopen... because it fails to do the fsockopen because of the ports... read it all through.

-Adam
19-12-2008, 09:41 PM
The error it it simply wont load, the page stays blank

http://www.watchhabbo.co.uk/stats.php

Robbie
19-12-2008, 09:43 PM
Did you use the code I posted?

iUnknown
19-12-2008, 09:48 PM
If it stays blank, that means you've entered the wrong SHOUTcast password or one of the following things along the same line:

1. You've changed the SHOUTcast password but not restarted the SHOUTcast.
2. The host you have the SHOUTcast from has two SHOUTcasts running on the port you're on, and not both of the passwords are the same.
3. You've entered the wrong port or IP and so it's trying to connect to someone elses SHOUTcast with your password.
4. You've simply entered the wrong password in the configuration file.

Remember, you enter the SHOUTcast BROADCAST password to the config file, not the SHOUTcast admin password.

-Adam
19-12-2008, 09:52 PM
I have everything correct :S

RyanDOT
19-12-2008, 09:59 PM
Try DJ?

And view the page.

-Adam
19-12-2008, 10:00 PM
My mate is djing

iUnknown
19-12-2008, 10:29 PM
I have everything correct :S

If it comes up blank, it is definitely one of the things I said. Triple-check.

RyanDOT
20-12-2008, 08:48 AM
If it comes up blank, it is definitely one of the things I said. Triple-check.

I think he did it....

Want to hide these adverts? Register an account for free!