Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- echo "Navigation: <a href='index.php'>Start</a> - <a href='?navi=bilder'>Alle Bilder anzeigen</a> - <a href='?navi=fehlt'>Fehlt noch</a>";
- echo "<hr>";
- if (!isset($_GET[id])) {
- echo "Klicke auf den Namen, um den Steckbrief zu bearbeiten!<br><br>";
- }
- $dir = dir(".");
- $id = 1;
- $zahl = 0;
- while (false !== ($folder = $dir->read())) {
- if ($folder !== "." && $folder !== ".." && $folder !== "index.php" && $folder !== "error.jpg"){
- if ($_GET[navi] != "fehlt" && !isset($_GET[id])) {
- echo $id." - <a href='?id=".$id."'><b>".$folder."\n"."</b></a><br>";
- }
- $subdir = dir("./".$folder);
- //Pseudo-Datenbank
- $name[$id] = $folder;
- $aktuell[$id] = "<font color='red'>nein</font>";
- $alt[$id] = "<font color='red'>nein</font>";
- $aktuellpath[$id] = "error.jpg";
- $altpath[$id] = "error.jpg";
- //Bilder anzeigen
- while (false !== ($file = $subdir->read())) {
- if ($file !== "." && $file !== ".." && $file !== "..."){
- if ($_GET[navi] == "bilder") {
- if(strpos($file,".txt")==false){
- echo "<img src='".$folder."/".$file."' height='400px'>";
- }
- }
- }
- if(strpos($file,"aktuell")!==false){
- $aktuell[$id] = "<font color='green'>ja</font>";
- $aktuellpath[$id] = $folder."/".$file;
- }
- if(strpos($file,"alt")!==false){
- $alt[$id] = "<font color='green'>ja</font>";
- $altpath[$id] = $folder."/".$file;
- }
- }
- if ($_GET[navi] == "bilder") {
- echo "<br>";
- }
- if ($_GET[navi] == "fehlt") {
- if($aktuell[$id] == "<font color='red'>nein</font>" || $alt[$id] == "<font color='red'>nein</font>"){
- echo $id." - <a href='?id=".$id."'><b>".$folder."\n"."</b></a><br>";
- $zahl++;
- }
- }
- $subdir->close();
- if ($_GET[navi] == "fehlt") {
- if($aktuell[$id] == "<font color='red'>nein</font>" || $alt[$id] == "<font color='red'>nein</font>"){
- echo "Aktuelles Bild? ".$aktuell[$id]."<br>";
- echo "Altes Bild? ".$alt[$id]."<br><br>";
- }
- }
- if ($_GET[navi] != "fehlt" && !isset($_GET[id])){
- echo "Aktuelles Bild? ".$aktuell[$id]."<br>";
- echo "Altes Bild? ".$alt[$id]."<br><br>";
- }
- $id++;
- }
- }
- if (isset($_GET[id])) {
- echo $name[$_GET[id]]."<br>";
- echo "<img src='".$aktuellpath[$_GET[id]]."' height='400px'>";
- echo "<img src='".$altpath[$_GET[id]]."' height='400px'><br>";
- echo "Aktuelles Bild? ".$aktuell[$_GET[id]]."<br>";
- echo "Altes Bild? ".$alt[$_GET[id]]."<br><br>";
- //Steckbrief anlegen
- $datei = $name[$_GET[id]]."/".$name[$_GET[id]]." Steckbrief.txt";
- if(!file_exists($filename)) {
- $fp = fopen($datei, "a");
- fclose($fp);
- }
- if (!isset($_POST["steckbrief"])) {
- $fp = fopen($datei, "rb");
- if(filesize($datei) == 0){
- $inhalt = fgets($fp);
- }else{
- $inhalt = fread($fp, filesize($datei));
- }
- echo "Steckbrief:<br><form method='post'><textarea cols='80' rows='10' name='steckbrief'>".$inhalt."</textarea><br><input type=\"submit\" value=\"Daten senden\"></form>";
- fclose($fp);
- }
- if (isset($_POST["steckbrief"])) {
- $fp = fopen($datei, "w+");
- rewind($fp);
- $steckbrief = $_POST["steckbrief"];
- fputs($fp,$steckbrief);
- fclose($fp);
- //Auslesen
- $fp = fopen($datei, "rb");
- $inhalt = fread($fp, filesize($datei));
- echo "Steckbrief:<br><form method='post'><textarea cols='80' rows='10' name='steckbrief'>".$inhalt."</textarea><br><input type=\"submit\" value=\"Daten senden\"></form>";
- fclose($fp);
- echo "<br>Fertig!";
- }
- }
- $dir->close();
- if ($_GET[navi] == "fehlt") {
- echo "So viele Schüler haben ihre Bilder für die Abi-Zeitung noch nicht vollständig abgeliefert: ".$zahl;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement