|
Posted by otto on 12/08/07 12:42
Hello
I have the following problem with the simplified script bellow!
When I start this script the first time files (~17000) are read in the /camera25 directory in less then
5 sec.
When I click again on the same camera button ( second from the left), or reload button on the browser, I get a timeout from provider.
Same for the No. 3 or 4 camera button. Here I have only 2 or 5 pictures in the directory.
What are the differences when I close and reload the bowser to reload the same script with a SELF call ?
Do I have to delete someting ?
Here the link : http://www.schlierholz.ch/camera/indexl.php who show the problem!
<?php
session_start();
// Action on the button to select directory's
if (isset($_GET['c24_x'])) {
# Répertoire des images de la caméra
$pict_path = "camera24/";
}
elseif (isset($_GET['c25_x'])) {
$pict_path = "camera25/";
}
elseif (isset($_GET['c26_x'])) {
$pict_path = "camera26/";
}
elseif (isset($_GET['c27_x'])) {
$pict_path = "camera27/";
}
else
{
$pict_path = "camera25/";
}
echo $pict_path."<br>";
?>
<!-- Form to select directory's -->
<body>
<form action="<?PHP echo $_SERVER['PHP_SELF'] ?>" method="GET">
<p>
<input type="image" src="images/icon_camera.gif" name="c24">
<input type="image" src="images/icon_camera.gif" name="c25">
<input type="image" src="images/icon_camera.gif" name="c26">
<input type="image" src="images/icon_camera.gif" name="c27">
</p>
</form>
<form method="POST" action="--WEBBOT-SELF--">
<p>
<?php
$start = time();
$ordner = opendir($pict_path);
$i=0;
while ( $rfile = readdir($ordner) )
{
// only files without . and ..
if ($rfile != '.' && $rfile != '..' && substr($rfile,5,1) == '@')
{
// save filename to array
$files[$i]=$rfile;
$i++;
}
}
closedir($ordner);
// Sort array by name
sort($files);
// Save Session
$_SESSION['files'] = $files;
echo "Pictures : ".$i."<br>";
$end = time();
echo $end - $start."<br>";
$start = time();
$fp = 0;
$pos = 2;
$nodem = 0;
while ($fp < count($files))
{
$annee = substr($files[$fp],6,4);
$mois = substr($files[$fp],10,2);
if ($mois <> $rmois) {
echo"<img border='0' src='images/icon_mois.gif' width='16' height='14'>";
echo"<a target='c_gauche' href='dayshow.php?filtre=$annee$mois'> $annee$mois</a><br>";
// $nodem = $pos;
$rmois = $mois;
}
$fp++;
}
$end = time();
echo "Pictures : ".$fp."<br>";
echo $end - $start."<br>";
?>
</p>
</form>
</body>
</html>
Navigation:
[Reply to this message]
|