Results 1 to 5 of 5

Thread: dj stats prob

  1. #1
    Join Date
    Nov 2005
    Posts
    192
    Tokens
    0

    Default dj stats prob

    KK when no dj is on it goes Blank i loaded radio_stats and i made sure it's

    if(!$scfp) {
    $scsuccs=1;
    echo''.$scdef.'Radio is Offline';

    but still blank

  2. #2
    Join Date
    Nov 2004
    Posts
    268
    Tokens
    0

    Default

    Post the whole code.
    Status:

  3. #3
    Join Date
    Aug 2005
    Location
    Webdesign Section
    Posts
    1,032
    Tokens
    0

    Latest Awards:

    Default

    you probaly didnt add the information the "variables" by the //

  4. #4
    Join Date
    Jun 2005
    Location
    Manchester
    Posts
    3,187
    Tokens
    0

    Latest Awards:

    Default

    Yeah when linking you have to link to the Variables $variablename i think.

    - Dan

  5. #5
    Join Date
    Nov 2005
    Posts
    192
    Tokens
    0

    Default

    kk heres the code some one feel free to fix

    <?php
    // Shoutcast Server Stats
    // Parses shoutcasts xml to make an effective stats thing for any website
    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.'Radio 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>
    </head>

    <body text="" bgcolor="#FFFFFF">




    <p align="center"><center>

    <font color="#000000"><font face="Verdana" size="1"><b>&nbsp;Current DJ:</b>&nbsp;'.$servertitle.'</font></p>
    <font color="#000000"><font face="Verdana" size="1"><b>&nbsp;Listeners:</b>&nbsp;'.$currentlisteners.' /50</font></p>

    <font color="#000000"><font face="Verdana" size="1" color=""><b>

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


    <font color="#000000"><font face="Verdana" size="1">
    Past Songs:</font></b>
    <font color=""><font face="Verdana" size="1">
    <p align="center">
    <b>1.</b> '.$song[1].'<BR>
    <b>2.</b> '.$song[2].'<BR>

    </font>
    <BR>
    </p></p>
    </body>

    </html>';
    }
    ?><body bgcolor="#FFFFFF">

Posting Permissions

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