RevCMS hot rooms

Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    Account Upgraded | Title Enabled! Mozilla2 is offline
    MemberRank
    Apr 2012 Join Date
    The NetherlandsLocation
    223Posts

    RevCMS hot rooms

    Hello, community.

    Today i release something small. I gonna release `hot rooms / popular rooms".
    It shows the top 5 rooms with the most users in it.

    First of all, add this to your page ( i recommend the community page):
    Spoiler:

    PHP Code:
    <link rel="stylesheet" href="{url}/app/tpl/skins/Habbo/styles/rooms.css" type="text/css">
     
    <
    script type="text/javascript" src="{url}/app/tpl/skins/Habbo/js/rooms.js"></script> 

    Remember, replace "skins/Habbo" with your skin folder, like "skins/yourskin"

    Then, add the following code on the page you want it , i recommend the community page.
    Spoiler:

    PHP Code:
                                    <?php

    $eo 
    'even';
     
    function 
    GenerateRoomOccupancy($usersNow$usersMax)
    {
        
    $num 1;
        
    $percentage intval(($usersNow $usersMax) * 100);
     
        if (
    $percentage <= 0)
        {
            
    $num 1;
        }
        else if (
    $percentage 35)
        {
            
    $num 2;
        }
        else if (
    $percentage 75)
        {
            
    $num 3;
        }
        else if (
    $percentage 100)
        {
            
    $num 4;
        }
        else if (
    $percentage >= 100)
        {
            
    $num 5;
        }
     
        return 
    'room-occupancy-' $num;
    }
     
    ?>
    <div class="habblet-container "> 
    <div class="cbb clearfix red ">
     
    <h2 class="title">Populaire kamers</h2>
     
    <style type="text/css">
    .room-occupancy-1 { background-image: url('{url}/app/tpl/skins/Habbo/images/rooms/room_icon_1.gif') !important; }
    .room-occupancy-2 { background-image: url('{url}/app/tpl/skins/Habbo/images/rooms/room_icon_2.gif') !important; }
    .room-occupancy-3 { background-image: url('{url}/app/tpl/skins/Habbo/images/rooms/room_icon_3.gif') !important; }
    .room-occupancy-4 { background-image: url('{url}/app/tpl/skins/Habbo/images/rooms/room_icon_4.gif') !important; }
    .room-occupancy-5 { background-image: url('{url}/app/tpl/skins/Habbo/images/rooms/room_icon_5.gif') !important; }
    </style>
     
    <div id="rooms-habblet-list-container-h124" class="recommendedrooms-lite-habblet-list-container">
    <ul class="habblet-list">
     
    <?php
     
    $get 
    mysql_query("SELECT * FROM rooms WHERE roomtype = 'private' ORDER BY users_now DESC LIMIT 5")or die(mysql_error());
     
    while (
    $room mysql_fetch_assoc($get))
    {
        if (
    $eo == 'even')
        {
            
    $eo 'odd';
        }
        else
        {
            
    $eo 'even';
        }
     
        echo 
    '<li class="' $eo '">
        <span class="clearfix enter-room-link ' 
    GenerateRoomOccupancy($room['users_now'], $room['users_max']) . '" title="Go There" roomid="' $room['id'] . '">
        <span class="room-enter">Naar kamer</span>
        <span class="room-name">' 
    htmlspecialchars ($room['caption']) . '</span>
        <span class="room-description">' 
    htmlspecialchars ($room['description']) . '</span>       
        <span class="room-owner">Owner: <a href="/home/' 
    . ($room['owner']) . '">' . ($room['owner']) . '</a></span>
        </span>
        </li>'
    ;
    }
     
    ?>
     
    <div id="room-more-data-h124" style="display: none">
    <ul class="habblet-list room-more-data">
     
    <?php
     
    $get 
    mysql_query("SELECT * FROM rooms WHERE roomtype = 'private' ORDER BY users_now DESC LIMIT 6,10")or die(mysql_error());
     
    while (
    $room mysql_fetch_assoc($get))
    {
        if (
    $eo == 'even')
        {
            
    $eo 'odd';
        }
        else
        {
            
    $eo 'even';
        }
     
        echo 
    '<li class="' $eo '">
        <span class="clearfix enter-room-link ' 
    GenerateRoomOccupancy($room['users_now'], $room['users_max']) . '" title="Go There" roomid="' $room['id'] . '">
        <span class="room-enter">Naar kamer</span> <br>
        <span class="room-name">' 
    htmlspecialchars ($room['caption']) . '</span> <br>
        <span class="room-description">' 
    htmlspecialchars ($room['description']) . '</span>       
        <span class="room-owner">Owner: <a href="/home/' 
    . ($room['owner']) . '">' . ($room['owner']) . '</a></span>
        </span>
        </li>'
    ;
    }
     
    ?>
     
    </ul>
    </div>
     
    <div class="clearfix">
    <a href="#" class="room-toggle-more-data" id="room-toggle-more-data-h124">Meer kamers!</a>
    </div>
     
    </div>
     
    <script type="text/javascript">
    L10N.put("show.more", "Show more rooms");
    L10N.put("show.less", "Show less rooms");
    var roomListHabblet_h124 = new RoomListHabblet("rooms-habblet-list-container-h124", "room-toggle-more-data-h124", "room-more-data-h124");
    </script>
     
    </div>
    </div>
    <script type="text/javascript">if (!$(document.body).hasClassName('process-template')) { Rounder.init(); }</script>
     
       
    <br /><br>


    Remember, replace "skins/Habbo" with your skin folder, like "skins/yourskin"
    The only thing you need to do is add the css and js in your style and js folder.

    Download link of the css and js : https://www.mediafire.com/?tki8xg7417i1p67

    Screenshot of the result : http://gyazo.com/f3b0bb3deac31b08cbd44fe5c231e755
    Sorry if you don't understand the tutorial on how to set this up, i have some trouble with my English grammar.

    Anyways, have a nice day further,

    Mozilla.
    Last edited by Mozilla2; 24-07-14 at 12:12 AM.


  2. #2
    Member R4G3H is offline
    MemberRank
    Jun 2013 Join Date
    69Posts

    Re: RevCMS hot rooms

    Wow thank you so much I was in need of this for my RP, and this will work! Thank you!

    +1 like and rep!

  3. #3
    Account Upgraded | Title Enabled! Mozilla2 is offline
    MemberRank
    Apr 2012 Join Date
    The NetherlandsLocation
    223Posts

    Re: RevCMS hot rooms

    Quote Originally Posted by R4G3H View Post
    Wow thank you so much I was in need of this for my RP, and this will work! Thank you!

    +1 like and rep!
    Thanks :)! Here is a screenshot of the result : http://gyazo.com/f3b0bb3deac31b08cbd44fe5c231e755

  4. #4
    hi JackHoll is offline
    MemberRank
    Mar 2013 Join Date
    UKLocation
    469Posts

    Re: RevCMS hot rooms

    Just by looking at the code I can tell it's vulnerable to XSS exploits.

    This is what I use:

    http://pastebin.com/raw.php?i=EiFS81AW

  5. #5
    Account Upgraded | Title Enabled! Mozilla2 is offline
    MemberRank
    Apr 2012 Join Date
    The NetherlandsLocation
    223Posts

    Re: RevCMS hot rooms

    Quote Originally Posted by JackHoll View Post
    Just by looking at the code I can tell it's vulnerable to XSS exploits.

    This is what I use:

    http://pastebin.com/raw.php?i=EiFS81AW
    Where do you see a XSS vulnerable?

    Nevermind, i found it.

  6. #6
    Alpha Member Emily is offline
    MemberRank
    Oct 2012 Join Date
    The NetherlandsLocation
    2,408Posts

    Re: RevCMS hot rooms

    I don't like the code behind the idea but the idea is cool. This reminds me of the old days with HoloCMS which had the same. Sadly, the code is pretty shit, just like RevCMS.. :-(

  7. #7
    Account Upgraded | Title Enabled! Joe Richardson is offline
    MemberRank
    Feb 2013 Join Date
    485Posts

    Re: RevCMS hot rooms

    Does the button bring extra rooms down?

  8. #8
    Account Upgraded | Title Enabled! Mozilla2 is offline
    MemberRank
    Apr 2012 Join Date
    The NetherlandsLocation
    223Posts

    Re: RevCMS hot rooms

    Quote Originally Posted by Tha View Post
    I don't like the code behind the idea but the idea is cool. This reminds me of the old days with HoloCMS which had the same. Sadly, the code is pretty shit, just like RevCMS.. :-(
    Yeah, i converted it from holocms. Thanks for your feedback.

    - - - Updated - - -

    I updated the code, it should be exploit free now

  9. #9
    hi JackHoll is offline
    MemberRank
    Mar 2013 Join Date
    UKLocation
    469Posts

    Re: RevCMS hot rooms

    Quote Originally Posted by Mozilla2 View Post
    Where do you see a XSS vulnerable?

    Nevermind, i found it.
    If you was to add <script>alert('Hello!')</script> in the room title as long as the room was shown it an alert would popup saying Hello!

  10. #10
    Account Upgraded | Title Enabled! Mozilla2 is offline
    MemberRank
    Apr 2012 Join Date
    The NetherlandsLocation
    223Posts

    Re: RevCMS hot rooms

    Quote Originally Posted by JackHoll View Post
    If you was to add <script>alert('Hello!')</script> in the room title as long as the room was shown it an alert would popup saying Hello!
    I know, i already updated the code in my post :P. Anyways, thanks for helping buddy!

  11. #11
    hi JackHoll is offline
    MemberRank
    Mar 2013 Join Date
    UKLocation
    469Posts

    Re: RevCMS hot rooms

    Quote Originally Posted by Mozilla2 View Post
    I know, i already updated the code in my post :P. Anyways, thanks for helping buddy!
    It's all good

  12. #12
    Check http://arcturus.pw The General is offline
    DeveloperRank
    Aug 2011 Join Date
    7,610Posts

    Re: RevCMS hot rooms

    You can use modulus (%) to switch between two values. $i = $i %2; $i++ (Would switch between 1 and 0). Just some small tip

    Besides that, you have twice identical code (except the LIMIT in the query). Programmers don't like double code. Try come up with some algorithm so any double code gets eliminated. ^_^

    Good job so far on creating those small widgets for RevCMS

  13. #13
    Keep your head up. FlyHotel is offline
    MemberRank
    Apr 2011 Join Date
    The NetherlandsLocation
    570Posts

    Re: RevCMS hot rooms

    Quote Originally Posted by The General View Post
    You can use modulus (%) to switch between two values. $i = $i %2; $i++ (Would switch between 1 and 0). Just some small tip

    Besides that, you have twice identical code (except the LIMIT in the query). Programmers don't like double code. Try come up with some algorithm so any double code gets eliminated. ^_^

    Good job so far on creating those small widgets for RevCMS
    You smartboy :$ But, is this code safe?

  14. #14
    Account Upgraded | Title Enabled! Mozilla2 is offline
    MemberRank
    Apr 2012 Join Date
    The NetherlandsLocation
    223Posts

    Re: RevCMS hot rooms

    Quote Originally Posted by The General View Post
    You can use modulus (%) to switch between two values. $i = $i %2; $i++ (Would switch between 1 and 0). Just some small tip

    Besides that, you have twice identical code (except the LIMIT in the query). Programmers don't like double code. Try come up with some algorithm so any double code gets eliminated. ^_^

    Good job so far on creating those small widgets for RevCMS
    Hey,

    Thanks for the tips, it's verry useful to me :)!

    - - - Updated - - -

    Quote Originally Posted by FlyHotel View Post
    You smartboy :$ But, is this code safe?
    Yes, it is.

  15. #15
    Check http://arcturus.pw The General is offline
    DeveloperRank
    Aug 2011 Join Date
    7,610Posts

    Re: RevCMS hot rooms

    Quote Originally Posted by FlyHotel View Post
    You smartboy :$ But, is this code safe?
    Yes it is. If it wasn't I would've mentioned it ^.^

    - - - Updated - - -

    Quote Originally Posted by Mozilla2 View Post
    Hey,

    Thanks for the tips, it's verry useful to me :)!
    No problem mate



Page 1 of 2 12 LastLast

Advertisement