BrainCMS | How do I fix the Fatal error for Currently in the room

DanishAdam

Member
Jan 28, 2020
68
15
Hello Devbest!

What does Unknown column mean? How do I fix that? Can someone please guide me for this. If I know how, so I can fix for the Buy VIP too, and the other error if there's more.

You must be registered for see images attach
You must be registered for see images attach
You must be registered for see images attach
 
Solution
Currently in the room could be fixed with this:

Replace "roomcount.php" in "templates/brain" with the following code:

PHP:
<?php
    $sql = $dbh->prepare("SELECT id,users,name,owner_id,owner_name FROM rooms WHERE users > 0 ORDER BY users DESC LIMIT 5");
    $sql->execute();
    If($sql->RowCount() > 0)
    {
        while ($on = $sql->fetch())
        {
            echo'
            <a  style="text-decoration: none;color: #000;">
            <img  src="/templates/brain/style/images/icons/habbo_online_anim.gif" align="right">
            ';
            if ($on['users'] == 0)
            {
                $onlineUsers = '<img style="padding-right: 10px;" src="/templates/brain/style/images/icons/room_icon_1.gif" align="left">'...

Wieiscool

New Member
Jan 27, 2013
28
11
Currently in the room could be fixed with this:

Replace "roomcount.php" in "templates/brain" with the following code:

PHP:
<?php
    $sql = $dbh->prepare("SELECT id,users,name,owner_id,owner_name FROM rooms WHERE users > 0 ORDER BY users DESC LIMIT 5");
    $sql->execute();
    If($sql->RowCount() > 0)
    {
        while ($on = $sql->fetch())
        {
            echo'
            <a  style="text-decoration: none;color: #000;">
            <img  src="/templates/brain/style/images/icons/habbo_online_anim.gif" align="right">
            ';
            if ($on['users'] == 0)
            {
                $onlineUsers = '<img style="padding-right: 10px;" src="/templates/brain/style/images/icons/room_icon_1.gif" align="left">';
            }
            else if ($on['users'] > 29)
            {
                $onlineUsers = '<img style="padding-right: 10px;" src="/templates/brain/style/images/icons/room_icon_5.gif" align="left">';
            }
            else if ($on['users'] > 19)
            {
                $onlineUsers = '<img style="padding-right: 10px;" src="/templates/brain/style/images/icons/room_icon_4.gif" align="left">';
            }
            else if ($on['users'] > 9)
            {
                $onlineUsers = '<img style="padding-right: 10px;" src="/templates/brain/style/images/icons/room_icon_3.gif" align="left">';
            }
            else if ($on['users'] > 0)
            {
                $onlineUsers = '<img style="padding-right: 10px;" src="/templates/brain/style/images/icons/room_icon_2.gif" align="left">';
            }
            echo $onlineUsers;
            echo'
            <div class="users_now">
            </div>
            <div class="caption">
            <b>'.filter($on['name']).'.</b>                    </div>
            <div class="owner">
            Currently <b>'.filter($on['users']).'</b> user(s) in the room.<br>
            Room owner: <a href="/home/'.filter($on['owner_name']) .'"><b>'.filter($on['owner_name']).'</a></b>
            </div>
            <hr>
            </a>
            ';
        }
    }
    else
    {
        echo '
        <img style="padding-right: 10px;" src="/templates/brain/style/images/icons/room_icon_1.gif" align="left">
        <div class="users_now">
        </div>
        <div class="caption">
        <b><br>there are no users in a room.</b></div>
        <div class="owner">
        </div>
        ';
    }
?>

Buy vip should be fixed with:

Go to "system/app/plugins" and replace the code in "buyvip.php" with this code:


PHP:
<?php
    if(!defined('BRAIN_CMS'))
    {
        die('Sorry but you cannot access this file!');
    }
    function buyvip()
    {
        global $dbh,$config,$lang;
        if (isset($_POST['getvip']))
        {
            if (User::userData('vip_points') >= $config['vipCost'])
            {
                if (User::userData('online') == 1)
                {
                    return Html::error($lang["Vonline"]);
                }
                else
                {
                    if (User::userData('rank') == $config['vipRankToGet'])
                    {
                        return Html::error($lang["Valreadyvip"]);
                    }
                    else
                    {
                        $removeDiamonds = $dbh->prepare("
                        UPDATE users_currency SET
                        amount=amount - :cost
                        WHERE
                        user_id=:id
                        AND
                        type=5
                        ");
                        $removeDiamonds->bindParam(':id', $_SESSION['id']);
                        $removeDiamonds->bindParam(':cost', $config['vipCost']);
                        $removeDiamonds->execute();
                        $giveVipRank = $dbh->prepare("
                        UPDATE users SET
                        rank = :viprank
                        WHERE
                        id=:id
                        ");
                        $giveVipRank->bindParam(':id', $_SESSION['id']);
                        $giveVipRank->bindParam(':viprank', $config['vipRankToGet']);
                        $giveVipRank->execute();
                        $giveVipBadge = $dbh->prepare("
                        INSERT INTO
                        users_badges
                        (user_id, slot_id, badge_code)
                        VALUES
                        (
                        :id,
                        0,
                        :badgeid
                        )");
                        $giveVipBadge->bindParam(':id', $_SESSION['id']);
                        $giveVipBadge->bindParam(':badgeid', $config['vipBadge']);
                        $giveVipBadge->execute();
                        return Html::errorSucces($lang["VbuySucces"]);
                    }
                }
            }
            else
            {
                return Html::error($lang["VnoDimonds"]);
            }
        }
    }


If any more errors occur, let us know :)
 
Solution

DanishAdam

Member
Jan 28, 2020
68
15
Currently in the room could be fixed with this:

Replace "roomcount.php" in "templates/brain" with the following code:

PHP:
<?php
    $sql = $dbh->prepare("SELECT id,users,name,owner_id,owner_name FROM rooms WHERE users > 0 ORDER BY users DESC LIMIT 5");
    $sql->execute();
    If($sql->RowCount() > 0)
    {
        while ($on = $sql->fetch())
        {
            echo'
            <a  style="text-decoration: none;color: #000;">
            <img  src="/templates/brain/style/images/icons/habbo_online_anim.gif" align="right">
            ';
            if ($on['users'] == 0)
            {
                $onlineUsers = '<img style="padding-right: 10px;" src="/templates/brain/style/images/icons/room_icon_1.gif" align="left">';
            }
            else if ($on['users'] > 29)
            {
                $onlineUsers = '<img style="padding-right: 10px;" src="/templates/brain/style/images/icons/room_icon_5.gif" align="left">';
            }
            else if ($on['users'] > 19)
            {
                $onlineUsers = '<img style="padding-right: 10px;" src="/templates/brain/style/images/icons/room_icon_4.gif" align="left">';
            }
            else if ($on['users'] > 9)
            {
                $onlineUsers = '<img style="padding-right: 10px;" src="/templates/brain/style/images/icons/room_icon_3.gif" align="left">';
            }
            else if ($on['users'] > 0)
            {
                $onlineUsers = '<img style="padding-right: 10px;" src="/templates/brain/style/images/icons/room_icon_2.gif" align="left">';
            }
            echo $onlineUsers;
            echo'
            <div class="users_now">
            </div>
            <div class="caption">
            <b>'.filter($on['name']).'.</b>                    </div>
            <div class="owner">
            Currently <b>'.filter($on['users']).'</b> user(s) in the room.<br>
            Room owner: <a href="/home/'.filter($on['owner_name']) .'"><b>'.filter($on['owner_name']).'</a></b>
            </div>
            <hr>
            </a>
            ';
        }
    }
    else
    {
        echo '
        <img style="padding-right: 10px;" src="/templates/brain/style/images/icons/room_icon_1.gif" align="left">
        <div class="users_now">
        </div>
        <div class="caption">
        <b><br>there are no users in a room.</b></div>
        <div class="owner">
        </div>
        ';
    }
?>

Buy vip should be fixed with:

Go to "system/app/plugins" and replace the code in "buyvip.php" with this code:


PHP:
<?php
    if(!defined('BRAIN_CMS'))
    {
        die('Sorry but you cannot access this file!');
    }
    function buyvip()
    {
        global $dbh,$config,$lang;
        if (isset($_POST['getvip']))
        {
            if (User::userData('vip_points') >= $config['vipCost'])
            {
                if (User::userData('online') == 1)
                {
                    return Html::error($lang["Vonline"]);
                }
                else
                {
                    if (User::userData('rank') == $config['vipRankToGet'])
                    {
                        return Html::error($lang["Valreadyvip"]);
                    }
                    else
                    {
                        $removeDiamonds = $dbh->prepare("
                        UPDATE users_currency SET
                        amount=amount - :cost
                        WHERE
                        user_id=:id
                        AND
                        type=5
                        ");
                        $removeDiamonds->bindParam(':id', $_SESSION['id']);
                        $removeDiamonds->bindParam(':cost', $config['vipCost']);
                        $removeDiamonds->execute();
                        $giveVipRank = $dbh->prepare("
                        UPDATE users SET
                        rank = :viprank
                        WHERE
                        id=:id
                        ");
                        $giveVipRank->bindParam(':id', $_SESSION['id']);
                        $giveVipRank->bindParam(':viprank', $config['vipRankToGet']);
                        $giveVipRank->execute();
                        $giveVipBadge = $dbh->prepare("
                        INSERT INTO
                        users_badges
                        (user_id, slot_id, badge_code)
                        VALUES
                        (
                        :id,
                        0,
                        :badgeid
                        )");
                        $giveVipBadge->bindParam(':id', $_SESSION['id']);
                        $giveVipBadge->bindParam(':badgeid', $config['vipBadge']);
                        $giveVipBadge->execute();
                        return Html::errorSucces($lang["VbuySucces"]);
                    }
                }
            }
            else
            {
                return Html::error($lang["VnoDimonds"]);
            }
        }
    }


If any more errors occur, let us know :)
Uh-Oh, its works so well now. Thank you bro!
 

Users who are viewing this thread

Top