[PHP] [WITH SOURCE] HabboEmotion Shoutbox

Do you like this?


  • Total voters
    2
Status
Not open for further replies.

Markshall

Русский Стандарт
Contributor
Dec 18, 2010
2,637
2,389
Not a very big release, just a quick 45 minute job.

PEJump2 requested this so I coded it for him...

DEMO:


index.php
PHP:
<?php
/*
THIS WAS CODED BY m0nsta. FROM *****.COM AND CLUBHABBOFORUM.NET
I HAVE NO IDEA WHO CREATED THE IMAGES, BUT CREDITS TO THEM.
ALL CODING BY m0nsta. - THIS WAS REQUESTED BY PEJump2 FROM *****.COM SO I CODED IT.
*/

ob_start();
mysql_connect('localhost', 'db_user', 'db_pass') or die ('Can not conenct to DB');
mysql_select_db('db_name');
?>
<html>
<head>
<title>HabboEmotion Chat by m0nsta.</title>
<style type="text/css">
body {
    font-family: Verdana;
    font-size: 11px;
    color: black;
    margin: 0 auto;
}

input {
    font-family: Verdana;
    font-size: 11px;
    color: black;
}

div#container {
    width: 548px;
    margin: 0 auto;
}

div#top {
    background-image: url('img/top.png');
    height: 228px;
    width: 523px;
    margin: 10px 0 0 0;
    padding: 13px 5px 5px 20px;
}

div#speech {
    background-image: url('img/speech.png');
    height: 62px;
    width: 548px;
}

input#chat-msg {
    margin: 22px 0 0 65px;
    background-color: transparent;
    width: 465px;
    border: 0;
}
</style>
</head>

<body>
    <div id="container">
        <?php        
        $habbo = $_COOKIE['habbo'];
        $hotel = $_COOKIE['hotel'];
        
        if(isset($_GET['logout'])){
            setcookie("habbo", "null", time()-365);
            setcookie("hotel", "null", time()-365);
            setcookie("margin", "null", time()-365);
            header("Location: index.php");
        }
        
        if($habbo == 'null' && $hotel == 'null' || !$habbo && !$hotel){
            if($_POST[login]){
                $hab = strip_tags($_POST['habbo']);
                $hot = strip_tags($_POST['hotel']);
                if(!$hab || !$hot){
                    echo 'Both fields are required!<br><br><a href="index.php">&laquo; Back</a>';
                }else{
                    setcookie("habbo", $hab, time()+365);
                    setcookie("hotel", $hot, time()+365);
                    setcookie("margin", mt_rand(0, 25), time()+365);
                    header("Location: index.php");
                }
            }else{
                echo '<h1>You must login!</h1>
                <form method="post">
                    Habbo name: <input type="text" name="habbo" id="habbo" value="m0nsta." size="45"><br>
                    Habbo hotel: <input type="text" name="hotel" id="hotel" value="com" size="45"><br>
                    <input type="submit" name="login" value="Continue &raquo;">
                </form>';
            }
        }elseif($_POST['chat-msg']){
            $msg = strip_tags(mysql_real_escape_string($_POST['chat-msg']));
            if(!$msg){
                echo 'You must enter a message!<br><br><a href="index.php">&laquo; Back</a>';
            }else{
                $habbo2 = $_COOKIE['habbo'];
                $hotel2 = $_COOKIE['hotel'];
                $margin = $_COOKIE['margin'];
                mysql_query("INSERT INTO `chat` (`habbo`, `hotel`, `margin`, `message`) VALUES ('$habbo2', '$hotel2', '$margin', '$msg');");
                header("Location: index.php");
            }
        }else{
        ?>
            <div id="top">
                <?php
                $last10 = mysql_query("SELECT * FROM chat ORDER BY `id` DESC LIMIT 10");
                if(mysql_num_rows($last10) == 0){
                    echo '<img src="http://habboemotion.com/usable/bubble/bubble.php?habbo=m0nsta.&country=com&text=There are no messages to display!&format=say">';
                }else{
                    while($r = mysql_fetch_array($last10)){
                        $habbo = $r["habbo"];
                        $hotel = $r["hotel"];
                        $margin = $r["margin"];
                        $msg = $r["message"];
                        echo '<img src="http://habboemotion.com/usable/bubble/bubble.php?habbo='.$habbo.'&country='.$hotel.'&text='.$msg.'&format=say" style="margin-left: '.$margin.'px;"><br>';
                    }
                }
                ?>
            </div>
            <div id="speech">
                <form method="post">
                    <input type="text" name="chat-msg" value="Enter a message..." id="chat-msg" onfocus="if (this.value=='Enter a message...') this.value = '';" onblur="if (this.value=='') this.value = 'Enter a message...';">
                </form>
            </div>
            <a href="?logout">Logout</a>
        <?php
        }
        ?>
    </div>
</body>
</html>
<?php 
/*
THIS WAS CODED BY m0nsta. FROM *****.COM AND CLUBHABBOFORUM.NET
I HAVE NO IDEA WHO CREATED THE IMAGES, BUT CREDITS TO THEM.
ALL CODING BY m0nsta. - THIS WAS REQUESTED BY PEJump2 FROM *****.COM SO I CODED IT.
*/
ob_flush();
?>

mysql.sql
PHP:
CREATE TABLE IF NOT EXISTS `chat` (
  `id` int(90) NOT NULL AUTO_INCREMENT,
  `habbo` varchar(45) NOT NULL,
  `hotel` varchar(10) NOT NULL,
  `margin` int(2) NOT NULL DEFAULT '0',
  `message` varchar(100) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

top.png


speech.png



How to install this:

  1. Create a new folder called 'he-chat' or something
  2. Inside that, create a folder called 'img'
  3. Save those two images above in the 'img' folder
  4. Upload the 'he-chat' folder (or whatever you called it) to your site
  5. Set up your MySQL database and change the details on the first few lines of index.php
  6. Execute the mysql.sql code above
  7. Go to index.php and it should work


You have successfully installed the HabboEmotion chat.

It is not coded as good as the original one on HabboEmotion.com because I can not be bothered to code it that good.

Thanks,
- m0nsta.
 

Sledmore

Chaturbate Livestreamer
Staff member
FindRetros Moderator
Jul 24, 2010
5,195
3,907
This is good, Did you code the real one? Or just do a quick code your self? However - Thanks.
 

Markshall

Русский Стандарт
Contributor
Dec 18, 2010
2,637
2,389
I coded it from scratch. This isn't the real one, it's just one I coded to replicate it.

And thanks Kaz :-D
 
Status
Not open for further replies.

Users who are viewing this thread

Top