Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2004
    Location
    UK
    Posts
    534
    Tokens
    141

    Default help on tutorial for DJ Says

    Hey, i followed the tutorial for a DJ says in the tutorial forum. However it only allows a message, and i also want a Dj name put into it aswell.

    I have coded most of it, however on the below bit of code, i need it to also get "name" from "djsays", however i don't know how to get it in.

    Help plz, and + rep for whoever does.

    <?php
    include('include/session.php');
    $select = mysql_query("SELECT message from djsays order by id DESC LIMIT 1");
    $message = mysql_fetch_array($select)
    ?>
    Post Count: :eusa_danc 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | 1000 :eusa_danc

  2. #2
    Join Date
    Apr 2006
    Location
    wolvo init lol.
    Posts
    2,272
    Tokens
    0

    Latest Awards:

    Default

    Hi, a little thing I made using my radio stats. You wont need your above code. PLease note before doing this, the DJ name wont appear in your DJ says box, but just above it. Thanks.

    First, make a file called djsaysframe.php. In it, put:
    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, &$errstr, 30);
    if(!$scfp) {
      $scsuccs=1;
    echo''.$scdef.'Radio Stats';
    }
    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="40;URL=djsaysframe.php">
    <link rel=stylesheet href="" type="text/css">
    <title>'.$scdef.'</title>
    </head>
    <body text="verdana" bgcolor="#FFDE00">
    <font face="verdana" size="1" color="black"><b></b>&nbsp;'.$servertitle.'</font><font face="verdana" size="1" color="#000000"> Says:</font>
    </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=djsaysframe.php">
    <link rel=stylesheet href="" type="text/css">
    <title>YOURSITE Stats</title>
    </head>
    <body text="verdana" bgcolor="#FFDE00"><font face="verdana" size="1" color="black"><b>No DJ DJing, the current DJ says is from the previous DJ.</font></p>
    </body><a href=""></a>
    
    </html>';
    }
    ?>
    Make sure config_radio.php is configured to your radio details.

    Then, above the DJ says box, put this code:
    Code:
    <iframe src="djsaysframe.php" scrolling="no" frameborder="0" height="50" width="200"></iframe><br>
    YOUR DJ SAYS CODE HERE
    This does mean that when there is no DJ on it doesnt have a DJ name. You can edit what it says when there is no DJ on in the code above. Just find the writing that says: No DJ DJing, the current DJ says is from the previous DJ.

    I also suppose youll want to change bg colour, but Im guessing youll know how to do that


    Hope that is of help. You can see mine at work by clicking here.
    Last edited by reindeer.; 01-08-2006 at 01:18 PM.

  3. #3
    Join Date
    Dec 2004
    Location
    UK
    Posts
    534
    Tokens
    141

    Default

    nah its ok thanx, i managed to do it anover way using

    <?php
    include('include/session.php');
    $select = mysql_query("SELECT name from djsays order by id DESC LIMIT 1");
    $name = mysql_fetch_array($select);
    ?>
    <?php

    $select = mysql_query("SELECT message from djsays order by id DESC LIMIT 1");
    $message = mysql_fetch_array($select);
    ?>
    Thanks anyway!
    Post Count: :eusa_danc 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | 1000 :eusa_danc

Posting Permissions

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