Alexander Brock: Fotoalbum mit 20 Zeilen Quelltext?

Beitrag lesen

Hallo,

Ich habe mal ein extrem einfaches PHP-Script zu diesem Zweck geschrieben:

<?php
ob_start("ob_gzhandler");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Lustiges</title>
<link href="./bilder.css.php" rel="stylesheet" type="text/css" />
</head>

<body>
<div>

<?php

Die Variablen

$bilder = array();

if (!isset($_GET["pos"])) {
 $position = 0;
}

else {
 $position = $_GET["pos"];
}

$vorposition = $position-1;
$nachposition = $position+1;

Auslesen des Bilder-Verzeichnisses

$verz = opendir('./bilder');
while ($file = readdir($verz)) {
 if ($file != '.' && $file != '..') {
  array_push($bilder,$file);
 }
}
closedir($verz);

if (isset($bilder[$position])) {
 if (isset($bilder[$vorposition])) {
  echo '<a href="'.$_SERVER["PHP_SELF"].'?pos='.($position-1).'">Vorheriges Bild</a>
  ';
 }
 if (isset($bilder[$nachposition])) {
  echo '<a href="'.$_SERVER["PHP_SELF"].'?pos='.($position+1).'">N&auml;chstes Bild</a><br />
  ';
 }
 else {
  echo '<br />';
 }
 echo '<img alt="'.$bilder[$position].'" src="./bilder/'.$bilder[$position].'" />
 ';
}

else {
 echo '<a href="'.$_SERVER["PHP_SELF"].'">Zur Startseite</a>';
}
?>

</div>
</body>
</html>

Was haltet ihr davon (Performance, Sicherheit...)?

Gruß
Alexander Brock

--
SelfCode: ie:{ fl:{ br:> va:) ls:# fo:) rl:( n4:( ss:| de:> js:( ch:| sh:( mo:) zu:}
http://againsttcpa.com