[Help] PHP Script Problem

AaidenX

Member
Jun 30, 2012
261
29
Ok, so I need a PHP script to show a habbo user's motto, and did find a script but it doesn't actually seem to work.

PHP:
<?php
 
        class generator
        {
 
                var $data;
                var $habboname;
                var $hotel;
                var $url;
 
                function generator( $habboname, $hotel )
                {
 
                        $this->habboname = $habboname;
                        $this->hotel    = $hotel;
                        $this->url      = "http://habbo." . $hotel . "/home/" . $habboname;
                        $this->data      = @file_get_contents( $this->url );
 
                }
 
                function offline() {
 
                        if( eregi( "User personal habbo page is hidden", $this->data ) or !$this->name() ) {
 
                                return true;
 
                        }
                        else {
 
                                return false;
 
                        }
 
                }
 
 
 
                function online()
                {
 
                        if ( eregi( "habbo_online_anim.gif", $this->data ) )
                        {
 
                                return true;
 
                        }
                        else
                        {
 
                                return false;
 
                        }
 
                }
 
                function motto()
                {
 
                        $motto = explode( "<div class=\"profile-motto\">", $this->data );
                        $motto = explode( "<div", $motto[1] );
                        $motto = trim($motto[0]);
 
                        return $motto;
 
                }
 
                function badge()
                {
 
                        if( eregi( "c_images/album1584/", $this->data ) )
                        {
 
                                $badge = explode( "/c_images/album1584/", $this->data );
                                $badge = explode( ".gif", $badge[1] );
                                $badge = trim( $badge[0] );
                                $badge = "http://images.habbo.com/c_images/album1584/" . $badge . ".gif";
 
                                return $badge;
 
                        }
                        else
                        {
 
                                return false;
 
                        }
 
                }
 
                function figure()
                {
 
                        $figure = "http://www.habbo." . $this->hotel . "/habbo-imaging/avatarimage?user=" . $this->habboname . "&action=&direction=2&head_direction=3&gesture=sml&size=l&img_format=gif";
                        return $figure;
 
                }
 
                function birthDate()
                {
 
                        $birthdate = explode( "<div class=\"birthday date\">", $this->data );
                        $birthdate = explode( "</div>", $birthdate[1] );
                        $birthdate = trim( $birthdate[0] );
 
                        return $birthdate;
 
                }
 
                function name()
                {
 
                        $name = explode( "<span class=\"name-text\">", $this->data );
                        $name = explode( "</span>", $name[1] );
                        $name = trim( $name[0] );
 
                        return $name;
 
                }
 
                function groupBadge()
                {
 
                        if( eregi( "/habbo-imaging/badge/", $this->data ) )
                        {
 
                                $badge = explode( "/habbo-imaging/badge/", $this->data );
                                $badge = explode( ".gif", $badge[1] );
                                $badge = trim( $badge[0] );
                                $badge = "http://www.habbo." . $this->hotel . "/habbo-imaging/badge/" . $badge . ".gif";
 
                                return $badge;
 
                        }
                        else
                        {
 
                                return false;
 
                        }
 
                } 
 
        }
     
        $habbo = $_GET['name'];
     
        switch( $_GET['hotel'] ) {
     
                case 'au':
                $hotel = "com.au";
                break;
             
                case 'sg':
                $hotel = "com.sg";
                break;
             
                case 'us':
                $hotel = "com";
                break;
             
                case 'ca':
                $hotel = "ca";
                break;
             
                default:
                $hotel = "co.uk";
                break;
     
        }
?>
<?php
        if( $motto = $data->name() ){
                echo $motto;
        }
?>

But if you have a better script than this/working one, please pass it to me. I would be also appreciated if you made that one working.

My errors:
PHP:
Notice: Undefined index: name in C:\Xampp\htdocs\Files\index.php on line 146
 
Notice: Undefined index: hotel in C:\Xampp\htdocs\Files\index.php on line 148
 
Notice: Undefined variable: data in C:\Xampp\htdocs\Files\index.php on line 173
 
Fatal error: Call to a member function name() on a non-object in C:\Xampp\htdocs\Files\index.php on line 173
 

Markshall

Русский Стандарт
Contributor
Dec 18, 2010
2,638
2,393
It's because you need to check whether 'name', 'hotel' and 'data' exist before accessing them.

PHP:
$habbo = (isset($_GET['name'])) ? $_GET['name'] : 'm0nsta.';
PHP:
if (isset($_GET['hotel'])) {
    switch($_GET['hotel']) {
        /*rest of code here*/
    }
}
PHP:
$data = new generator();
if ($motto = $data->name()) {
    echo $motto;
}

I'm not sure what you're trying to do in the last code but whatever.
 

Cronus

Cerberus Founder/Developer
Jul 19, 2013
449
25
<?php
function clean($str) {
$str = @trim($str);
if(get_magic_quotes_gpc()) {
$str = stripslashes($str);
}
return mysql_real_escape_string($str);
}

$username = filter($_REQUEST["user"]);
$userid = filter($_REQUEST["id"]);

// User Info \\
$userinfo = mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$username'"));
$_GET2 = mysql_fetch_assoc($userinfo);

$motto = filter($_GET2['motto']);

?>

Put that ^^^^^^ at the top of the page


then put <?php echo $motto; ?> where you want it




EDIT: O wait is this for retro or real habbo
 

AaidenX

Member
Jun 30, 2012
261
29
real habbo, please put any forms if they are to be included too, thanks! I want for real habbo.


<?php
function clean($str) {
$str = @trim($str);
if(get_magic_quotes_gpc()) {
$str = stripslashes($str);
}
return mysql_real_escape_string($str);
}

$username = filter($_REQUEST["user"]);
$userid = filter($_REQUEST["id"]);

// User Info \\
$userinfo = mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$username'"));
$_GET2 = mysql_fetch_assoc($userinfo);

$motto = filter($_GET2['motto']);

?>

Put that ^^^^^^ at the top of the page


then put <?php echo $motto; ?> where you want it




EDIT: O wait is this for retro or real habbo
 

Users who are viewing this thread

Top