Compare commits
4 Commits
0e3c68542d
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
11a260008e | ||
|
|
ec20b28fc4 | ||
|
|
19c2ba6e1f | ||
|
|
be93d16a61 |
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>
|
||||||
@@ -8,6 +8,12 @@ Wichtige Informationen
|
|||||||
- Stundenplan - [Link](https://wvss-mannheim.webuntis.com/WebUntis/?school=wvss-mannheim#/basic/timetablePublic/class?entityId=2583)
|
- 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)
|
## 12-12-25 - PHP (SQL)
|
||||||
- Aufgabe von gester überarbeitet
|
- Aufgabe von gester überarbeitet
|
||||||
- Unterrichts Projekt:
|
- Unterrichts Projekt:
|
||||||
|
|||||||
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
|
||||||
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
|
||||||
@@ -34,7 +34,7 @@ Implementiere eine Bestellfunktion, die:
|
|||||||
|
|
||||||
## File Handling Aufgaben
|
## File Handling Aufgaben
|
||||||
|
|
||||||
### Aufgabe 3: Log-System (TXT)
|
### Aufgabe 3: Log-System (TXT) X
|
||||||
|
|
||||||
Entwickle ein mehrstufiges Logging-System:
|
Entwickle ein mehrstufiges Logging-System:
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,8 @@
|
|||||||
// ###########
|
// ###########
|
||||||
// geht nicht!
|
// geht nicht!
|
||||||
|
|
||||||
|
ini_set("display_errors", "on");
|
||||||
|
|
||||||
// Datei
|
// Datei
|
||||||
$file = "produkt.csv";
|
$file = "produkt.csv";
|
||||||
|
|
||||||
@@ -13,18 +15,15 @@ if(!file_exists($file)){
|
|||||||
// Beende das Skript
|
// Beende das Skript
|
||||||
}
|
}
|
||||||
|
|
||||||
$fp = @fopen($file, 'r'); // a -> all (read, write ...)
|
$fp = @fopen($file, 'r');
|
||||||
if(!$fp){
|
if(!$fp){
|
||||||
die("Error while opening file!");
|
die("Error while opening file!");
|
||||||
}
|
}
|
||||||
|
|
||||||
$header = fgetcsv($fp, 0, ",");
|
$header = fgetcsv($fp);
|
||||||
|
|
||||||
fclose($fp);
|
|
||||||
|
|
||||||
// READ FILE
|
// READ FILE <- GEHT NICHT
|
||||||
|
|
||||||
$fp = @fopen($file, "W");
|
|
||||||
|
|
||||||
$yo = print_r($header);
|
$yo = print_r($header);
|
||||||
echo "<pre> $yo </pre>";
|
echo "<pre> $yo </pre>";
|
||||||
@@ -38,8 +37,10 @@ while(!feof($fp)){ // solange nicht das Ende der Datei erreicht ist
|
|||||||
echo "<p> -------------------------------- </p>";
|
echo "<p> -------------------------------- </p>";
|
||||||
}
|
}
|
||||||
|
|
||||||
// WRITE TO FILE
|
fclose($fp);
|
||||||
|
|
||||||
|
// WRITE TO FILE <- GEHT
|
||||||
|
// $fp = @fopen($file, "W");
|
||||||
//$row = [7, "NZXTKeyboard", 120, "Tastatur"];
|
//$row = [7, "NZXTKeyboard", 120, "Tastatur"];
|
||||||
// file, data (array), seperator
|
// file, data (array), seperator
|
||||||
//fputcsv($fp, $row, ",");
|
//fputcsv($fp, $row, ",");
|
||||||
|
|||||||
Reference in New Issue
Block a user