[FANSITE BADGE SCRIPT]

Status
Not open for further replies.

Zephyrus

Wanderer
Sep 28, 2011
336
21
If someone can get this script to display a maximum of only 3 images, that would be great! PLEASE POST A REPLY BACK!!!!

[THIS SCRIPT DISPLAYS ALL OF THE IMAGES WITHIN THE BADGES DIRECTORY IN THEIR SWFS.]


<?php
$url = " "; // you can change habbo.com to other hotels
$data = file_get_contents($url);
$newlines = array("\n" ,"\r", "\r\n", ">", "<", "/");
$content = str_replace($newlines, "", html_entity_decode($data));

$Statushtml= '/badge_desc_(.+?)=/';
preg_match_all($Statushtml,$content,$Statusraw);
$badges = implode("-", $Statusraw[0]);
$badgevar = explode("=-badge_desc_", $badges);
$number = ($badgevar);
$badgevar2 = str_replace("=","",$badgevar);
$badgevar3 = str_replace("badge_desc_","",$badgevar2);
$number = count($badgevar3);
while ($number != 3) {

$number = $number - 1;

$imageUrl = " "; // if you did change habbo.com, you'd have to change it here too.

if(file_exists('images/badges/' . $badgevar3[$number] . '.gif'))
{
// removed the echo failure line line
} else {
echo '<div style="float:left; background:url(' . $imageUrl . '); height:50px; width:10%; background-repeat:no-repeat; background-position:center center;"></div>'; // changed this echo to display the image.
}
}

?>














<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.pages.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("div.holder").jPages({
containerID : "test",
perPage: 60
});
});
</script>

<section class="row">
<div class="news-box">
<span style="font-weight:bold;">Habbo Badges</span>

<div class="holder"></div>
<div id="test" style="overflow-x:scroll; height:350px;">
<?php
function mtimecmp($a, $b) {
$mt_a = filemtime($a);
$mt_b = filemtime($b);

if ($mt_a == $mt_b)
return 0;
else if ($mt_a < $mt_b)
return -1;
else
return 1;
}

$images = glob("images/badges/*.gif");
usort($images, "mtimecmp");

for ($i = count($images) - 1; $i >= 0; $i--) {
$image = $images[$i];
$imgname = basename($image,".gif");
echo '<div style="float:left; background:url(' . $image . '); height:50px; width:10%; background-repeat:no-repeat; background-position:center center;"></div>';
}
?>
<div style="clear:both;"></div>
</div>
</div>

</div>
</div>
</section>
 

Weasel

👄 I'd intercept me
Nov 25, 2011
4,132
2,456
PHP:
<?php
$url    = "http://xeonhotel.co.uk/r63/external_flash_texts.txt";
$data   = file_get_contents($url);

$newlines   = array("\n" ,"\r", "\r\n", ">", "<", "/");
$content    = str_replace($newlines, "", html_entity_decode($data));

$statusHtml = '/badge_desc_(.+?)=/';
preg_match_all($statusHtml, $content, $statusRaw);

$badges     = implode("-", $statusRaw[0]);
$badgeVar   = explode("=-badge_desc_", $badges);
$badgeVar2  = str_replace("=", "", $badgeVar);
$badgeVar3  = str_replace("badge_desc_", "", $badgeVar2);
$number     = count($badgeVar3);

$i = 1;
while ($i <= 3)
{
    $number     = $number - 1;
    $imageUrl   = "http://game.habboon.com/c_images/album1584/" . $badgeVar3[$number] . ".gif";

    if (file_exists('images/badges/' . $badgeVar3[$number] . '.gif'))
    {
        echo '<div style="float:left; background:url(' . $imageUrl . '); height:50px; width:10%; background-repeat:no-repeat; background-position:center center;"></div>'; // changed this echo to display the image.
    }
  
    $i++;
}
?>
 

Zephyrus

Wanderer
Sep 28, 2011
336
21
PHP:
<?php
$url    = "http://xeonhotel.co.uk/r63/external_flash_texts.txt";
$data   = file_get_contents($url);

$newlines   = array("\n" ,"\r", "\r\n", ">", "<", "/");
$content    = str_replace($newlines, "", html_entity_decode($data));

$statusHtml = '/badge_desc_(.+?)=/';
preg_match_all($statusHtml, $content, $statusRaw);

$badges     = implode("-", $statusRaw[0]);
$badgeVar   = explode("=-badge_desc_", $badges);
$badgeVar2  = str_replace("=", "", $badgeVar);
$badgeVar3  = str_replace("badge_desc_", "", $badgeVar2);
$number     = count($badgeVar3);

$i = 1;
while ($i <= 3)
{
    $number     = $number - 1;
    $imageUrl   = "http://game.habboon.com/c_images/album1584/" . $badgeVar3[$number] . ".gif";

    if (file_exists('images/badges/' . $badgeVar3[$number] . '.gif'))
    {
        echo '<div style="float:left; background:url(' . $imageUrl . '); height:50px; width:10%; background-repeat:no-repeat; background-position:center center;"></div>'; // changed this echo to display the image.
    }
 
    $i++;
}
?>
Does your version of the script display the latest 3?

PHP:
<?php
$url    = "http://xeonhotel.co.uk/r63/external_flash_texts.txt";
$data   = file_get_contents($url);

$newlines   = array("\n" ,"\r", "\r\n", ">", "<", "/");
$content    = str_replace($newlines, "", html_entity_decode($data));

$statusHtml = '/badge_desc_(.+?)=/';
preg_match_all($statusHtml, $content, $statusRaw);

$badges     = implode("-", $statusRaw[0]);
$badgeVar   = explode("=-badge_desc_", $badges);
$badgeVar2  = str_replace("=", "", $badgeVar);
$badgeVar3  = str_replace("badge_desc_", "", $badgeVar2);
$number     = count($badgeVar3);

$i = 1;
while ($i <= 3)
{
    $number     = $number - 1;
    $imageUrl   = "http://game.habboon.com/c_images/album1584/" . $badgeVar3[$number] . ".gif";

    if (file_exists('images/badges/' . $badgeVar3[$number] . '.gif'))
    {
        echo '<div style="float:left; background:url(' . $imageUrl . '); height:50px; width:10%; background-repeat:no-repeat; background-position:center center;"></div>'; // changed this echo to display the image.
    }
 
    $i++;
}
?>
The script does not work,
 
Last edited by a moderator:
Status
Not open for further replies.

Users who are viewing this thread

Top