PDA

View Full Version : PHP source HabboClass function.



Bob3k
27-04-2008, 01:45 PM
Hey Guys, ive found a php code at the internet. That shows habbo's badge - Also not the Group badge but the orginal.
<?
echo getHabboBadge($habboHome);
?>

That is the code im using to grab users badge, is it possible to do if the user dosent have a badge on the habbo. Then the picture will dosent show up.

Thanks for your help !

PixelWill
27-04-2008, 01:58 PM
Does that even work? :S

Protege
27-04-2008, 02:33 PM
Thats not a code thats a function you are calling. If you want help you've got to provide the code behind that.

PixelWill
27-04-2008, 02:40 PM
Thats not a code thats a function you are calling. If you want help you've got to provide the code behind that.

Yeah, that's what I thought.. xD

Bob3k
27-04-2008, 04:58 PM
<?php











function setHome($Hotel, $HabboName) //Set a variable has data from the Habbo Home



{



if (!$Hotel or !$HabboName)



{



return false;



}



else



{



$homeData = file_get_contents("http://habbohotel." . $Hotel . "/home/" . $HabboName);



return $homeData;



}



}







function isBanned($Home) //Check if a habbo is banned



{



if (!$Home)



{



return false;



}



else



{



if (eregi("This page is not available anymore", $Home))



{



return true;



}



else



{



return false;



}



}



}







function isPrivate($Home) //Check if a Habbo Home is private



{



if (!$Home)



{



return false;



}



else



{



if (eregi("</span> marked this page as private.", $Home))



{



return true;



}



else



{



return false;



}



}



}







function habboExists($Home) //See if a Habbo exists



{



if (!$Home)



{



return false;



}



else



{



if (eregi('<div id="page-headline-text">Habbo Homes</div>', $Home))



{



return false;



}



else



{



return true;



}



}







}







function isOnline($Home) //See if a Habbo is online



{



if (!$Home)



{



return false;



}



else



{



if (eregi("habbo_online_anim.gif", $Home))



{



return true;



}



else



{



return false;



}



}



}







function getHabboMotto($Home) //Grab the Habbos motto



{



if (!$Home)



{



return false;



}



else



{



$mottoStart = explode('<div class="profile-motto">', $Home);



$mottoEnd = explode('</div>', $mottoStart[1]);



$mottoTrim = trim($mottoEnd[0]);



$motto = str_replace(' <div class="clear">', '', $mottoTrim);



return $motto;



}



}







function getHabboName($Home) //Get the Habbos name in full casing



{



if (!$Home)



{



return false;



}



else



{



if (eregi("This page is not available anymore", $Home))



{



$nameStart = explode(



'This page is not available anymore, <span style="font-weight: bold;">', $Home);



$nameEnd = explode('</span> was banned<br />', $nameStart[1]);



$name = trim($nameEnd[0]);



return $name;



}



elseif (eregi("</span> marked this page as private.", $Home))



{



$nameStart = explode(



'src="http://images.habbohotel.co.uk/c_images/album1358/frank_stop_001.gif" / alt="">',



$Home);



$nameEnd = explode("</span> marked this page as private.", $nameStart[1]);



$name = trim($nameEnd[0]);



return $name;



}



else



{



$nameStart = explode("<title>Habbo ~ Habbo home: ", $Home);



$nameEnd = explode("</title>", $nameStart[1]);



$name = trim($nameEnd[0]);



return $name;



}



}



}







function getHabboBadge($Home) //Grab the habbos badge



{



if (!$Home)



{



return false;



}



else



{



if (eregi("c_images/album1584/", $Home))



{



$extensionStart = explode("http://images.habbohotel.", $Home);



$extensionEnd = explode("/", $extensionStart[1]);



$extension = trim($extensionEnd[0]);



$badgeStart = explode("http://images.habbohotel." . $extension .



"/c_images/album1584/", $Home);



$badgeEnd = explode(".gif", $badgeStart[1]);



$badgeTrim = trim($badgeEnd[0]);



$badge = "http://images.habbohotel." . $extension . "/c_images/album1584/" . $badgeTrim .



".gif";



return $badge;



}



else



{



return false;



}



}



}







function getHabboFigure($Home) //Get the Habbos Figure



{



if (!$Home)



{



return false;



}



else



{



$figureStart = explode('<div class="profile-figure">', $Home);



$figureEnd = explode('</div>', $figureStart[1]);



$figureTrim = trim($figureEnd[0]);



$figure = preg_replace('/<img alt=\"(.*?)\" src=\"(.*?)\" \/>/', '$2', $figureTrim);



$hotelStart = explode('<div id="habbologo"><a href="', $Home);



$hotelEnd = explode('/"></a></div>', $hotelStart[1]);



$hotel = trim($hotelEnd[0]);



$figure = $hotel . $figure;



return $figure;



}



}







function getHabboBirthdate($Home) //Grab the date a Habbo was born



{



if (!$Home)



{



return false;



}



else



{



$birthdateStart = explode('<div class="birthday date">', $Home);



$birthdateEnd = explode('</div>', $birthdateStart[1]);



$birthdate = trim($birthdateEnd[0]);



return $birthdate;



}



}







function getHabbosOnline($Home) //Get the amount of habbos online



{



if (!$Home)



{



return false;







}



else



{



$onlineStart = explode('<td id="topbar-count">', $Home);



$onlineEnd = explode(' Habbos online</td>', $onlineStart[1]);



$onlineTrim = trim($onlineEnd[0]);



$online = eregi_replace(",", "", $onlineTrim);



return $online;



}



}



?>



That is the code behind it ;) Hope you can help.

Protege
27-04-2008, 10:10 PM
Who EVER did that, is horrible.

I took some of the whitespaces out of the few functions but I dont see why he over used functions


function setHome($Hotel, $HabboName) {
if (!$Hotel or !$HabboName) {
return false;
} else {
$homeData = file_get_contents("http://habbohotel." . $Hotel . "/home/" . $HabboName);
return $homeData;
}
}

function isBanned($Home) {
if (!$Home) {
return false;
} else {
if (eregi("This page is not available anymore", $Home)) {
return true;
} else {
return false;
}
}
}

function isPrivate($Home) {
if (!$Home) {
return false;
} else {
if (eregi("</span> marked this page as private.", $Home)) {
return true;
} else {
return false;
}
}
}

function habboExists($Home) {
if (!$Home) {
return false;
} else {
if (eregi('<div id="page-headline-text">Habbo Homes</div>', $Home)) {
return false;
} else {
return true;
}
}
}

function isOnline($Home) {
if (!$Home) {
return false;
} else {
if (eregi("habbo_online_anim.gif", $Home)) {
return true;
} else {
return false;
}
}
}


If you return the PHP with it nice and clean like above someone might help.

Want to hide these adverts? Register an account for free!