I can not make the limitation [closed]

0

Hello, I have the following problem:
When I press the button it generates 24 more images, this is not my desire, I want it to continue only 24 and only change for the following. ( see here )

code:

    <head>
<title>Hebbo Gadget</title>
</head>
<style>
.hebbo {height: auto;overflow:hidden;width:230px;}
.emblema {float: left;height:50px;width:50px;margin: 3px;border-radius: 15px;background-repeat: no-repeat;background-position: center center;}
</style>

<div class="hebbo" id='test'>

<?php
$url    = "http://hebbohotel.com.br/swf/gamedata/hebbo_texts.txt?9761831";
$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;
$e = 24;
// aqui você entra com incremento de variável
$maisClique = ((isset($_GET['cliquei']) and !empty($_GET['cliquei']))?$_GET['cliquei']:false);

if(isset($maisClique) and !empty($maisClique)){
    $e += $maisClique;
}
while ($i <= $e)
{
    $number     = $number - 1;
    $imageUrl   = "http://hebbohotel.com.br/swf/c_images/album1584/" . $badgeVar3[$number] . ".gif";
    echo '<div class="emblema" style="background:url(' . $imageUrl . ') no-repeat center,  #E7E7E7;"></div>'; // changed this echo to display the image.
    $i++;
}
// aqui você define o valor $cliques que será calculado em $number para alterações da matriz
if(isset($_GET['cliquei']) and !empty($_GET['cliquei'])){
    $cliques = $_GET['cliquei'] + 24;
}else{
    $cliques = 24;
}
?>
<input type="button" onclick="window.location.replace('http://<?php echo $_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."?cliquei=".$cliques ?>')" value="cliquei" />
</div>
    
asked by anonymous 12.06.2016 / 17:13

1 answer

1

I think the error might be in this part of my friend.

"if(isset($_GET['cliquei']) and !empty($_GET['cliquei'])){
    $cliques = $_GET['cliquei'] + 24;
}else{
    $cliques = 24;
}"

Because you add more than 24 generates the inclusion, you have to overwrite the 24 again and do not increment another 24.

    
13.06.2016 / 00:16