Naključni link
3 naročniki
3 naročniki
5 odgovorov
<?php
$RANDOM_TXT_FILE = "linki.txt";
srand((double)microtime()*1000000);
if (file_exists($RANDOM_TXT_FILE)) {
$arry_txt = preg_split("/--NEXT--/", join('', file($RANDOM_TXT_FILE)));
echo $arry_txt[rand(0, sizeof($arry_txt) -1)];
} else {
echo "Error: can't open $RANDOM_TXT_FILE file";
}
?>
v linki.txt pa zapiši
<a href="http://www.link.com">Bla bla</a>
--NEXT--
<a href="http://www.link2.com">Bla bla 2</a>
--NEXT--
<a href="http://www.link3.com">Bla bla3</a>