PHP para mostrar texto e links randômicos

LINKS PATROCINADOS

  <?php

/*
* Script written by Danltn
* Leave this message intact for use, visitors won’t see it, don’t worry
* URL: http://danltn.com
*/

function site($site, $url)
{
// This function turns the provided parameters into a link.
$link = ‘<a href=”‘. $url . ‘”>’ . $site . ‘</a>’;
return $link;
}
// Set your websites here, remember to increase the number by one each time.

$website[1] = site(“Google”,”http://google.com”);
$website[2] = site(“MSN”,”http://msn.com”);
$website[3] = site(“Yahoo”,”http://yahoo.com”);
$website[4] = site(“Ask”,”http://ask.com”);
$website[5] = site(“Ebay”,”http://ebay.com”);

$before = “”; // What should go before each link, you could for example use it as a <li> element. I’ve set it to nothing.
$after = “<br />”; // What should go after, it could be </li> or <br /> for example. I’ve set it to line break.

$show = 3; // Set the amount of websites to list here

// PHP Magic
$show = floor($show);
if ($show != 1) {
if ($show > count($website)) { $show = count($website); }
$r = array_rand($website, $show);
for ($k=0; $k < $show; $k++)
{
echo $before . $website[$r[$k]] . $after;
} } elseif ($show = 1) { $rand = rand(1, count($website)); echo $website[$rand]; }
?>

LINKS PATROCINADOS
Veja uma seleção dos 10 melhores artigos que temos sobre este assunto:
Pesquisa personalizada

Deixe seus comentários