2
0

Compare commits

..

6 Commits

Author SHA1 Message Date
Daniel
cef321152a add stuff from 22-05-26 2026-05-22 08:15:56 +02:00
Daniel
94441419c6 set all day heading to H3, more 2026-05-22 07:50:42 +02:00
Daniel
c021ed345f fix typo, cisco packet... idk what changed 2026-05-22 07:47:37 +02:00
Daniel
a4eb5a0d23 remove old KA files 2026-05-22 07:45:00 +02:00
cwikladaniel
e25792cbb9 Task to JS + AJAX and PHP, code from 21-05-26 2026-05-21 10:31:08 +02:00
Daniel
ac5030828d add ospf routing 2026-05-21 09:02:21 +02:00
10 changed files with 139 additions and 295 deletions

View File

@@ -1,19 +0,0 @@
<?php
// DANIEL CWIKLA
function db_connect() {
require_once "db_connection.php";
$db_server = "$db_engine:dbname=$db_name;host=$db_host";
try {
$dbh = new PDO($db_server, $db_user, $db_password);
echo "<p>DB Connected</p>";
return $dbh;
}
catch(PDOException $e) {
die("<p>Error</p>");
}
}
?>

View File

@@ -1,10 +0,0 @@
<?php
// DANIEL CWIKLA
$db_engine = "mysql";
$db_name = "hardwarefuchs";
$db_host = "localhost";
$db_user = "phpmyadmin";
$db_password = "server";
?>

View File

@@ -1,136 +0,0 @@
<?php
// DANIEL CWIKLA
function kundeEinfuegen($dbh, $kdnr, $nachname, $email){
if($kdnr != 0 AND $nachname != '' AND $email != "") {
// JAHRESUMSATZ und RABATSTUFFE sind auf default 0.00 bzw. 0
// deswegen werden die hier nicht nochmal auf 0.00 bzw. 0 gesetzt
$query = "INSERT INTO kunde VALUES (:kdnr, :nachname, :email, 0.00, 0)";
$stmt = $dbh->prepare($query);
$stmt->bindParam(':kdnr', $kdnr);
$stmt->bindParam(':nachname', $nachname);
$stmt->bindParam(':email', $email);
try {
$stmt->execute();
return "Kunde (Herr/Frau $nachname) wurde erstellt!";
}
catch(PDOException $e) {
$errMsg = $e->getMessage();
$errCode = $e->getCode();
switch($errCode) {
case "23000": $custErrMsg = "<p>Email-Adress already exists!</p>"; break;
default: $custErrMsg = "<p>Oooops, something went wrong!</p>";
}
echo $$errMsg;
echo $custErrMsg;
}
} else {
return "ERROR: missing data";
}
}
function setJahresUmsatz($dbh, $kdnr, $umsatz){
if($kdnr != 0 AND $umsatz != 0) {
$query = "UPDATE kunde
SET jahresumsatz = $umsatz
WHERE :kdnr = kd_nummer";
$stmt = $dbh->prepare($query);
$stmt->bindParam(':kdnr', $kdnr);
//$stmt->bindParam(':umsatz', $umsatz);
try {
$stmt->execute();
return "Der JAhresumsatz von Kunde ($kdnr) wurde geupdated!";
}
catch(PDOException $e) {
$errMsg = $e->getMessage();
$errCode = $e->getCode();
switch($errCode) {
case "23000": $custErrMsg = "<p>Email-Adress already exists!</p>"; break;
default: $custErrMsg = "<p>Oooops, something went wrong!</p>";
}
echo $$errMsg;
echo $custErrMsg;
}
}else {
return "ERROR: missing data";
}
}
function getJahresUmsatz($dbh, $kdnr){
if($kdnr != 0){
$query = "SELECT jahresumsatz FROM kunde WHERE kd_nummer = $kdnr;";
$jahresUmsatzArray = $dbh->query($query)->fetch();
return $jahresUmsatzArray[0];
} else {
return "ERROR: missing data";
}
}
function setAllRabattStufen($dbh){
$getAllKunden = "SELECT * FROM kunde;";
$allKunden = $dbh->query($getAllKunden)->fetchAll();
foreach($allKunden as $kunde) {
$rabatt = 0;
$umsatz = $kunde[3];
$kdnr = $kunde[0];
echo "umsatz, kdnr";
echo $umsatz;
echo "---";
echo $kdnr;
echo "-----";
if($umsatz > 250000.0){
$rabatt = 25;
} else if ($umsatz > 100000.0) {
$rabatt = 15;
}
else if ($umsatz > 50000.0) {
$rabatt = 10;
}
else if ($umsatz > 10000.0) {
$rabatt = 5;
}
$updateRabattStufeQuery = "UPDATE kunde
SET rabattstufe = :rabatt
WHERE :kdnr = kd_nummer";
$stmt = $dbh->prepare($updateRabattStufeQuery);
$stmt->bindParam(':kdnr', $kdnr);
$stmt->bindParam(':rabatt', $rabatt);
echo $rabatt;
try {
$stmt->execute();
echo "Die Rabattstufe von Kunde ($kdnr) wurde geupdated!";
}
catch(PDOException $e) {
$errMsg = $e->getMessage();
$errCode = $e->getCode();
switch($errCode) {
case "23000": $custErrMsg = "<p>Email-Adress already exists!</p>"; break;
default: $custErrMsg = "<p>Oooops, something went wrong!</p>";
}
echo $$errMsg;
echo $custErrMsg;
}
}
}

View File

@@ -1,51 +0,0 @@
-- phpMyAdmin SQL Dump
-- version 5.1.1deb5ubuntu1
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: May 19, 2026 at 02:41 PM
-- Server version: 10.6.21-MariaDB-0ubuntu0.22.04.2
-- PHP Version: 8.1.2-1ubuntu2.21
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `hardwarefuchs`
--
CREATE DATABASE IF NOT EXISTS `hardwarefuchs` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
USE `hardwarefuchs`;
-- --------------------------------------------------------
--
-- Table structure for table `kunde`
--
CREATE TABLE `kunde` (
`kd_nummer` int(11) NOT NULL,
`nachname` varchar(50) NOT NULL,
`email` varchar(100) NOT NULL,
`jahresumsatz` float NOT NULL DEFAULT 0,
`rabattstufe` int(11) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
--
-- Dumping data for table `kunde`
--
INSERT INTO `kunde` (`kd_nummer`, `nachname`, `email`, `jahresumsatz`, `rabattstufe`) VALUES
(1, 'daniel', 'daniel@daniel.com', 50000.7, 10),
(2, 'daniel2', 'daniel2@danielvici.com', 0, 0);
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

View File

@@ -1,28 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Neuer Kunde</title>
</head>
<body>
<h1>DANIEL CWIKLA</h1>
<form>
<label>Kundennummer: <input name="kdnr" type="number"></label><br>
<label>Nachname: <input name="nachname" type="text"></label><br>
<label>E-Mail: <input name="email" type="email"></label><br>
<button type="submit">Anlegen</button>
</form>
</body>
</html>
<?php
// DANIEL CWIKLA
require_once 'funktionen.php';
require_once 'db_connect.php';
if(!empty($_REQUEST)){
$dbh = db_connect();
echo kundeEinfuegen($dbh, $_REQUEST['kdnr'], $_REQUEST['nachname'], $_REQUEST['email']);
}
?>

View File

@@ -1,26 +0,0 @@
<?php
// DANIEL CWIKLA
require_once 'funktionen.php';
require_once 'db_connect.php';
$dbh = db_connect();
$kdnr = 1;
$umsatz = 50000.676;
echo "<h2>setJahresUmsatz</h2>";
echo "<p>Kundennummer: $kdnr</p>";
echo "<p>Neuer Umsatz: $umsatz</p>";
echo setJahresUmsatz($dbh, $kdnr, $umsatz);
echo "<h2>getJahresUmsatz</h2>";
echo "<p>Jahresumsaz: ";
// php rundet automatisch: "... num is rounded to decimals significant digits before the decimal point."
// https://www.php.net/manual/en/function.number-format.php
echo number_format(getJahresUmsatz($dbh, $kdnr),2);
echo "€ </p>";
echo "<p>setAllRabattStufen: ";
echo setAllRabattStufen($dbh);

BIN
Zweites Jahr/CISCO PACKET TRACER/Routing_E2FI1a.pkt Executable file → Normal file

Binary file not shown.

View File

@@ -6,7 +6,7 @@ Wichtige Informationen
- Wird eventuell nie aktuell sein.
- Stundenplan - [Link](https://wvss-mannheim.webuntis.com/WebUntis/?school=wvss-mannheim#/basic/timetablePublic/class?entityId=2583)
- Ab 21
- Ab 21-05-25 habe ich vor `.pkt` (Cisco Packet Tracer) Datein auch im Repo zu speichern.
## Ordner
@@ -14,94 +14,95 @@ Wichtige Informationen
- Unterrichts Projekt - [./unterrichts_projekt](/Zweites%20Jahr/unterrichts_projekt/portal/register.php) (Register Seite)
- Cisco Packet Tracer - [./CISCO PACKET TRACER](/Zweites%20Jahr/CISCO%20PACKET%20TRACER/)
## 21-05-25 - CPT
## Was gemacht
> Möglicher weise nicht zu 100% akurat oder aktuell.
### 22-05-26 - PHP (Unterrichts Projekt)
- Register wiederholt
### 21-05-26 - CPT + PHP, JS und AJAX
- RIP routing datein hinzugefügt
- OSPRF hinzugefügt
- AB zu PHP, JS und AJAX
## 20-04-26 - JS + AJAX
### 20-04-26 - JS + AJAX
- Einführung AJAX
- HTML Formular mit JavaScript
## 19-04-26 - PHP KA
### 19-04-26 - PHP KA
- KA geschrieben ([Klassenarbeit](/Zweites%20Jahr/Klassenarbeit/LBT3/KA2/))
## 30-04-26
### 30-04-26
- Event Listener
## 29-04-26 - JS + PHP
### 29-04-26 - JS + PHP
- Login in PHP (unfertig)
- Einstieg in JAVASCRIPT
## 27-03-26 - PHP (Unterrichts Projekt)
### 27-03-26 - PHP (Unterrichts Projekt)
- Registrierung weiter gemacht
- Passwort checks
- Passwort hashing
- Email checking
## 25-03-26 - PHP (Unterrichts Projekt)
### 25-03-26 - PHP (Unterrichts Projekt)
- Registrierung gemacht
> Es wurden ebenfalls fehlende Datein hinzugefügt
## 05-03-26 - packet tracer
### 05-03-26 - packet tracer
- vlan in packet tracer
## 06-02-26 - SQL
### 06-02-26 - SQL
- DATE sachen in SQL
## 05-02-26 - PHP (JSON, SQL)
### 05-02-26 - PHP (JSON, SQL)
- Aus PHP JSON Datei erstellen
- In PHP SQL abfrage in JSON datei umwandeln
## 04-02-26 - PHP (Kryptographie)
### 04-02-26 - PHP (Kryptographie)
- Caeser chiffere kontrolliert
- Vigenere chieffre gemacht
## 03-02-26 - PHP (JSON)
### 03-02-26 - PHP (JSON)
- JSON in PHP (Datein derzeit nicht verfügbar da Pc nicht mehr zugägnlich)
## 16-01-26 - PHP
### 16-01-26 - PHP
- Modulo
## 14-01-26 - PHP
### 14-01-26 - PHP
- Kryptologie (LBT3)
## 12-12-25 - PHP (SQL)
### 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)
### 11-12-25 - PHP (XML)
- XML aus PHP erstellt
- CSV Datei in XML Datei konvertiert
## 10-12-25 - PHP
### 10-12-25 - PHP
- Unterrichtsprojekt begonnen:
- Verbindung zur Datenbank
## 9-12-25 - PHP (SQL)
### 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

View File

@@ -0,0 +1,47 @@
<?php
header('Content-Type: application/json; charset=utf-8');
// DB-Zugangsdaten (bitte anpassen)
$host = 'localhost';
$db = 'json';
$user = 'phpmyadmin';
$pass = 'server';
$charset = 'utf8mb4';
if (isset($_GET['qualifikation']) && !empty($_GET['qualifikation'])) {
$quali = $_GET['qualifikation'];
$dsn = "mysql:host=$host;dbname=$db;charset=$charset";
$options = [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
PDO::ATTR_EMULATE_PREPARES => false,
];
try {
// PDO-Verbindung aufbauen
$pdo = new PDO($dsn, $user, $pass, $options);
// SQL-Statement vorbereiten (Schutz vor SQL-Injection)
// HINWEIS: Tabellen- und Spaltennamen müssen dem importierten Dump entsprechen.
$stmt = $pdo->prepare(
'SELECT m.Name AS name, q.Qualifikation AS qualifikation
FROM mitarbeiter m
JOIN mitarbeiter_hat_qualifikation mhq ON m.idMitarbeiter = mhq.Mitarbeiter_idMitarbeiter
JOIN qualifikation q ON mhq.Qualifikation_idQualifikation = q.idQualifikation
WHERE qualifikation = ?');
$stmt->execute([$quali]);
$ergebnisse = $stmt->fetchAll();
// Als JSON an den Client senden
echo json_encode($ergebnisse);
} catch (\PDOException $e) {
// Im Fehlerfall leeres Array oder Fehlermeldung senden
echo json_encode(['error' => 'Datenbankfehler: ' . $e->getMessage()]);
}
} else {
echo json_encode([]);
}

View File

@@ -0,0 +1,66 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<title>Mitarbeiter Qualifikation</title>
<style>
table { width: 50%; border-collapse: collapse; margin-top: 20px; }
th, td { border: 1px solid #ccc; padding: 8px; text-align: left; }
th { background-color: #f4f4f4; }
</style>
</head>
<body>
<label for="qualiSelect">Qualifikation:</label>
<select id="qualiSelect" onchange="loadMitarbeiter(this.value)">
<option value="">- Bitte Auswählen -</option>
<option value="Java">Java</option>
<option value="HTML">HTML</option>
<option value="CSS">CSS</option>
<option value="RedisDB">RedisDB</option>
<option value="MySQL">MySQL</option>
</select>
<table id="resultTable" style="display:none;">
<thead>
<tr>
<th>Name</th>
<th>Qualifikation</th>
</tr>
</thead>
<tbody id="tableBody"></tbody>
</table>
<script>
function loadMitarbeiter(quali) {
if (!quali) {
document.getElementById('resultTable').style.display = 'none';
return;
}
// AJAX-Anfrage über GET senden
fetch(`backend.php?qualifikation=${encodeURIComponent(quali)}`)
.then(response => response.json())
.then(data => {
const tbody = document.getElementById('tableBody');
tbody.innerHTML = ''; // Alte Ergebnisse löschen
if(data.length > 0) {
data.forEach(mitarbeiter => {
const row = `<tr>
<td>${mitarbeiter.name}</td>
<td>${mitarbeiter.qualifikation}</td>
</tr>`;
tbody.innerHTML += row;
});
document.getElementById('resultTable').style.display = 'table';
} else {
tbody.innerHTML = '<tr><td colspan="2">Keine Mitarbeiter gefunden.</td></tr>';
document.getElementById('resultTable').style.display = 'table';
}
})
.catch(error => console.error('Fehler:', error));
}
</script>
</body>
</html>