diff --git a/public/admin.php b/public/admin.php new file mode 100644 index 0000000..0b40100 --- /dev/null +++ b/public/admin.php @@ -0,0 +1,156 @@ + + + + + + + + + Login + + +
+

Login

+
+ +
+ +
+ +
+
+ + + $inactive_time) { + // Abmeldung des Benutzers aufgrund von Inaktivität + session_unset(); + session_destroy(); + header("Location: logout.php"); // Leite den Benutzer zur Logout-Seite weiter + exit; + } else { + // Aktualisiere die letzte Aktivitätszeit + $_SESSION['last_activity'] = time(); + } +} + +require_once '../vendor/autoload.php'; // Include barcode library + +// Funktion zum Generieren des Barcodes +function generateBarcode($ean) +{ + // Überprüfen, ob die EAN gültig ist (nur Zahlen und Länge 13) + if (ctype_digit($ean) && strlen($ean) == 13) { + $generator = new Picqer\Barcode\BarcodeGeneratorHTML(); + return $generator->getBarcode($ean, $generator::TYPE_EAN_13); + } else { + return "Ungültige EAN"; + } +} + +// Datenbankverbindung herstellen und Daten abrufen +$config = include '../config/config.php'; +$conn = new mysqli($config['servername'], $config['username'], $config['password'], $config['database']); + +if ($conn->connect_error) { + die("Connection failed: " . $conn->connect_error); +} + +$sql = "SELECT * FROM articles"; +$result = $conn->query($sql); +?> + + + + + + + + Admin + + + + +
+

Herdset Übersicht

+ + + + + + + + + + + + + + + + + + num_rows > 0) { + while($row = $result->fetch_assoc()) { + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + } + } else { + echo "0 results"; + } + $conn->close(); + ?> +
IDHerstellerSet NameArticle NumberEAN BarcodeBackofenBackofen EANKochfeldKochfeld EANAuszugAuszug EANBackblechBackblech EANPakete
" . $row["id"] . "" . $row["manufacturer"] . "" . $row["set_name"] . "" . $row["article_number"] . "" . generateBarcode($row["ean_barcode"]) . "" . $row["part1"] . "" . generateBarcode($row["part1_ean"]) . "" . $row["part2"] . "" . generateBarcode($row["part2_ean"]) . "" . $row["part3"] . "" . generateBarcode($row["part3_ean"]) . "" . $row["part4"] . "" . generateBarcode($row["part4_ean"]) . "" . $row["quantity"] . "
+ Hinzufügen +
+ + diff --git a/public/login.php b/public/login.php new file mode 100644 index 0000000..033eed8 --- /dev/null +++ b/public/login.php @@ -0,0 +1,72 @@ + + + + + + Login + + + +
+
+
+
+
Login
+
+
+
+ + +
+
+ + +
+ +
+ + + +
+
+
+
+
+ + diff --git a/public/logout.php b/public/logout.php new file mode 100644 index 0000000..774a63f --- /dev/null +++ b/public/logout.php @@ -0,0 +1,7 @@ + diff --git a/public/search.php b/public/search.php new file mode 100644 index 0000000..410cc66 --- /dev/null +++ b/public/search.php @@ -0,0 +1,196 @@ + 0, + 'padding' => 0, + 'fgcolor' => array(0, 0, 0), + 'bgcolor' => false, + 'module_width' => 0.5, + 'module_height' => 10 + ); + return $pdf->write1DBarcode($eanNumber, 'EAN13', '', '', '', 20, 1, $style, 'N'); +} + +if ($_SERVER["REQUEST_METHOD"] == "POST") { + $articleNumber = $_POST['article_number']; + $setName = $_POST['set_name']; + $sql = "SELECT * FROM articles WHERE article_number = ? OR set_name LIKE ?"; + $stmt = $conn->prepare($sql); + $stmt->bind_param("ss", $articleNumber, $setName); + $stmt->execute(); + $result = $stmt->get_result(); + + if ($result) { + if ($result->num_rows > 0) { + $articleData = $result->fetch_assoc(); + } else { + $error = "Artikel nicht gefunden."; + } + } else { + $error = "Fehler beim Ausführen der Abfrage: " . $conn->error; + } +} + +if (isset($_POST['download_pdf'])) { + if (!empty($articleData)) { + $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); + $pdf->SetCreator(PDF_CREATOR); + $pdf->SetAuthor('M_Viper'); + $pdf->SetTitle('Article Information'); + $pdf->SetSubject('Article Details'); + $pdf->SetKeywords('Article, Details, PDF'); + $pdf->AddPage(); + $pdf->SetFont('helvetica', '', 13); + + $html = ' +

 

+ + + + + + + + +
+

Hersteller: ' . $articleData['manufacturer'] . '

+

Bezeichnung: ' . $articleData['set_name'] . '

+

Artikelnummer: ' . $articleData['article_number'] . '

+

EAN: ' . $articleData['ean_barcode'] . '

+
+


+
+ '; + + // Adding additional tables for parts + $parts = array( + array("Bezeichnung" => "Backofen", "Teil" => $articleData['part1'], "EAN" => $articleData['part1_ean'], "Barcode" => $articleData['ean_barcode'], "Pakete" => $articleData['quantity']), + array("Bezeichnung" => "Kochfeld", "Teil" => $articleData['part2'], "EAN" => $articleData['part2_ean'], "Barcode" => '', "Pakete" => ''), + array("Bezeichnung" => "Auszug", "Teil" => $articleData['part3'], "EAN" => $articleData['part3_ean'], "Barcode" => '', "Pakete" => ''), + array("Bezeichnung" => "Backblech", "Teil" => $articleData['part4'], "EAN" => $articleData['part4_ean'], "Barcode" => '', "Pakete" => '') + ); + + foreach ($parts as $key => $part) { + $barcode = ($part["Barcode"] && $key === 0) ? generateEANBarcode($part["Barcode"], $pdf) : ''; + $html .= ' + + + + + +
+

' . $part["Bezeichnung"] . ': ' . $part["Teil"] . '

+

EAN: ' . $part["EAN"] . '

+
' . ($barcode ? $barcode : '') . '
+

 

'; + } + + $html .= ' + + + + +
Pakete: ' . $articleData['quantity'] . '
'; + + $pdf->writeHTML($html); + $pdf->Output($pdfDirectory . '/article_details.pdf', 'F'); + header('Content-Type: application/pdf'); + header('Content-Disposition: attachment; filename="article_details.pdf"'); + readfile($pdfDirectory . '/article_details.pdf'); + exit; + } else { + $error = "Keine Artikelinformationen gefunden."; + } +} +?> + + + + + + + + + + + + + Einbauherdset Suche + + +
+

Einbauherdset Suche

+ Title Image +
+
+ +
+

Artikel Details

+ +
+

Hersteller:

+
+
+

Artikelnummer:

+

Bezeichnung:

+

EAN Barcode:

+
+ + + + + +
+

:

+

Bezeichnung:

+

EAN Barcode:

+
+ + +
+

Pakete:

+

+
+
+ + +
+ +

+ +
+
+ + +