#!/usr/bin/perl
### http-picture-webslide.pl-show

use warnings;
use CGI;
$query = new CGI;
$| = 1;
                                  ### wo sind die Pic's
chdir '/var/www/htdocs/uscout/';
                                  ### CGI-Location definieren
$cgi = "http://neo.magdeburg.de/cgi-bin/webslide.pl";
                                  ### Web-Location definieren
$url = "http://neo.magdeburg.de/uscout/";
                                  ### Intervall
$timer = 5;
                                  ### wonach wird gesucht
open(F, "ls *.png |");
@all = <F>;
close(F);

$such = 0 if ( ! defined( $query->param('such') ) );
$such = $query->param('such') if ( defined( $query->param('such') ) );

$next = $such + 1;

print "Content-Type: text/html\n";
print "Refresh: $timer";
if (! defined  $all[$next] ){
  print "; URL=$cgi?such=0\n\n";
} else {
  print "; URL=$cgi?such=$next\n\n";
}
chop($all[$such]); 
$image = "$url" . "$all[$such]";
print "Name: <b>$all[$such]</b><br>";
print "<img src=$image>";
print "</body></html>";

