Compare commits
21 Commits
dev/m1_saf
...
final/m2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
72ecc1e836 | ||
|
|
2cbfe5ee61 | ||
|
|
d98acc1ce0 | ||
|
|
09d786ea9b | ||
|
|
9382b6375a | ||
|
|
17646a1ecd | ||
|
|
1b5faa0d69 | ||
|
|
daa8f95cb7 | ||
|
|
59d1540de6 | ||
|
|
217a13bd52 | ||
|
|
0c360ccb99 | ||
|
|
d1ee9c1fb9 | ||
|
|
8b4c4c1c7f | ||
|
|
f1831cc58d | ||
|
|
b8c27e90ea | ||
|
|
2539383e67 | ||
|
|
fddeba1ce8 | ||
|
|
7d4ec262a5 | ||
|
|
fc22cd51df | ||
|
|
c7e17faeaf | ||
|
|
48cca528a8 |
8
.idea/.gitignore
generated
vendored
Normal file
8
.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
8
.idea/DBWT-Praktika.iml
generated
Normal file
8
.idea/DBWT-Praktika.iml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="WEB_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
8
.idea/modules.xml
generated
Normal file
8
.idea/modules.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/DBWT-Praktika.iml" filepath="$PROJECT_DIR$/.idea/DBWT-Praktika.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
20
.idea/php.xml
generated
Normal file
20
.idea/php.xml
generated
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="MessDetectorOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
<component name="PHPCSFixerOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
<component name="PHPCodeSnifferOptionsConfiguration">
|
||||
<option name="highlightLevel" value="WARNING" />
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
<component name="PhpProjectSharedConfiguration" php_language_level="8.2" />
|
||||
<component name="PhpStanOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
<component name="PsalmOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
</project>
|
||||
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
1
M2/.idea/php.xml
generated
1
M2/.idea/php.xml
generated
@@ -10,6 +10,7 @@
|
||||
<option name="highlightLevel" value="WARNING" />
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
<component name="PhpProjectSharedConfiguration" php_language_level="8.0" />
|
||||
<component name="PhpStanOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
|
||||
21
M2/Beispiele/Test.php
Normal file
21
M2/Beispiele/Test.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<?php
|
||||
$anweisung = 3;
|
||||
switch ($anweisung) {
|
||||
case 1:
|
||||
echo "catch _1_ !";
|
||||
break;
|
||||
case 2:
|
||||
echo "catch _2_ !";
|
||||
break;
|
||||
case 3:
|
||||
echo "catch _3_ !";
|
||||
default:
|
||||
echo "nothing to catch!";
|
||||
break;
|
||||
}
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
1
M2/Beispiele/accesslog.txt
Normal file
1
M2/Beispiele/accesslog.txt
Normal file
@@ -0,0 +1 @@
|
||||
07.11.2023 - 13:02 | 127.0.0.1 | Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/119.0
|
||||
4
M2/Beispiele/en.txt
Normal file
4
M2/Beispiele/en.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
Bewertung;Rating
|
||||
Name;Name
|
||||
Begründung;Reason
|
||||
Senden;Send
|
||||
3
M2/Beispiele/erstesphp.php
Normal file
3
M2/Beispiele/erstesphp.php
Normal file
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
echo "Erstes PHP-Skript <br>";
|
||||
phpinfo();
|
||||
12
M2/Beispiele/m2_5a_standardparameter.php
Normal file
12
M2/Beispiele/m2_5a_standardparameter.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
/**
|
||||
* Praktikum DBWT. Autoren:
|
||||
* Şafak, Hazinedar, 3108590
|
||||
* Robert, Joel, 3672729
|
||||
*/
|
||||
|
||||
function addieren(int $number1,int $number2=0){
|
||||
return $number1+$number2;
|
||||
}
|
||||
|
||||
?>
|
||||
13
M2/Beispiele/m2_5b_include.php
Normal file
13
M2/Beispiele/m2_5b_include.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
/**
|
||||
* Praktikum DBWT. Autoren:
|
||||
* Şafak, Hazinedar, 3108590
|
||||
* Robert, Joel, 3672729
|
||||
*/
|
||||
|
||||
include "m2_5a_standardparameter.php";
|
||||
|
||||
echo addieren(2,3)."<br>";
|
||||
echo addieren(50,10)."<br>";
|
||||
echo addieren(-2,3);
|
||||
?>
|
||||
53
M2/Beispiele/m2_5c_addform.php
Normal file
53
M2/Beispiele/m2_5c_addform.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/**
|
||||
* Praktikum DBWT. Autoren:
|
||||
* Şafak, Hazinedar, 3108590
|
||||
* Robert, Joel, 3672729
|
||||
*/
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
if ($_POST['rechnen'] == 'Addieren') {
|
||||
|
||||
$number1 = $_POST['number1'];
|
||||
$number2 = $_POST['number2'];
|
||||
$ergebnis = $number1 + $number2;
|
||||
|
||||
} elseif ($_POST['rechnen'] == "Multiplizieren") {
|
||||
$number1 = $_POST['number1'];
|
||||
$number2 = $_POST['number2'];
|
||||
$ergebnis = $number1 * $number2;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title>Addform</title>
|
||||
<style>
|
||||
* {
|
||||
font-family: Arial, serif;
|
||||
}
|
||||
.rating {
|
||||
color: darkgray;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<form action="m2_5c_addform.php" method="post">
|
||||
<label for="number1">Erste Zahl:</label>
|
||||
<input id="number1" type="text" name="number1"/>
|
||||
<label for="number2">Zweite Zahl:</label>
|
||||
<input id="number2" type="text" name="number2"/>
|
||||
|
||||
<input type="Submit" name="rechnen" value="Addieren" />
|
||||
<input type="Submit" name="rechnen" value="Multiplizieren" />
|
||||
|
||||
<?php
|
||||
if(!empty($ergebnis))
|
||||
{
|
||||
echo "<br><br>Ergebnis: ".$ergebnis;
|
||||
}
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
67
M2/Beispiele/m2_5d_array.php
Normal file
67
M2/Beispiele/m2_5d_array.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
/**
|
||||
* Praktikum DBWT. Autoren:
|
||||
* Şafak, Hazinedar, 3108590
|
||||
* Robert, Joel, 3672729
|
||||
*/
|
||||
|
||||
function missingYear($famousMeals){
|
||||
$years = [];
|
||||
$winneryears = [];
|
||||
$ergebniss = [];
|
||||
for ($i = 0;$i <= 23; $i++){
|
||||
$years[] = 2000+$i;
|
||||
}
|
||||
|
||||
foreach ($famousMeals as $meal){
|
||||
if(gettype($meal["winner"])== "array"){
|
||||
foreach ($meal["winner"]as $year){
|
||||
$winneryears[] = $year;
|
||||
}
|
||||
}else{
|
||||
$winneryears[] = $year;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($years as $year){
|
||||
$a=0;
|
||||
foreach ($winneryears as $winners){
|
||||
if ($year == $winners){
|
||||
$a = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if($a==0){
|
||||
$ergebniss[]=$year;
|
||||
}
|
||||
}
|
||||
echo var_dump($ergebniss);
|
||||
}
|
||||
|
||||
$famousMeals = [
|
||||
1 => ['name' => 'Currywurst mit Pommes',
|
||||
'winner' => [2001, 2003, 2007, 2010, 2020]],
|
||||
2 => ['name' => 'Hähnchencrossies mit Paprikareis',
|
||||
'winner' => [2002, 2004, 2008]],
|
||||
3 => ['name' => 'Spaghetti Bolognese',
|
||||
'winner' => [2011, 2012, 2017]],
|
||||
4 => ['name' => 'Jägerschnitzel mit Pommes',
|
||||
'winner' => 2019]
|
||||
];
|
||||
echo "<ol>";
|
||||
foreach ($famousMeals as $meal){
|
||||
echo "<li>". $meal['name']."<br>";
|
||||
if(gettype($meal["winner"])== "array"){
|
||||
foreach ($meal["winner"]as $year){
|
||||
$dump[] = $year;
|
||||
}
|
||||
}else{
|
||||
$dump[] = $year;
|
||||
}
|
||||
echo implode( ', ', $dump);
|
||||
$dump = null;
|
||||
echo "</li><br>";
|
||||
}
|
||||
echo "</ol>";
|
||||
missingYear($famousMeals);
|
||||
?>
|
||||
16
M2/Beispiele/m2_7a_accesslog.php
Normal file
16
M2/Beispiele/m2_7a_accesslog.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
/**
|
||||
* Praktikum DBWT. Autoren:
|
||||
* Şafak, Hazinedar, 3108590
|
||||
* Robert, Joel, 3672729
|
||||
*/
|
||||
|
||||
$ip = $_SERVER['REMOTE_ADDR'];
|
||||
$agent = $_SERVER['HTTP_USER_AGENT'];
|
||||
|
||||
$logFile = fopen("accesslog.txt", "a");
|
||||
$time = time();
|
||||
$datum = date("d.m.Y - H:i", $time);
|
||||
$write = $datum." | ".$ip." | ".$agent."\n";
|
||||
fwrite($logFile, $write);
|
||||
?>
|
||||
46
M2/Beispiele/m2_7b_showtext.php
Normal file
46
M2/Beispiele/m2_7b_showtext.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/**
|
||||
* Praktikum DBWT. Autoren:
|
||||
* Şafak, Hazinedar, 3108590
|
||||
* Robert, Joel, 3672729
|
||||
*/
|
||||
|
||||
const GET_PARAM_SEARCH_TEXT = 'search_text';
|
||||
|
||||
$searchTerm = "";
|
||||
|
||||
if (!empty($_GET[GET_PARAM_SEARCH_TEXT])) {
|
||||
$searchTerm = $_GET[GET_PARAM_SEARCH_TEXT];
|
||||
|
||||
}
|
||||
|
||||
$enFile = fopen("en.txt", "r");
|
||||
$fileLines = [];
|
||||
while ($line = fgets($enFile)) {
|
||||
$fileLines[] = $line;
|
||||
}
|
||||
|
||||
$found = false;
|
||||
foreach ($fileLines as $line){
|
||||
$lineArray[] = explode(';', $line);
|
||||
$deutsch = $lineArray[0][0];
|
||||
if(strtolower($deutsch)==strtolower($searchTerm)){
|
||||
$found = true;
|
||||
echo $searchTerm." bedeutet ".$lineArray[0][1];
|
||||
}
|
||||
unset($lineArray);
|
||||
}
|
||||
if(!$found){
|
||||
if(!empty($searchTerm)){
|
||||
echo "Das gesuchte Wort ".$searchTerm." ist nicht enthalten";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<form method="get">
|
||||
<label for="search_text">Suche:</label>
|
||||
<input id="search_text" type="text" name="search_text" value=<?php echo $searchTerm?>>
|
||||
<input type="submit" value="Suchen">
|
||||
</form>
|
||||
206
M2/Beispiele/meal.php
Normal file
206
M2/Beispiele/meal.php
Normal file
@@ -0,0 +1,206 @@
|
||||
<?php
|
||||
const GET_PARAM_MIN_STARS = 'search_min_stars';
|
||||
const GET_PARAM_SEARCH_TEXT = 'search_text';
|
||||
const GET_PARAM_SHOW_DESCRIPTION = 'show_description';
|
||||
const GET_PARAM_SPRACHE = 'sprache';
|
||||
const GET_PARAM_TOP_FLOPP = 'top_flopp';
|
||||
/**
|
||||
* List of all allergens.
|
||||
*/
|
||||
$allergens = [
|
||||
11 => 'Gluten',
|
||||
12 => 'Krebstiere',
|
||||
13 => 'Eier',
|
||||
14 => 'Fisch',
|
||||
17 => 'Milch'
|
||||
];
|
||||
|
||||
$meal = [
|
||||
'name' => 'Süßkartoffeltaschen mit Frischkäse und Kräutern gefüllt',
|
||||
'description' => 'Die Süßkartoffeln werden vorsichtig aufgeschnitten und der Frischkäse eingefüllt.',
|
||||
'price_intern' => 2.90,
|
||||
'price_extern' => 3.90,
|
||||
'allergens' => [11, 13],
|
||||
'amount' => 42 // Number of available meals
|
||||
];
|
||||
|
||||
$ratings = [
|
||||
[ 'text' => 'Die Kartoffel ist einfach klasse. Nur die Fischstäbchen schmecken nach Käse. ',
|
||||
'author' => 'Ute U.',
|
||||
'stars' => 2 ],
|
||||
[ 'text' => 'Sehr gut. Immer wieder gerne',
|
||||
'author' => 'Gustav G.',
|
||||
'stars' => 4 ],
|
||||
[ 'text' => 'Der Klassiker für den Wochenstart. Frisch wie immer',
|
||||
'author' => 'Renate R.',
|
||||
'stars' => 4 ],
|
||||
[ 'text' => 'Kartoffel ist gut. Das Grüne ist mir suspekt.',
|
||||
'author' => 'Marta M.',
|
||||
'stars' => 3 ]
|
||||
];
|
||||
|
||||
$dic = [
|
||||
[ "Gericht" => "Gericht",
|
||||
"Allergien" => "Allergien",
|
||||
"Bewertungen" => "Bewertungen (Insgesamt: ",
|
||||
"Text" => "Text",
|
||||
"Sterne" => "Sterne",
|
||||
"Author" => "Author",
|
||||
"Preis" => "Preis",
|
||||
"Gaeste" => "Gäste"
|
||||
],
|
||||
[ "Gericht" => "Meal",
|
||||
"Allergien" => "Allergies",
|
||||
"Bewertungen" => "Review (overall: ",
|
||||
"Text" => "Text",
|
||||
"Sterne" => "Stars",
|
||||
"Author" => "Author",
|
||||
"Preis" => "Price",
|
||||
"Gaeste" => "Guests"
|
||||
]
|
||||
];
|
||||
|
||||
$translation = $dic[0];
|
||||
$language = "de";
|
||||
if (!empty($_GET[GET_PARAM_SPRACHE])){
|
||||
$language = $_GET[GET_PARAM_SPRACHE];
|
||||
}
|
||||
if($language == "en"){$translation = $dic[1];}
|
||||
|
||||
if (empty($_GET[GET_PARAM_SHOW_DESCRIPTION])){
|
||||
$meal['description'] = "";
|
||||
}
|
||||
|
||||
$searchTerm = "";
|
||||
$showRatings = [];
|
||||
if (!empty($_GET[GET_PARAM_SEARCH_TEXT])) {
|
||||
$searchTerm = $_GET[GET_PARAM_SEARCH_TEXT];
|
||||
foreach ($ratings as $rating) {
|
||||
if (strpos(strtolower($rating['text']), strtolower($searchTerm) )!== false) {
|
||||
$showRatings[] = $rating;
|
||||
}
|
||||
}
|
||||
} else if (!empty($_GET[GET_PARAM_MIN_STARS])) {
|
||||
$minStars = $_GET[GET_PARAM_MIN_STARS];
|
||||
foreach ($ratings as $rating) {
|
||||
if ($rating['stars'] >= $minStars) {
|
||||
$showRatings[] = $rating;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$showRatings = $ratings;
|
||||
}
|
||||
|
||||
if (!empty($_GET[GET_PARAM_TOP_FLOPP])){
|
||||
$flopp = $_GET[GET_PARAM_TOP_FLOPP];
|
||||
if($flopp == "flopp"){
|
||||
unset($showRatings);
|
||||
$showRatings=[];
|
||||
$stars=[];
|
||||
foreach ($ratings as $rating) {
|
||||
$stars[] = $rating["stars"];
|
||||
}
|
||||
$min = min($stars);
|
||||
foreach ($ratings as $rating) {
|
||||
if ($rating['stars'] == $min) {
|
||||
$showRatings[] = $rating;
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif ($flopp == "top"){
|
||||
unset($showRatings);
|
||||
$showRatings=[];
|
||||
$stars=[];
|
||||
foreach ($ratings as $rating) {
|
||||
$stars[] = $rating["stars"];
|
||||
}
|
||||
$min = max($stars);
|
||||
foreach ($ratings as $rating) {
|
||||
if ($rating['stars'] == $min) {
|
||||
$showRatings[] = $rating;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*:float gibt den return value der Funktion an
|
||||
*/
|
||||
function calcMeanStars (array $ratings) : float {
|
||||
$sum = 0;
|
||||
foreach ($ratings as $rating) {
|
||||
$sum += $rating['stars'] / count($ratings);
|
||||
}
|
||||
return $sum;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<title><?php echo $translation["Gericht"].": ". $meal['name']; ?></title>
|
||||
<style>
|
||||
* {
|
||||
font-family: Arial, serif;
|
||||
}
|
||||
.rating {
|
||||
color: darkgray;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1><?php echo $translation["Gericht"].": ". $meal['name']; ?></h1>
|
||||
<p><?php echo $meal['description']; ?>
|
||||
</p>
|
||||
|
||||
<h4><?php echo $translation["Preis"].":"?></h4>
|
||||
<p>
|
||||
<?php echo $translation["Preis"]." intern: ".$meal["price_intern"]."€";?> <br>
|
||||
<?php echo $translation["Preis"]." ".$translation["Gaeste"].": ".$meal["price_extern"]."€";?>
|
||||
</p>
|
||||
|
||||
<h4><?php echo $translation["Allergien"].":"?> </h4>
|
||||
<ul>
|
||||
<?php
|
||||
foreach ($meal['allergens'] as $all) {
|
||||
echo "<li>$allergens[$all]</li>";
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<h1><?php echo $translation["Bewertungen"].calcMeanStars($ratings); ?>)</h1>
|
||||
<!--Such form in den Bewertungen für den User -->
|
||||
<form method="get">
|
||||
<label for="search_text">Filter:</label>
|
||||
<input id="search_text" type="text" name="search_text" value=<?php echo $searchTerm?>>
|
||||
<input type="submit" value="Suchen">
|
||||
</form>
|
||||
<table class="rating">
|
||||
<thead>
|
||||
<tr>
|
||||
<td><?php echo $translation["Text"]?></td>
|
||||
<td><?php echo $translation["Sterne"]?></td>
|
||||
<td><?php echo $translation["Author"]?></td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
foreach ($showRatings as $rating) {
|
||||
echo "<tr><td class='rating_text'>{$rating['text']}</td>
|
||||
<td class='rating_stars'>{$rating['stars']}</td>
|
||||
<td class='rating_author'>{$rating['author']}</td>
|
||||
</tr>";
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
<a href="?sprache=de">Deutsch</a> oder <a href="?sprache=en">English</a>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,10 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
</head>
|
||||
<body>
|
||||
Test
|
||||
</body>
|
||||
</html>
|
||||
1
M2/Werbeseite/besucher.txt
Normal file
1
M2/Werbeseite/besucher.txt
Normal file
@@ -0,0 +1 @@
|
||||
64
|
||||
BIN
M2/Werbeseite/fh-logo.jpg
Normal file
BIN
M2/Werbeseite/fh-logo.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 64 KiB |
31
M2/Werbeseite/gerichte.php
Normal file
31
M2/Werbeseite/gerichte.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* Praktikum DBWT. Autoren:
|
||||
* Şafak, Hazinedar, 3108590
|
||||
* Robert, Joel, 3672729
|
||||
*/
|
||||
|
||||
|
||||
$gerichte = [
|
||||
1 => ['name' => 'Rindfleich mit Bambus, Kaiserschoten und roter Paprika, dazu Mie Nudeln',
|
||||
'priceint' => 3.50,
|
||||
"priceex" => 6.20,
|
||||
"img" =>"img/bambus.jpg"
|
||||
],
|
||||
2 => ['name' => 'Spinatrisotto mit kleinen Samosateigecken und gemischter Salat',
|
||||
'priceint' => 2.90,
|
||||
"priceex" => 5.30,
|
||||
"img" =>"img/risotto.jpg"
|
||||
],
|
||||
3 => ['name' => 'Spaghetti Bolognese',
|
||||
'priceint' => 3,
|
||||
"priceex" => 5,
|
||||
"img" =>"img/bolo.jpg"
|
||||
],
|
||||
4 => ['name' => 'Spaghetti Carbonara',
|
||||
'priceint' => 3,
|
||||
"priceex" => 5,
|
||||
"img" =>"img/carbonara.jpg"
|
||||
]
|
||||
]
|
||||
?>
|
||||
BIN
M2/Werbeseite/img/bambus.jpg
Normal file
BIN
M2/Werbeseite/img/bambus.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 MiB |
BIN
M2/Werbeseite/img/bolo.jpg
Normal file
BIN
M2/Werbeseite/img/bolo.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 MiB |
BIN
M2/Werbeseite/img/carbonara.jpg
Normal file
BIN
M2/Werbeseite/img/carbonara.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 139 KiB |
BIN
M2/Werbeseite/img/risotto.jpg
Normal file
BIN
M2/Werbeseite/img/risotto.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 103 KiB |
308
M2/Werbeseite/index.php
Normal file
308
M2/Werbeseite/index.php
Normal file
@@ -0,0 +1,308 @@
|
||||
<?php
|
||||
/**
|
||||
* Praktikum DBWT. Autoren:
|
||||
* Şafak, Hazinedar, 3108590
|
||||
* Robert, Joel, 3672729
|
||||
*/
|
||||
|
||||
include "gerichte.php";
|
||||
|
||||
$besucherCount = 0;
|
||||
$newletterCount = 0;
|
||||
|
||||
//Besucher counter
|
||||
if (file_exists("besucher.txt")) {
|
||||
$besucherFile = fopen("besucher.txt", "r");
|
||||
$besucherCount = fgets($besucherFile) + 1;
|
||||
fclose($besucherFile);
|
||||
$besucherFile = fopen("besucher.txt", "w");
|
||||
fwrite($besucherFile, $besucherCount);
|
||||
fclose($besucherFile);
|
||||
} else {
|
||||
$besucherFile = fopen("besucher.txt", "w");
|
||||
fwrite($besucherFile, 1);
|
||||
fclose($besucherFile);
|
||||
}
|
||||
|
||||
//Newletter counter
|
||||
if (file_exists("newletter.txt")) {
|
||||
$newsFile = fopen("newletter.txt", "r");
|
||||
$newletterCount = fgets($newsFile);
|
||||
fclose($newsFile);
|
||||
} else {
|
||||
$newsFile = fopen("newletter.txt", "w");
|
||||
fwrite($newsFile, 0);
|
||||
fclose($newsFile);
|
||||
}
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
$name = $_POST['name'];
|
||||
$email = $_POST['email'];
|
||||
$language = $_POST['language'];
|
||||
$terms = $_POST['terms'];
|
||||
|
||||
$errors = array();
|
||||
|
||||
if (empty(trim($name))) {
|
||||
$errors[] = "Bitte geben Sie einen Namen ein.";
|
||||
}
|
||||
|
||||
if (!isset($terms)) {
|
||||
$errors[] = "Bitte stimmen Sie den Datenschutzbestimmungen zu.";
|
||||
}
|
||||
|
||||
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
||||
$errors[] = "Bitte geben Sie eine gültige E-Mail-Adresse ein.";
|
||||
}
|
||||
|
||||
$spam_domains = array("rcpt.at", "damnthespam.at", "wegwerfmail.de", "trashmail");
|
||||
|
||||
foreach ($spam_domains as $domain) {
|
||||
if (str_contains($email, $domain)) {
|
||||
$errors[] = "Bitte geben Sie eine gültige E-Mail-Adresse ein, keine Wegwerf- oder Spam-E-Mail-Adresse.";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($errors)) {
|
||||
$data = array(
|
||||
"name" => $name,
|
||||
"email" => $email,
|
||||
"language" => $language,
|
||||
"terms" => $terms
|
||||
);
|
||||
|
||||
$file = "subscriptions.json";
|
||||
$current_data = file_exists($file) ? json_decode(file_get_contents($file), true) : array();
|
||||
$current_data[] = $data;
|
||||
|
||||
if (file_put_contents($file, json_encode($current_data))) {
|
||||
echo '<script type="text/javascript">';
|
||||
echo 'alert("Vielen Dank für Ihre Anmeldung zum Newsletter.");';
|
||||
echo '</script>';
|
||||
|
||||
//Newsletter counter
|
||||
$newletterCount++;
|
||||
$newsFile = fopen("newletter.txt", "w");
|
||||
fwrite($newsFile, $newletterCount);
|
||||
fclose($newsFile);
|
||||
} else {
|
||||
echo '<script type="text/javascript">';
|
||||
echo 'alert("Es gab einen Fehler bei Ihrer Anmeldung. Bitte versuchen Sie es erneut.");';
|
||||
echo '</script>';
|
||||
}
|
||||
} else {
|
||||
$error_string = "";
|
||||
foreach ($errors as $error) {
|
||||
$error_string .= $error . '\n';
|
||||
}
|
||||
|
||||
echo '<script type="text/javascript">';
|
||||
echo 'alert("' . $error_string . '");';
|
||||
echo '</script>';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" xmlns="http://www.w3.org/1999/html">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Ihre E-Mensa</title>
|
||||
<style>
|
||||
* {
|
||||
font-family: Arial;
|
||||
}
|
||||
|
||||
.grid {
|
||||
display: grid;
|
||||
grid-template-columns: 200px auto 200px;
|
||||
}
|
||||
|
||||
img {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.speisen {
|
||||
border: solid;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.speisen td {
|
||||
border: solid;
|
||||
border-collapse: collapse;
|
||||
border-radius: 4px;
|
||||
padding: 5px;
|
||||
width: 150px;
|
||||
}
|
||||
|
||||
.speisen td:not(:first-of-type) {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
p {
|
||||
text-align: justify;
|
||||
}
|
||||
|
||||
.zahlen {
|
||||
list-style-type: none;
|
||||
display: grid;
|
||||
grid-template-columns: auto auto auto;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.zahlen p {
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.formular {
|
||||
display: grid;
|
||||
grid-template-columns: auto auto auto;
|
||||
justify-content: start;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.wichtig {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.wichtigListe {
|
||||
display: inline-block;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.freude {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
footer {
|
||||
border-top: 1px solid;
|
||||
}
|
||||
|
||||
.fusszeile {
|
||||
padding-top: 20px;
|
||||
padding-bottom: 20px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.fusszeile td:first-child {
|
||||
border-left: none;
|
||||
padding-left: 20px;
|
||||
padding-right: 20px;
|
||||
}
|
||||
|
||||
.fusszeile td {
|
||||
border-left: 3px solid;
|
||||
padding-left: 20px;
|
||||
padding-right: 20px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div class="grid">
|
||||
<div>
|
||||
<img src="fh-logo.jpg" alt="FH-Logo">
|
||||
</div>
|
||||
<div>
|
||||
<a href="#ankündigung">Ankündigung</a>
|
||||
<a href="#speisen">Speisen</a>
|
||||
<a href="#zahlen">Zahlen</a>
|
||||
<a href="#kontakt">Kontakt</a>
|
||||
<a href="#wichtig">Wichtig für uns</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="grid">
|
||||
<div></div>
|
||||
<div>
|
||||
<img src="mensa21.jpg" alt="Essen">
|
||||
<h1 id="ankündigung">Bald gibt es auch Essen online ;)</h1>
|
||||
<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et
|
||||
dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet
|
||||
clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet,
|
||||
consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,
|
||||
sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no
|
||||
sea takimata sanctus est Lorem ipsum dolor sit amet.</p>
|
||||
<h1 id="speisen">Köstlichkeiten die Sie erwarten</h1>
|
||||
<table class="speisen">
|
||||
|
||||
<tr class="speisen">
|
||||
<td>Gerichte</td>
|
||||
<td>Preis intern</td>
|
||||
<td>Preis extern</td>
|
||||
<td>Bild</td>
|
||||
</tr>
|
||||
<?php
|
||||
/**
|
||||
* Speisekarte
|
||||
*/
|
||||
foreach ($gerichte as $gericht) {
|
||||
echo "<tr class=\"speisen\"><td>" . $gericht["name"] . "</td><td>" . $gericht["priceint"] . "</td><td>" . $gericht["priceex"] . "</td><td><img src=" . $gericht["img"] . " alt=" . $gericht["name"] . ">";
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
<h1 id="zahlen">E-Mensa in Zahlen</h1>
|
||||
<div class="zahlen">
|
||||
<p><?php echo $besucherCount; ?> Besuche</p>
|
||||
<p><?php echo $newletterCount; ?> Anmeldungen zum Newsletter</p>
|
||||
<p><?php echo count($gerichte); ?> Speisen</p>
|
||||
</div>
|
||||
<h1 id="kontakt">Interesse geweckt? Wir informieren</h1>
|
||||
|
||||
<form method="post">
|
||||
<div class="formular">
|
||||
<div>
|
||||
<label for="name">Name:</label> <br>
|
||||
<input type="text" name="name" id="name" placeholder="Bitte geben Sie Ihren Namen ein">
|
||||
</div>
|
||||
<div>
|
||||
<label for="email">E-Mail:</label> <br>
|
||||
<input type="email" name="email" id="email" placeholder="Bitte geben Sie Ihre E-Mail ein">
|
||||
</div>
|
||||
<div>
|
||||
<label for="language">Newsletter bitte in:</label> <br>
|
||||
<select name="language" id="language">
|
||||
<option value="deutsch">Deutsch</option>
|
||||
<option value="englisch">Englisch</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<input required type="checkbox" name="terms" id="terms">
|
||||
<label for="terms">Den Datenschutzbestimmungen stimme ich zu</label>
|
||||
<button type="submit">Zum Newsletter anmelden</button>
|
||||
</form>
|
||||
|
||||
|
||||
<h1 id="wichtig">Das ist uns wichtig</h1>
|
||||
<div class="wichtig">
|
||||
<ul class="wichtigListe">
|
||||
<li>Beste frische saisonale Zutaten</li>
|
||||
<li>Ausgewogen abwechslungsreiche Gerichte</li>
|
||||
<li>Sauberkeit</li>
|
||||
</ul>
|
||||
</div>
|
||||
<h1 class="freude">Wir freuen uns auf Ihren Besuch!</h1>
|
||||
</div>
|
||||
</div>
|
||||
<footer>
|
||||
<table class="fusszeile">
|
||||
<tr>
|
||||
<td>(c) E-Mensa GmbH</td>
|
||||
<td>Şafak Hazinedar & Robert Joel</td>
|
||||
<td><a href="">Impressum</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
BIN
M2/Werbeseite/mensa21.jpg
Normal file
BIN
M2/Werbeseite/mensa21.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 153 KiB |
1
M2/Werbeseite/newletter.txt
Normal file
1
M2/Werbeseite/newletter.txt
Normal file
@@ -0,0 +1 @@
|
||||
1
|
||||
1
M2/Werbeseite/subscriptions.json
Normal file
1
M2/Werbeseite/subscriptions.json
Normal file
@@ -0,0 +1 @@
|
||||
[{"name":"Max","email":"max@gmail.com","language":"deutsch","terms":"on"},{"name":"Max","email":"max@gmail.com","language":"deutsch","terms":"on"},{"name":"Max","email":"max@gmail.com","language":"deutsch","terms":"on"},{"name":"Max","email":"max@gmail.com","language":"deutsch","terms":"on"},{"name":"Ro","email":"robert-joel@web.de","language":"deutsch","terms":"on"},{"name":"Robert","email":"robert-joel@web.de","language":"deutsch","terms":"on"}]
|
||||
3
M2/beispiele/erstesphp.php
Normal file
3
M2/beispiele/erstesphp.php
Normal file
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
echo "Erstes PHP-Skript <br>";
|
||||
phpinfo();
|
||||
BIN
M2/dossier M2.xlsx
Normal file
BIN
M2/dossier M2.xlsx
Normal file
Binary file not shown.
Reference in New Issue
Block a user