Páginas del sitio
Curso actual
Participantes
General
21 de septiembre - 27 de septiembre
28 de septiembre - 4 de octubre
5 de octubre - 11 de octubre
12 de octubre - 18 de octubre
19 de octubre - 25 de octubre
26 de octubre - 1 de noviembre
2 de noviembre - 8 de noviembre
9 de noviembre - 15 de noviembre
16 de noviembre - 22 de noviembre
23 de noviembre - 29 de noviembre
30 de noviembre - 6 de diciembre
7 de diciembre - 13 de diciembre
14 de diciembre - 20 de diciembre
21 de diciembre - 27 de diciembre
28 de diciembre - 3 de enero
4 de enero - 10 de enero
11 de enero - 17 de enero
18 de enero - 24 de enero
25 de enero - 31 de enero
1 de febrero - 7 de febrero
<?php
$path = "/Homes/elmio/";
$nombredir = "imagenes";
function cuentaficheros($nombredir) {
$numerodefichs=0;
if (is_dir($nombredir)) {
if ($dir = opendir($nombredir)) {
while (($nombrefich=readdir($dir))!=false)
if ((!is_dir($nombredir . "/$nombrefich"))&&($nombrefich{0}!="."))
$numerodefichs++;
closedir($dir);
return $numerodefichs;
}
else return -1;
}
else return -1;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>script</title>
</head>
<body>
<?php
$pathcompleto = $path . $nombredir;
if (is_dir($pathcompleto)) {
$numfichs=cuentaficheros($pathcompleto);
if ($numfichs>0) {
$alea=rand(1,$numfichs);
$dir=opendir($pathcompleto);
while ($alea>0) {
$nombrefich=readdir($dir);
if (($nombrefich{0}==".")||(is_dir($pathcompleto . "/$nombrefich")))
continue;
$alea--;
}
print "<img src=\"/~daniel/$nombredir/" . $nombrefich . "\" />";
}
}
?>
<p>Contenido de la página</p>
</body>
</html>
$path = "/Homes/elmio/";
$nombredir = "imagenes";
function cuentaficheros($nombredir) {
$numerodefichs=0;
if (is_dir($nombredir)) {
if ($dir = opendir($nombredir)) {
while (($nombrefich=readdir($dir))!=false)
if ((!is_dir($nombredir . "/$nombrefich"))&&($nombrefich{0}!="."))
$numerodefichs++;
closedir($dir);
return $numerodefichs;
}
else return -1;
}
else return -1;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>script</title>
</head>
<body>
<?php
$pathcompleto = $path . $nombredir;
if (is_dir($pathcompleto)) {
$numfichs=cuentaficheros($pathcompleto);
if ($numfichs>0) {
$alea=rand(1,$numfichs);
$dir=opendir($pathcompleto);
while ($alea>0) {
$nombrefich=readdir($dir);
if (($nombrefich{0}==".")||(is_dir($pathcompleto . "/$nombrefich")))
continue;
$alea--;
}
print "<img src=\"/~daniel/$nombredir/" . $nombrefich . "\" />";
}
}
?>
<p>Contenido de la página</p>
</body>
</html>
Última modificación: martes, 6 de agosto de 2013, 12:04