Autor Zpráva
Lollita
Profil *
Dokázal by tu někdo upravit tento script, tak, aby šel použít na náhodné zobrazení obrázku ?

<?php

define('DIR','foto/');

$files = array();

$handle=opendir(DIR);
while (($file = readdir($handle)) !== false){
if(is_file(DIR . $file)) $files[] = $file;
}
closedir($handle);

echo DIR . $files[ array_rand($files, 1) ];

?>
Lollita
Profil *
Teda spíš sprovoznit toto :)


<?php

define('DIR','foto/');

$files = array();

$handle=opendir(DIR);
while (($file = readdir($handle)) !== false){
if(is_file(DIR . $file)) $files[] = $file;
}
closedir($handle);

echo "<A href="DIR . $files[ array_rand($files, 1) ]">IMG src="DIR . $files[ array_rand($files, 1) ]"></A>";

?>
ah01
Profil
V tom posledním řádku máš chyby. Mělo by tam být tohle:

echo "<a href=" . DIR . $files[ array_rand($files, 1) ] . "><img src=" . DIR . $files[ array_rand($files, 1) ] . " /></a>"; 


PS: díky za použití mého kódu ;-)
Lollita
Profil *
Nemáš zač. Onehdy jsem ho tady viděla a zrovna se mi hodil, tak... :)
Toto téma je uzamčeno. Odpověď nelze zaslat.

0