- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
<?php
echo '
<form method="POST" action="">
<input type="submit" name="sub" value="Отправить">
</form>
';
$sub=$_POST['sub'];
if ($sub==true){
function rand_foto($patch = "images")
{
if(!$dir = opendir($patch)) return "images";
while(($t = readdir($dir)) !== false)
{
$ext = substr(strrchr($t,'.'), 1);
if(is_file($t) && ($ext == "gif") || ($ext == "jpg") || ($ext == "png"))
{
$filename[] = $patch."/".$t;
}
}
closedir($dir);
$index = rand(0, count($filename) - 1);
$foto = "<img src=".$filename[$index].">";
return $foto;
}
echo rand_foto(); }
brainstorm 21.02.2011 21:14 # 0