Compare commits
48 Commits
66acae0db4
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
11a260008e | ||
|
|
ec20b28fc4 | ||
|
|
19c2ba6e1f | ||
|
|
be93d16a61 | ||
|
|
0e3c68542d | ||
|
|
ae071b453c | ||
|
|
3ded7fe223 | ||
|
|
b540d8a11a | ||
|
|
cc73d75998 | ||
|
|
cb023b88de | ||
|
|
e59c3c4e59 | ||
|
|
3a3c99701f | ||
|
|
576d664240 | ||
|
|
a1040bd5db | ||
|
|
d26d5ea4a7 | ||
|
|
b98c0037f7 | ||
|
|
4413283006 | ||
|
|
385226a4a3 | ||
| f5408a6ad0 | |||
|
|
58b1ff7eef | ||
|
|
688c610a85 | ||
|
|
43d1eddc8c | ||
|
|
9b39a80879 | ||
|
|
be203da14d | ||
|
|
25f63a161b | ||
|
|
07166e1f6b | ||
|
|
1aaae0e219 | ||
|
|
1c7e90e8c5 | ||
|
|
ed17579448 | ||
|
|
58872b2416 | ||
|
|
6fdadf3ddf | ||
|
|
7eb513209d | ||
|
|
9b46ec8a53 | ||
|
|
4632ceaac0 | ||
| 861ebfbe3d | |||
|
|
70c46b4ea4 | ||
| b3a782c9a4 | |||
| 714d7cfc16 | |||
| 9a6e2d1709 | |||
| cd8302d8d3 | |||
| 1ecf1f211b | |||
| 7d761ec2b4 | |||
| 078f793430 | |||
|
|
7e5884e51b | ||
|
|
dd9c35c7b1 | ||
|
|
778c9019b3 | ||
|
|
bb0f530b8b | ||
| 7e9110d454 |
@@ -1,14 +1,31 @@
|
|||||||
# Erstes Jahr
|
# Erstes Jahr
|
||||||
|
|
||||||
|
## Info
|
||||||
|
|
||||||
|
Die HTML Datein sind das was wir gemacht haben aus den Fächer LBT3 und LBT2 bei Herr Staudt.
|
||||||
|
|
||||||
|
SQL Datein sind SQL Befehle aus dem Unterricht LBT4 / LBT2 bei Herr Schatke
|
||||||
|
|
||||||
## Gemacht
|
## Gemacht
|
||||||
*Wir warscheinlich nie aktuell aber egaaaal*
|
*Wir warscheinlich nie aktuell aber egaaaal*
|
||||||
|
|
||||||
### 13.10.25
|
#### 17.10.25 - HTML
|
||||||
|
- Verweise (Links)
|
||||||
|
- Menü (nav)
|
||||||
|
- Website
|
||||||
|
|
||||||
|
### 16.10.25 - SQL
|
||||||
|
- AB1 Übung Mitarbeiter
|
||||||
|
|
||||||
|
### 15.10.25 - HTML
|
||||||
|
- Grafiken
|
||||||
|
|
||||||
|
### 14.10.25 - HTML
|
||||||
|
- Listen
|
||||||
|
|
||||||
|
### 13.10.25 - HTML
|
||||||
- Grundgerüst HTML
|
- Grundgerüst HTML
|
||||||
- White Spaces
|
- White Spaces
|
||||||
- Heading
|
- Heading
|
||||||
- Paragraphs
|
- Paragraphs
|
||||||
- Emphasizing
|
- Emphasizing
|
||||||
|
|
||||||
### 14.10.25
|
|
||||||
- Listen
|
|
||||||
27
Erstes Jahr/ab1-uebung-mitarbeiter.sql
Normal file
27
Erstes Jahr/ab1-uebung-mitarbeiter.sql
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
-- Begonnen bei A7 da die anderen Aufgaben wo anders gemacht wurde aber nicht notiert
|
||||||
|
-- A7
|
||||||
|
SELECT AVG(m_gehalt) FROM Mitarbeiter;
|
||||||
|
-- A8
|
||||||
|
SELECT m_nachname FROM Mitarbeiter GROUP BY m_nachname DESC;
|
||||||
|
-- A9
|
||||||
|
SELECT m_geburtsdatum FROM Mitarbeiter GROUP BY m_geburtsdatum;
|
||||||
|
-- A10
|
||||||
|
SELECT COUNT(m_id) FROM Mitarbeiter;
|
||||||
|
-- A11
|
||||||
|
SELECT COUNT(DISTINCT m_nachname) FROM Mitarbeiter;
|
||||||
|
-- A12
|
||||||
|
SELECT m_vorname, m_nachname,m_gehalt * 1.045 FROM Mitarbeiter;
|
||||||
|
-- A13
|
||||||
|
SELECT m_vorname, m_nachname, m_gehalt * 1.05
|
||||||
|
FROM Mitarbeiter
|
||||||
|
WHERE m_gehalt * 1.05 > 2050;
|
||||||
|
-- A14
|
||||||
|
SELECT * FROM Mitarbeiter WHERE m_nachname LIKE 'K%';
|
||||||
|
-- A15
|
||||||
|
SELECT * FROM Mitarbeiter WHERE m_gehalt BETWEEN 1500 AND 2500;
|
||||||
|
-- A16
|
||||||
|
SELECT * FROM Mitarbeiter
|
||||||
|
WHERE YEAR(m_geburtsdatum) IN (1967, 1988, 1993);
|
||||||
|
-- -------- --
|
||||||
|
-- END --
|
||||||
|
-- -------- --
|
||||||
BIN
Erstes Jahr/downloads/file.pdf
Executable file
BIN
Erstes Jahr/downloads/file.pdf
Executable file
Binary file not shown.
31
Erstes Jahr/images.html
Executable file
31
Erstes Jahr/images.html
Executable file
@@ -0,0 +1,31 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Grafiken</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Grafiken</h1>
|
||||||
|
<h2>Grafik ohne Zusammenhang zum Text</h2>
|
||||||
|
<img src = "WvSS_Logo.png" alt = "Logo der WvSS">
|
||||||
|
|
||||||
|
<h2>Grafik mit Zusammenhang zum Text (Abbildung)</h2>
|
||||||
|
<figure>
|
||||||
|
<img src = "WvSS_Logo.png" alt = "Logo der WvSS">
|
||||||
|
<figcaption>Abb 1: Logo der WvSS</figcaption>
|
||||||
|
</figure>
|
||||||
|
|
||||||
|
<h2>Responsive Grafik mit picture-Element</h2>
|
||||||
|
<p>Verhindert, dass bei kleinem viewport eine Grafik mit sehr hoher Auflösung geladen wird</p>
|
||||||
|
<figure>
|
||||||
|
<picture>
|
||||||
|
<source media="(min-width: 650px)" srcset="img_pink_flowers.jpg">
|
||||||
|
<source media="(min-width: 465px)" srcset="img_white_flower.jpg">
|
||||||
|
<img src="img_orange_flowers.jpg" alt="Flowers">
|
||||||
|
</picture>
|
||||||
|
<figcaption>Abb 1: Logo der WvSS</figcaption>
|
||||||
|
</figure>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
BIN
Erstes Jahr/img/logo.png
Normal file
BIN
Erstes Jahr/img/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.7 MiB |
30
Erstes Jahr/links.html
Executable file
30
Erstes Jahr/links.html
Executable file
@@ -0,0 +1,30 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Links</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>HTML-Grundlagen: Verweise (Links)</h1>
|
||||||
|
<h2>Relativer Verweis auf Datei</h2>
|
||||||
|
<a href="images.html">HTML Grundlagen: Images</a>
|
||||||
|
|
||||||
|
<h2>Relativer Verweis auf pdf-Datei (Download)</h2>
|
||||||
|
<a href="downloads/file.pdf">pdf-Datei downloaden</a>
|
||||||
|
|
||||||
|
<h2>Relativer Verweis auf Grafik-Datei</h2>
|
||||||
|
<a href="img/logo.png">Bild anzeigen</a>
|
||||||
|
|
||||||
|
<h2>Absoluter Verweis auf eine externe Website</h2>
|
||||||
|
<a href="https://cloud.danielvici.com" target="_blank">Daniels Cloud</a><br>
|
||||||
|
<a href="https://git.danielvici.com" target="_blank">GITEA</a>
|
||||||
|
|
||||||
|
<h2>Seiteninterner Link (Sprungmarke)</h2>
|
||||||
|
<a href="#p2">Zu Abschnitt 2</a>
|
||||||
|
|
||||||
|
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Exercitationem, veritatis blanditiis. Commodi ducimus vitae numquam voluptate corporis porro dolores est dignissimos eos ipsam quam pariatur amet unde repellendus, corrupti dicta, quia ad eius molestias, et laborum. Rerum harum nesciunt consectetur obcaecati voluptas accusamus, iure repellat, deserunt hic illo dolorum adipisci porro repellendus nobis iusto itaque maiores ex doloremque culpa. Consequuntur quo dolore praesentium consequatur voluptas cum? Delectus officiis ducimus maxime nihil corrupti, culpa aspernatur odit illum nisi enim! Accusantium ut culpa id perferendis veritatis quis fuga placeat doloremque officiis et a nesciunt voluptates, ea maxime eaque at officia? Cumque, repudiandae!</p>
|
||||||
|
<h3 id="p2">Abschnitt 3</h3>
|
||||||
|
<p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Maiores, qui?</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
30
Erstes Jahr/menu.html
Normal file
30
Erstes Jahr/menu.html
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Hauptmenü</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Hauptmenü</h1>
|
||||||
|
|
||||||
|
<nav>
|
||||||
|
<!-- Ebene 1-->
|
||||||
|
<ul>
|
||||||
|
<li><a href="#">Menüpunk 1</a></li>
|
||||||
|
<li><a href="#">Menüpunk 2</a>
|
||||||
|
<!-- Ebene 2-->
|
||||||
|
<ul>
|
||||||
|
<li><a href="#">Menüpunk 2.1</a></li>
|
||||||
|
<li><a href="#">Menüpunk 2.2</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li><a href="#">Menüpunk 3</a></li>
|
||||||
|
<li><a href="#">Menüpunk 4</a></li>
|
||||||
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
60
Erstes Jahr/website/index.html
Normal file
60
Erstes Jahr/website/index.html
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Website | Homepage</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<!-- begin static content -->
|
||||||
|
<header>
|
||||||
|
<img src="https://placehold.co/200x180">
|
||||||
|
<div id="company">Website</div>
|
||||||
|
<div id="slogan">da kongred Website</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<nav>
|
||||||
|
<!-- Ebene 1-->
|
||||||
|
<ul>
|
||||||
|
<li><a href="index.html">Homepage</a></li>
|
||||||
|
<li><a href="#">About Us</a></li>
|
||||||
|
<li><a href="#">Portfolio</a></li>
|
||||||
|
<li><a href="#">Contact</a></li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<!-- end static content -->
|
||||||
|
<!-- begin dynamic content -->
|
||||||
|
<main>
|
||||||
|
<h1>Homepage</h1>
|
||||||
|
<p>Welcome!</p>
|
||||||
|
</main>
|
||||||
|
<!-- end dynamic content -->
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<aside>
|
||||||
|
<h3>Save the dates</h3>
|
||||||
|
<p>
|
||||||
|
<ul>
|
||||||
|
<li>2025-11-01: Event 1</li>
|
||||||
|
<li>2025-11-02: Event 2</li>
|
||||||
|
<li>2025-11-03: Event 3</li>
|
||||||
|
</ul>
|
||||||
|
</p>
|
||||||
|
</aside>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<!-- begin static content -->
|
||||||
|
<footer>
|
||||||
|
Created by <a href="https://github.com/danielvici">danielvici</a>(.com)
|
||||||
|
© 2025
|
||||||
|
</footer>
|
||||||
|
<!-- end static content -->
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
BIN
Erstes Jahr/wvss-logo.jpeg
Normal file
BIN
Erstes Jahr/wvss-logo.jpeg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.3 KiB |
@@ -1,5 +1,7 @@
|
|||||||
# Ausbildung 25-28
|
# Ausbildung 25-27
|
||||||
*Durch Verkürzung evtl. nur bis 27*
|
*Durch Verkürzung nur bis 27*
|
||||||
|
|
||||||
[Erstes Jahr](https://git.danielvici.com/admin/schule/src/branch/main/Erstes%20Jahr)
|
[Erstes Jahr](https://git.danielvici.com/admin/schule/src/branch/main/Erstes%20Jahr) (Ist nur erste zwei Blöcke)
|
||||||
|
|
||||||
|
[Zweites Jahr](https://git.danielvici.com/admin/schule/src/branch/main/Zweites%20Jahr)
|
||||||
|
|
||||||
|
|||||||
111
Zweites Jahr/Kryptologie/caeser-verschluesselung.php
Normal file
111
Zweites Jahr/Kryptologie/caeser-verschluesselung.php
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// WIP
|
||||||
|
|
||||||
|
// Caesar-Chiffre Funktion
|
||||||
|
function caesar($text, $shift) {
|
||||||
|
|
||||||
|
$textArr = str_split($text, 1);
|
||||||
|
// definition is gewohnheit aus angular
|
||||||
|
$textAscii = [];
|
||||||
|
$resAscii = [];
|
||||||
|
$resArr = [];
|
||||||
|
|
||||||
|
for($i = 0; $i > count($textArr); $i++){
|
||||||
|
// jeder buchstabe des textes wird zum array,
|
||||||
|
// in dessen ascii zeichen, $resAscii hinzugefügt
|
||||||
|
array_push($textAscii, ord($textArr[$i]));
|
||||||
|
// verschiebung
|
||||||
|
$resAscii[$i] =+ $shift;
|
||||||
|
// ascii buchstaben werden in ein wort gemacht
|
||||||
|
array_push($resArr, chr($resAscii[$i]));
|
||||||
|
}
|
||||||
|
// aus array ein wort machen
|
||||||
|
$result = implode("", $resArr);
|
||||||
|
|
||||||
|
$yo = print_r($textArr);
|
||||||
|
echo "<pre> $yo </pre>";
|
||||||
|
$yo = print_r($textAscii);
|
||||||
|
echo "<pre> $yo </pre>";
|
||||||
|
$yo = print_r($resAscii);
|
||||||
|
echo "<pre> $yo </pre>";
|
||||||
|
$yo = print_r($resArr);
|
||||||
|
echo "<pre> $yo </pre>";
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Formularverarbeitung
|
||||||
|
$output = "";
|
||||||
|
$text = "";
|
||||||
|
$shift = 0;
|
||||||
|
if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||||
|
$text = $_POST["text"] ?? "";
|
||||||
|
$shift = intval($_POST["shift"] ?? 0);
|
||||||
|
|
||||||
|
if (isset($_POST["encrypt"])) {
|
||||||
|
$output = caesar($text, $shift);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($_POST["decrypt"])) {
|
||||||
|
$output = caesar($text, -$shift);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="de">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Caesar Chiffre</title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
font-family: Arial, sans-serif;
|
||||||
|
background: #f4f4f4;
|
||||||
|
padding: 30px;
|
||||||
|
}
|
||||||
|
.box {
|
||||||
|
background: white;
|
||||||
|
padding: 20px;
|
||||||
|
max-width: 500px;
|
||||||
|
margin: auto;
|
||||||
|
border-radius: 8px;
|
||||||
|
}
|
||||||
|
textarea, input {
|
||||||
|
width: 100%;
|
||||||
|
padding: 10px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
button {
|
||||||
|
padding: 10px 20px;
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
label{
|
||||||
|
display: block;
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="box">
|
||||||
|
<h2>Caesar Chiffre</h2>
|
||||||
|
|
||||||
|
<form method="post">
|
||||||
|
<label for="text">Nachricht:</label>
|
||||||
|
<textarea name="text" rows="4"><?= htmlspecialchars($text) ?></textarea>
|
||||||
|
|
||||||
|
<label>Verschiebung:</label>
|
||||||
|
<input type="number" name="shift" min = 1 max = 26 value="<?= htmlspecialchars($shift) ?>">
|
||||||
|
<!--<input type="number" name="shift" value="<?= htmlspecialchars($shift) ?>">-->
|
||||||
|
|
||||||
|
<button type="submit" name="encrypt">Verschlüsseln</button>
|
||||||
|
<button type="submit" name="decrypt">Entschlüsseln</button>
|
||||||
|
|
||||||
|
<label for="result"> Verschlüsselte Nachricht:</label>
|
||||||
|
<textarea name="result" rows="4" readonly><?= htmlspecialchars($output ?: $text) ?></textarea>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
56
Zweites Jahr/README.md
Normal file
56
Zweites Jahr/README.md
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
# Zweites Jahr
|
||||||
|
|
||||||
|
## Infos
|
||||||
|
|
||||||
|
Wichtige Informationen
|
||||||
|
|
||||||
|
- Wir eventuell nie aktuell sein.
|
||||||
|
- Stundenplan - [Link](https://wvss-mannheim.webuntis.com/WebUntis/?school=wvss-mannheim#/basic/timetablePublic/class?entityId=2583)
|
||||||
|
|
||||||
|
|
||||||
|
## 16-01-26 - PHP
|
||||||
|
- Modulo
|
||||||
|
|
||||||
|
## 14-01-26 - PHP
|
||||||
|
- Kryptologie (LBT3)
|
||||||
|
|
||||||
|
## 12-12-25 - PHP (SQL)
|
||||||
|
- Aufgabe von gester überarbeitet
|
||||||
|
- Unterrichts Projekt:
|
||||||
|
- Verschiedene wege um daten aus db anzuzeigen
|
||||||
|
- Form um user anzulegen
|
||||||
|
|
||||||
|
## 11-12-25 - PHP (XML)
|
||||||
|
- XML aus PHP erstellt
|
||||||
|
- CSV Datei in XML Datei konvertiert
|
||||||
|
|
||||||
|
## 10-12-25 - PHP
|
||||||
|
|
||||||
|
- Unterrichtsprojekt begonnen:
|
||||||
|
- Verbindung zur Datenbank
|
||||||
|
|
||||||
|
## 9-12-25 - PHP (SQL)
|
||||||
|
|
||||||
|
- Datenbank durch PHP erstellt und Daten hinzufügen
|
||||||
|
|
||||||
|
### 21-11-25 - PHP
|
||||||
|
|
||||||
|
- Aufgabe von gestern Kontroliert + Kommentare hinzugefügt
|
||||||
|
- XML von AP1 Aufgabe
|
||||||
|
|
||||||
|
### 20-11-25 - PHP
|
||||||
|
|
||||||
|
- GETTER in PHP
|
||||||
|
- Übung zu OOP
|
||||||
|
|
||||||
|
### 19-11-25 - PHP
|
||||||
|
|
||||||
|
- Übung Datei lesen/schreiben (Log Access)
|
||||||
|
|
||||||
|
### 18-11-25 - PHP
|
||||||
|
|
||||||
|
- Datein lesen CSV
|
||||||
|
|
||||||
|
### Davor
|
||||||
|
|
||||||
|
Alles was die Klasse gemacht hat bevor ich dazu gekommen ist liegt in `alt`
|
||||||
58
Zweites Jahr/Rechteck.class.php
Executable file
58
Zweites Jahr/Rechteck.class.php
Executable file
@@ -0,0 +1,58 @@
|
|||||||
|
<?php
|
||||||
|
class Rechteck
|
||||||
|
{
|
||||||
|
//Attribute
|
||||||
|
private float $seiteA;
|
||||||
|
private float $seiteB;
|
||||||
|
private string $farbe;
|
||||||
|
|
||||||
|
//SET-Methoden
|
||||||
|
public function setSeiteA($sA)
|
||||||
|
{
|
||||||
|
//Plausibilitätskontrolle
|
||||||
|
if($sA<0){$sA*=-1;}
|
||||||
|
$this->seiteA=$sA;
|
||||||
|
}
|
||||||
|
public function setSeiteB($sB)
|
||||||
|
{
|
||||||
|
$this->seiteB=$sB;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setFarbe($f)
|
||||||
|
{
|
||||||
|
$this->farbe=$f;
|
||||||
|
}
|
||||||
|
|
||||||
|
// GET-Methoden
|
||||||
|
|
||||||
|
public function getSeiteA(): float
|
||||||
|
{
|
||||||
|
return $this->seiteA;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSeiteB(): float
|
||||||
|
{
|
||||||
|
return $this->seiteB;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFarbe(): string
|
||||||
|
{
|
||||||
|
return $this->farbe;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Andere Methoden
|
||||||
|
public function showFlaeche()
|
||||||
|
{
|
||||||
|
//$seiteA=$this-seiteA;
|
||||||
|
$ergebnis=$this->seiteA*$this->seiteB;
|
||||||
|
|
||||||
|
echo "<p>{$this->seiteA} * {$this->seiteB} = {$ergebnis}</p>";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
||||||
24
Zweites Jahr/TestRechteck.php
Executable file
24
Zweites Jahr/TestRechteck.php
Executable file
@@ -0,0 +1,24 @@
|
|||||||
|
<h1>Test Rechteck</h1>
|
||||||
|
<?php
|
||||||
|
include("Rechteck.class.php");
|
||||||
|
|
||||||
|
|
||||||
|
//Objekt instanzi(i)eren
|
||||||
|
$re1 = new Rechteck();
|
||||||
|
$re1->setSeiteA(-5.3);
|
||||||
|
$re1->setSeiteB(10.3);
|
||||||
|
//$re1->seiteA=5.3;
|
||||||
|
//$re1->seiteB=10.3;
|
||||||
|
$re1->showFlaeche();
|
||||||
|
echo "{$re1->getSeiteA()} <br>";
|
||||||
|
echo "{$re1->getSeiteB()} <br>";
|
||||||
|
|
||||||
|
$re2 = new Rechteck();
|
||||||
|
$re2->setSeiteA(500.0);
|
||||||
|
$re2->setSeiteB(3000.4);
|
||||||
|
//$re2->seiteA=500.0;
|
||||||
|
//$re2->seiteB=3000.4;
|
||||||
|
$re2->showFlaeche();
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
||||||
19
Zweites Jahr/XML/ap1.xml
Normal file
19
Zweites Jahr/XML/ap1.xml
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<personen>
|
||||||
|
<benutzer>
|
||||||
|
<benuztername>maier1</benuztername>
|
||||||
|
<passwort>mXabc123m!<passwort>
|
||||||
|
<vorname>Hubertus</vorname>
|
||||||
|
<nachname>Maier</nachname>
|
||||||
|
<email>maier1@bfpohg.de</email>
|
||||||
|
</benutzer>
|
||||||
|
|
||||||
|
<benutzer>
|
||||||
|
<benuztername>maier1</benuztername>
|
||||||
|
<passwort>mXabc123m!<passwort>
|
||||||
|
<vorname>Hubertus</vorname>
|
||||||
|
<nachname>Maier</nachname>
|
||||||
|
<email>maier1@bfpohg.de</email>
|
||||||
|
</benutzer>
|
||||||
|
</personen>
|
||||||
|
|
||||||
65
Zweites Jahr/XML/createXmlDocument.php
Normal file
65
Zweites Jahr/XML/createXmlDocument.php
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
ini_set("display_errors", 1);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<personen>
|
||||||
|
<benutzer>
|
||||||
|
<benutzername>maier1</benutzername>
|
||||||
|
<passwort>mXabc123m!</passwort>
|
||||||
|
<vorname>Hubertus</vorname>
|
||||||
|
<nachname>Maier</nachname>
|
||||||
|
<email>maier1@bfpohg.de</email>
|
||||||
|
</benutzer>
|
||||||
|
|
||||||
|
<benutzer> ... </benutzer>
|
||||||
|
</personen>
|
||||||
|
*/
|
||||||
|
|
||||||
|
// create xml docs
|
||||||
|
$xmlDoc = new DOMDocument("1.0", "utf-8");
|
||||||
|
$xmlDoc->formatOutput=true;
|
||||||
|
|
||||||
|
// Root element
|
||||||
|
$xmlRoot = $xmlDoc->createElement("personen");
|
||||||
|
$xmlDoc->appendChild($xmlRoot);
|
||||||
|
|
||||||
|
// first node - benutzer
|
||||||
|
$xmlPerson = $xmlDoc->createElement("benutzer");
|
||||||
|
|
||||||
|
// child node of benutzer: benutzername
|
||||||
|
$xmlBenutzername = $xmlDoc->createElement("benutzername", "Daniel");
|
||||||
|
$xmlPerson->appendChild($xmlBenutzername);
|
||||||
|
|
||||||
|
// child node of benutzer: passwort
|
||||||
|
$xmlPasswort = $xmlDoc->createElement("passwort", "danielISTcool");
|
||||||
|
$xmlPerson->appendChild($xmlPasswort);
|
||||||
|
|
||||||
|
// append node to root
|
||||||
|
$xmlRoot->appendChild($xmlPerson);
|
||||||
|
|
||||||
|
// --- SECOND USER ---
|
||||||
|
// second node - benutzer
|
||||||
|
$xmlPerson = $xmlDoc->createElement("benutzer");
|
||||||
|
|
||||||
|
// child node of benutzer: benutzername
|
||||||
|
$xmlBenutzername = $xmlDoc->createElement("benutzername", "Peter");
|
||||||
|
$xmlPerson->appendChild($xmlBenutzername);
|
||||||
|
|
||||||
|
// child node of benutzer: passwort
|
||||||
|
$xmlPasswort = $xmlDoc->createElement("passwort", "12345");
|
||||||
|
$xmlPerson->appendChild($xmlPasswort);
|
||||||
|
|
||||||
|
// append node to root
|
||||||
|
$xmlRoot->appendChild($xmlPerson);
|
||||||
|
|
||||||
|
// create file
|
||||||
|
$bytes = $xmlDoc->save(__DIR__ . "/personen.xml");
|
||||||
|
var_dump($bytes);
|
||||||
|
|
||||||
|
echo $bytes . "<br>";
|
||||||
|
echo __DIR__;
|
||||||
|
?>
|
||||||
11
Zweites Jahr/XML/personen.xml
Normal file
11
Zweites Jahr/XML/personen.xml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<personen>
|
||||||
|
<benutzer>
|
||||||
|
<benutzername>Daniel</benutzername>
|
||||||
|
<passwort>danielISTcool</passwort>
|
||||||
|
</benutzer>
|
||||||
|
<benutzer>
|
||||||
|
<benutzername>Peter</benutzername>
|
||||||
|
<passwort>12345</passwort>
|
||||||
|
</benutzer>
|
||||||
|
</personen>
|
||||||
36
Zweites Jahr/XML/readXmlDocument.php
Normal file
36
Zweites Jahr/XML/readXmlDocument.php
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
ini_set("display_errors", 1);
|
||||||
|
|
||||||
|
echo "<h1>XML Ausgabe</h1>";
|
||||||
|
|
||||||
|
// load xml file
|
||||||
|
$xmlDoc = new DOMDocument();
|
||||||
|
$xmlDoc->load("personen.xml");
|
||||||
|
|
||||||
|
echo "<h2>Einfach</h1>";
|
||||||
|
|
||||||
|
// simple output
|
||||||
|
echo $xmlDoc->saveXML();
|
||||||
|
|
||||||
|
echo "<hr>";
|
||||||
|
|
||||||
|
echo "<h2>Gesamte Knoten</h1>";
|
||||||
|
|
||||||
|
// output of individual nodes
|
||||||
|
$benutzer=$xmlDoc->getElementsByTagName("benutzer");
|
||||||
|
|
||||||
|
foreach($benutzer as $benutzerDaten){
|
||||||
|
echo "<strong>Person: </strong>".$benutzerDaten->textContent."<br>";
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "<hr>";
|
||||||
|
echo "<h2>Element eines Knotens</h1>";
|
||||||
|
// output of an node's element
|
||||||
|
foreach($benutzer as $benutzerDaten){
|
||||||
|
foreach($benutzerDaten->childNodes as $element){
|
||||||
|
if($element->nodeName == "benutzername"){
|
||||||
|
echo "<strong>Person: </strong>".$element->textContent."<br>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
17
Zweites Jahr/alt/LJ1/betonung.htm
Executable file
17
Zweites Jahr/alt/LJ1/betonung.htm
Executable file
@@ -0,0 +1,17 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta keywords = "ljhlkjsh, asdfhlasd f">
|
||||||
|
<title>HTML-Grundlagen: Textauszeichnung zur Betonung</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>HTML-Grundlagen: Textauszeichnung zur Betonung</h1>
|
||||||
|
<h2>Starke Betonung</h2>
|
||||||
|
<p>Dies ist ein <strong>sauwichtiges</strong> Wort</p>
|
||||||
|
<h2>Betonung</h2>
|
||||||
|
<p>Dies ist ein <em>wichtiges</em> Wort</p>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
BIN
Zweites Jahr/alt/LJ1/downloads/file.pdf
Executable file
BIN
Zweites Jahr/alt/LJ1/downloads/file.pdf
Executable file
Binary file not shown.
68
Zweites Jahr/alt/LJ1/forms/data_evaluate.php
Executable file
68
Zweites Jahr/alt/LJ1/forms/data_evaluate.php
Executable file
@@ -0,0 +1,68 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Document</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<?php
|
||||||
|
ini_set("display_errors", "on");
|
||||||
|
|
||||||
|
// file: data_evaluate.php
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// required fields
|
||||||
|
if( empty($_REQUEST['lastname']) ||
|
||||||
|
empty($_REQUEST['password']) ||
|
||||||
|
empty($_REQUEST['email'])) {
|
||||||
|
echo "<p>All required fields must be filled in</p>";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
// required fields
|
||||||
|
$lastname = $_REQUEST['lastname'];
|
||||||
|
$country = $_REQUEST['country'];
|
||||||
|
$email = $_REQUEST['email'];
|
||||||
|
$favs = $_REQUEST['favs'];
|
||||||
|
|
||||||
|
|
||||||
|
// optional fields
|
||||||
|
$firstname = empty($_REQUEST['firstname']) ? "n.a." : $_REQUEST['firstname'];
|
||||||
|
$dob = empty($_REQUEST['dob']) ? "n.a." : $_REQUEST['dob'];
|
||||||
|
|
||||||
|
|
||||||
|
echo "<h2>Your data:</h2>";
|
||||||
|
echo "<p>";
|
||||||
|
echo "<strong>First Name:</strong> $firstname<br>";
|
||||||
|
echo "<strong>Last Name:</strong> $lastname<br>";
|
||||||
|
echo "<strong>Email:</strong> $email<br>";
|
||||||
|
echo "<strong>Country:</strong> $country<br>";
|
||||||
|
echo "<strong>Date Of Birth:</strong> $dob<br>";
|
||||||
|
echo "<strong>Favorites:</strong><br>";
|
||||||
|
|
||||||
|
if(!empty($_REQUEST["favs"]) && is_array($_REQUEST["favs"])) {
|
||||||
|
echo "<ul>";
|
||||||
|
$favs = $_REQUEST["favs"];
|
||||||
|
foreach($favs as $fav) {
|
||||||
|
echo "<li>$fav</li>";
|
||||||
|
}
|
||||||
|
echo "</ul>";
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo "n.a<br>";
|
||||||
|
/*
|
||||||
|
echo "<pre>";
|
||||||
|
print_r($favs);
|
||||||
|
echo "</pre>";
|
||||||
|
*/
|
||||||
|
//echo "<strong>Favorites:</strong> $favs<br>";
|
||||||
|
echo "</p>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
97
Zweites Jahr/alt/LJ1/forms/formtemplate.htm
Executable file
97
Zweites Jahr/alt/LJ1/forms/formtemplate.htm
Executable file
@@ -0,0 +1,97 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Form Template</title>
|
||||||
|
<style>
|
||||||
|
html {
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
div.form-row {
|
||||||
|
background: silver;
|
||||||
|
padding: .2rem;
|
||||||
|
margin: .2rem;
|
||||||
|
}
|
||||||
|
label {
|
||||||
|
display: inline-block;
|
||||||
|
width: 7rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
label::after {
|
||||||
|
content: ":";
|
||||||
|
}
|
||||||
|
|
||||||
|
form {
|
||||||
|
border: 1px solid black;
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[required] {
|
||||||
|
background: rgba(31, 225, 232, 0.2);
|
||||||
|
border: 1px solid #003366;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<form action = "data_evaluate.php">
|
||||||
|
|
||||||
|
<div class = "form-row">
|
||||||
|
<label for = "fn">First Name</label>
|
||||||
|
<input id = "ln" name = "firstname" placeholder = "Hans" title = "Please insert your first name here!">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class = "form-row">
|
||||||
|
<label for = "ln">Last Name</label>
|
||||||
|
<input id = "ln" name = "lastname" placeholder = "Mustermann" required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class = "form-row">
|
||||||
|
<label for = "pw">Password</label>
|
||||||
|
<input id = "pw" name = "password" type = "password" required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class = "form-row">
|
||||||
|
<label for = "email">Email</label>
|
||||||
|
<input id = "email" name = "email" type = "email" placeholder = "me@mydomain.com" required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class = "form-row">
|
||||||
|
<label for = "dob">Date of Birth</label>
|
||||||
|
<input id = "dob" name = "dob" type = "date">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class = "form-row">
|
||||||
|
<label for = "country">Country</label>
|
||||||
|
<select id = "country" name = "country">
|
||||||
|
<option>n.a.</option>
|
||||||
|
<option>Germany</option>
|
||||||
|
<option>United States Of America</option>
|
||||||
|
<option>United Kingdom</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class = "form-row">
|
||||||
|
<label for = "favs">Favorits</label>
|
||||||
|
<select id = "favs" name = "favs[]" multiple>
|
||||||
|
<option>web engineering</option>
|
||||||
|
<option>music</option>
|
||||||
|
<option>sports</option>
|
||||||
|
<option>bing watching</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class = "form-row">
|
||||||
|
<button>Go!</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
0
Zweites Jahr/alt/LJ1/forms/validate_date.php
Executable file
0
Zweites Jahr/alt/LJ1/forms/validate_date.php
Executable file
30
Zweites Jahr/alt/LJ1/grafiken_e3fi1.htm
Executable file
30
Zweites Jahr/alt/LJ1/grafiken_e3fi1.htm
Executable file
@@ -0,0 +1,30 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>HTML-Grundlagen: Grafiken</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>HTML-Grundlagen: Grafiken</h1>
|
||||||
|
<h2>Grafiken ohne Zusammenhang zum Text</h2>
|
||||||
|
<!-- src und alt sind Pflicht-Attribute -->
|
||||||
|
<img src = "images/pic.jpg" alt = "Bild von WvSS in Vietnam">
|
||||||
|
|
||||||
|
<h2>Abbildung mit Bezug zum Text</h2>
|
||||||
|
<figure>
|
||||||
|
<img src = "images/pic.jpg" alt = "Erklärendes Bild">
|
||||||
|
<figcaption>Abb 1.1 Vergaser</figcaption>
|
||||||
|
</figure>
|
||||||
|
|
||||||
|
<h2>Falls Grafik mit hoher Auflösung für verschiedene Endgeräte</h2>
|
||||||
|
<picture>
|
||||||
|
<!-- Desktop -->
|
||||||
|
<source media="(min-width:950px)" srcset="large.jpg">
|
||||||
|
<!-- Laptop -->
|
||||||
|
<source media="(min-width:465px)" srcset="medium.jpg">
|
||||||
|
<!-- Smartphone -->
|
||||||
|
<img src="small.jpg" alt="Flowers">
|
||||||
|
</picture>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
BIN
Zweites Jahr/alt/LJ1/images/pic.jpg
Executable file
BIN
Zweites Jahr/alt/LJ1/images/pic.jpg
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 352 KiB |
49
Zweites Jahr/alt/LJ1/listen.htm
Executable file
49
Zweites Jahr/alt/LJ1/listen.htm
Executable file
@@ -0,0 +1,49 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>HTML-Grundlagen: Listen</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>HTML-Grundlagen: Listen</h1>
|
||||||
|
|
||||||
|
<h2>Ungeordnete Liste</h2>
|
||||||
|
<ul> <!-- unordered list -->
|
||||||
|
<li>Pink Floyd</li> <!-- list items-->
|
||||||
|
<li>Saga</li>
|
||||||
|
<li>Manfred Mann's Earth Band</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2>Geordnete Liste</h2>
|
||||||
|
<ol> <!-- ordered list -->
|
||||||
|
<li>Full Metal Jacket</li> <!-- list items-->
|
||||||
|
<li>Clockwork Orange</li>
|
||||||
|
<li>Existenz</li>
|
||||||
|
</ol>
|
||||||
|
|
||||||
|
|
||||||
|
<h2>Ungeordnete Liste</h2>
|
||||||
|
<h3>Verschachtelt</h3>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li>Saga</li>
|
||||||
|
<li>Pink Floyd
|
||||||
|
<ul>
|
||||||
|
<li>Roger Waters</li>
|
||||||
|
<li>David Gilour
|
||||||
|
<ul>
|
||||||
|
<li>Vocals</li>
|
||||||
|
<li>Lead Guitar</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
<li>Nick Mason</li>
|
||||||
|
<li>Richard Wright</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li>Manfred Mann's Earth Band</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
28
Zweites Jahr/alt/LJ1/menues_e3fi1.htm
Executable file
28
Zweites Jahr/alt/LJ1/menues_e3fi1.htm
Executable file
@@ -0,0 +1,28 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>HTML-Grundlagen: Hauptmenüs</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>HTML-Grundlagen: Hauptmenüs</h1>
|
||||||
|
<nav>
|
||||||
|
<ul>
|
||||||
|
<li><a href = "#">Menüpunkt 1</a></li>
|
||||||
|
<li><a href = "#">Menüpunkt 2</a></li>
|
||||||
|
<li><a href = "#">Menüpunkt 3</a>
|
||||||
|
|
||||||
|
<!-- Untermenü zu Punkt 3 -->
|
||||||
|
<ul>
|
||||||
|
<li><a href = "#">Menüpunkt 3.1</a></li>
|
||||||
|
<li><a href = "#">Menüpunkt 3.2</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li><a href = "#">Menüpunkt 4</a></li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
24
Zweites Jahr/alt/LJ1/paragraph_br_header.htm
Executable file
24
Zweites Jahr/alt/LJ1/paragraph_br_header.htm
Executable file
@@ -0,0 +1,24 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>HTML-Grundlagen: Absatz, Umbruch, Überschrift</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<!-- Datei: paragraph_br_header.htm -->
|
||||||
|
<h1>HTML-Grundlagen: Absatz, Umbruch, Überschrift</h1>
|
||||||
|
<p>Jede HTML-Datei soll nur eine Überschrift 1. Ordnung besitzen</p>
|
||||||
|
<p>Lorem ipsum dolor sit, <br>amet consectetur adipisicing elit.
|
||||||
|
Aliquam est molestiae nesciunt fugit aspernatur inventore
|
||||||
|
quas esse, natus, nobis excepturi,<br> ad reiciendis eaque.
|
||||||
|
Totam obcaecati, assumenda non voluptas odio nobis?</p>
|
||||||
|
<h2>Überschrift 2. Ordnung</h2>
|
||||||
|
<h3>Überschrift 3. Ordnung</h3>
|
||||||
|
<h4>Überschrift 4. Ordnung</h4>
|
||||||
|
<h5>Überschrift 5. Ordnung</h5>
|
||||||
|
<h6>Überschrift 6. Ordnung</h6>
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
35
Zweites Jahr/alt/LJ1/verweise_e3fi1.htm
Executable file
35
Zweites Jahr/alt/LJ1/verweise_e3fi1.htm
Executable file
@@ -0,0 +1,35 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>HTML-Grundlagen: Verweise</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>HTML-Grundlagen: Verweise</h1>
|
||||||
|
|
||||||
|
<h2>relative Verweise</h2>
|
||||||
|
<!-- href = hyper reference | a = anker -->
|
||||||
|
<a href = "listen.htm">Zur Datei "Listen"</a><br>
|
||||||
|
<a href = "downloads/file.pdf">Download</a><br>
|
||||||
|
<a href = "images/pic.jpg">Bild ansehen</a>
|
||||||
|
|
||||||
|
<h2>absolute Verweise (externe URL's)</h2>
|
||||||
|
|
||||||
|
<a href = "https://www.wvss-mannheim.de" target = "_blank">
|
||||||
|
Zur Website der WvSS
|
||||||
|
</a><br>
|
||||||
|
|
||||||
|
<!-- Achtung Fishing !!! -->
|
||||||
|
<a href = "https://google.de" target = "_blank">
|
||||||
|
Auf Sparkasse.de anmelden
|
||||||
|
</a><br>
|
||||||
|
|
||||||
|
<h2>Verlinkte Grafiken</h2>
|
||||||
|
|
||||||
|
<a href = "images/pic.jpg">
|
||||||
|
<img src="images/pic.jpg" width = "10%" alt = "thumb">
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
54
Zweites Jahr/alt/LJ1/website/about.htm
Executable file
54
Zweites Jahr/alt/LJ1/website/about.htm
Executable file
@@ -0,0 +1,54 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>MyCompany | About</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<!-- static -->
|
||||||
|
<header>
|
||||||
|
<div id = "company">MyCompany</div>
|
||||||
|
<div id = "slogan">My Slogan</div>
|
||||||
|
<div id = "logo">
|
||||||
|
<img src = "https://placehold.co/200x100" alt = "logo">
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<hr>
|
||||||
|
<nav>
|
||||||
|
<ul>
|
||||||
|
<li><a href = "index.htm">Home</a></li>
|
||||||
|
<li><a href = "about.htm">About</a></li>
|
||||||
|
<li><a href = "portfolio.htm">Portfolio</a></li>
|
||||||
|
<li><a href = "contact.htm">Contact</a></li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
<hr>
|
||||||
|
<!-- static end-->
|
||||||
|
|
||||||
|
<!-- dynamic -->
|
||||||
|
<main>
|
||||||
|
<h1>About</h1>
|
||||||
|
<p>We do stuff!</p>
|
||||||
|
</main>
|
||||||
|
<hr>
|
||||||
|
<!-- dynamic end -->
|
||||||
|
|
||||||
|
<!-- dynamic/static -->
|
||||||
|
<aside>
|
||||||
|
<h3>Dates</h3>
|
||||||
|
<time>2011-01-01</time>
|
||||||
|
<p>Open Day</p>
|
||||||
|
</aside>
|
||||||
|
<hr>
|
||||||
|
<!-- dynamic/static end -->
|
||||||
|
|
||||||
|
<!-- static -->
|
||||||
|
<footer>
|
||||||
|
<p>© 2025 MyCompany</p>
|
||||||
|
</footer>
|
||||||
|
<!-- static end -->
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
57
Zweites Jahr/alt/LJ1/website/contact.htm
Executable file
57
Zweites Jahr/alt/LJ1/website/contact.htm
Executable file
@@ -0,0 +1,57 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>MyCompany | Contact </title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<!-- static -->
|
||||||
|
<header>
|
||||||
|
<div id = "company">MyCompany</div>
|
||||||
|
<div id = "slogan">My Slogan</div>
|
||||||
|
<div id = "logo">
|
||||||
|
<img src = "https://placehold.co/200x100" alt = "logo">
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<hr>
|
||||||
|
<nav>
|
||||||
|
<ul>
|
||||||
|
<li><a href = "index.htm">Home</a></li>
|
||||||
|
<li><a href = "about.htm">About</a></li>
|
||||||
|
<li><a href = "portfolio.htm">Portfolio</a></li>
|
||||||
|
<li><a href = "contact.htm">Contact</a></li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
<hr>
|
||||||
|
<!-- static end-->
|
||||||
|
|
||||||
|
<!-- dynamic -->
|
||||||
|
<main>
|
||||||
|
<h1>Contact</h1>
|
||||||
|
<address>
|
||||||
|
<div id = "email">staudt@wvss-mannheim.de</div>
|
||||||
|
</address>
|
||||||
|
|
||||||
|
</main>
|
||||||
|
<hr>
|
||||||
|
<!-- dynamic end -->
|
||||||
|
|
||||||
|
<!-- dynamic/static -->
|
||||||
|
<aside>
|
||||||
|
<h3>Dates</h3>
|
||||||
|
<time>2011-01-01</time>
|
||||||
|
<p>Open Day</p>
|
||||||
|
</aside>
|
||||||
|
<hr>
|
||||||
|
<!-- dynamic/static end -->
|
||||||
|
|
||||||
|
<!-- static -->
|
||||||
|
<footer>
|
||||||
|
<p>© 2025 MyCompany</p>
|
||||||
|
</footer>
|
||||||
|
<!-- static end -->
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
54
Zweites Jahr/alt/LJ1/website/index.htm
Executable file
54
Zweites Jahr/alt/LJ1/website/index.htm
Executable file
@@ -0,0 +1,54 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>MyCompany | Homepage</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<!-- static -->
|
||||||
|
<header>
|
||||||
|
<div id = "company">MyCompany</div>
|
||||||
|
<div id = "slogan">My Slogan</div>
|
||||||
|
<div id = "logo">
|
||||||
|
<img src = "https://placehold.co/200x100" alt = "logo">
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<hr>
|
||||||
|
<nav>
|
||||||
|
<ul>
|
||||||
|
<li><a href = "index.htm">Home</a></li>
|
||||||
|
<li><a href = "about.htm">About</a></li>
|
||||||
|
<li><a href = "portfolio.htm">Portfolio</a></li>
|
||||||
|
<li><a href = "contact.htm">Contact</a></li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
<hr>
|
||||||
|
<!-- static end-->
|
||||||
|
|
||||||
|
<!-- dynamic -->
|
||||||
|
<main>
|
||||||
|
<h1>Homepage</h1>
|
||||||
|
<p>Welcome on our website!</p>
|
||||||
|
</main>
|
||||||
|
<hr>
|
||||||
|
<!-- dynamic end -->
|
||||||
|
|
||||||
|
<!-- dynamic/static -->
|
||||||
|
<aside>
|
||||||
|
<h3>Dates</h3>
|
||||||
|
<time>2011-01-01</time>
|
||||||
|
<p>Open Day</p>
|
||||||
|
</aside>
|
||||||
|
<hr>
|
||||||
|
<!-- dynamic/static end -->
|
||||||
|
|
||||||
|
<!-- static -->
|
||||||
|
<footer>
|
||||||
|
<p>© 2025 MyCompany</p>
|
||||||
|
</footer>
|
||||||
|
<!-- static end -->
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
58
Zweites Jahr/alt/LJ1/website/portfolio.htm
Executable file
58
Zweites Jahr/alt/LJ1/website/portfolio.htm
Executable file
@@ -0,0 +1,58 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>MyCompany | Portfolio</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<!-- static -->
|
||||||
|
<header>
|
||||||
|
<div id = "company">MyCompany</div>
|
||||||
|
<div id = "slogan">My Slogan</div>
|
||||||
|
<div id = "logo">
|
||||||
|
<img src = "https://placehold.co/200x100" alt = "logo">
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<hr>
|
||||||
|
<nav>
|
||||||
|
<ul>
|
||||||
|
<li><a href = "index.htm">Home</a></li>
|
||||||
|
<li><a href = "about.htm">About</a></li>
|
||||||
|
<li><a href = "portfolio.htm">Portfolio</a></li>
|
||||||
|
<li><a href = "contact.htm">Contact</a></li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
<hr>
|
||||||
|
<!-- static end-->
|
||||||
|
|
||||||
|
<!-- dynamic -->
|
||||||
|
<main>
|
||||||
|
<h1>Portfolio</h1>
|
||||||
|
<ul>
|
||||||
|
<li>service</li>
|
||||||
|
<li>consulting</li>
|
||||||
|
<li>training</li>
|
||||||
|
</ul>
|
||||||
|
</main>
|
||||||
|
<hr>
|
||||||
|
<!-- dynamic end -->
|
||||||
|
|
||||||
|
<!-- dynamic/static -->
|
||||||
|
<aside>
|
||||||
|
<h3>Dates</h3>
|
||||||
|
<time>2011-01-01</time>
|
||||||
|
<p>Open Day</p>
|
||||||
|
</aside>
|
||||||
|
<hr>
|
||||||
|
<!-- dynamic/static end -->
|
||||||
|
|
||||||
|
<!-- static -->
|
||||||
|
<footer>
|
||||||
|
<p>© 2025 MyCompany</p>
|
||||||
|
</footer>
|
||||||
|
<!-- static end -->
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
30
Zweites Jahr/alt/LJ1/whitespaces.htm
Executable file
30
Zweites Jahr/alt/LJ1/whitespaces.htm
Executable file
@@ -0,0 +1,30 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>HTML-Grundlagen: Whitespaces</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
Lorem ipsum, dolor sit amet consectetur adipisicing elit.
|
||||||
|
Est veniam illo culpa aliquid,
|
||||||
|
esse fugiat dolorem
|
||||||
|
dignissimos! Viele Leerzeichen: Rem mollitia,
|
||||||
|
Viele leere Zeilen:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
expedita asperiores
|
||||||
|
accusantium reprehenderit Viele Tabs: iusto sint numquam temporibus
|
||||||
|
qui distinctio pariatur!
|
||||||
|
|
||||||
|
Erzwungene Leerzeichen (aber keinen Grund diese anzuwenden): <-- Leerzeichen
|
||||||
|
Erzwungene Zeilenumbrüche:<br><br><br><br><br> (niemals mehrere breaks)
|
||||||
|
Tabs werden mit CSS gestaltet
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
68
Zweites Jahr/alt/data_evaluate.php
Executable file
68
Zweites Jahr/alt/data_evaluate.php
Executable file
@@ -0,0 +1,68 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Document</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<?php
|
||||||
|
ini_set("display_errors", "on");
|
||||||
|
|
||||||
|
// file: data_evaluate.php
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// required fields
|
||||||
|
if( empty($_REQUEST['lastname']) ||
|
||||||
|
empty($_REQUEST['password']) ||
|
||||||
|
empty($_REQUEST['email'])) {
|
||||||
|
echo "<p>All required fields must be filled in</p>";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
// required fields
|
||||||
|
$lastname = $_REQUEST['lastname'];
|
||||||
|
$country = $_REQUEST['country'];
|
||||||
|
$email = $_REQUEST['email'];
|
||||||
|
$favs = $_REQUEST['favs'];
|
||||||
|
|
||||||
|
|
||||||
|
// optional fields
|
||||||
|
$firstname = empty($_REQUEST['firstname']) ? "n.a." : $_REQUEST['firstname'];
|
||||||
|
$dob = empty($_REQUEST['dob']) ? "n.a." : $_REQUEST['dob'];
|
||||||
|
|
||||||
|
|
||||||
|
echo "<h2>Your data:</h2>";
|
||||||
|
echo "<p>";
|
||||||
|
echo "<strong>First Name:</strong> $firstname<br>";
|
||||||
|
echo "<strong>Last Name:</strong> $lastname<br>";
|
||||||
|
echo "<strong>Email:</strong> $email<br>";
|
||||||
|
echo "<strong>Country:</strong> $country<br>";
|
||||||
|
echo "<strong>Date Of Birth:</strong> $dob<br>";
|
||||||
|
echo "<strong>Favorites:</strong><br>";
|
||||||
|
|
||||||
|
if(!empty($_REQUEST["favs"]) && is_array($_REQUEST["favs"])) {
|
||||||
|
echo "<ul>";
|
||||||
|
$favs = $_REQUEST["favs"];
|
||||||
|
foreach($favs as $fav) {
|
||||||
|
echo "<li>$fav</li>";
|
||||||
|
}
|
||||||
|
echo "</ul>";
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo "n.a<br>";
|
||||||
|
/*
|
||||||
|
echo "<pre>";
|
||||||
|
print_r($favs);
|
||||||
|
echo "</pre>";
|
||||||
|
*/
|
||||||
|
//echo "<strong>Favorites:</strong> $favs<br>";
|
||||||
|
echo "</p>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
66
Zweites Jahr/alt/file_handling/file_write.php
Executable file
66
Zweites Jahr/alt/file_handling/file_write.php
Executable file
@@ -0,0 +1,66 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Document</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<form>
|
||||||
|
<div>
|
||||||
|
<label>First Name:
|
||||||
|
<input name = "fn">
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label for = "ln">Last Name:</label>
|
||||||
|
<input id = "ln" name = "ln">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button>Ab damit</button>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
//file: file_write.php
|
||||||
|
$file = "testfile_1.txt";
|
||||||
|
$fp = fopen($file, 'w'); // open file for writing
|
||||||
|
if(!$fp) { // is fp = false?
|
||||||
|
die("Cannot open file!"); // "die" breaks the script
|
||||||
|
}
|
||||||
|
|
||||||
|
// insert one row
|
||||||
|
/*
|
||||||
|
$row = "This is a row\n";
|
||||||
|
if(!fputs($fp, $row)) echo "Error on writing";
|
||||||
|
else echo "writing succesful";
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
// insert from an assoziative array
|
||||||
|
/*
|
||||||
|
$myArray = [
|
||||||
|
"firstname" => "Michael",
|
||||||
|
"lastname" => "Staudt",
|
||||||
|
"email" => "staudt@wvss-mannheim.de"
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach($myArray as $attr => $value) {
|
||||||
|
$row = "$attr: $value\n";
|
||||||
|
fputs($fp, $row);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
// insert from form
|
||||||
|
if(!empty($_REQUEST)) { //submit button clicked
|
||||||
|
$row = "First Name: $_REQUEST[fn] | Last Name: $_REQUEST[ln]\n";
|
||||||
|
fputs($fp, $row);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fclose($fp);
|
||||||
|
?>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
1
Zweites Jahr/alt/file_handling/testfile_1.txt
Executable file
1
Zweites Jahr/alt/file_handling/testfile_1.txt
Executable file
@@ -0,0 +1 @@
|
|||||||
|
First Name: | Last Name:
|
||||||
1
Zweites Jahr/alt/file_handling/testsfile_1.txt
Executable file
1
Zweites Jahr/alt/file_handling/testsfile_1.txt
Executable file
@@ -0,0 +1 @@
|
|||||||
|
This is a rowThis is a rowThis is a rowThis is a rowThis is a row
|
||||||
50
Zweites Jahr/alt/file_handling/validate_date.php
Executable file
50
Zweites Jahr/alt/file_handling/validate_date.php
Executable file
@@ -0,0 +1,50 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Document</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
// validate_date.php
|
||||||
|
|
||||||
|
//ini_set("display_errors", "on");
|
||||||
|
|
||||||
|
// M A I N
|
||||||
|
$date = "29.02.2400";
|
||||||
|
if(isValidDate($date)) echo "<p>Datum $date ist <strong>gültig</strong></p>";
|
||||||
|
else echo "<p>Datum $date ist <strong>ungültig</strong></p>";
|
||||||
|
|
||||||
|
|
||||||
|
// Functions
|
||||||
|
function isLeapYear(int $year): bool {
|
||||||
|
return ($year % 4 == 0 && $year % 100 != 0 || $year % 400 == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
function isValidDate(string $date): bool {
|
||||||
|
$date_parts = ["Tag","Monat", "Jahr"];
|
||||||
|
$date_array = explode(".", $date);
|
||||||
|
|
||||||
|
$days_of_month = [31,28,31,30,31,30,31,31,30,31,30,31];
|
||||||
|
if(isLeapYear($date_array[2])) {
|
||||||
|
$days_of_month[1] = 29;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Monat auf Gültigkeit prüfen
|
||||||
|
if($date_array[1] < 1 || $date_array[1] > 12) return false;
|
||||||
|
|
||||||
|
// Tag auf Gültigkeit prüfen
|
||||||
|
if($date_array[0] < 1 || $date_array[0] > $days_of_month[$date_array[1]-1]) return false;
|
||||||
|
|
||||||
|
// Jahr auf Gültigkeit prüfen
|
||||||
|
if($date_array[2] < 0 || $date_array[2] > 3000) return false;
|
||||||
|
|
||||||
|
// Falls Datum gültig
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
97
Zweites Jahr/alt/formtemplate.htm
Executable file
97
Zweites Jahr/alt/formtemplate.htm
Executable file
@@ -0,0 +1,97 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Form Template</title>
|
||||||
|
<style>
|
||||||
|
html {
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
div.form-row {
|
||||||
|
background: silver;
|
||||||
|
padding: .2rem;
|
||||||
|
margin: .2rem;
|
||||||
|
}
|
||||||
|
label {
|
||||||
|
display: inline-block;
|
||||||
|
width: 7rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
label::after {
|
||||||
|
content: ":";
|
||||||
|
}
|
||||||
|
|
||||||
|
form {
|
||||||
|
border: 1px solid black;
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[required] {
|
||||||
|
background: rgba(31, 225, 232, 0.2);
|
||||||
|
border: 1px solid #003366;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<form action = "data_evaluate.php">
|
||||||
|
|
||||||
|
<div class = "form-row">
|
||||||
|
<label for = "fn">First Name</label>
|
||||||
|
<input id = "ln" name = "firstname" placeholder = "Hans" title = "Please insert your first name here!">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class = "form-row">
|
||||||
|
<label for = "ln">Last Name</label>
|
||||||
|
<input id = "ln" name = "lastname" placeholder = "Mustermann" required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class = "form-row">
|
||||||
|
<label for = "pw">Password</label>
|
||||||
|
<input id = "pw" name = "password" type = "password" required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class = "form-row">
|
||||||
|
<label for = "email">Email</label>
|
||||||
|
<input id = "email" name = "email" type = "email" placeholder = "me@mydomain.com" required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class = "form-row">
|
||||||
|
<label for = "dob">Date of Birth</label>
|
||||||
|
<input id = "dob" name = "dob" type = "date">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class = "form-row">
|
||||||
|
<label for = "country">Country</label>
|
||||||
|
<select id = "country" name = "country">
|
||||||
|
<option>n.a.</option>
|
||||||
|
<option>Germany</option>
|
||||||
|
<option>United States Of America</option>
|
||||||
|
<option>United Kingdom</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class = "form-row">
|
||||||
|
<label for = "favs">Favorits</label>
|
||||||
|
<select id = "favs" name = "favs[]" multiple>
|
||||||
|
<option>web engineering</option>
|
||||||
|
<option>music</option>
|
||||||
|
<option>sports</option>
|
||||||
|
<option>bing watching</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class = "form-row">
|
||||||
|
<button>Go!</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
86
Zweites Jahr/alt/validate_date.php
Executable file
86
Zweites Jahr/alt/validate_date.php
Executable file
@@ -0,0 +1,86 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Document</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
// validate_date.php
|
||||||
|
|
||||||
|
//ini_set("display_errors", "on");
|
||||||
|
|
||||||
|
// M A I N
|
||||||
|
$date = "29.02.2400";
|
||||||
|
if(isValidDate($date)) echo "<p>Datum $date ist <strong>gültig</strong></p>";
|
||||||
|
else echo "<p>Datum $date ist <strong>ungültig</strong></p>";
|
||||||
|
|
||||||
|
|
||||||
|
// Functions
|
||||||
|
function isLeapYear(int $year): bool {
|
||||||
|
return ($year % 4 == 0 && $year % 100 != 0 || $year % 400 == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
function isValidDate(string $date): bool {
|
||||||
|
$date_parts = ["Tag","Monat", "Jahr"];
|
||||||
|
$date_array = explode(".", $date);
|
||||||
|
|
||||||
|
$days_of_month = [31,28,31,30,31,30,31,31,30,31,30,31];
|
||||||
|
if(isLeapYear($date_array[2])) {
|
||||||
|
$days_of_month[1] = 29;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
// geht nicht:
|
||||||
|
echo $date_array;
|
||||||
|
|
||||||
|
// Ausgabe des Arrays zum Debuggen
|
||||||
|
echo "<pre>";
|
||||||
|
print_r($date_array);
|
||||||
|
echo "</pre>";
|
||||||
|
|
||||||
|
// Benutzerfreundliche Ausgabe
|
||||||
|
echo "<p>Tag: $date_array[0]<br>";
|
||||||
|
echo "Monat: $date_array[1]<br>";
|
||||||
|
echo "Jahr: $date_array[2]</p>";
|
||||||
|
|
||||||
|
|
||||||
|
for($i = 0; $i < sizeof($date_array); $i++) {
|
||||||
|
echo "<p>$date_parts[$i]: $date_array[$i]</p>";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
echo "<pre>";
|
||||||
|
print_r($date_array_assoz);
|
||||||
|
echo "</pre>";
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
$date_array_assoz = array_combine($date_parts, $date_array);
|
||||||
|
foreach($date_array_assoz as $datepartkey => $datepartvalue) {
|
||||||
|
echo "<p>$datepartkey: $datepartvalue</p>";
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
// Monat auf Gültigkeit prüfen
|
||||||
|
if($date_array[1] < 1 || $date_array[1] > 12) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tag auf Gültigkeit prüfen
|
||||||
|
if($date_array[0] < 1 || $date_array[0] > $days_of_month[$date_array[1]-1]) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Jahr auf Gültigkeit prüfen
|
||||||
|
if($date_array[2] < 0 || $date_array[2] > 3000) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
157
Zweites Jahr/aufgaben/PDO_Info.html
Executable file
157
Zweites Jahr/aufgaben/PDO_Info.html
Executable file
@@ -0,0 +1,157 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="de">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>PDO SQL Schritte</title>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
font-family: Arial, sans-serif;
|
||||||
|
background-color: #f4f4f4;
|
||||||
|
text-align: center;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 20px;
|
||||||
|
margin-top: 30px;
|
||||||
|
flex-wrap: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.step {
|
||||||
|
background-color: white;
|
||||||
|
padding: 20px;
|
||||||
|
width: 170px;
|
||||||
|
border: 2px solid #ccc;
|
||||||
|
border-radius: 10px;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: 0.3s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.step:hover {
|
||||||
|
background-color: #e5f4ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.info-box {
|
||||||
|
background-color: white;
|
||||||
|
border: 2px solid #ccc;
|
||||||
|
border-radius: 10px;
|
||||||
|
padding: 20px;
|
||||||
|
width: 60%;
|
||||||
|
margin: 40px auto 0 auto;
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.code-snippet {
|
||||||
|
background: #f0f0f0;
|
||||||
|
padding: 10px;
|
||||||
|
border-radius: 8px;
|
||||||
|
text-align: left;
|
||||||
|
white-space: pre-wrap;
|
||||||
|
font-family: monospace;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<h1>PDO - Grundlegende SQL-Kommandos</h1>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
|
||||||
|
<div class="step" data-step="tryCatch">
|
||||||
|
<h2>try catch</h2>
|
||||||
|
<p>besseres finden von Fehlern</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="step" data-step="connect">
|
||||||
|
<h2>PDO verbinden</h2>
|
||||||
|
<p>Datenbank verbinden</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="step" data-step="create">
|
||||||
|
<h2>CREATE TABLE</h2>
|
||||||
|
<p>Tabelle anlegen</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="step" data-step="insert">
|
||||||
|
<h2>INSERT</h2>
|
||||||
|
<p>Daten einfügen</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="step" data-step="select">
|
||||||
|
<h2>SELECT</h2>
|
||||||
|
<p>Daten lesen</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="step" data-step="delete">
|
||||||
|
<h2>DELETE</h2>
|
||||||
|
<p>Daten löschen</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="info-box" class="info-box">
|
||||||
|
<h2 id="info-title"></h2>
|
||||||
|
<p id="info-text"></p>
|
||||||
|
<pre id="code-snippet" class="code-snippet"></pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const steps = {
|
||||||
|
|
||||||
|
tryCatch: {
|
||||||
|
title:"try{}catch{}",
|
||||||
|
desc:"Benutze try und catch um Fehler besser erkennen zu können",
|
||||||
|
code:`try{\n$pdo = new PDO("mysql:host=localhost;dbname=testdb","root","");\n}catch(PDOException $e){\necho $e->getMessage();\n}`
|
||||||
|
},
|
||||||
|
|
||||||
|
connect: {
|
||||||
|
title: "PDO Verbindung",
|
||||||
|
desc: "So stellst du eine einfache Verbindung zu MySQL her.",
|
||||||
|
code: `Wenn die Datenbank bereits existiert:\n\n<?php\n\ &dollarpdo = new PDO("mysql:host=localhost;dbname=testdb", "root", "");\necho "Verbindung erfolgreich!";\n?>\n\nWenn die Datenbank noch nicht exisitert:\n\n<?php\n$pdo = new PDO("mysql:host=localhost", "root", "");\n$pdo->exec("CREATE DATABASE IF NOT EXISTS testdb");\n$pdo = new PDO("mysql:host=localhost;dbname=testdb","root","");\n?>\n?>`
|
||||||
|
},
|
||||||
|
|
||||||
|
create: {
|
||||||
|
title: "CREATE TABLE",
|
||||||
|
desc: "Eine neue Tabelle namens 'users' erstellen.",
|
||||||
|
code: `<?php\n$sql = "CREATE TABLE users (\n id INT AUTO_INCREMENT PRIMARY KEY,\n username VARCHAR(50),\n email VARCHAR(100)\n)";\n$pdo->exec($sql);\necho "Tabelle 'users' wurde erstellt!";\n?>`
|
||||||
|
},
|
||||||
|
|
||||||
|
insert: {
|
||||||
|
title: "INSERT",
|
||||||
|
desc: "Einen Datensatz in die Tabelle einfügen.",
|
||||||
|
code: `<?php\n$sql = "INSERT INTO person VALUES (\n 'value1'\n 'value2';\n .....\n );\n";\n$pdo->exec($sql)\n?>`
|
||||||
|
},
|
||||||
|
|
||||||
|
select: {
|
||||||
|
title: "SELECT",
|
||||||
|
desc: "Daten aus der Tabelle auslesen.",
|
||||||
|
code: `<?php\n$sql = "SELECT * FROM users";\n$result = $pdo->query($sql);\n\n$valuesArray=$values->fetchAll();\necho"<pre>";\nprint_r($valluesArray);\necho"</pre>"; "<br>";\n}\n?>`
|
||||||
|
},
|
||||||
|
|
||||||
|
delete: {
|
||||||
|
title: "DELETE",
|
||||||
|
desc: "Ein Benutzer wird gelöscht (hier: ID = 1).",
|
||||||
|
code: `<?php\n$sql = "DELETE FROM users WHERE id = 1";\n$pdo->exec($sql);\necho "Benutzer mit ID 1 gelöscht!";\n?>`
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
document.querySelectorAll(".step").forEach(box => {
|
||||||
|
box.addEventListener("click", () => {
|
||||||
|
const key = box.dataset.step;
|
||||||
|
|
||||||
|
document.getElementById("info-title").textContent = steps[key].title;
|
||||||
|
document.getElementById("info-text").textContent = steps[key].desc;
|
||||||
|
document.getElementById("code-snippet").textContent = steps[key].code;
|
||||||
|
|
||||||
|
document.getElementById("info-box").style.display = "block";
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
69
Zweites Jahr/aufgaben/csvToXml/convertCSVtoXML.php
Normal file
69
Zweites Jahr/aufgaben/csvToXml/convertCSVtoXML.php
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
<h1>CSV -> XML</h1>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
ini_set("display_errors", 1);
|
||||||
|
|
||||||
|
// DOM struktur
|
||||||
|
/*
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<personen>
|
||||||
|
<nr> </nr>
|
||||||
|
<vorname> </vorname>
|
||||||
|
<nachname> </nachname>
|
||||||
|
</personen
|
||||||
|
*/
|
||||||
|
|
||||||
|
// READ CSV FILE
|
||||||
|
$fileCSV = "e2fi2.csv";
|
||||||
|
if(!file_exists($fileCSV)){
|
||||||
|
die("File $fileCSV doesn't exist or not found!");
|
||||||
|
}
|
||||||
|
|
||||||
|
$fp = @fopen($fileCSV, 'r');
|
||||||
|
if(!$fp){
|
||||||
|
die("Error while opening CSV file!");
|
||||||
|
}
|
||||||
|
$header_array =fgetcsv($fp, 0, ";");
|
||||||
|
|
||||||
|
|
||||||
|
// CREATE XML DOM
|
||||||
|
$xmlDoc = new DOMDocument("1.0", "utf-8");
|
||||||
|
$xmlDoc->formatOutput=true;
|
||||||
|
|
||||||
|
$xmlRoot = $xmlDoc->createElement("data");
|
||||||
|
$xmlDoc->appendChild($xmlRoot);
|
||||||
|
|
||||||
|
|
||||||
|
// FILL XML FILE WITH CSV DATA
|
||||||
|
while(($row_array = fgetcsv($fp, 0, ";")) !== false){
|
||||||
|
// skip emty value
|
||||||
|
if ($row_array === null || $row_array === []) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// create sub elemente
|
||||||
|
$xmlSchueler = $xmlDoc->createElement("schuelerdata");
|
||||||
|
// for the count of elements in a row do this
|
||||||
|
for ($i = 0; $i < count($row_array); $i++){
|
||||||
|
// make sure there is a header to row
|
||||||
|
if (!isset($header_array[$i])){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// get current collumn
|
||||||
|
$column = $header_array[$i];
|
||||||
|
|
||||||
|
// create a new element with name of column and row data
|
||||||
|
$xmlSchuelerDaten = $xmlDoc->createElement($column, $row_array[$i]);
|
||||||
|
$xmlSchueler->appendChild($xmlSchuelerDaten);
|
||||||
|
}
|
||||||
|
// save element
|
||||||
|
$xmlRoot-> appendChild($xmlSchueler);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save whole XML file
|
||||||
|
$fileXML = "e2fi2.xml";
|
||||||
|
$xmlDoc->save(__DIR__ . "/$fileXML");
|
||||||
|
|
||||||
|
echo "CSV FILE ($fileCSV) CONVERTED TO XML ($fileXML) AND SAVED";
|
||||||
19
Zweites Jahr/aufgaben/csvToXml/e2fi2.csv
Normal file
19
Zweites Jahr/aufgaben/csvToXml/e2fi2.csv
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
Nr;Vorname;Nachname
|
||||||
|
1;Noah;Bassmann
|
||||||
|
2;Dawid;Brueller
|
||||||
|
3;Maksim;Dessauer
|
||||||
|
4;Jonas;Gassenhauer
|
||||||
|
5;Klara;Goettinger
|
||||||
|
6;Marc;Hausmueller
|
||||||
|
7;Timo;Heiterberg
|
||||||
|
8;Johannes;Kachelmann
|
||||||
|
9;Konstantin;Matern
|
||||||
|
10;Anna;Manna
|
||||||
|
11;Kamil;Nether
|
||||||
|
12;Tobias;Scholz
|
||||||
|
13;Eric;Schmidt
|
||||||
|
14;Ferdinand;Tetris
|
||||||
|
15;Damien;Tapfer
|
||||||
|
16;Uemit;Toser
|
||||||
|
17;Sebastian;Wenger
|
||||||
|
18;Fabio;Wellenwein
|
||||||
|
93
Zweites Jahr/aufgaben/csvToXml/e2fi2.xml
Normal file
93
Zweites Jahr/aufgaben/csvToXml/e2fi2.xml
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<data>
|
||||||
|
<schuelerdata>
|
||||||
|
<Nr>1</Nr>
|
||||||
|
<Vorname>Noah</Vorname>
|
||||||
|
<Nachname>Bassmann</Nachname>
|
||||||
|
</schuelerdata>
|
||||||
|
<schuelerdata>
|
||||||
|
<Nr>2</Nr>
|
||||||
|
<Vorname>Dawid</Vorname>
|
||||||
|
<Nachname>Brueller</Nachname>
|
||||||
|
</schuelerdata>
|
||||||
|
<schuelerdata>
|
||||||
|
<Nr>3</Nr>
|
||||||
|
<Vorname>Maksim</Vorname>
|
||||||
|
<Nachname>Dessauer</Nachname>
|
||||||
|
</schuelerdata>
|
||||||
|
<schuelerdata>
|
||||||
|
<Nr>4</Nr>
|
||||||
|
<Vorname>Jonas</Vorname>
|
||||||
|
<Nachname>Gassenhauer</Nachname>
|
||||||
|
</schuelerdata>
|
||||||
|
<schuelerdata>
|
||||||
|
<Nr>5</Nr>
|
||||||
|
<Vorname>Klara</Vorname>
|
||||||
|
<Nachname>Goettinger</Nachname>
|
||||||
|
</schuelerdata>
|
||||||
|
<schuelerdata>
|
||||||
|
<Nr>6</Nr>
|
||||||
|
<Vorname>Marc</Vorname>
|
||||||
|
<Nachname>Hausmueller</Nachname>
|
||||||
|
</schuelerdata>
|
||||||
|
<schuelerdata>
|
||||||
|
<Nr>7</Nr>
|
||||||
|
<Vorname>Timo</Vorname>
|
||||||
|
<Nachname>Heiterberg</Nachname>
|
||||||
|
</schuelerdata>
|
||||||
|
<schuelerdata>
|
||||||
|
<Nr>8</Nr>
|
||||||
|
<Vorname>Johannes</Vorname>
|
||||||
|
<Nachname>Kachelmann</Nachname>
|
||||||
|
</schuelerdata>
|
||||||
|
<schuelerdata>
|
||||||
|
<Nr>9</Nr>
|
||||||
|
<Vorname>Konstantin</Vorname>
|
||||||
|
<Nachname>Matern</Nachname>
|
||||||
|
</schuelerdata>
|
||||||
|
<schuelerdata>
|
||||||
|
<Nr>10</Nr>
|
||||||
|
<Vorname>Anna</Vorname>
|
||||||
|
<Nachname>Manna</Nachname>
|
||||||
|
</schuelerdata>
|
||||||
|
<schuelerdata>
|
||||||
|
<Nr>11</Nr>
|
||||||
|
<Vorname>Kamil</Vorname>
|
||||||
|
<Nachname>Nether</Nachname>
|
||||||
|
</schuelerdata>
|
||||||
|
<schuelerdata>
|
||||||
|
<Nr>12</Nr>
|
||||||
|
<Vorname>Tobias</Vorname>
|
||||||
|
<Nachname>Scholz</Nachname>
|
||||||
|
</schuelerdata>
|
||||||
|
<schuelerdata>
|
||||||
|
<Nr>13</Nr>
|
||||||
|
<Vorname>Eric</Vorname>
|
||||||
|
<Nachname>Schmidt</Nachname>
|
||||||
|
</schuelerdata>
|
||||||
|
<schuelerdata>
|
||||||
|
<Nr>14</Nr>
|
||||||
|
<Vorname>Ferdinand</Vorname>
|
||||||
|
<Nachname>Tetris</Nachname>
|
||||||
|
</schuelerdata>
|
||||||
|
<schuelerdata>
|
||||||
|
<Nr>15</Nr>
|
||||||
|
<Vorname>Damien</Vorname>
|
||||||
|
<Nachname>Tapfer</Nachname>
|
||||||
|
</schuelerdata>
|
||||||
|
<schuelerdata>
|
||||||
|
<Nr>16</Nr>
|
||||||
|
<Vorname>Uemit</Vorname>
|
||||||
|
<Nachname>Toser</Nachname>
|
||||||
|
</schuelerdata>
|
||||||
|
<schuelerdata>
|
||||||
|
<Nr>17</Nr>
|
||||||
|
<Vorname>Sebastian</Vorname>
|
||||||
|
<Nachname>Wenger</Nachname>
|
||||||
|
</schuelerdata>
|
||||||
|
<schuelerdata>
|
||||||
|
<Nr>18</Nr>
|
||||||
|
<Vorname>Fabio</Vorname>
|
||||||
|
<Nachname>Wellenwein</Nachname>
|
||||||
|
</schuelerdata>
|
||||||
|
</data>
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
SELECT book.bibNr, book.titel, COUNT(book.bibNr) AS ausleihAnzahl
|
||||||
|
FROM buch as book
|
||||||
|
LEFT JOIN Ausleihe as rent ON book.bibNr = rent.bibNr
|
||||||
|
AND YEAR(rent.ausleihdatum) = 2015
|
||||||
|
GROUP BY book.bibNr, book.titel
|
||||||
|
ORDER BY ausleihAnzahl ASC
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
SELECT bibNr, COUNT(*) AS orderAnzahl
|
||||||
|
FROM Ausleihe
|
||||||
|
GROUP BY bibNr
|
||||||
|
HAVING COUNT(*) > 10;
|
||||||
61
Zweites Jahr/aufgaben/saveLibaryDataInXml/task.md
Normal file
61
Zweites Jahr/aufgaben/saveLibaryDataInXml/task.md
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
# 2.2 XML
|
||||||
|
|
||||||
|
## 2.2.1
|
||||||
|
|
||||||
|
- Namen sind klar und deutlich
|
||||||
|
- inhaltlich korrekt geordnet
|
||||||
|
|
||||||
|
## 2.2.2
|
||||||
|
|
||||||
|
````xml
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<data>
|
||||||
|
<buch>
|
||||||
|
<bibNr> </bibNr>
|
||||||
|
<title> </title>
|
||||||
|
<zustand> </zustand>
|
||||||
|
<seitenanzahl> </seitenanzahl>
|
||||||
|
</buch>
|
||||||
|
<avmedium>
|
||||||
|
<bibNr> </bibNr>
|
||||||
|
<title> </title>
|
||||||
|
<zustand> </zustand>
|
||||||
|
<dauer> </dauer>
|
||||||
|
</avmedium>
|
||||||
|
</data>
|
||||||
|
````
|
||||||
|
|
||||||
|
### 2.3 SQL
|
||||||
|
|
||||||
|
## 2.3.1
|
||||||
|
### Meine Lösung
|
||||||
|
```sql
|
||||||
|
SELECT book.bibNr, book.titel, COUNT(book.bibNr) AS wieOftAusgeliehen
|
||||||
|
FROM buch AS book
|
||||||
|
LEFT JOIN Ausleihe AS rent ON book.bibNr = rent.bibNr
|
||||||
|
AND YEAR(rent.ausleihdatum) = 2015
|
||||||
|
GROUP BY book.bibNr, book.titel
|
||||||
|
ORDER BY wieOftAusgeliehen ASC
|
||||||
|
```
|
||||||
|
### Lösung des Lehrers
|
||||||
|
```sql
|
||||||
|
SELECT a.bibNr, b.titel, COUNT(*) AS wieOftAusgeliehen
|
||||||
|
FROM Ausleihe, Buch
|
||||||
|
WHERE AUsleihe.bibNr=Buch.bibNr
|
||||||
|
WHERE Aulsiehe.ausleihdatum BETWEEN "2015-01-01" AND "2015-12-32"
|
||||||
|
GROUP BY bibNr, titel
|
||||||
|
ORDER BY COUNT(*) DESC;
|
||||||
|
```
|
||||||
|
|
||||||
|
## 2.3.2
|
||||||
|
|
||||||
|
```sql
|
||||||
|
SELECT bibNr, COUNT(*) AS orderAnzahl
|
||||||
|
FROM Ausleihe
|
||||||
|
GROUP BY bibNr
|
||||||
|
HAVING COUNT(*) > 10; -- HAVING bei solchen funktionen
|
||||||
|
```
|
||||||
|
|
||||||
|
## 2.3.3
|
||||||
|
|
||||||
|
Gute Frage, frag chatgpt!
|
||||||
27
Zweites Jahr/aus_anderen_Faechern/subnetze.md
Normal file
27
Zweites Jahr/aus_anderen_Faechern/subnetze.md
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
Sufix - Maske - Max IPs
|
||||||
|
|
||||||
|
/29 - / - 8
|
||||||
|
/28 - / - 16
|
||||||
|
/27 - / - 32
|
||||||
|
/26 - / - 64
|
||||||
|
/25 - 255.255.255.128 - 128
|
||||||
|
/24 - 255.255.255.0 - 255
|
||||||
|
/23 - 255.255.254.0 - 511
|
||||||
|
/22 - 255.255.252.0 - 1024
|
||||||
|
/21 - 255.255.248.0 - 2048
|
||||||
|
/20
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
bsp. /21 -> 21x 1
|
||||||
|
|
||||||
|
Dez - Binär - Anzahl 1
|
||||||
|
255 - 1111 1111 - 8
|
||||||
|
255 - 1111 1111 - 8
|
||||||
|
248 - 1111 1000 - 5
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
128|64|32|16 | 8|4|2|1
|
||||||
|
|
||||||
59
Zweites Jahr/aus_anderen_Faechern/vlsm_übung.md
Normal file
59
Zweites Jahr/aus_anderen_Faechern/vlsm_übung.md
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
# VLSM Übung
|
||||||
|
## Übung 1
|
||||||
|
|
||||||
|
Netz: 10.10.32.0/20
|
||||||
|
|
||||||
|
Netze zu erstellen:
|
||||||
|
|
||||||
|
A - 1022 /22
|
||||||
|
B - 400 /23
|
||||||
|
C - 63 /25
|
||||||
|
D - 12 /28
|
||||||
|
|
||||||
|
Sonstige Anweisungen
|
||||||
|
|
||||||
|
Nach größe Sortieren
|
||||||
|
|
||||||
|
### Netz A:
|
||||||
|
10.10.32.0/21 - 10.10.39.255
|
||||||
|
|
||||||
|
Subnetsmaske:
|
||||||
|
255.255.248.0
|
||||||
|
|
||||||
|
|
||||||
|
#### Rechnung
|
||||||
|
|
||||||
|
Subnetzmaske:
|
||||||
|
Address in Binär
|
||||||
|
0000 1010 . 0000 1010 . 0010 0000 . 0000 0000
|
||||||
|
Letzte Adresse (in Binär & Normal)
|
||||||
|
0000 1010 . 0000 1010 . 0010 0111 . 1111 1111
|
||||||
|
10.10.39.255
|
||||||
|
Subnetmaske in Binär
|
||||||
|
1111 1111 . 1111 1111 . 1111 1000 . 0000 0000
|
||||||
|
|
||||||
|
|
||||||
|
### Netz B:
|
||||||
|
10.10.40.0/23 - 10.10.41.255
|
||||||
|
255.255.254.0
|
||||||
|
|
||||||
|
### Netz C:
|
||||||
|
10.10.42.0/25 - 10.10.42.127
|
||||||
|
|
||||||
|
255.255.255. 1000 0000 -> 128
|
||||||
|
10.10.42. 0111 1111 -> 127
|
||||||
|
|
||||||
|
### Netz D:
|
||||||
|
|
||||||
|
10.10.42.128/28 - 10.10.42.143
|
||||||
|
255.255.255. 1111 0000 -> 240 (Subnetzmaske)
|
||||||
|
10.10.42. 1000 1111 (Bis IP)
|
||||||
|
|
||||||
|
> Info zur Bis IP
|
||||||
|
> Alle 1 wurden zu 0 und alle 0 wurden zu 1 aber
|
||||||
|
> nicht in der 4 Gruppe sondern nun in der 8 Gruppe
|
||||||
|
|
||||||
|
Vergleich Von - Bis (Binär)
|
||||||
|
10.10.42.
|
||||||
|
0000 1010 . 0000 1010 . 0010 1010 . 0111 1111
|
||||||
|
0000 1010 . 0000 1010 . 0010 1010 . 1000 1111
|
||||||
48
Zweites Jahr/csv/file_read.php
Normal file
48
Zweites Jahr/csv/file_read.php
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Filehandling: file read</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$file = "person.csv";
|
||||||
|
if(!file_exists($file)){
|
||||||
|
die("File $file doesn't exist or not found!");
|
||||||
|
// Beende das Skript
|
||||||
|
}
|
||||||
|
|
||||||
|
$fp = @fopen($file, 'r'); // Datei zum lesen öffnen, @ macht das der system error in system_error_1.txt
|
||||||
|
if(!$fp){
|
||||||
|
die("Error while opening file!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Kopfzeile auslesen und in Array umwandeln (1x -> Pointer geht auf Zeile 2)
|
||||||
|
$header_array = fgetcsv($fp);
|
||||||
|
/* Umständlich
|
||||||
|
$header = fgetcsv($fp);
|
||||||
|
$header_array = explode(",", $header);
|
||||||
|
*/
|
||||||
|
|
||||||
|
$yo = print_r($header_array);
|
||||||
|
echo "<pre> $yo </pre>";
|
||||||
|
|
||||||
|
// Äußere Schleife: Zeile auslesen
|
||||||
|
while(!feof($fp)){ // solange nicht das Ende der Datei erreicht ist
|
||||||
|
$row_array = fgetcsv($fp);
|
||||||
|
/* $yo2 = print_r($header_array);
|
||||||
|
echo "<pre> $yo2 </pre>";*/
|
||||||
|
|
||||||
|
// Inner Schleife: Spalten ausgeben
|
||||||
|
for ($i = 0; $i < count($row_array); $i++){
|
||||||
|
echo "$header_array[$i]: $row_array[$i]<br>";
|
||||||
|
}
|
||||||
|
echo "<p> -------------------------------- </p>";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
5
Zweites Jahr/csv/person.csv
Executable file
5
Zweites Jahr/csv/person.csv
Executable file
@@ -0,0 +1,5 @@
|
|||||||
|
ID,Vorname,Nachname,E-Mail,Telefon
|
||||||
|
1,Max,Müller,max.mueller@example.com,0151-1234567
|
||||||
|
2,Anna,Schmidt,anna.schmidt@example.com,0172-9876543
|
||||||
|
3,Peter,Fischer,peter.fischer@example.com,0160-5555555
|
||||||
|
4,Sara,Becker,sara.becker@example.com,0157-7654321
|
||||||
|
25
Zweites Jahr/log_access/access_log.txt
Executable file
25
Zweites Jahr/log_access/access_log.txt
Executable file
@@ -0,0 +1,25 @@
|
|||||||
|
Count | Date | IP
|
||||||
|
1 | Wed, 19 Nov 2025 14:15:24 +0100 | 127.0.0.1
|
||||||
|
1 | Wed, 19 Nov 2025 14:15:26 +0100 | 127.0.0.1
|
||||||
|
2 | Wed, 19 Nov 2025 14:15:26 +0100 | 127.0.0.1
|
||||||
|
3 | Wed, 19 Nov 2025 14:15:26 +0100 | 127.0.0.1
|
||||||
|
4 | Wed, 19 Nov 2025 14:15:27 +0100 | 127.0.0.1
|
||||||
|
5 | Wed, 19 Nov 2025 14:15:27 +0100 | 127.0.0.1
|
||||||
|
6 | Wed, 19 Nov 2025 14:15:27 +0100 | 127.0.0.1
|
||||||
|
7 | Wed, 19 Nov 2025 14:15:27 +0100 | 127.0.0.1
|
||||||
|
8 | Wed, 19 Nov 2025 14:15:27 +0100 | 127.0.0.1
|
||||||
|
9 | Wed, 19 Nov 2025 14:15:27 +0100 | 127.0.0.1
|
||||||
|
10 | Wed, 19 Nov 2025 14:15:28 +0100 | 127.0.0.1
|
||||||
|
11 | Wed, 19 Nov 2025 14:15:28 +0100 | 127.0.0.1
|
||||||
|
12 | Wed, 19 Nov 2025 14:15:28 +0100 | 127.0.0.1
|
||||||
|
13 | Wed, 19 Nov 2025 14:15:28 +0100 | 127.0.0.1
|
||||||
|
14 | Wed, 19 Nov 2025 14:15:29 +0100 | 127.0.0.1
|
||||||
|
15 | Wed, 19 Nov 2025 14:15:29 +0100 | 127.0.0.1
|
||||||
|
16 | Wed, 19 Nov 2025 14:15:29 +0100 | 127.0.0.1
|
||||||
|
17 | Wed, 19 Nov 2025 14:15:29 +0100 | 127.0.0.1
|
||||||
|
18 | Wed, 19 Nov 2025 14:15:29 +0100 | 127.0.0.1
|
||||||
|
19 | Wed, 19 Nov 2025 14:15:30 +0100 | 127.0.0.1
|
||||||
|
20 | Wed, 19 Nov 2025 14:15:30 +0100 | 127.0.0.1
|
||||||
|
21 | Wed, 19 Nov 2025 14:15:30 +0100 | 127.0.0.1
|
||||||
|
22 | Wed, 19 Nov 2025 14:15:30 +0100 | 127.0.0.1
|
||||||
|
23 | Wed, 19 Nov 2025 14:15:30 +0100 | 127.0.0.1
|
||||||
54
Zweites Jahr/log_access/log_access.php
Normal file
54
Zweites Jahr/log_access/log_access.php
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Document</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
|
||||||
|
<?php
|
||||||
|
/*
|
||||||
|
|
||||||
|
Arbeitsauftrag:
|
||||||
|
Erstellen Sie ein PHP-Skript namens „log_access.php”, das jeden Aufruf der Seite in der Textdatei „access_log.txt” speichert.
|
||||||
|
Beim Aufruf der Seite soll das Skript das aktuelle Datum und die aktuelle Uhrzeit erfassen.
|
||||||
|
- das aktuelle Datum und die aktuelle Uhrzeit erfassen.
|
||||||
|
- die IP-Adresse des Clients ermitteln (Tipp: $_SERVER)
|
||||||
|
- diese Informationen in die Datei access_log.txt im selben Verzeichnis schreiben.
|
||||||
|
|
||||||
|
Bonus:
|
||||||
|
Geben Sie im Browser zusätzlich an, wie viele Zugriffe insgesamt schon protokolliert wurden.
|
||||||
|
Tipp: Schauen Sie sich die Funktionen file() und readfile() an oder nutzen Sie fread() wie bisher.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
$now = date(DATE_RFC2822, time()); // current time
|
||||||
|
$userIP = $_SERVER['REMOTE_ADDR'] ; // users ip
|
||||||
|
|
||||||
|
$file = "access_log.txt";
|
||||||
|
$fp = fopen($file, 'r') or die ("Cannot open file"); // open file for writing
|
||||||
|
|
||||||
|
if (countLines($file) < 2) {
|
||||||
|
$txt = "Count | Date | IP\n";
|
||||||
|
fwrite($fp, $txt);
|
||||||
|
$count = countLines($file);
|
||||||
|
$txt = "$count | $now | $userIP\n";
|
||||||
|
fwrite($fp, $txt);
|
||||||
|
echo countLines($file) -1;
|
||||||
|
} else {
|
||||||
|
$count = countLines($file) - 1;
|
||||||
|
$txt = "$count | $now | $userIP\n";
|
||||||
|
fwrite($fp, $txt);
|
||||||
|
echo countLines($file) - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
function countLines($currentFile){
|
||||||
|
return count(file($currentFile));
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose($fp);
|
||||||
26
Zweites Jahr/modulo.php
Normal file
26
Zweites Jahr/modulo.php
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$ergebnis = (int)(7/2);
|
||||||
|
echo $ergebnis."<br>";
|
||||||
|
|
||||||
|
$ergebnis = 7%3;
|
||||||
|
echo "Restwert: ".$ergebnis."<br>";
|
||||||
|
|
||||||
|
// Ist ZAhl gerade?
|
||||||
|
|
||||||
|
$zahl = 5;
|
||||||
|
|
||||||
|
if($zahl % 2 == 0)echo "$zahl is gerade.<br>";
|
||||||
|
else echo "$zahl ist ungerade.<br>";
|
||||||
|
|
||||||
|
// LEtze Zahl einer ZAhl ermitteln
|
||||||
|
|
||||||
|
$zahl = 123;
|
||||||
|
|
||||||
|
echo $zahl % 10; // In Zahl steht 3 wenn $zahl%=3
|
||||||
|
|
||||||
|
echo "<br>".$zahl."<br>";
|
||||||
|
|
||||||
|
echo (int)($zahl/10); // 123 -> 12
|
||||||
25
Zweites Jahr/pdo_a2-a4_create-db.php
Normal file
25
Zweites Jahr/pdo_a2-a4_create-db.php
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
// USERNAME, password
|
||||||
|
//$pdo = new PDO("mysql:host=localhost", "phpmyadmin", "server");
|
||||||
|
$pdo = new PDO("mysql:host=localhost;dbname=person","phpmyadmin","server");
|
||||||
|
|
||||||
|
|
||||||
|
$createTable= 'CREATE TABLE IF NOT EXISTS schueler(
|
||||||
|
id INTEGER AUTO_INCREMENT PRIMARY KEY, -- zahl, wird automatisch ausgefüllt
|
||||||
|
frstName VARCHAR(255) NOT NULL,
|
||||||
|
lastName VARCHAR(255) NOT NULL
|
||||||
|
);';
|
||||||
|
|
||||||
|
$pdo->exec($createTable);
|
||||||
|
echo 'TABELLE ERSTELLT <br>';
|
||||||
|
|
||||||
|
$createUser ='INSERT INTO schueler VALUES(
|
||||||
|
null, -- null da "AUTO_INCREMENT" gestzt wurde
|
||||||
|
"Schüler Vorname",
|
||||||
|
"Schüler Nachname"
|
||||||
|
)';
|
||||||
|
|
||||||
|
$pdo->exec($createUser);
|
||||||
|
echo 'NUTZER ERSTELLT <br>';
|
||||||
|
|
||||||
|
?>
|
||||||
22
Zweites Jahr/pdo_a5.php
Normal file
22
Zweites Jahr/pdo_a5.php
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
// USERNAME, password
|
||||||
|
//$pdo = new PDO("mysql:host=localhost", "phpmyadmin", "server");
|
||||||
|
$pdo = new PDO("mysql:host=localhost;dbname=person","phpmyadmin","server");
|
||||||
|
|
||||||
|
|
||||||
|
$selectAll= 'SELECT * FROM schueler;';
|
||||||
|
|
||||||
|
$allValues = $pdo->query($selectAll);
|
||||||
|
// $query -> gibt was aus
|
||||||
|
// $exec -> gibt nix aus
|
||||||
|
|
||||||
|
echo "<pre>";
|
||||||
|
print_r($allValues->fetchAll());
|
||||||
|
echo "</pre>";
|
||||||
|
echo 'Alle einträge: <br>';
|
||||||
|
|
||||||
|
foreach($allValues as $value){
|
||||||
|
echo $value["id"]."|".$value['frstName']."|".$value['lastName']."<br>";
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
BIN
Zweites Jahr/skipass/AB_Skipass.pdf
Executable file
BIN
Zweites Jahr/skipass/AB_Skipass.pdf
Executable file
Binary file not shown.
16
Zweites Jahr/skipass/LogSkipass.txt
Executable file
16
Zweites Jahr/skipass/LogSkipass.txt
Executable file
@@ -0,0 +1,16 @@
|
|||||||
|
Jan 09 2016|09:15:17|30201|1|SL02|650
|
||||||
|
Jan 09 2016|09:15:18|43097|1|SL01|945
|
||||||
|
Jan 09 2016|09:15:19|28774|2|SB03|1389
|
||||||
|
Jan 09 2016|09:16:21|00788|1|SL02|650
|
||||||
|
Jan 09 2016|09:17:25|03361|3|SL01|945
|
||||||
|
Jan 09 2016|09:17:33|08385|1|SL02|650
|
||||||
|
Jan 09 2016|09:18:43|10234|1|SL01|945
|
||||||
|
Jan 09 2016|09:21:55|00788|1|SL02|650
|
||||||
|
Jan 09 2016|09:24:43|03361|3|SB03|1389
|
||||||
|
Jan 09 2016|09:26:01|30201|1|SB03|1389
|
||||||
|
Jan 09 2016|09:26:21|28774|2|SL02|650
|
||||||
|
Jan 09 2016|09:26:25|00788|1|SL02|650
|
||||||
|
Jan 09 2016|09:27:21|28774|2|SL02|650
|
||||||
|
Jan 09 2016|09:29:32|30201|1|SL01|945
|
||||||
|
Jan 09 2016|09:30:12|34032|1|SB03|1389
|
||||||
|
Jan 09 2016|09:30:15|08767|3|SL02|650
|
||||||
59
Zweites Jahr/skipass/skipass.php
Normal file
59
Zweites Jahr/skipass/skipass.php
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Document</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
$now = date(DATE_RFC2822, time()); // current time
|
||||||
|
$userIP = $_SERVER['REMOTE_ADDR'] ; // users ip
|
||||||
|
|
||||||
|
$file = "access_log.txt";
|
||||||
|
$fp = fopen($file, 'a') or die ("Cannot open file"); // open file for writing
|
||||||
|
|
||||||
|
if (countLines($file) < 2) {
|
||||||
|
$txt = "Count | Date | IP\n";
|
||||||
|
fwrite($fp, $txt);
|
||||||
|
$count = countLines($file);
|
||||||
|
$txt = "$count | $now | $userIP\n";
|
||||||
|
fwrite($fp, $txt);
|
||||||
|
echo countLines($file) -1;
|
||||||
|
} else {
|
||||||
|
$count = countLines($file) - 1;
|
||||||
|
$txt = "$count | $now | $userIP\n";
|
||||||
|
fwrite($fp, $txt);
|
||||||
|
echo countLines($file) - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
function countLines($currentFile){
|
||||||
|
return count(file($currentFile));
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose($fp);
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
function getLiftLength(string $dataName,int $passID):int {
|
||||||
|
$file = "LogSkipass.txt";
|
||||||
|
$fp = file(fopen($file, 'a')or die($result = 0)); // file opened and made to an array
|
||||||
|
|
||||||
|
foreach ($fp as $line) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
62
Zweites Jahr/uebung_konto/konto.class.php
Normal file
62
Zweites Jahr/uebung_konto/konto.class.php
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
class Konto{
|
||||||
|
|
||||||
|
// Attribute
|
||||||
|
private string $iban;
|
||||||
|
private string $kontoInhaber;
|
||||||
|
private float $kontoStand;
|
||||||
|
private float $dispoRahmen;
|
||||||
|
|
||||||
|
// Kontruktor
|
||||||
|
public function __construct(string $cIban, string $cInhaber, float $cdispo) {
|
||||||
|
$this->iban = $cIban;
|
||||||
|
$this->kontoInhaber = $cInhaber;
|
||||||
|
$this->dispoRahmen = $cdispo;
|
||||||
|
$this->kontoStand = 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// SETTER
|
||||||
|
public function setDispoRahmen(float $sDispo){
|
||||||
|
$this->dispoRahmen = $sDispo;
|
||||||
|
}
|
||||||
|
|
||||||
|
// GETTER
|
||||||
|
public function getIban():string {
|
||||||
|
return $this->iban;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getKontoInhaber():string {
|
||||||
|
return $this->kontoInhaber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDispoRahmen():string {
|
||||||
|
return $this->dispoRahmen;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Methoden
|
||||||
|
|
||||||
|
public function einzahlen(float $betrag){
|
||||||
|
$this->kontoStand += $betrag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function auszahlen(float $betrag) {
|
||||||
|
if ($betrag >= $this->kontoStand){
|
||||||
|
$this->kontoStand -= $betrag;
|
||||||
|
} else if ($betrag >= $this->dispoRahmen){
|
||||||
|
$this->dispoRahmen -= $betrag;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function ausgeben(){
|
||||||
|
echo "<h1> Kontodaten: </h1>";
|
||||||
|
echo "<p><strong>IBAN:</strong> $this->iban</p>";
|
||||||
|
echo "<p><strong>Kontoinhaber:</strong> $this->kontoInhaber</p>";
|
||||||
|
echo "<p><strong>Disporahmen:</strong> $this->dispoRahmen</p>";
|
||||||
|
echo "<p><strong>Kontostand:</strong> $this->kontoStand</p>";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
10
Zweites Jahr/uebung_konto/konto.php
Normal file
10
Zweites Jahr/uebung_konto/konto.php
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<h1>Übung: Konto</h1>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once("konto.class.php");
|
||||||
|
|
||||||
|
$bank = new Konto("DE2498276498237", "Michael Staudt", 1000);
|
||||||
|
$bank->einzahlen(1000);
|
||||||
|
$bank->ausgeben();
|
||||||
|
|
||||||
|
?>
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
// db_connection_data.php
|
||||||
|
|
||||||
|
|
||||||
|
$db_engine ="mysql";
|
||||||
|
$db_name = "E2FI1_2025";
|
||||||
|
$db_host = "localhost";
|
||||||
|
$db_user = "phpmyadmin";
|
||||||
|
$db_password = "server";
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
// db_connection_function.php
|
||||||
|
|
||||||
|
function db_connect(){
|
||||||
|
require_once("db_connection_data.php");
|
||||||
|
// db_server = "mysql:dbname=testdb;host:localhost";
|
||||||
|
$db_server = "$db_engine:dbname=$db_name;host=$db_host";
|
||||||
|
try {
|
||||||
|
$dbh = new PDO ($db_server, $db_user, $db_password);
|
||||||
|
echo "<p>DB Connection succesfull established!</p>";
|
||||||
|
return $dbh;
|
||||||
|
} catch (PDOException $e){
|
||||||
|
//echo "Could not connect to DB!<br> ";
|
||||||
|
die("More:".$e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Test:
|
||||||
|
// db_connect();
|
||||||
121
Zweites Jahr/unterrichts_projekt/pdo_test.php
Normal file
121
Zweites Jahr/unterrichts_projekt/pdo_test.php
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>PDO >> TEST <<</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<?php
|
||||||
|
// pdo_test.php
|
||||||
|
// holt sich den code aus der datei
|
||||||
|
require_once "inc/db_connection_function.php";
|
||||||
|
|
||||||
|
// etsablish db connect
|
||||||
|
// verbindet sich mit der datenbank
|
||||||
|
$dbh = db_connect();
|
||||||
|
|
||||||
|
// get data from fields:
|
||||||
|
$u_firstname = $_REQUEST['firstname'];
|
||||||
|
$u_lastname = $_REQUEST['lastname'];
|
||||||
|
$u_email = $_REQUEST['email'];
|
||||||
|
|
||||||
|
// definiert den SQL befehl um
|
||||||
|
// einen Nutzer korrekt in der DB anzulegen
|
||||||
|
$addUser="INSERT INTO user VALUES(
|
||||||
|
NULL,
|
||||||
|
'$u_firstname',
|
||||||
|
'$u_lastname',
|
||||||
|
'$u_email'
|
||||||
|
)";
|
||||||
|
|
||||||
|
// Versucht code auszufügen (try{...}) wenn das fehlschlägt
|
||||||
|
// nimmt er sich den error und es wird anderer code ausgeführt
|
||||||
|
// (catch(...){...})
|
||||||
|
try {
|
||||||
|
// führe befehl aus
|
||||||
|
$dbh->exec($addUser);
|
||||||
|
// gib aus das der user erstellt wurde
|
||||||
|
echo "USER CREATED";
|
||||||
|
// kein error also null
|
||||||
|
$custErrMsg = NULL;
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
// weise error nachricht var zu
|
||||||
|
$errMsg = $e->getMessage();
|
||||||
|
// weise error code var zu
|
||||||
|
$errCode = $e->getCode();
|
||||||
|
//echo "ERROR: user could not created. try again later";
|
||||||
|
//echo "<br> Error Message: $errMsg";
|
||||||
|
//echo "<br> Error-Code: $errCode";
|
||||||
|
|
||||||
|
switch ($errCode) {
|
||||||
|
case "23000": $custErrMsg = "<p>Email-Adress already exists</p>"; break;
|
||||||
|
default: $custErrMsg = "<p>Oooooops, something went wrong!</p>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
echo $custErrMsg;
|
||||||
|
|
||||||
|
// ####################################
|
||||||
|
// read records from db
|
||||||
|
|
||||||
|
// result consists of multiple rows and columns
|
||||||
|
|
||||||
|
// wähle * (alles) aus 'user' (tabelle)
|
||||||
|
$readUser = "SELECT * FROM user";
|
||||||
|
|
||||||
|
/*speicher das ergebnis in der variable,
|
||||||
|
// führe den SQL befehl aus und wandle
|
||||||
|
// das ergebnis in einen array um.
|
||||||
|
// resultReadUser = $dbh->query($readUser)->fetchAll();
|
||||||
|
$dbh->exec($readUser);
|
||||||
|
|
||||||
|
echo "<pre>";
|
||||||
|
print_r($resultReadUser);
|
||||||
|
echo "</pre>";
|
||||||
|
|
||||||
|
ODER
|
||||||
|
|
||||||
|
// speicher das ergebnis in der variable,
|
||||||
|
// führe den SQL befehl aus
|
||||||
|
*/
|
||||||
|
$resultReadUser = $dbh->query($readUser);
|
||||||
|
|
||||||
|
// gebe alles aus dem array aus
|
||||||
|
echo "ID | VORNAME | NACHNAME | MAIL<br>";
|
||||||
|
foreach($resultReadUser as $row) {
|
||||||
|
echo "$row[0] | $row[1] | $row[2] | $row[3]<br>";
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---
|
||||||
|
// result consists of one row and multiple columns
|
||||||
|
// gibt eine spalte
|
||||||
|
$UserID = 1;
|
||||||
|
$getUserById = "SELECT * FROM user WHERE u_id = $UserID";
|
||||||
|
$resultGetUserById = $dbh->query($getUserById)->fetch();
|
||||||
|
echo "<pre>";
|
||||||
|
print_r($resultGetUserById);
|
||||||
|
echo "</pre>";
|
||||||
|
|
||||||
|
echo "<p>Search User ID $UserID:</p>";
|
||||||
|
if($resultGetUserById){
|
||||||
|
echo "<p>User found: {$resultGetUserById['u_firstname']} {$resultGetUserById['u_lastname']}</p>";
|
||||||
|
} else {
|
||||||
|
echo "<p>No User found</p>";
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---
|
||||||
|
// result represents one cell
|
||||||
|
// gibt eine zelle zurück
|
||||||
|
$getFirstnameByUserId = "SELECT u_firstname FROM user WHERE u_id = $UserID ";
|
||||||
|
$resultFristnameByUserId = $dbh->query($getFirstnameByUserId)->fetchColumn();
|
||||||
|
|
||||||
|
echo "<p>Search Firstname of User ID $UserID:</p>";
|
||||||
|
if($resultFristnameByUserId){
|
||||||
|
echo "<p>Firstname of User found: $resultFristnameByUserId</p>";
|
||||||
|
} else {
|
||||||
|
echo "<p>No User found</p>";
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
24
Zweites Jahr/unterrichts_projekt/pdo_test_form.php
Normal file
24
Zweites Jahr/unterrichts_projekt/pdo_test_form.php
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Document</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>PDO Testset</h1>
|
||||||
|
<h2>Entry Form</h2>
|
||||||
|
<p>Please insert your data and press 'save'</p>
|
||||||
|
<form action = "pdo_test.php">
|
||||||
|
<label>Firstname:
|
||||||
|
<input name = "firstname">
|
||||||
|
</label><br>
|
||||||
|
<label>Lastname:
|
||||||
|
<input name = "lastname">
|
||||||
|
</label><br>
|
||||||
|
<label>Email:
|
||||||
|
<input name = "email">
|
||||||
|
</label><br>
|
||||||
|
<button>Save!</button>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
131
lernen/ka-1-lbt3+4/README.MD
Normal file
131
lernen/ka-1-lbt3+4/README.MD
Normal file
@@ -0,0 +1,131 @@
|
|||||||
|
# PHP Übungsaufgaben: PDO & File Handling
|
||||||
|
|
||||||
|
## PDO Aufgaben
|
||||||
|
|
||||||
|
### Aufgabe 1: Benutzerverwaltung mit PDO X
|
||||||
|
|
||||||
|
Erstelle ein Verwaltungssystem für Benutzer mit folgenden Features:
|
||||||
|
|
||||||
|
- Datenbank `benutzer_verwaltung` mit Tabelle `users` (id, username, email, created_at, status)
|
||||||
|
- CRUD-Operationen (Create, Read, Update, Delete) mit PDO
|
||||||
|
- Prepared Statements für alle Queries
|
||||||
|
- Error Handling mit try-catch
|
||||||
|
- Pagination für die Benutzeranzeige (20 Benutzer pro Seite)
|
||||||
|
|
||||||
|
**Bonusaufgabe:** Implementiere eine Suchfunktion, die nach username oder email filtert.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Aufgabe 2: Transaktionen und Rollback X
|
||||||
|
|
||||||
|
Erstelle ein Bestell-System mit zwei Tabellen:
|
||||||
|
|
||||||
|
- `produkte` (id, name, preis, lagerbestand)
|
||||||
|
- `bestellungen` (id, produkt_id, anzahl, datum)
|
||||||
|
|
||||||
|
Implementiere eine Bestellfunktion, die:
|
||||||
|
|
||||||
|
- Den Lagerbestand prüft
|
||||||
|
- Bei ausreichendem Lager eine Bestellung anlegt UND den Lagerbestand reduziert
|
||||||
|
- PDO-Transaktionen nutzt (beginTransaction, commit, rollback)
|
||||||
|
- Bei Fehlern oder fehlendem Lagerbestand einen Rollback durchführt
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## File Handling Aufgaben
|
||||||
|
|
||||||
|
### Aufgabe 3: Log-System (TXT) X
|
||||||
|
|
||||||
|
Entwickle ein mehrstufiges Logging-System:
|
||||||
|
|
||||||
|
- Schreibe Logs in verschiedene Dateien: `error.log`, `access.log`, `debug.log`
|
||||||
|
- Jeder Log-Eintrag enthält: Timestamp, Log-Level (ERROR/INFO/DEBUG), Nachricht
|
||||||
|
- Implementiere eine Funktion `writeLog($level, $message)`
|
||||||
|
- Erstelle eine Funktion, die die letzten N Zeilen einer Log-Datei ausliest
|
||||||
|
|
||||||
|
**Bonusaufgabe:** Implementiere Log-Rotation (wenn Datei > 1MB, erstelle neue Datei mit Timestamp).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Aufgabe 4: CSV Import/Export System
|
||||||
|
|
||||||
|
Erstelle ein System für Produktdaten:
|
||||||
|
|
||||||
|
- **Import:** Lese CSV-Datei mit Produkten (ID, Name, Preis, Kategorie) und importiere sie in eine Datenbank
|
||||||
|
- **Export:** Exportiere Datenbankeinträge als CSV-Datei
|
||||||
|
- Validierung der CSV-Daten (Preis muss numerisch sein, Pflichtfelder prüfen)
|
||||||
|
- Fehlerhafte Zeilen in separate `fehler.csv` schreiben
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Aufgabe 5: XML Konfigurationsdatei (XML)
|
||||||
|
|
||||||
|
Erstelle ein Konfigurations-Management-System:
|
||||||
|
|
||||||
|
- Lese eine XML-Konfigurationsdatei mit Datenbank-Verbindungsparametern, E-Mail-Settings, etc.
|
||||||
|
- Schreibe eine Klasse `ConfigManager`, die:
|
||||||
|
- XML mit SimpleXML oder DOMDocument parst
|
||||||
|
- Konfigurationswerte auslesen kann (`getConfig('database.host')`)
|
||||||
|
- Konfigurationswerte ändern und zurück in XML schreiben kann
|
||||||
|
- Erstelle eine Funktion, die XML nach JSON konvertiert
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Kombinierte Aufgabe
|
||||||
|
|
||||||
|
### Aufgabe 6: Kontaktverwaltung mit Multi-Format Support
|
||||||
|
|
||||||
|
Entwickle eine vollständige Kontaktverwaltung:
|
||||||
|
|
||||||
|
- **Datenbank:** Tabelle `kontakte` (id, vorname, nachname, email, telefon, firma)
|
||||||
|
- **PDO:** Alle CRUD-Operationen mit PDO
|
||||||
|
- **Export-Funktionen:**
|
||||||
|
- Als CSV exportieren
|
||||||
|
- Als XML exportieren
|
||||||
|
- Als JSON exportieren (bonus)
|
||||||
|
- **Import-Funktionen:**
|
||||||
|
- CSV-Import mit Validierung
|
||||||
|
- XML-Import
|
||||||
|
- **Logging:** Alle Aktionen (Erstellen, Ändern, Löschen) in `contacts.log` protokollieren
|
||||||
|
|
||||||
|
**Anforderungen:**
|
||||||
|
|
||||||
|
- Fehlerbehandlung bei allen File- und DB-Operationen
|
||||||
|
- Prepared Statements für SQL
|
||||||
|
- Datei-Upload für CSV/XML-Import
|
||||||
|
- Benutzerfreundliche Fehler-/Erfolgsmeldungen
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Zusätzliche Challenges
|
||||||
|
|
||||||
|
### Challenge 1: Backup-System
|
||||||
|
|
||||||
|
Erstelle ein automatisches Backup-System:
|
||||||
|
|
||||||
|
- Exportiere komplette Datenbank-Tabelle als SQL-Dump in TXT-Datei
|
||||||
|
- Komprimiere Backup mit ZIP
|
||||||
|
- Speichere mit Timestamp im Dateinamen
|
||||||
|
- Alte Backups (> 7 Tage) automatisch löschen
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Challenge 2: XML-Feed-Parser
|
||||||
|
|
||||||
|
Erstelle einen RSS/XML-Feed-Parser:
|
||||||
|
|
||||||
|
- Parse einen externen XML-Feed (z.B. News-Feed)
|
||||||
|
- Speichere relevante Daten in Datenbank
|
||||||
|
- Aktualisiere nur neue Einträge (vermeide Duplikate)
|
||||||
|
- Erstelle einen eigenen XML-Feed aus den DB-Daten
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Hinweise
|
||||||
|
|
||||||
|
- Nutze immer Prepared Statements für SQL-Queries
|
||||||
|
- Implementiere ordentliches Error Handling
|
||||||
|
- Kommentiere deinen Code
|
||||||
|
- Teste alle Edge Cases (leere Dateien, fehlerhafte Daten, etc.)
|
||||||
|
|
||||||
|
Viel Erfolg! 🚀
|
||||||
3
lernen/ka-1-lbt3+4/access.log
Normal file
3
lernen/ka-1-lbt3+4/access.log
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
TIMESTAMP | LOG-LEVEL | NACHRICHT
|
||||||
|
Mon, 12 Jan 2026 22:17:35 +0100 | access | Es wurde nicht auf die Datei zugegriffen
|
||||||
|
Mon, 12 Jan 2026 22:20:11 +0100 | access | Es wurde nicht auf die Datei zugegriffen
|
||||||
40
lernen/ka-1-lbt3+4/aufgabe1.php
Normal file
40
lernen/ka-1-lbt3+4/aufgabe1.php
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
// datenbank heißt absichtlich lernenjahr2 und nicht benutzer_verwaltung
|
||||||
|
try {
|
||||||
|
$pdo = new PDO("mysql:host=localhost;dbname=lernenjahr2","root","deinPasswort");
|
||||||
|
|
||||||
|
|
||||||
|
// Tabelle erstellen
|
||||||
|
$createTable = $pdo ->exec('CREATE TABLE IF NOT EXISTS `user`(
|
||||||
|
id INTEGER AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
username VARCHAR(255),
|
||||||
|
email VARCHAR(255),
|
||||||
|
created_at TIME,
|
||||||
|
status VARCHAR(30)
|
||||||
|
);');
|
||||||
|
echo "TABLE CREATED (IF NOT EXISTS) <br>";
|
||||||
|
|
||||||
|
// CREATE USER
|
||||||
|
$createUser = $pdo ->exec('INSERT INTO user VALUES(
|
||||||
|
null,
|
||||||
|
"danielvici223",
|
||||||
|
"daniel@danielvici.com",
|
||||||
|
"11:00:00",
|
||||||
|
"active"
|
||||||
|
);');
|
||||||
|
|
||||||
|
echo "USER CREATED <br>";
|
||||||
|
// update haben wir nicht gemacht
|
||||||
|
|
||||||
|
// DELETE USER
|
||||||
|
$deleteUser = $pdo ->exec('DELETE FROM user WHERE id=1');
|
||||||
|
|
||||||
|
// pagination <- keine was das ist?
|
||||||
|
echo "USER 1 DELETED <br>";
|
||||||
|
|
||||||
|
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
echo "". $e ."";
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
49
lernen/ka-1-lbt3+4/aufgabe2.php
Normal file
49
lernen/ka-1-lbt3+4/aufgabe2.php
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
try {
|
||||||
|
$pdo = new PDO("mysql:host=localhost;dbname=lernenjahr2","root","deinPasswort");
|
||||||
|
|
||||||
|
$produkteTabelle = 'CREATE TABLE IF NOT EXISTS produkte (
|
||||||
|
id INTEGER AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
name VARCHAR(255),
|
||||||
|
preis INTEGER,
|
||||||
|
lagerbestand INTEGER)';
|
||||||
|
|
||||||
|
$produkteBestellung = 'CREATE TABLE IF NOT EXISTS bestellungen (
|
||||||
|
id INTEGER AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
produkt_id INTEGER,
|
||||||
|
anzahl INTEGER,
|
||||||
|
datum DATE)';
|
||||||
|
|
||||||
|
$createTable = $pdo->exec($produkteTabelle);
|
||||||
|
echo "TABELLE produkte ERSTELLT <br>";
|
||||||
|
$createTable = $pdo->exec($produkteBestellung);
|
||||||
|
echo "TABELLE Bestellung ERSTELLT <br>";
|
||||||
|
|
||||||
|
$lagerbestandProProduktQuery = 'SELECT `name`, lagerbestand, id FROM produkte';
|
||||||
|
$lagerbestandProProdukt = $pdo->query($lagerbestandProProduktQuery)->fetchAll();
|
||||||
|
|
||||||
|
echo "<pre>";
|
||||||
|
print_r($lagerbestandProProdukt);
|
||||||
|
echo "</pre>";
|
||||||
|
|
||||||
|
foreach($lagerbestandProProdukt as $row){
|
||||||
|
if ($row[1] >= 1){
|
||||||
|
echo "Von '$row[0]' haben wir aktuell $row[1] (ID: $row[2]). <br>";
|
||||||
|
} else {
|
||||||
|
echo "Von '$row[0]' haben wir nichts mehr <br>";
|
||||||
|
$createBestellung = $pdo->exec("INSERT INTO bestellungen VALUES(
|
||||||
|
null,
|
||||||
|
$row[2],
|
||||||
|
999,
|
||||||
|
'2025-01-12'
|
||||||
|
)");
|
||||||
|
echo "Von '$row[0]' wurden 999 stück bestellt.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
echo "Error: ", $e->getMessage();
|
||||||
|
}
|
||||||
67
lernen/ka-1-lbt3+4/aufgabe3.php
Normal file
67
lernen/ka-1-lbt3+4/aufgabe3.php
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
<?php
|
||||||
|
ini_set("display_errors", "on");
|
||||||
|
|
||||||
|
echo "<h1>AUFGABE 3</h1>";
|
||||||
|
|
||||||
|
// file names
|
||||||
|
$error = "error.log";
|
||||||
|
$access = "access.log";
|
||||||
|
$debug = "debug.log";
|
||||||
|
|
||||||
|
// read function
|
||||||
|
function read($file){
|
||||||
|
$fileName = $file.".log";
|
||||||
|
$fp = fopen($fileName, 'r') or die ("Cannot open file"); // open file
|
||||||
|
$fileLineCount = count(file($fileName)); // count lines
|
||||||
|
// if file is empty
|
||||||
|
if ($fileLineCount == 0) {
|
||||||
|
echo "Datei '".$file.".log' ist leer <br>";
|
||||||
|
} else {
|
||||||
|
//echo "TIMESTAMP | LOG-LEVEL | NACHRICHT<br>";
|
||||||
|
foreach(file($fileName) as $line){
|
||||||
|
echo "$line<br>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fclose($fp);
|
||||||
|
}
|
||||||
|
|
||||||
|
function writeLog($level, $message){
|
||||||
|
$fileName = $level.".log";
|
||||||
|
$fp = fopen($fileName, 'a') or die ("Cannot open file");
|
||||||
|
// get current time
|
||||||
|
$now = date(DATE_RFC2822, time());
|
||||||
|
|
||||||
|
$fileLineCount = count(file($fileName)); // count lines
|
||||||
|
// if file is empty
|
||||||
|
if ($fileLineCount == 0) {
|
||||||
|
fwrite($fp, "TIMESTAMP | LOG-LEVEL | NACHRICHT\n");
|
||||||
|
}
|
||||||
|
$data = "$now | $level | $message\n";
|
||||||
|
fwrite($fp, $data);
|
||||||
|
echo "Wurde geloggt <br>";
|
||||||
|
fclose($fp);
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "<h2>READ LOGS BEFORE WRITE</h2>";
|
||||||
|
|
||||||
|
echo "<h3>Error Log</h3>";
|
||||||
|
read("error");
|
||||||
|
echo "<h3>Access Log</h3>";
|
||||||
|
read("access");
|
||||||
|
echo "<h3>Debug Log</h3>";
|
||||||
|
read("debug");
|
||||||
|
// ------------------------------------------
|
||||||
|
echo "<h2>WRITE LOGS</h2>";
|
||||||
|
|
||||||
|
writeLog("error", "Es gab kein Fehler");
|
||||||
|
writeLog("access", "Es wurde nicht auf die Datei zugegriffen");
|
||||||
|
writeLog("debug","Das ka.php wurde gedebugt");
|
||||||
|
// ------------------------------------------
|
||||||
|
echo "<h2>READ LOGS AFTER WRITE</h2>";
|
||||||
|
|
||||||
|
echo "<h3>Error Log</h3>";
|
||||||
|
read("error");
|
||||||
|
echo "<h3>Access Log</h3>";
|
||||||
|
read("access");
|
||||||
|
echo "<h3>Debug Log</h3>";
|
||||||
|
read("debug");
|
||||||
47
lernen/ka-1-lbt3+4/aufgabe4.php
Normal file
47
lernen/ka-1-lbt3+4/aufgabe4.php
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// ###########
|
||||||
|
// # WICHTIG #
|
||||||
|
// ###########
|
||||||
|
// geht nicht!
|
||||||
|
|
||||||
|
ini_set("display_errors", "on");
|
||||||
|
|
||||||
|
// Datei
|
||||||
|
$file = "produkt.csv";
|
||||||
|
|
||||||
|
if(!file_exists($file)){
|
||||||
|
die("File $file doesn't exist or not found!");
|
||||||
|
// Beende das Skript
|
||||||
|
}
|
||||||
|
|
||||||
|
$fp = @fopen($file, 'r');
|
||||||
|
if(!$fp){
|
||||||
|
die("Error while opening file!");
|
||||||
|
}
|
||||||
|
|
||||||
|
$header = fgetcsv($fp);
|
||||||
|
|
||||||
|
|
||||||
|
// READ FILE <- GEHT NICHT
|
||||||
|
|
||||||
|
$yo = print_r($header);
|
||||||
|
echo "<pre> $yo </pre>";
|
||||||
|
|
||||||
|
while(!feof($fp)){ // solange nicht das Ende der Datei erreicht ist
|
||||||
|
|
||||||
|
// Inner Schleife: Spalten ausgeben
|
||||||
|
for ($i = 0; $i < count($header); $i++){
|
||||||
|
echo "$header[$i]: $header[$i]<br>";
|
||||||
|
}
|
||||||
|
echo "<p> -------------------------------- </p>";
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose($fp);
|
||||||
|
|
||||||
|
// WRITE TO FILE <- GEHT
|
||||||
|
// $fp = @fopen($file, "W");
|
||||||
|
//$row = [7, "NZXTKeyboard", 120, "Tastatur"];
|
||||||
|
// file, data (array), seperator
|
||||||
|
//fputcsv($fp, $row, ",");
|
||||||
|
|
||||||
3
lernen/ka-1-lbt3+4/debug.log
Normal file
3
lernen/ka-1-lbt3+4/debug.log
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
TIMESTAMP | LOG-LEVEL | NACHRICHT
|
||||||
|
Mon, 12 Jan 2026 22:17:35 +0100 | debug | Das ka.php wurde gedebugt
|
||||||
|
Mon, 12 Jan 2026 22:20:11 +0100 | debug | Das ka.php wurde gedebugt
|
||||||
31
lernen/ka-1-lbt3+4/docker-compose.yml
Normal file
31
lernen/ka-1-lbt3+4/docker-compose.yml
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
version: '3.8'
|
||||||
|
|
||||||
|
services:
|
||||||
|
mysql:
|
||||||
|
image: mysql:latest
|
||||||
|
container_name: mysql-db
|
||||||
|
environment:
|
||||||
|
MYSQL_ROOT_PASSWORD: deinPasswort
|
||||||
|
MYSQL_DATABASE: testdb
|
||||||
|
MYSQL_USER: phpuser
|
||||||
|
MYSQL_PASSWORD: phpPasswort
|
||||||
|
ports:
|
||||||
|
- "3306:3306"
|
||||||
|
volumes:
|
||||||
|
- mysql-data:/var/lib/mysql
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
phpmyadmin:
|
||||||
|
image: phpmyadmin:latest
|
||||||
|
container_name: phpmyadmin
|
||||||
|
environment:
|
||||||
|
PMA_HOST: mysql
|
||||||
|
PMA_PORT: 3306
|
||||||
|
ports:
|
||||||
|
- "8080:80"
|
||||||
|
depends_on:
|
||||||
|
- mysql
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
mysql-data:
|
||||||
3
lernen/ka-1-lbt3+4/error.log
Normal file
3
lernen/ka-1-lbt3+4/error.log
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
TIMESTAMP | LOG-LEVEL | NACHRICHT
|
||||||
|
Mon, 12 Jan 2026 22:17:35 +0100 | error | Es gab kein Fehler
|
||||||
|
Mon, 12 Jan 2026 22:20:11 +0100 | error | Es gab kein Fehler
|
||||||
8
lernen/ka-1-lbt3+4/produkt.csv
Normal file
8
lernen/ka-1-lbt3+4/produkt.csv
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
ID,Name,Preis,Kategorie
|
||||||
|
1,"Mac Book",2600, pc
|
||||||
|
2,Spezi, 15, getränk
|
||||||
|
3,Watch, 500, uhr
|
||||||
|
4,iPhone,1500,Handy
|
||||||
|
5,"NZXT Mini",100,Tastatur
|
||||||
|
6,"NZXT Keyboard",120,Tastatur
|
||||||
|
7,NZXTKeyboard,120,Tastatur
|
||||||
|
Reference in New Issue
Block a user