diff --git a/README.md b/README.md index 8a9fadc..b81a28a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@ # SGD Projekt -### Version 2 +### Version 3 hier wird das SGD Projekt hochgeladen und verwaltet - \ No newline at end of file diff --git a/projekt_v3/bildspeichern.php b/projekt_v3/bildspeichern.php new file mode 100644 index 0000000..8050d12 --- /dev/null +++ b/projekt_v3/bildspeichern.php @@ -0,0 +1,85 @@ + + + + + + Bild speichern + + + + 100000) || + (filesize($_FILES['datei']['tmp_name']) + > 100000)) { + echo "Die Dateigröβe ist auf " . + "100.000 Byte beschränkt.
" . + "Verkleinern Sie das Bild bitte mit " . + "einem geeigneten Grafikprogramm.
"; + } + else if (($_FILES['datei']['type'] != "image/png") + && ($_FILES['datei']['type'] != "image/pjpeg") + && ($_FILES['datei']['type'] != "image/jpeg")) { + echo "Es dürfen nur Bilddateien vom Typ" . + " PNG oder JPEG hochgeladen werden.
"; + } else if (!empty($_FILES['datei']['name'])) { + $dateiname = $_SESSION["name"] . time(); + if ($_FILES['datei']['type'] != "image/png") { + $dateiname .= ".jpg"; + } else { + $dateiname .= ".png"; + } + $_SESSION["dateiname"] = $dateiname; + if (move_uploaded_file( + $_FILES['datei']['tmp_name'], + 'images/' . $dateiname)) { + @include ("db.inc.php"); + + if ($stmt = $pdo -> prepare( + "SELECT userid, id_mitglied FROM mitglieder")) { + $stmt -> execute(); + while ($row = $stmt -> fetch()) { + if ($_SESSION["name"] == $row["userid"]) { + $_SESSION["id_mitglied"] = $row["id_mitglied"]; + break; + } + } + + } + if ($stmt = $pdo -> prepare( + "INSERT INTO fragen" . + " (bild, zusatzinfos, id_mitglied) " . + " VALUES (:bild, :zusatzinfos, :userid)")) { + if ($stmt -> execute( + array( + ':bild' => $_SESSION["dateiname"], + ':zusatzinfos' => $_POST["zusatzinfos"], + ':userid' => $_SESSION["id_mitglied"] + ) + + )) { + $dat = "upload_ok.php"; + } else { + $dat = "upload_fehler.php"; + } + header("Location: $dat"); + } + } + } + echo "
Zur Homepage"; + } + } +} +$obj = new Bildspeichern(); +$obj -> datup(); +?> + + \ No newline at end of file diff --git a/projekt_v3/captchagenerieren.php b/projekt_v3/captchagenerieren.php new file mode 100644 index 0000000..3a5271a --- /dev/null +++ b/projekt_v3/captchagenerieren.php @@ -0,0 +1,44 @@ + diff --git a/projekt_v3/db.inc.php b/projekt_v3/db.inc.php new file mode 100644 index 0000000..47dd56c --- /dev/null +++ b/projekt_v3/db.inc.php @@ -0,0 +1,14 @@ +getMessage()); +} + +?> \ No newline at end of file diff --git a/projekt_v3/fonts/Anorexia.ttf b/projekt_v3/fonts/Anorexia.ttf new file mode 100644 index 0000000..453eeb0 Binary files /dev/null and b/projekt_v3/fonts/Anorexia.ttf differ diff --git a/projekt_v3/fonts/arial.ttf b/projekt_v3/fonts/arial.ttf new file mode 100644 index 0000000..886789b Binary files /dev/null and b/projekt_v3/fonts/arial.ttf differ diff --git a/projekt_v3/fonts/tahoma.ttf b/projekt_v3/fonts/tahoma.ttf new file mode 100644 index 0000000..3146f53 Binary files /dev/null and b/projekt_v3/fonts/tahoma.ttf differ diff --git a/projekt_v3/index.php b/projekt_v3/index.php new file mode 100644 index 0000000..9465269 --- /dev/null +++ b/projekt_v3/index.php @@ -0,0 +1,79 @@ + version_compare(PHP_VERSION, '7')) { + die('

Für diese Anwendung ' . 'ist mindestens PHP 7 notwendig'); +} + +class MeineAusnahme extends Exception{}; +?> + + + + + + + + Image2Food - Sag mir was ich daraus kochen kann - Index + + +

+

Das soziale, multimediale Netzwerk für Kochideen

+

Leider gibt es ein Problem mit der Webseite. + Wir arbeiten daran mit Hochdruck. Besuchen Sie uns in kürze wieder erneut

"); + } + ?> + +
+

Image2Food - Sag mir was ich daraus kochen kann

+

Das soziale, multimediale Netzwerk für Kochideen

+

Mitgliederbereich


Sie sind Angemeldet
"; + @include("uploadformular.inc.php"); + echo "Vorschau"; + } elseif (isset($_SESSION["login"]) && ($_SESSION["login"] == "false")){ + echo "
Sie können sich jetzt zum Mitgliederbereich anmelden.
"; + } elseif (isset($_COOKIE['Image2Food'])){ + echo "
Schön Sie wieder zu sehen. Melden Sie sich an, um in den geschlossenen Mitgliederbereich zu gelangen, wenn Sie sich schon registriert haben.
"; + } else { + echo "
Willkommen auf unserer Webseite. Schauen Die sich um. Sie können sich hier registrieren und dann in einem geschlossenen Mitgliederbereich anmelden.
"; + } + } + } + $obj = new Index(); + $obj -> besucher(); + ?> + + + + \ No newline at end of file diff --git a/projekt_v3/lib/css/stil.css b/projekt_v3/lib/css/stil.css new file mode 100644 index 0000000..50b8724 --- /dev/null +++ b/projekt_v3/lib/css/stil.css @@ -0,0 +1,337 @@ +// Elemente und Universalselektor +* { + margin: 0; + padding: 0; + border: 0; + outline: 0; + vertical-align: baseline; + background: transparent; +} +body { + background: #145D05; + color: white; +} +h1, h2, h3, h4, h5 { + display: block; + text-align: center; + margin: 15px; + padding: 5px; + border-style: groove; + border-width: 1pt; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + border-radius: 5px; +} + +a { + color: white; + background: #6C0610; + text-decoration: none; + display: inline-block; + min-width: 85px; + height: 20px; + text-align: center; + margin: 5px; + padding: 5px; + border-style: groove; + border-width: 1pt; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + border-radius: 5px; + -moz-box-shadow: 5px 2px 3px #888; + -webkit-box-shadow: 5px 2px 3px #888; + box-shadow: 5px 2px 3px #888; +} +form { + background: white; + color: #145D05; + margin: 5px; + padding: 10px; + border-style: inset; + border-width: 3pt; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + border-radius: 5px; + -moz-box-shadow: 5px 5px 5px #888; + -webkit-box-shadow: 5px 5px 5px #888; + -moz-box-shadow: 5px 2px 3px #888; + -webkit-box-shadow: 5px 2px 3px #888; + box-shadow: 5px 2px 3px #888; +} +textarea { + margin: 10px; + padding: 10px; + border-style: solid; + border-width: 1pt; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + border-radius: 5px; + -moz-box-shadow: 5px 5px 5px #888; + -webkit-box-shadow: 5px 5px 5px #888; + -moz-box-shadow: 5px 2px 3px #888; + -webkit-box-shadow: 5px 2px 3px #888; + box-shadow: 5px 2px 3px #888; +} +input { + margin: 5px; + padding: 2px; + border-style: solid; + border-width: 1pt; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + border-radius: 5px; + -moz-box-shadow: 5px 5px 5px #888; + -webkit-box-shadow: 5px 5px 5px #888; + -moz-box-shadow: 5px 2px 3px #888; + -webkit-box-shadow: 5px 2px 3px #888; + box-shadow: 5px 2px 3px #888; +} +// Klassen +.hlink { + + text-decoration: none; + display: inline-block; + height: 35px; + text-align: center; + margin: 5px; + padding: 5px; + border-style: groove; + border-width: 1pt; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + border-radius: 5px; + -moz-box-shadow: 5px 2px 3px #888; + -webkit-box-shadow: 5px 2px 3px #888; + box-shadow: 5px 2px 3px #888; +} +.spezielleUeber { + background: white; + color: #145D05; + font-size: 110%; +} +.reg_label { + display: inline-block; + width: 200px; +} +a:hover { + color: #145D05; + background: white; +} +.hlink:hover { + color: white; + background: #6C0610; +} +.thumb { + width: 120px; + height: 160px; + display: inline-block; + margin: 10px; + padding: 10px; + overflow: hidden; + border-style: groove; + border-width: 1pt; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + border-radius: 5px; + -moz-box-shadow: 5px 2px 3px #888; + -webkit-box-shadow: 5px 2px 3px #888; + box-shadow: 5px 2px 3px #888; +} +.fehlermeldung { + color: #6C0610; +} + +.captcha { + width: 200px; + margin: 10px; + border-style: groove; + border-width: 1pt; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + border-radius: 5px; + -moz-box-shadow: 5px 2px 3px #888; + -webkit-box-shadow: 5px 2px 3px #888; + box-shadow: 5px 2px 3px #888; +} +.detailbildcontainer { + height: 250px; + width: 250px; + margin: 3px; +} +.detailbild { + max-height: 320px; + max-width: 320px; + padding: 3px; +} +.vorschauinfos { + color: #145D05; + background: white; + margin: 5px; + padding: 15px; + width: 650px; + max-height: 150px; + overflow: scroll; + border-style: inline; + border-width: 1pt; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + border-radius: 5px; +} +.hlink_klein { + + text-decoration: none; + height: 18px; + width: 110px; + text-align: center; + margin: 2px; + padding: 2px; + font-size: 12px; + border-style: groove; + border-width: 1pt; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + border-radius: 5px; + -moz-box-shadow: 5px 2px 3px #888; + -webkit-box-shadow: 5px 2px 3px #888; + box-shadow: 5px 2px 3px #888; +} +.hlink_nix { + color: white; + background: #145D05; + text-decoration: none; + display: inline-block; + min-width: 85px; + height: auto; + text-align: center; + margin: 5px; + padding: 5px; + text-decoration: none; + text-align: left; + margin: 2px; + padding: 2px; + font-size: 0px; + border-style: none; + border-width: 0pt; + -moz-border-radius: 0px; + -webkit-border-radius: 0px; + border-radius: 0px; + -moz-box-shadow: 0px 0px 0px #888; + -webkit-box-shadow: 0px 0px 0px #888; + box-shadow: 0px 0px 0px #888; +} +.thumb_bild { + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; + border-style: dotted; + border-width: 1pt; + opacity: 0.9; + color: #888; +} +.thumb_bild:hover { + border-style: groove; + color: white; + opacity: 1; + -moz-box-shadow: 2px 2px 3px #888; + -webkit-box-shadow: 2px 2px 3px #888; + box-shadow: 2px 2px 3px #888; +} +.rezepttab { + + width: 950px; + margin: 5px; +} + + +// IDs +#detailbereich { + height: 550px; + width: 98%; + margin: auto; + border-style: groove; + border-width: 1pt; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + border-radius: 5px; + -moz-box-shadow: 5px 2px 3px #888; + -webkit-box-shadow: 5px 2px 3px #888; + box-shadow: 5px 2px 3px #888; + overflow-x: scroll; +} +#vorschauber { + height: 300px; + width: 98%; + margin: auto; + border-style: groove; + border-width: 1pt; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + border-radius: 5px; + -moz-box-shadow: 5px 2px 3px #888; + -webkit-box-shadow: 5px 2px 3px #888; + box-shadow: 5px 2px 3px #888; + overflow-x: scroll; +} +#nav { + width: 1000px; + height: 40px; + margin: auto; + padding: 10px; +} +#content { + width: 1000px; + margin: auto; + padding: 20px; + border-style: groove; + border-width: 1pt; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + border-radius: 5px; +} + +#indextext { + text-align: justify; + background: white; + color: #145D05; + margin: 5px; + padding: 10px; + border-style: inset; + border-width: 3pt; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + border-radius: 5px; + -moz-box-shadow: 5px 5px 5px #888; + -webkit-box-shadow: 5px 5px 5px #888; + box-shadow: 5px 5px 5px #888; +} +#meldung { + position: relative; + top: -200px; + margin: 0 auto; + opacity: 0.7; + visibility: hidden; + background: white; + color: #6C0610; + width: 450px; + min-height: 40px; + padding: 20px; + border-style: inset; + border-width: 3pt; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + border-radius: 5px; + -moz-box-shadow: 5px 5px 5px #888; + -webkit-box-shadow: 5px 5px 5px #888; + box-shadow: 5px 5px 5px #888; +} + +#rezeptformular { + width: 950px; + margin: 3px; +} +#detailinfo { + vertical-align: top; + padding: 5px; + margin: 20px; +} + diff --git a/projekt_v3/login.inc.php b/projekt_v3/login.inc.php new file mode 100644 index 0000000..3a36afe --- /dev/null +++ b/projekt_v3/login.inc.php @@ -0,0 +1,18 @@ +
+ + * + + +
+ + * + + +
+ Captcha
+ + * + +
+ +
\ No newline at end of file diff --git a/projekt_v3/login.php b/projekt_v3/login.php new file mode 100644 index 0000000..a545b15 --- /dev/null +++ b/projekt_v3/login.php @@ -0,0 +1,105 @@ + version_compare(PHP_VERSION, '7')) { + die('

Für diese Anwendung ' . 'ist mindestens PHP 7 notwendig'); +} + +session_start(); + +?> + + + + + + + Image2Food - Sag mir was ich daraus kochen kann - login + + + +
+

Login

+ plausiblisieren()) { + $this->anmelden_db(); + } + } + + /** + * Plausiblisierungsmethode + * Testet die einzelnen Eingabefelder des Registrierungsformulars gegenüber + * - den Notwendigkeiten in der MySQL-Datenbank und + * - weiteren Anforderungen, die die Logik des Netzwerks fordert + * Die Eingaben stehen im globalen Array $_POST zur Verfügung + * @return true, wenn die Plausiblisierung keine Fehler ergab - sonst false + */ + + private function plausiblisieren() { + // Fehlervariable + $anmelden = 0; + + $p = new Plausi(); + $anmelden += $p->nutzerdatentest($_POST['userid']); + $anmelden += $p->nutzerdatentest($_POST['pw']); + $anmelden += $p->captchatest($_POST['captcha']); + + // Testausgaben für den derzeitigen Stand des Projekts + echo "Die Eingaben:
"; + print_r($_POST); + echo "
Fehleranzahl: " . $anmelden . "
"; + if ($anmelden == 0) return true; + else return false; + } + + private function anmelden_db() { + $vorhanden = false; + @include("db.inc.php"); + if ($stmt = $pdo->prepare("SELECT userid, pw FROM mitglieder")) + { + $stmt -> execute(); + while ($row = $stmt -> fetch()) { + if (isset($_POST["userid"]) && $_POST["userid"] == $row['userid'] && md5($_POST["pw"]) == $row['pw']); { + $vorhanden = true; + break; + } + } + } + + if ($vorhanden) { + $_SESSION["name"] = $_POST["userid"]; + $_SESSION["login"] = "true"; + $dat = "index.php"; + } + else { + $dat = "loginfehler.php"; + } + header("Location: $dat"); + } + } + + $regobj = new Login(); + if (sizeof($_POST) > 0) { + $regobj->_login(); + } + ?> +
+ + + \ No newline at end of file diff --git a/projekt_v3/loginfehler.php b/projekt_v3/loginfehler.php new file mode 100644 index 0000000..122bdc7 --- /dev/null +++ b/projekt_v3/loginfehler.php @@ -0,0 +1,33 @@ + version_compare(PHP_VERSION, '7')) { + die('

Für diese Anwendung ' . 'ist mindestens PHP 7 notwendig'); +} + +?> + + + + + + + Image2Food - Sag mir was ich daraus kochen kann - Index + + + +
+

Anmeldefehler

+ Die Anmeldedaten waren leider falsch

". "Neu Anmelden"; + } + } + $loginobj = new LoginFehler(); + $loginobj -> fehler(); + ?> + + + \ No newline at end of file diff --git a/projekt_v3/logout.php b/projekt_v3/logout.php new file mode 100644 index 0000000..7842807 --- /dev/null +++ b/projekt_v3/logout.php @@ -0,0 +1,14 @@ + ausloggen(); +?> \ No newline at end of file diff --git a/projekt_v3/nav.php b/projekt_v3/nav.php new file mode 100644 index 0000000..a4f38cb --- /dev/null +++ b/projekt_v3/nav.php @@ -0,0 +1,3 @@ +Home +Registrieren +Login diff --git a/projekt_v3/navmitglieder.php b/projekt_v3/navmitglieder.php new file mode 100644 index 0000000..23bd50a --- /dev/null +++ b/projekt_v3/navmitglieder.php @@ -0,0 +1 @@ +Logout \ No newline at end of file diff --git a/projekt_v3/plausi.inc.php b/projekt_v3/plausi.inc.php new file mode 100644 index 0000000..3932dd0 --- /dev/null +++ b/projekt_v3/plausi.inc.php @@ -0,0 +1,71 @@ + \ No newline at end of file diff --git a/projekt_v3/regfehler.php b/projekt_v3/regfehler.php new file mode 100644 index 0000000..319f80c --- /dev/null +++ b/projekt_v3/regfehler.php @@ -0,0 +1,32 @@ + version_compare(PHP_VERSION, '7')) { + die('

Für diese Anwendung ist mindestens PHP 7 notwendig'); +} +?> + + + + + + Image2Food - Sag mir was ich daraus kochen kann - Index + + + +
+

Registrierungsfehler

+ Die Registrierung hat leider nicht funktioniert

". "
Wählen Sie eine andere Userid und versuchen Sie es erneut.
"; + } + } + $regobj = new RegFehler(); + $regobj -> fehler() + ?> + + + + diff --git a/projekt_v3/registrieren.inc.php b/projekt_v3/registrieren.inc.php new file mode 100644 index 0000000..6a4d4fc --- /dev/null +++ b/projekt_v3/registrieren.inc.php @@ -0,0 +1,57 @@ +
+ + * + + /> + +
+ + * + + /> + +
+ + * + + /> + +
+ + * + + +
+ + * + + +
+ + + + +
+ +
\ No newline at end of file diff --git a/projekt_v3/registrieren.php b/projekt_v3/registrieren.php new file mode 100644 index 0000000..34c4d66 --- /dev/null +++ b/projekt_v3/registrieren.php @@ -0,0 +1,124 @@ + version_compare(PHP_VERSION, '7')) { + die('

Für diese Anwendung ' . 'ist mindestens PHP 7 notwendig'); +} + +?> + + + + + + + Image2Food - Sag mir was ich daraus kochen kann - Regestrierung + + + +
+

Registrierung

+ plausiblisieren()) { + $this->eintragen_db(); + } + } + + /** + * Plausiblisierungsmethode + * Testet die einzelnen Eingabefelder des Registrierungsformulars gegenüber + * - den Notwendigkeiten in der MySQL-Datenbank und + * - weiteren Anforderungen, die die Logik des Netzwerks fordert + * Die Eingaben stehen im globalen Array $_POST zur Verfügung + * @return true, wenn die Plausiblisierung keine Fehler ergab - sonst false + */ + + private function plausiblisieren() { + // Fehlervariable + $anmelden = 0; + + $p = new Plausi(); + $anmelden += $p->namentest($_POST['name']); + $anmelden += $p->namentest($_POST['vorname']); + $anmelden += $p->emailtest($_POST['email']); + $anmelden += $p->nutzerdatentest($_POST['userid']); + $anmelden += $p->nutzerdatentest($_POST['pw']); + + //Kritische Zeichen aus der freien Eingabe der Zusatzinfos eleminieren + + $_POST['zusatzinfos'] = preg_replace("/[<>$\%&§]/", "#", $_POST['zusatzinfos']); + + // Testausgaben für den derzeitigen Stand des Projekts + echo "Die Eingaben:
"; + print_r($_POST); + echo "
Fehleranzahl: " . $anmelden . "
"; + if ($anmelden == 0) return true; + else return false; + } + + /** + * Eintragen der Anmeldedaten in die Datenbank + * Die Eingaben stehen im Array $_POST zur Verfügung + */ + + private function eintragen_db() { + @include ("db.inc.php"); + try { + $stmt = $pdo->prepare("INSERT INTO mitglieder ( + name, vorname, email, zusatzinfos, rolle, userid, pw) + VALUES (:name, :vorname, :email, :zusatzinfos, :rolle, + :userid, :pw)"); + + $stmt->execute(array( + ':name' => $_POST["name"], + ':vorname' => $_POST["vorname"], + ':email' => $_POST["email"], + ':zusatzinfos' => $_POST["zusatzinfos"], + ':rolle' => "Mitglied", + ':userid' => $_POST["userid"], + ':pw' => md5($_POST["pw"]) + )); + + $_SESSION["name"] = $_POST["userid"]; + $_SESSION["login"] = "false"; + $dat = "index.php"; + } + catch (PDOException $e) { + error_log("Registrierungsfehler: " . $e->getMessage()); // Log für Admins + $dat = "regfehler.php"; + + } + + header("Location: $dat"); + } + + } + $regobj = new Registrierung(); + if (sizeof($_POST) > 0) { + $regobj -> registrieren(); + } + ?> +
+ + + \ No newline at end of file diff --git a/projekt_v3/uploadformular.inc.php b/projekt_v3/uploadformular.inc.php new file mode 100644 index 0000000..e1b9e54 --- /dev/null +++ b/projekt_v3/uploadformular.inc.php @@ -0,0 +1,8 @@ +

Wählen Sie eine Datei zum Upload aus

+
+
+ +
+ +
\ No newline at end of file diff --git a/projekt_v3/vorschaubilder.php b/projekt_v3/vorschaubilder.php new file mode 100644 index 0000000..acca203 --- /dev/null +++ b/projekt_v3/vorschaubilder.php @@ -0,0 +1,74 @@ + + + + Vorschau + + + +

Vorschau

+ "; + + } + } + closedir($verzeichnis); + } + + } + + $obj = new Thumb(); + + $obj -> thumbnail_erstellen(); + $obj -> thumbnail_anzeigen(); + ?> + + \ No newline at end of file