PDA

View Full Version : Radio Stats



Seduced
05-11-2006, 12:27 AM
Okay, my radio_stats.php file dont work.

Can anyone make me a stats.php page?

I need it looking like www.freshhabbo.com (http://www.freshhabbo.com) 's / Clubhabbo.net 's/ThinkHabbo's as it's going to be in a box like that.

ty.

in Verdana Font
White Text
Size 1

Likethis but in White:

Currrent DJ: DJ Kport
Listeners: 13
Song: My My My (Radio Edit)


Who ever can will get a Dicemaster from me for there help:)

Zaub
05-11-2006, 02:09 AM
radio_stats.php:

<?php
// Shoutcast Server Stats
// Parses shoutcasts xml to make an effective stats thing for any website
// &#169;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, 30);
if(!$scfp) {
$scsuccs=1;
echo''.$scdef.' is 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]>", "", $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>
<style type="text/css">body,html{background-color:transparent;}</style>
</head>

<body style="scrollbar-face-color: #006699; scrollbar-highlight-color: #000000; scrollbar-shadow-color: #000000; scrollbar-3dlight-color: #000000; scrollbar-arrow-color: #ffffff; scrollbar-track-color: #000000; scrollbar-darkshadow-color: #000000;" text="#ffffff">

<p align="left">

<font face="verdana" size="1"><b>&nbsp;Current DJ:</b>&nbsp;'.$servertitle.'</font></p>
<font face="verdana" size="1"><b>&nbsp;Listeners:</b>&nbsp;'.$currentlisteners.'</font></p>

<font face="verdana" size="1" color="#ffffff"><b>

Current Song:</b>'.$song[0].'</font></p>
<b>

<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="30;URL=radio_stats.php">
<link rel=stylesheet href="" type="text/css">
<title>Radio Server Is Offline</title>
<style type="text/css">body,html{background-color:transparent;}</style>
</head>

<body text="#ffffff">
<font face="verdana" size="1"><center>HabboSimple is currently offline!<br><br>Radio is currently Offline</font>
</body>

</html>';
}
?>


config_radio.php:

<?php
//////////////////////////////////////////////////////////////////////////////////////////////
// Dinghy Radio Stats Information
// Grabs the xml from your radio server and displays it in a iframe that refreshes every 30 seconds.
// &#169;Daniel Brown www.gmtt.co.uk
//////////////////////////////////////////////////////////////////////////////////////////////
//Configuration
$scdef = "Site Name"; // 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 = "port"; // port of shoutcast server
$scpass = "password"; // password to shoutcast server
//End configuration

?>

Habbo UK Name: chrism182

Drop dicemaster in my donations if you can :)

Seduced
05-11-2006, 09:26 AM
This appears:


Warning: fsockopen() [function.fsockopen (http://www.shouthabbo.com/function.fsockopen)]: unable to connect to shallowhosting.com:7000 in /home/hshout/public_html/radio_stats.php on line 7
radio is Offline

:Blob
05-11-2006, 10:10 AM
radio_stats.php:

<?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, 30);
if(!$scfp) {
$scsuccs=1;
echo''.$scdef.' is 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]>", "", $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>
<style type="text/css">body,html{background-color:transparent;}</style>
</head>

<body style="scrollbar-face-color: #006699; scrollbar-highlight-color: #000000; scrollbar-shadow-color: #000000; scrollbar-3dlight-color: #000000; scrollbar-arrow-color: #ffffff; scrollbar-track-color: #000000; scrollbar-darkshadow-color: #000000;" text="#ffffff">

<p align="left">

<font face="verdana" size="1"><b>&nbsp;Current DJ:</b>&nbsp;'.$servertitle.'</font></p>
<font face="verdana" size="1"><b>&nbsp;Listeners:</b>&nbsp;'.$currentlisteners.'</font></p>

<font face="verdana" size="1" color="#ffffff"><b>

Current Song:</b>'.$song[0].'</font></p>
<b>

<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="30;URL=radio_stats.php">
<link rel=stylesheet href="" type="text/css">
<title>Radio Server Is Offline</title>
<style type="text/css">body,html{background-color:transparent;}</style>
</head>

<body text="#ffffff">
<font face="verdana" size="1"><center>HabboSimple is currently offline!<br><br>Radio is currently Offline</font>
</body>

</html>';
}
?>


config_radio.php:

<?php
//////////////////////////////////////////////////////////////////////////////////////////////
// Dinghy Radio Stats Information
// Grabs the xml from your radio server and displays it in a iframe that refreshes every 30 seconds.
// ©Daniel Brown www.gmtt.co.uk
//////////////////////////////////////////////////////////////////////////////////////////////
//Configuration
$scdef = "Site Name"; // 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 = "port"; // port of shoutcast server
$scpass = "password"; // password to shoutcast server
//End configuration

?>

Habbo UK Name: chrism182

Drop dicemaster in my donations if you can :)


All you have done is copied my tutorial.. I could have done that.

Seduced
05-11-2006, 11:00 AM
Warning: fsockopen() expects parameter 2 to be long, string given in /home/hshout/public_html/radio_stats.php on line 7
radio is Offline

tried both of them:(

Vixt
05-11-2006, 11:01 AM
either:

enter the details properly
turn your radio on
make sure your host supports php

Jackboy
05-11-2006, 05:22 PM
either:

enter the details properly
turn your radio on
make sure your host supports php

- Lol course the host supports php! otherwhys he wouldn't of got a error like that!
- Course hes turned the radio on..

The details probs are turned on properly

You need shell access.

13reaking
05-11-2006, 05:32 PM
Jack, if he radio was on, why would it say "radio is Offline". It might be a case of your typing in the infomation worng.

If you could post the infomation you posted, just edit out the password so we can see what you've done worng.

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