Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2007
    Location
    Blackpool
    Posts
    224
    Tokens
    0

    Default Radio Statistic Coding

    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:

    PHP Code:
    <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, &$errstr10);
     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($scfp1000);
     }
    ######################################################################################################################
    /////////////////////////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">&nbsp;'
    .$servertitle.'</font></font><font color="#FFFFFF"></p>
    </font>
     
     
    <font color="black">
    <p></p>
    <p><font face="verdana" size="1" color="#FFFFFF"><b>Listeners:</b>&nbsp;'
    .$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 Code:
    <?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!
    [Go-RockFM.co.uk] [Now Open?]
    [ Don't Forget To Tune In ] [ Owner / DJ Rob ]
    [ You All Rock ] [ Felt Like Being Kind ]
    [ I Can Tell Your Name. All Green Rep's Returned ]


  2. #2
    Join Date
    Aug 2006
    Location
    Wakefield, West Yorkshire
    Posts
    1,351
    Tokens
    0

    Latest Awards:

    Default

    here's it edited so it will say out of 50 listeners and "go rock fm is off air a dj will be on shortly" when theres no1 djing:
    PHP Code:
    <?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, &$errstr30);
     
     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($scfp1000);
     
     }
     
    ######################################################################################################################
     
    /////////////////////////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>
     
    </head>
     
     
     
    <body text="#00FFFF" bgcolor="#000000" link="#FFFF00" vlink="#FF0000">
     
     
     
     
     
     
     
     
     
    <p align="center"><center>
     
     
     
    <font face="verdana" size="1" color="#000000"><b>&nbsp;Current DJ:</b>&nbsp;'
    .$servertitle.'</font></p>
     
    <font face="verdana" size="1" color="#000000"><b>&nbsp;Listeners:</b>&nbsp;'
    .$currentlisteners.' / 50</font></p>
     
     
     
    <font face="verdana" size="1" color="#000000"><b>
     
     
     
        Current Song:</b> '
    .$song[0].'</font></p>
     
        <b>
     
     
     
     
     
        <font face="verdana" size="1" color="#000000">
     
        Past Songs:</font></b>
     
    <font color="#000000"><font face="verdana" size="1">
     
    <p align="center">
     
    <b>1.</b>  '
    .$song[1].'<BR>
     
    <b>2.</b>  '
    .$song[2].'<BR>
     
    <b>3.</b>  '
    .$song[3].'<BR>
     
    </font>
     
    <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>Clubbing Habbos is offline</title>
     
    </head>
     
    <body text="#00FFFF" bgcolor="#000000" link="#FFFF00" vlink="#FF0000"
     
    background="http://www.rarehabbo.co.uk/nav.gif">
     
    <font face="verdana" size="1" color="#000000">Go Rock FM is off air a DJ will be on shortly</font>
     
     
     
    </html>'
    ;
     
    }
     
    ?>
    Last edited by beer; 09-03-2007 at 11:05 AM.

  3. #3
    Join Date
    Jan 2007
    Location
    Blackpool
    Posts
    224
    Tokens
    0

    Default

    Many thanks, +Rep.

    Oh wait, sorry I can't.. I.O.U Rep
    [Go-RockFM.co.uk] [Now Open?]
    [ Don't Forget To Tune In ] [ Owner / DJ Rob ]
    [ You All Rock ] [ Felt Like Being Kind ]
    [ I Can Tell Your Name. All Green Rep's Returned ]


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •