Erstellen der nächsten Projektversion
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
# SGD Projekt
|
# SGD Projekt
|
||||||
|
|
||||||
### Version 2
|
### Version 3
|
||||||
|
|
||||||
hier wird das SGD Projekt hochgeladen und verwaltet
|
hier wird das SGD Projekt hochgeladen und verwaltet
|
||||||
|
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Start der Session
|
||||||
|
*/
|
||||||
|
session_start();
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="de">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Bild speichern </title>
|
||||||
|
<meta name="viewport" content=
|
||||||
|
"width=device-width, initial-scale=1.0">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<?php
|
||||||
|
class Bildspeichern {
|
||||||
|
public function datup() {
|
||||||
|
if (isset($_FILES['datei'])) {
|
||||||
|
if (($_FILES['datei']['size'] > 100000) ||
|
||||||
|
(filesize($_FILES['datei']['tmp_name'])
|
||||||
|
> 100000)) {
|
||||||
|
echo "Die Dateigröβe ist auf " .
|
||||||
|
"100.000 Byte beschränkt.<br>" .
|
||||||
|
"Verkleinern Sie das Bild bitte mit " .
|
||||||
|
"einem geeigneten Grafikprogramm.<br>";
|
||||||
|
}
|
||||||
|
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.<br>";
|
||||||
|
} 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 "<hr><a href='index.php'>Zur Homepage</a>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$obj = new Bildspeichern();
|
||||||
|
$obj -> datup();
|
||||||
|
?>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Start der Session
|
||||||
|
*/
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
unset($_SESSION['captchacode']);
|
||||||
|
// Zeichen, die der Captchacode enthalten darf
|
||||||
|
$moeglicheZeichen = "abcdefghiklmnpqrstuvwxy123456789" .
|
||||||
|
"ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||||
|
// Anzahl der Zeichen, die das Captcha enthalten soll
|
||||||
|
$anzahlZeichen = 4;
|
||||||
|
// Captcha-Variable
|
||||||
|
$captchacode = "";
|
||||||
|
// Füllen der Captcha-Variable mit der festgelegten
|
||||||
|
// Anzahl zufälliger Zeichen
|
||||||
|
for ($i = 0; $i < $anzahlZeichen; $i++) {
|
||||||
|
$captchacode .= substr($moeglicheZeichen,
|
||||||
|
(rand() % (strlen($moeglicheZeichen))), 1);
|
||||||
|
}
|
||||||
|
// Schreiben des Captchacodes in die Session
|
||||||
|
$_SESSION['captchacode'] = $captchacode;
|
||||||
|
header('Content-type: image/jpg');
|
||||||
|
$image = imagecreate(350, 130);
|
||||||
|
$farben = array();
|
||||||
|
for ($i = 0; $i < $anzahlZeichen; $i++) {
|
||||||
|
$farben[$i] = imagecolorallocate($image,
|
||||||
|
rand(0, 255), rand(0, 255), rand(0, 255));
|
||||||
|
}
|
||||||
|
$bgc = imagecolorallocate($image, 230, 230, 230);
|
||||||
|
imagefill($image, 0, 0, $bgc);
|
||||||
|
for ($i = 0; $i < $anzahlZeichen; $i++) {
|
||||||
|
ImageTTFText($image, rand(20, 80), rand(-20, 60),
|
||||||
|
50 + ($i * 50), rand(80, 120),
|
||||||
|
$farben[rand(0, $anzahlZeichen - 1)],
|
||||||
|
"fonts/Anorexia.ttf", $captchacode[$i]);
|
||||||
|
}
|
||||||
|
for ($i = 0; $i < $anzahlZeichen; $i++) {
|
||||||
|
imageline($image, rand(0, 10), rand(0, 150),
|
||||||
|
rand(330, 340), rand(0, 150), $farben[$i]);
|
||||||
|
}
|
||||||
|
imagejpeg($image);
|
||||||
|
imagedestroy($image);
|
||||||
|
?>
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$dbuser = 'root';
|
||||||
|
$dbpw = 'Feuerwehr1!';
|
||||||
|
$dbhost = 'localhost';
|
||||||
|
$dbname = 'sozialesnetzwerk';
|
||||||
|
|
||||||
|
try {
|
||||||
|
$pdo = new PDO ("mysql:dbname=$dbname;host=$dbhost", $dbuser, $dbpw);
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
die ($e->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,79 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
setcookie("Image2Food", time(), time() + (60 * 60 * 24 * 120));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Festlegung der Untergrenze für die PHP-Version
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
if (0 > version_compare(PHP_VERSION, '7')) {
|
||||||
|
die('<h1>Für diese Anwendung ' . 'ist mindestens PHP 7 notwendig');
|
||||||
|
}
|
||||||
|
|
||||||
|
class MeineAusnahme extends Exception{};
|
||||||
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="de">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Image2Food - Sag mir was ich daraus kochen kann - Index</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="nav">
|
||||||
|
<?php
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (isset($_SESSION["login"]) && ($_SESSION["login"] == "true")) {
|
||||||
|
if (!@include("navmitglieder.php")){
|
||||||
|
throw new MeineAusnahme();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (!@include("nav.php")){
|
||||||
|
throw new MeineAusnahme();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (MeineAusnahme $e) {
|
||||||
|
die("<h1>Image2Food - Sag mir was ich daraus kochen kann</h1>
|
||||||
|
<h2>Das soziale, multimediale Netzwerk für Kochideen</h2>
|
||||||
|
<p> Leider gibt es ein Problem mit der Webseite.
|
||||||
|
Wir arbeiten daran mit Hochdruck. Besuchen Sie uns in kürze wieder erneut</p>");
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<div id="content">
|
||||||
|
<h1>Image2Food - Sag mir was ich daraus kochen kann</h1>
|
||||||
|
<h2>Das soziale, multimediale Netzwerk für Kochideen</h2>
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Das soziale Netzwerk für Kochideen
|
||||||
|
* die Einstiegsseite mit der Hauptklasse
|
||||||
|
*/
|
||||||
|
class Index {
|
||||||
|
function besucher() {
|
||||||
|
if (isset($_SESSION["login"]) && ($_SESSION["login"] == "true")){
|
||||||
|
echo "<div id='indextext'><h3>Mitgliederbereich</h3><br>Sie sind Angemeldet</div>";
|
||||||
|
@include("uploadformular.inc.php");
|
||||||
|
echo "<a href='vorschaubilder.php'" ." target='vorschau'>Vorschau</a>";
|
||||||
|
} elseif (isset($_SESSION["login"]) && ($_SESSION["login"] == "false")){
|
||||||
|
echo "<div id='indextext'> Sie können sich jetzt zum Mitgliederbereich anmelden. </div>";
|
||||||
|
} elseif (isset($_COOKIE['Image2Food'])){
|
||||||
|
echo "<div id='indextext'> Schön Sie wieder zu sehen. Melden Sie sich an, um in den geschlossenen Mitgliederbereich zu gelangen, wenn Sie sich schon registriert haben. </div>";
|
||||||
|
} else {
|
||||||
|
echo "<div id= 'indextext'>Willkommen auf unserer Webseite. Schauen Die sich um. Sie können sich hier registrieren und dann in einem geschlossenen Mitgliederbereich anmelden.</div>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$obj = new Index();
|
||||||
|
$obj -> besucher();
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<form action="login.php" method="post">
|
||||||
|
<label class="reg_label">Userid</label>
|
||||||
|
<span class="pflichtfeld"> * </span>
|
||||||
|
<input name="userid" maxlength="20"/>
|
||||||
|
<span class="fehlermeldung"></span>
|
||||||
|
<br>
|
||||||
|
<label class="reg_label">Passwort</label>
|
||||||
|
<span class="pflichtfeld"> * </span>
|
||||||
|
<input name="pw" type="password" maxlength="50"/>
|
||||||
|
<span class="fehlermeldung"></span>
|
||||||
|
<br>
|
||||||
|
<img src="captchagenerieren.php" alt="Captcha"><br>
|
||||||
|
<label class="reg_label">Captcha</label>
|
||||||
|
<span class="pflichtmarker"> * </span>
|
||||||
|
<input name="captcha">
|
||||||
|
<br>
|
||||||
|
<input type="submit">
|
||||||
|
</form>
|
||||||
@@ -0,0 +1,105 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Festlegung der Untergrenze für die PHP-Version
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
if (0 > version_compare(PHP_VERSION, '7')) {
|
||||||
|
die('<h1>Für diese Anwendung ' . 'ist mindestens PHP 7 notwendig');
|
||||||
|
}
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="de">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Image2Food - Sag mir was ich daraus kochen kann - login</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="nav">
|
||||||
|
<?php
|
||||||
|
@include("nav.php");
|
||||||
|
@include("plausi.inc.php")
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<div id="content">
|
||||||
|
<h1>Login</h1>
|
||||||
|
<?php
|
||||||
|
@include("login.inc.php");
|
||||||
|
/**
|
||||||
|
* Das soziale Netzwerk für Kochideen
|
||||||
|
* die Loginseite
|
||||||
|
*/
|
||||||
|
class Login {
|
||||||
|
|
||||||
|
|
||||||
|
public function _login(){
|
||||||
|
if ($this->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: <hr>";
|
||||||
|
print_r($_POST);
|
||||||
|
echo "<br>Fehleranzahl: " . $anmelden . "<hr>";
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
if (0 > version_compare(PHP_VERSION, '7')) {
|
||||||
|
die('<h1>Für diese Anwendung ' . 'ist mindestens PHP 7 notwendig');
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="de">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Image2Food - Sag mir was ich daraus kochen kann - Index</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="nav"> <?php @include("nav.php") ?></div>
|
||||||
|
<div id="content">
|
||||||
|
<h1>Anmeldefehler</h1>
|
||||||
|
<?php
|
||||||
|
@include("login.inc.php");
|
||||||
|
|
||||||
|
class LoginFehler {
|
||||||
|
public function fehler() {
|
||||||
|
echo "<h4>Die Anmeldedaten waren leider falsch</h4>". "<a href='login.php'>Neu Anmelden</a>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$loginobj = new LoginFehler();
|
||||||
|
$loginobj -> fehler();
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
class OFF {
|
||||||
|
function ausloggen() {
|
||||||
|
session_destroy();
|
||||||
|
$dat = "index.php";
|
||||||
|
header("Location: $dat");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$obj = new Off();
|
||||||
|
$obj -> ausloggen();
|
||||||
|
?>
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
<a href="index.php">Home</a>
|
||||||
|
<a href="registrieren.php">Registrieren</a>
|
||||||
|
<a href="login.php">Login</a>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
<a href="logout.php">Logout</a>
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Klasse mit Testmethoden, on die offensichtlichen Regeln für das Netzwerk erfüllt sind
|
||||||
|
*/
|
||||||
|
|
||||||
|
class Plausi {
|
||||||
|
public function namentest($wert) {
|
||||||
|
|
||||||
|
if (preg_match("/^\w{2,30}$/", $wert)) {
|
||||||
|
return 0;
|
||||||
|
}else {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function emailtest($wert) {
|
||||||
|
$fehler = 0;
|
||||||
|
|
||||||
|
//Test der notwendige E-Mail-Struktur
|
||||||
|
|
||||||
|
if (!preg_match("/\w+@\w+\.\w{2}/", $wert)) {
|
||||||
|
$fehler++;
|
||||||
|
}
|
||||||
|
|
||||||
|
//nichtalphanumerische Zeichen - ausser dem Zeichen @
|
||||||
|
|
||||||
|
if (preg_match("/\W/", $wert, $ergarray)) {
|
||||||
|
if ($ergarray[0] != "@") {
|
||||||
|
$fehler++;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return $fehler;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function nutzerdatentest($wert) {
|
||||||
|
|
||||||
|
$fehler = 0;
|
||||||
|
|
||||||
|
if (!preg_match("/^\w{8,20}$/", $wert)) {
|
||||||
|
$fehler++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Prüfung keine Zahl
|
||||||
|
|
||||||
|
if (!preg_match("/\d/", $wert)) {
|
||||||
|
$fehler++;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Kein Großbuchstabe
|
||||||
|
|
||||||
|
if (!preg_match("/[A-Z]/", $wert)) {
|
||||||
|
$fehler++;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Kein Kleinbuchstabe
|
||||||
|
|
||||||
|
if (!preg_match("/[a-z]/", $wert)) {
|
||||||
|
$fehler++;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function captchatest($wert) {
|
||||||
|
$fehler = 0;
|
||||||
|
if ($_SESSION['captchacode'] != $wert) {
|
||||||
|
return ++$fehler;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
if (0 > version_compare(PHP_VERSION, '7')) {
|
||||||
|
die('<h1>Für diese Anwendung ist mindestens PHP 7 notwendig');
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="de">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Image2Food - Sag mir was ich daraus kochen kann - Index</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="nav"> <?php @include("nav.php") ?></div>
|
||||||
|
<div id="content">
|
||||||
|
<h1>Registrierungsfehler</h1>
|
||||||
|
<?php
|
||||||
|
@include ("registrieren.inc.php");
|
||||||
|
class RegFehler {
|
||||||
|
public function fehler() {
|
||||||
|
echo "<h4>Die Registrierung hat leider nicht funktioniert</h4>". "<h5>Wählen Sie eine andere Userid und versuchen Sie es erneut.</h5>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$regobj = new RegFehler();
|
||||||
|
$regobj -> fehler()
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
<form action="registrieren.php" method="post">
|
||||||
|
<label class="reg_label">Name</label>
|
||||||
|
<span class="pflichtmaker"> * </span>
|
||||||
|
<input name="name" maxlength="30"
|
||||||
|
<?php
|
||||||
|
if (isset($_POST['name'])) {
|
||||||
|
echo "value='" . $_POST['name'] . "'";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
/>
|
||||||
|
<span class="fehlermeldung"></span>
|
||||||
|
<br>
|
||||||
|
<label class="reg_label">Vorname</label>
|
||||||
|
<span class="pflichtmaker"> * </span>
|
||||||
|
<input name="vorname" maxlength="30"
|
||||||
|
<?php
|
||||||
|
if (isset($_POST['vorname'])) {
|
||||||
|
echo "value='" . $_POST['vorname'] . "'";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
/>
|
||||||
|
<span class="fehlermeldung"></span>
|
||||||
|
<br>
|
||||||
|
<label class="reg_lab">E-Mail</label>
|
||||||
|
<span class="pflichtfeld"> * </span>
|
||||||
|
<input name="email" maxlength="30"
|
||||||
|
<?php
|
||||||
|
if (isset($_POST['email'])) {
|
||||||
|
echo "value='" . $_POST['email'] . "'";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
/>
|
||||||
|
<span class="fehlermeldung"></span>
|
||||||
|
<br>
|
||||||
|
<label class="reg_label">Userid</label>
|
||||||
|
<span class="pflichtfeld"> * </span>
|
||||||
|
<input name="userid" maxlength="20"/>
|
||||||
|
<span class="fehlermeldung"></span>
|
||||||
|
<br>
|
||||||
|
<label class="reg_label">Passwort</label>
|
||||||
|
<span class="pflichtfeld"> * </span>
|
||||||
|
<input name="pw" type="password" maxlength="50"/>
|
||||||
|
<span class="fehlermeldung"></span>
|
||||||
|
<br>
|
||||||
|
<label class="reg_label">Zusatzinfos</label>
|
||||||
|
<span class="plichtfeld"> </span>
|
||||||
|
<textarea name="zusatzinfos" rows="5" cols="30">
|
||||||
|
<?php
|
||||||
|
if (isset($_POST['zusatzinfos'])) {
|
||||||
|
echo $_POST['zusatzinfos'];
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</textarea>
|
||||||
|
<span class="fehlermeldung"></span>
|
||||||
|
<br>
|
||||||
|
<input type="submit">
|
||||||
|
</form>
|
||||||
@@ -0,0 +1,124 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
/**
|
||||||
|
* Festlegung der Untergrenze für die PHP-Version
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
if (0 > version_compare(PHP_VERSION, '7')) {
|
||||||
|
die('<h1>Für diese Anwendung ' . 'ist mindestens PHP 7 notwendig');
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="de">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Image2Food - Sag mir was ich daraus kochen kann - Regestrierung</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="nav">
|
||||||
|
<?php
|
||||||
|
@include("nav.php");
|
||||||
|
@include("plausi.inc.php");
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<div id="content">
|
||||||
|
<h1>Registrierung</h1>
|
||||||
|
<?php
|
||||||
|
@include("registrieren.inc.php");
|
||||||
|
/**
|
||||||
|
* Das soziale Netzwerk für Kochideen die registrierungsseite
|
||||||
|
*/
|
||||||
|
class Registrierung {
|
||||||
|
/**
|
||||||
|
* Registrierungsmethode
|
||||||
|
* - Erst Eingaben des Anwenders plausiblisieren
|
||||||
|
* - Dann in der MySQL-Datenbank eintragen, wenn die Plausiblisierung keine Fehler ergeben hat.
|
||||||
|
*/
|
||||||
|
public function registrieren(){
|
||||||
|
if ($this->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: <hr>";
|
||||||
|
print_r($_POST);
|
||||||
|
echo "<br>Fehleranzahl: " . $anmelden . "<hr>";
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<h1>Wählen Sie eine Datei zum Upload aus</h1>
|
||||||
|
<form action="bildspeichern.php" method="post" enctype="multipart/form-data">
|
||||||
|
<input name="datei" type="file"><br>
|
||||||
|
<textarea name="zusatzinfos" cols="20" rows="5">
|
||||||
|
</textarea>
|
||||||
|
<br>
|
||||||
|
<input type="submit" value="Starte Upload">
|
||||||
|
</form>
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Vorschau</title>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Vorschau</h1>
|
||||||
|
<?php
|
||||||
|
class Thumb {
|
||||||
|
function thumbnail_erstellen() {
|
||||||
|
$bv = "images";
|
||||||
|
$vb = "thumb";
|
||||||
|
$verzeichnis = opendir($bv);
|
||||||
|
$bilder = array();
|
||||||
|
while (($datei = readdir($verzeichnis)) !== false) {
|
||||||
|
if ((preg_match("/\.jpe?g$/i", $datei)) || (preg_match("/\.png$/i", $datei))) {
|
||||||
|
$bilder[] = $datei;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
closedir($verzeichnis);
|
||||||
|
$verzeichnis = opendir($vb);
|
||||||
|
|
||||||
|
|
||||||
|
//Schleife, bis alle Files im Verzeichnis ausgelesen wurden
|
||||||
|
while (($datei = readdir($verzeichnis)) !== false) {
|
||||||
|
//Oft werden auch die Standardordner . und .. ausgelesen, diese sollen ignoriert werden
|
||||||
|
if ($datei != "." AND $datei != "..") {
|
||||||
|
//Files vom Server entfernen
|
||||||
|
@unlink("$vb/$datei");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
closedir($verzeichnis);
|
||||||
|
|
||||||
|
foreach ($bilder as $bild) {
|
||||||
|
if (preg_match("/\.png$/i", $bild)) {
|
||||||
|
|
||||||
|
$b = imagecreatefrompng("$bv/$bild");
|
||||||
|
} else {
|
||||||
|
$b = imagecreatefromjpeg("$bv/$bild");
|
||||||
|
}
|
||||||
|
|
||||||
|
$originalbreite = imagesx($b);
|
||||||
|
$originalhoehe = imagesy($b);
|
||||||
|
$neuebreite = 120;
|
||||||
|
$neuehoehe = floor($originalhoehe * ($neuebreite / $originalbreite));
|
||||||
|
$neuesbild = imagecreatetruecolor($neuebreite, $neuehoehe);
|
||||||
|
imagecopyresampled($neuesbild, $b, 0, 0, 0, 0, $neuebreite, $neuehoehe, $originalbreite, $originalhoehe);
|
||||||
|
imagejpeg($neuesbild, "$vb/$bild");
|
||||||
|
imagedestroy($neuesbild);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function thumbnail_anzeigen() {
|
||||||
|
$bv = "thumb";
|
||||||
|
$verzeichnis = opendir($bv);
|
||||||
|
while (($datei = readdir($verzeichnis)) !== false) {
|
||||||
|
if (preg_match("/\.jpe?g$/i", $datei)) {
|
||||||
|
echo "<a href=''><img src='$bv/$datei' " . "alt='Vorschaubild'></a> ";
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
closedir($verzeichnis);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$obj = new Thumb();
|
||||||
|
|
||||||
|
$obj -> thumbnail_erstellen();
|
||||||
|
$obj -> thumbnail_anzeigen();
|
||||||
|
?>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user