1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Radio RSL</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
// Notez que !== n'existait pas avant 4.0.0-RC2
$chemin='D:\Program Files\EasyPHP1-8\www\perl\images';
if ($handle = opendir($chemin)) {
//echo "Directory handle: $handle<br>";
//echo "Files:<br>";
/* Ceci est la façon correcte de traverser un dossier. */
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." && strpos($file, 'day.png',1)){
$nom=substr($file, 0, strpos($file, '-sig-day.png',1));
$target=@$_GET['target'];
$newfile="$nom.php";
$f=fopen($newfile,"w");
fputs($f,'<? echo "Daily Graph (5 minute averages)<br>";');
fputs($f,'echo "<img src=\"images/$nom-sig-day.png\"><br>";');
fputs($f,'echo "Weekly Graph (30 minute averages)<br>"; ');
//fputs($f," echo \"<img src=\"images/$nom-sig-week.png\"><br>\"; ");
fputs($f,' echo "Monthly Graph (2 hour averages)<br>"; ');
//fputs($f," echo \"<img src=\"images/$nom-sig-month.png\"><br>\"; ");
fputs($f,' echo "Yearly Graph (12 hour averages)<br>"; ?>');
//fputs($f,"<? echo \"<img src=\"images/$nom-sig-year.png\"><br>\"; ");
fclose($f);
echo "<h1>".$nom."</h1>";
echo "<a href=\"$newfile?target=$nom\"><img src=\"images/$file\"><a> <br>";
}
}
closedir($handle);
}
?>
</body>
</html> |
Partager