Mostrar imagem ou banner randomico

<?php
srand
microtime() * 1000000);
$advertise rand(1,3);
//After the rand decided how many youve got and the first and last number e.g got 3, 1,3
switch($advertise)
//you can add more just use the same format
{
case 
$banner="site 1 image url"$url="site one address"$height="height"$width="width"; break;
case 
$banner="site 2 image url"$url="site two address"$height="height"$width="width"; break;
case 
$banner="site 3 image url"$url="site 3 address"$height="height"$width="width"; break;
}
$display "<a href=\"$url\" target=\"_blank\"> ";
$display.= "<img src=\"$banner\"  ";
$display.= "width=\"$width\" height=\"$height\" border=\"0\" >";
$display.="</a>";
echo(
$display);
?>

Pesquisa personalizada

3 comentários

  1. Brax says:

    Poxa…não entendo muita coisa de Web Designer, mas acho que vc poderia colocar as informaçoes mais detalhadamente, assim todos poderiam usar suas dicas.

    Parabéns pelo site. Muito bom.

  2. zé linux says:

    Esste script não funciona: dá erro no switch

    Parse error: parse error, unexpected ‘:’ in /web/sites/meu_site.com.br/imagens_randomicas.php on line 10

  3. fofinhooooo says:

    <?php
    srand( microtime() * 1000000);
    $advertise = rand(1,3);
    //After the rand decided how many youve got and the first and last number e.g got 3, 1,3
    switch($advertise)
    //you can add more just use the same f

Deixe seus comentários