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 6 of 6
  1. #1
    Join Date
    Jun 2006
    Location
    Doncaster
    Posts
    1,150
    Tokens
    11

    Latest Awards:

    Thumbs up Rating System Needed

    Hi Guys,

    I'm looking for someone to develop me a rating system.

    This would need to grab the current song on my station, then enable users to vote like/dislike whilst they're listening to it on the website's radio player.

    Anyone able to do this, please leave a price plus any proof of work you may have.

    Thanks

  2. #2
    Join Date
    May 2011
    Location
    England
    Posts
    427
    Tokens
    3,403
    Habbo
    Pension

    Latest Awards:

    Default

    If you're using radiPanel or PODpanel then I can do this for you.


    Sent from my iPhone using Tapatalk

    robbie // pension.

  3. #3
    Join Date
    Oct 2011
    Location
    Melbourne
    Posts
    637
    Tokens
    1,376

    Default

    Quote Originally Posted by EverSteve View Post
    Hi Guys,

    I'm looking for someone to develop me a rating system.

    This would need to grab the current song on my station, then enable users to vote like/dislike whilst they're listening to it on the website's radio player.

    Anyone able to do this, please leave a price plus any proof of work you may have.

    Thanks
    Not sure if you want/need this still, even if you don't here is one for other people!

    It's a cross between a mod and an extension (I haven't checked it fully works since I don't own a radio).

    radio_stats.php


    SQL



    @EverSteve , view this.
    Last edited by Blinger; 03-03-2012 at 05:20 AM. Reason: Fixed a bit of the code

  4. #4
    Join Date
    Jan 2010
    Posts
    180
    Tokens
    2,678
    Habbo
    alede

    Latest Awards:

    Default

    I have found an error with this. It does not show the actual votes it got. It only says that "You've voted for this song"

  5. #5
    Join Date
    Oct 2011
    Location
    Melbourne
    Posts
    637
    Tokens
    1,376

    Default

    does that work?
    PHP Code:
    <?php
    # PODpanel - "radio_stats.php" file - Re-Written by lDaFreshKid.
    # Do not edit anything in this file, it could possibly lead to PODpanel not working properly.

        
    include("../_inc/config.php");
        include(
    "../_inc/functions.php");
        
    $siteinfo mysql_query("SELECT * FROM info");
            
    $siteinfo mysql_fetch_array($siteinfo);

            
    $info mysql_query("SELECT * from `info`");
            
    $info mysql_fetch_array($info);
    ?>

            <title><?php echo $info[sitename]; ?> :: Radio Statistics</title>    
        
            <style type="text/css">
            
            body {
            background: url(../images/bg.png);        
        padding-bottom: 0;
        margin-bottom: 0;

            }

            body, a, select {       
        font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;
            font-size:12px;
            color:#666666;
            text-decoration: none;
         
            }

            .container {                
        width: 450px;
        margin: auto;
        padding: 5px;
        margin-top: 15px;

        }

            .warning {
            background-color:#ffcfcf;
            border:solid 1px #e5a3a3;
            border-bottom:solid 2px #e5a3a3;
            color:#801b1b;
            text-align:left;
            font-weight: none;
            width: 100%px;
            padding:5px;

            }

            .safe {
            background-color:#D9FFCF;;
            border:solid 1px #ADE5A3;
            border-bottom:solid 2px #ADE5A3;
            color:#1B801B;
            text-align:left;
            font-weight: none;
            padding:5px;

            }
        
            .box {
            width: 600px;
        background: #fff;              
        -moz-border-radius: 3px;
        -webkit-border-radius: 3px;
        border-radius: 3px;
        padding: 5px;
        margin-bottom: 10px;
                   
            }

            .head {
        padding: 4px;               
        background: #2b3841;
            -moz-border-radius: 2px;
            -webkit-border-radius: 2px;
        font-size: 18px;
        font-weight: bold;
        color: #e4e7e7;
            text-color: white;

        }    

            input, textarea, select {
            color: #747474;
        font: 12px "Trebuchet MS", "Lucida Grande", Arial, Tahoma, sans-serif;
        background: white url("../images/textbg.png") 0 -480px repeat-x;
            width: auto;
            border: 1px solid #C1C1C1;
            -webkit-border-radius: 4px;
            -moz-border-radius: 4px;
            border-radius: 4px;
            -webkit-box-shadow: inset 0 1px 4px rgba(0, 0, 0, .16);
            -moz-box-shadow: inset 0 1px 4px rgba(0, 0, 0, .16);
            box-shadow: inset 0 1px 4px rgba(0, 0, 0, .16);
            position: relative;
            padding: 5px;
                    
            }    

            input[type=submit], input.button {
        color: #888;
        border-color: #ddd;
        background: #f0f0f0;
        cursor: pointer;
        padding: 3px;

            }

            input[type=button], input.button {
        color: #888;
        border-color: #ddd;
        background: #f0f0f0;
        cursor: pointer;
        padding: 3px;

            }

            input[type=submit]:hover, input.button:hover {
        background-color: #e6e6e6;
        border-color: #d6d6d6;

            }

            input[type=button]:hover, input.button:hover {
        background-color: #e6e6e6;
        border-color: #d6d6d6;

            }

            input[type=submit].green, input.button.green {
        background-color: #d9ffcf;
        border-color: #ade5a3;
        color: #1b801b;    
            
            }

            input[type=submit].red, input.button.red {
        background-color: #ffcfcf;
        border-color: #e5a3a3;
        color: #801b1b;
        
            }

           </style>
                                                                                   
    </head>

    <div class="container">

                <div class="box">
                   <div class="head">
                  <strong><?php echo $info[sitename]; ?> Radio Statistics</strong>
            </div>             
    <p>


    <?php
    include('../_inc/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.' <div class="warning"><strong><center>PODpanel Radio Is Currently Offline</strong></center></div>';
     }
    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"){


    /* Blingers fix to get the current DJ */

    $abc = array("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z");

    // get the day
    $day strtolower(date("l"));
    // get the current time into an int
    $timeNow date("H"time()) -1;

    if(
    $timeNow 0){
        
    $timeNow 0;
    }
    // select the letter from the alphabet from the int above
    $timeQuery $abc[$timeNow];

    // select the DJ from the DB
    $getOnlineDJ mysql_query("SELECT $timeQuery FROM `$day`");
    $rows mysql_fetch_array($getOnlineDJ);

    // current DJ
    $currentDJ $rows[$timeQuery];


    /* End Blingers DJ fix */

    // Get the habbo name from the DJ name
    $habbo mysql_query("SELECT * FROM users WHERE djname='{$currentDJ}'");
    $row mysql_fetch_array($habbo);
    $habboname $row['habboname'];
    if(
    is_null($habboname)){
        
    $habboname "Habbo";
    }

    /* DJ Says */

    // Get the DJ say who basically said something.
    $says mysql_query("SELECT says FROM info");
    $row mysql_fetch_array($says);
    $says $row['says'];
      if(
    is_null($says)){
        
    $says "Sorry there is currently no DJ Says, Stay tuned for the next DJ...";
    }


    /* lDaFreshKid's Fix */

    // Get the stalked DJ
    $stalk mysql_query("SELECT stalkDJ FROM info");
    $row mysql_fetch_array($stalk);
    $stalkDJ $row['stalkDJ'];
    $text = ($stalkDJ "<a target=\"_popup\" href=\"http://www.habbo.com/room/{$stalkDJ}\"><img border=\"0\" align=\"right\" src=\"http://bit.ly/q1cPrA\"></a>" "<img border=\"0\" align=\"right\" src=\"http://bit.ly/qKYbYP\">" );

    //you may edit the html below, make sure to keep variable intact
    echo ("
    <html>
    <img src=\"http://www.habbo.com/habbo-imaging/avatarimage?user=
    {$habboname}&action=wlk&direction=4&head_direction=4%20%20amp;gesture=sml&size=s\" align=\"right\">
    <div style=\"position: relative; top: 55px; float: right; margin-right: -23px;\">
    $text
    </div>

    <b>Current DJ:</b><br> 
    {$servertitle}<br>
    <b>Listeners:</b><br> 
    {$currentlisteners}<br>
    <b>Current Song:</b> <br><marquee> 
    {$song[0]}</marquee><br><br>");

    /* Blinger's rating system mod */
    if($_POST['rating']){
        
    // Get the posted variables
        
    $stars cleanTag($_POST['rating']);
        
    $song cleanTag($_POST['song']);
        
    // Get IP into a var
        
    $ip $_SERVER['REMOTE_ADDR'];

        
    // Check to see if they voted more or less than 5 stars
        
    if($stars != $stars 5){
            die(
    "An error has occurred.");
        } else {
            
    // Since they didn't check to see if they have already voted!
            
    $check_ip mysql_query("SELECT * FROM ratings WHERE ip='{$ip}' AND title = '{$song[0]}'");
            
    // If it doesn't equal zero, they have
            
    if($check_ip != 0){
                die(
    "You've already voted for this song!");
            }
            
    // Since they haven't, insert it into the DB
            
    mysql_query("INSERT INTO ratings (`title`, `rating`, `ip`) VALUES ('$song[0]', '{$stars}', '{$ip}')") or die("Error: There was an error casting your vote!");
            echo(
    "Thank you for voting!");
        }
    } else {
        echo(
    "<form id=\"ratings\" name=\"ratings\" method=\"post\" action=\"radio_stats.php\">
              <label for=\"rating\"><strong>What do you rate this song?</strong><br /></label>
                <select name=\"rating\" id=\"rating\" >
                  <option value=\"1\" selected=\"selected\">1 Star</option>
                  <option value=\"2\">2 Stars</option>
                  <option value=\"3\">3 Stars</option>
                  <option value=\"4\">4 Stars</option>
                  <option value=\"5\">5 Stars</option>
                </select>
                <input name=\"song\" type=\"hidden\" value=\"
    $song[0]\" />
                
                <input name=\"vote\" type=\"submit\" value=\"Vote!\" />
            </form>"
    );
    }

        
    // Check the database to see if the song title exists
        
    $check_DB mysql_query("SELECT * FROM ratings WHERE title='{$song[0]}'");
        if(
    mysql_num_rows($check_DB) >= 1){
            
    $array mysql_fetch_array($check_DB);
            
    // Get the song information from an array into seperate arrays
            
    $votes mysql_num_rows($check_DB);
            
            
            
    // Not sure why this happens, but it seems to work fine!
            
    $rating $array['rating'];    
            while(
    $i mysql_fetch_array($check_DB)){
                
    $rating $rating $i['rating'];
            }
            
            
    // Average out the ratings and limit it to two decimal places
            
    $rating round($rating $votes2);
            
    // Finally echo out the information!
            
    echo("$song[0] has an average rating of $rating! It has been rated by $votes time(s).<br>");
        } else {
            
    // Strip the slashes from the title
            
    echo("$song[0] has no ratings yet!<br>");
        }


    /* End of Blinger's rating system mod */
    echo("</html>");

            
    }
    if(
    $streamstatus == "0")
    {
    //you may edit the html below, make sure to keep variable intact
    echo'
    <div class="safe"><strong><center>PODpanel Radio is currently offline, please check back later!</strong></center></div>'
    ;
    }
    ?>
    </div>

  6. #6
    Join Date
    Jan 2010
    Posts
    180
    Tokens
    2,678
    Habbo
    alede

    Latest Awards:

    Default

    No still doesn't work.

Posting Permissions

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