Grom |
3rd September 2008 03:28 |
Shoutcast Radio
3 Attachment(s)
This is not all my work!
radio.php
PHP Code:
<? error_reporting(0); require_once("backend/functions.php"); dbconn(); if ($LOGGEDINONLY){ if (!$CURUSER){ echo "<BR><b><CENTER>You Are Not Logged InOnly Members Can Listen to MGA Radio Please Signup.</CENTER><BR><BR>"; }else{ echo ' <html>
<head> <meta http-equiv="Content-Language" content="en-gb"> <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"> <title>MGA Radio</title> </head>
<body topmargin="0" leftmargin="0" background="images/soundbg.jpg" link="#FFFF00" vlink="#FFFF00" alink="#FFFF00" text="#FFFFFF" bgcolor="#000000"> <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="350" height="100"> <tr> <td width="100%" valign="top"> <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%"> <tr> <td width="100%"> <p align="center"><font face="Arial"><b>MGA TV Torrents Radio</b></font></td> </tr> </table> <hr> <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%"> <tr> <td width="50%"> <p align="center"><b><font face="Arial" size="1"> <a href="radio/radioplayer.php?lang=&z=wmp">Play Using Windows Media Player</a></font></b></td> <td width="50%"> <p align="center"><b><font face="Arial" size="1"> <a href="radio/radioplayer.php?lang=&z=real">Play Using Real Player</a></font></b></td> </tr> </table> <hr> <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%"> <tr> <td width="100%"><font face="Arial" size="1">Windows Media Player 10 or above is needed to play shoutcast streams</font></td> </tr> </table> <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%"> <tr> <td width="100%"> <p align="center"><font size="1" face="Arial">Powered by MGA Radio, Winamp & Shoutcast</font></td> </tr> </table> </td> </tr> </table>
</body>
</html>'; } } ?>
myradio.php
PHP Code:
<? error_reporting(0); require_once("backend/functions.php"); dbconn(false); $showradioinfo="page"; include("radio-info.php"); stdhead(); begin_frame("MGA Radio"); ?> <p align="center"><b>
<a href="JavaScript:radio_player()">Click here to tune in and listen now.</a></b></p> <div align="center"> <center> <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%"> <tr> <td width="50%"> <div align="center"> <center> <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111"> <tr> <td width="50%" align="center"><a href="JavaScript:radio_player()"> <img border="0" src="images/win.gif" width="64" height="64"></a></td> <td width="50%" align="center"><a href="JavaScript:radio_player()"> <img border="0" src="images/real.gif" width="80" height="70"></a></td> </tr> <tr> <td width="50%" align="center"> <img border="0" src="images/shoutcast.gif" width="160" height="44"></td> <td width="50%" align="center"> <img border="0" src="images/winamp.gif" width="75" height="76"></td> </tr> </table> </center> </div> </td> <td width="50%"> <table border="0" cellpadding="2" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111"> <tr> <td align="left"><b>Status :</b> </td> <td><img border="0" src="<? echo $radioimg; ?>"></td> </tr> <tr> <td align="left"><b>Currently Playing : </b></td> <td><? echo $song[0]; ?></td> </tr> <tr> <td align="left"><b>Members Listening Now : </b></td> <td><? echo $currentlisteners; ?></td> </tr> <tr> <td align="left" valign="top"><b>Last 5 Tracks Played.. </b></td> <td><? echo $song[1]."<BR>"; ?><? echo $song[2]."<BR>"; ?><? echo $song[3]."<BR>"; ?><? echo $song[4]."<BR>"; ?><? echo $song[5]."<BR>"; ?></td> </tr> </table> <p> </td> </tr> </table> </center> </div> <p> </p> <div align="center"> <center> <p></p> </center> </div>
<p align="center">You will need Windows Media Player 10+ or Real Player to to listen to the radio stream! </p> <p align="center">Radio Powered by Shoutcast & Winamp</p>
<? end_frame(); stdfoot(); ?>
radio-info.php
PHP Code:
<? error_reporting(0); require_once("backend/functions.php"); dbconn(false); ?> <script language="JavaScript"> <!-- function radio_player() { props=window.open('radio.php', 'poppage', 'toolbars=0, scrollbars=0, location=0, statusbars=0, menubars=0, resizable=0, width=350, height=100 left = 100, top = 100'); } --> </script> <? error_reporting(0); error_reporting(0); require_once("backend/functions.php"); dbconn(false); $scdef = "NAME OF YOUR RADIO"; $scip = "HOST OF YOUR RADIO"; // IP OR DOMAIN $scport = "8000"; // PORT $scpass = "PASSWORD FOR SHOUTCAST SERVER";
$bgcolor = "#000000";
$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.1\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);
// uncomment the next line to see all variables //echo'$'.$scphp.' = '.$$scphp.''; $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 ($showradioinfo=="on"){ if ($streamstatus == "1"){ $rstatus = "Playing";} else { $rstatus = "Stopped";}
echo "<hr>Radio Status : ".$rstatus.""; echo "Current Listeners ".$currentlisteners.""; echo "Listening to...... ".$song[0]; echo "<a href='myradio.php'>Listen Now</a>";}
if ($showradioinfo=="page") { if ($streamstatus == "1"){ $radioimg = "images/radioonline.jpg";} else{ $radioimg = "images/radiooffline.jpg";}}
?>
if you want to have the radio stats in the left nav menu
in header.php under the donate block add this
PHP Code:
begin_block("MGA Radio Info"); $showradioinfo="on"; include("radio-info.php"); end_block();
upload all the images to your images folder
upload the radio folder to your trackers root (same place as index.php)
edit the config.php in the radio folder.
edit the radio-info.php
|