View Single Post
Old 7th July 2010, 19:30   #1
tom2k7
Junior Member
 
Join Date: Jul 2010
Posts: 8
help with radio script

hi im writing a radio script to view current listners name from the ipb database but im stuck i was hoping someone could help me
here is my code
code:
<html>
<head>

<BODY STYLE='background-color:transparent'>
<body background='background.jpg'>
<META HTTP-EQUIV="REFRESH" CONTENT='30'>
</head>
<body>
<?php
include("config.php");
include("xml.php");

function ConvertSeconds($seconds) {
$tmpseconds = substr("00".$seconds % 60, -2);
if ($seconds > 59) {
if ($seconds > 3599) {
$tmphours = substr("0".intval($seconds / 3600), -2);
$tmpminutes = substr("0".intval($seconds / 60 - (60 * $tmphours)), -2);

return ($tmphours.":".$tmpminutes.":".$tmpseconds);
} else {
return ("00:".substr("0".intval($seconds / 60), -2).":".$tmpseconds);
}
} else {
return ("00:00:".$tmpseconds);
}
}


if ($shoutcast->openstats()) {
// We got the XML, gogogo!..
if ($shoutcast->GetStreamStatus()) {

echo "<span style='border:1px solid;background:black;padding:0 3xp 0 3px;font-weight:bold;color:RED'>SSDJ radio Online</span><br>\n\n";
echo "<center><span style='border:1px solid;background:black;padding:0 3xp 0 3px;font-weight:bold;color:white'>CURRENT SONG</span></br> <font color='#FF00CC'><font size='5'><b> ".$shoutcast->GetCurrentSongTitle()." </b></font></font><br></center></td>\n\n";
echo "<center><span style='border:1px solid;background:black;padding:0 3xp 0 3px;font-weight:bold;color:white'>LISTENERS: ".$shoutcast->GetCurrentListenersCount()." </span></br></center></td>\n\n";
echo "<center><span style='border:1px solid;background:black;padding:0 3xp 0 3px;font-weight:bold;color:white'>BITRATE ".$shoutcast->GetBitRate()." KBPS</span></br></center></td>\n\n";
echo "<center><span style='border:1px solid;background:black;padding:0 3xp 0 3px;font-weight:bold;color:white'>DJ:</span> <span style='border:1px solid;background:black;padding:0 3xp 0 3px;font-weight:bold;color:5ffb17'> ".$shoutcast->GetServerTitle()."</span></font><br></center></span><br>\n\n";
echo "<center><a href='http://ssdj99.no-ip.org:8014/listen.pls'><img src='winamp.jpg'></img></a> <a href='listen.asx'><img src='wmp.jpg'></img></a></tr></table></center>\n\n";




echo "<b>Listners:</b>\n";
$listeners = $shoutcast->GetListeners();
if (is_array($listeners)) {
for ($i=0;$i<sizeof($listeners);$i++) {

$scip = "".$listeners[$i]["hostname"]."";
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( 'Unable to connect to database');
$query="SELECT `member_name`, `member_id`, `ip_address` FROM ibf_sessions";


$result=mysql_query($query);

$num=mysql_numrows($result);

mysql_close();

$i=0;
while ($i < $num) {
$ip=mysql_result($result,$i,'ip_address');
$r=mysql_result($result,$i,'member_name');
$id=mysql_result($result,$i,'member_id');
if($ip=$scip){
echo "<a href='$host$id'>$r$ip=$scip</a><br>";}


$i++;
}
} } else {
echo "Noone listens right now ";
}
} else {
echo "Server is up, but no Dj Online";
}
} else {
// Ohhh, damnit..
echo $shoutcast->geterror();
}
?>
</table>
</body>
</html>


im trying to get it to match up 2 ip addresses one from database and one from shoutcast xml but atm its jumbling up the member to the ip i was woundering if anyone could help

here is the code when its run
radio link
please could someone help

tom
tom2k7 is offline   Reply With Quote