Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Software Development
Programming
Programming Q&A
[Help] PHP Script Problem
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="AaidenX" data-source="post: 213201" data-attributes="member: 18868"><p>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.</p><p> </p><p>[PHP]<?php</p><p> </p><p> class generator</p><p> {</p><p> </p><p> var $data;</p><p> var $habboname;</p><p> var $hotel;</p><p> var $url;</p><p> </p><p> function generator( $habboname, $hotel )</p><p> {</p><p> </p><p> $this->habboname = $habboname;</p><p> $this->hotel = $hotel;</p><p> $this->url = "http://habbo." . $hotel . "/home/" . $habboname;</p><p> $this->data = @file_get_contents( $this->url );</p><p> </p><p> }</p><p> </p><p> function offline() {</p><p> </p><p> if( eregi( "User personal habbo page is hidden", $this->data ) or !$this->name() ) {</p><p> </p><p> return true;</p><p> </p><p> }</p><p> else {</p><p> </p><p> return false;</p><p> </p><p> }</p><p> </p><p> }</p><p> </p><p> </p><p> </p><p> function online()</p><p> {</p><p> </p><p> if ( eregi( "habbo_online_anim.gif", $this->data ) )</p><p> {</p><p> </p><p> return true;</p><p> </p><p> }</p><p> else</p><p> {</p><p> </p><p> return false;</p><p> </p><p> }</p><p> </p><p> }</p><p> </p><p> function motto()</p><p> {</p><p> </p><p> $motto = explode( "<div class=\"profile-motto\">", $this->data );</p><p> $motto = explode( "<div", $motto[1] );</p><p> $motto = trim($motto[0]);</p><p> </p><p> return $motto;</p><p> </p><p> }</p><p> </p><p> function badge()</p><p> {</p><p> </p><p> if( eregi( "c_images/album1584/", $this->data ) )</p><p> {</p><p> </p><p> $badge = explode( "/c_images/album1584/", $this->data );</p><p> $badge = explode( ".gif", $badge[1] );</p><p> $badge = trim( $badge[0] );</p><p> $badge = "http://images.habbo.com/c_images/album1584/" . $badge . ".gif";</p><p> </p><p> return $badge;</p><p> </p><p> }</p><p> else</p><p> {</p><p> </p><p> return false;</p><p> </p><p> }</p><p> </p><p> }</p><p> </p><p> function figure()</p><p> {</p><p> </p><p> $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";</p><p> return $figure;</p><p> </p><p> }</p><p> </p><p> function birthDate()</p><p> {</p><p> </p><p> $birthdate = explode( "<div class=\"birthday date\">", $this->data );</p><p> $birthdate = explode( "</div>", $birthdate[1] );</p><p> $birthdate = trim( $birthdate[0] );</p><p> </p><p> return $birthdate;</p><p> </p><p> }</p><p> </p><p> function name()</p><p> {</p><p> </p><p> $name = explode( "<span class=\"name-text\">", $this->data );</p><p> $name = explode( "</span>", $name[1] );</p><p> $name = trim( $name[0] );</p><p> </p><p> return $name;</p><p> </p><p> }</p><p> </p><p> function groupBadge()</p><p> {</p><p> </p><p> if( eregi( "/habbo-imaging/badge/", $this->data ) )</p><p> {</p><p> </p><p> $badge = explode( "/habbo-imaging/badge/", $this->data );</p><p> $badge = explode( ".gif", $badge[1] );</p><p> $badge = trim( $badge[0] );</p><p> $badge = "http://www.habbo." . $this->hotel . "/habbo-imaging/badge/" . $badge . ".gif";</p><p> </p><p> return $badge;</p><p> </p><p> }</p><p> else</p><p> {</p><p> </p><p> return false;</p><p> </p><p> }</p><p> </p><p> } </p><p> </p><p> }</p><p> </p><p> $habbo = $_GET['name'];</p><p> </p><p> switch( $_GET['hotel'] ) {</p><p> </p><p> case 'au':</p><p> $hotel = "com.au";</p><p> break;</p><p> </p><p> case 'sg':</p><p> $hotel = "com.sg";</p><p> break;</p><p> </p><p> case 'us':</p><p> $hotel = "com";</p><p> break;</p><p> </p><p> case 'ca':</p><p> $hotel = "ca";</p><p> break;</p><p> </p><p> default:</p><p> $hotel = "co.uk";</p><p> break;</p><p> </p><p> }</p><p>?></p><p><?php</p><p> if( $motto = $data->name() ){</p><p> echo $motto;</p><p> }</p><p>?>[/PHP]</p><p> </p><p>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.</p><p></p><p>My errors:</p><p>[PHP]Notice: Undefined index: name in C:\Xampp\htdocs\Files\index.php on line 146</p><p> </p><p>Notice: Undefined index: hotel in C:\Xampp\htdocs\Files\index.php on line 148</p><p> </p><p>Notice: Undefined variable: data in C:\Xampp\htdocs\Files\index.php on line 173</p><p> </p><p>Fatal error: Call to a member function name() on a non-object in C:\Xampp\htdocs\Files\index.php on line 173[/PHP]</p></blockquote><p></p>
[QUOTE="AaidenX, post: 213201, member: 18868"] 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; } ?>[/PHP] 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[/PHP] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Software Development
Programming
Programming Q&A
[Help] PHP Script Problem
Top