Dateien nach "install" hochladen
This commit is contained in:
		
							
								
								
									
										10
									
								
								install/index.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								install/index.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,10 @@
 | 
				
			|||||||
 | 
					<!DOCTYPE html>
 | 
				
			||||||
 | 
					<html>
 | 
				
			||||||
 | 
					<head>
 | 
				
			||||||
 | 
					    <title>Installation</title>
 | 
				
			||||||
 | 
					</head>
 | 
				
			||||||
 | 
					<body>
 | 
				
			||||||
 | 
					    <h2>Installation Completed</h2>
 | 
				
			||||||
 | 
					    <p>Installation is completed. You can now proceed to the <a href="../public/search.php">search page</a>.</p>
 | 
				
			||||||
 | 
					</body>
 | 
				
			||||||
 | 
					</html>
 | 
				
			||||||
							
								
								
									
										65
									
								
								install/install.css
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										65
									
								
								install/install.css
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,65 @@
 | 
				
			|||||||
 | 
					/* Allgemeine Stile */
 | 
				
			||||||
 | 
					body {
 | 
				
			||||||
 | 
					    font-family: 'Roboto', sans-serif;
 | 
				
			||||||
 | 
					    background-color: #f4f4f4;
 | 
				
			||||||
 | 
					    margin: 0;
 | 
				
			||||||
 | 
					    padding: 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.container {
 | 
				
			||||||
 | 
					    display: flex;
 | 
				
			||||||
 | 
					    justify-content: center;
 | 
				
			||||||
 | 
					    align-items: center;
 | 
				
			||||||
 | 
					    height: 100vh;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.box {
 | 
				
			||||||
 | 
					    max-width: 400px;
 | 
				
			||||||
 | 
					    width: 100%;
 | 
				
			||||||
 | 
					    background-color: #fff;
 | 
				
			||||||
 | 
					    border-radius: 8px;
 | 
				
			||||||
 | 
					    box-shadow: 0px 0px 20px rgba(0, 0, 0, 0.1);
 | 
				
			||||||
 | 
					    padding: 40px;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					h2 {
 | 
				
			||||||
 | 
					    text-align: center;
 | 
				
			||||||
 | 
					    margin-bottom: 30px;
 | 
				
			||||||
 | 
					    color: #333;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					form {
 | 
				
			||||||
 | 
					    text-align: left;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					label {
 | 
				
			||||||
 | 
					    display: block;
 | 
				
			||||||
 | 
					    margin-bottom: 5px;
 | 
				
			||||||
 | 
					    color: #555;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					input[type="text"],
 | 
				
			||||||
 | 
					input[type="password"] {
 | 
				
			||||||
 | 
					    width: 100%;
 | 
				
			||||||
 | 
					    padding: 10px;
 | 
				
			||||||
 | 
					    border: 1px solid #ccc;
 | 
				
			||||||
 | 
					    border-radius: 5px;
 | 
				
			||||||
 | 
					    font-size: 16px;
 | 
				
			||||||
 | 
					    margin-bottom: 10px;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					input[type="submit"] {
 | 
				
			||||||
 | 
					    width: 100%;
 | 
				
			||||||
 | 
					    padding: 12px;
 | 
				
			||||||
 | 
					    background-color: #007bff;
 | 
				
			||||||
 | 
					    color: #fff;
 | 
				
			||||||
 | 
					    border: none;
 | 
				
			||||||
 | 
					    border-radius: 5px;
 | 
				
			||||||
 | 
					    cursor: pointer;
 | 
				
			||||||
 | 
					    font-size: 16px;
 | 
				
			||||||
 | 
					    transition: background-color 0.3s ease;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					input[type="submit"]:hover {
 | 
				
			||||||
 | 
					    background-color: #0056b3;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										87
									
								
								install/install.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										87
									
								
								install/install.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,87 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					if ($_SERVER["REQUEST_METHOD"] == "POST") {
 | 
				
			||||||
 | 
					    // Verbindung zur MySQL-Datenbank herstellen
 | 
				
			||||||
 | 
					    $servername = $_POST['servername'];
 | 
				
			||||||
 | 
					    $username = $_POST['username'];
 | 
				
			||||||
 | 
					    $password = $_POST['password'];
 | 
				
			||||||
 | 
					    $database = $_POST['database'];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    $conn = new mysqli($servername, $username, $password);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Überprüfen, ob die Verbindung erfolgreich war
 | 
				
			||||||
 | 
					    if ($conn->connect_error) {
 | 
				
			||||||
 | 
					        die("Connection failed: " . $conn->connect_error);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Datenbank erstellen
 | 
				
			||||||
 | 
					    $sqlCreateDb = "CREATE DATABASE IF NOT EXISTS $database";
 | 
				
			||||||
 | 
					    if ($conn->query($sqlCreateDb) === TRUE) {
 | 
				
			||||||
 | 
					        // Datenbank wurde erfolgreich erstellt
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Datenbanktabellen erstellen
 | 
				
			||||||
 | 
					        $conn->select_db($database);
 | 
				
			||||||
 | 
					        $sqlCreateTable = "
 | 
				
			||||||
 | 
					            CREATE TABLE IF NOT EXISTS articles (
 | 
				
			||||||
 | 
									id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
 | 
				
			||||||
 | 
									manufacturer VARCHAR(255) NOT NULL,
 | 
				
			||||||
 | 
									set_name VARCHAR(255),
 | 
				
			||||||
 | 
									article_number VARCHAR(255) NOT NULL,
 | 
				
			||||||
 | 
									ean_barcode VARCHAR(255),
 | 
				
			||||||
 | 
									part1 VARCHAR(255),
 | 
				
			||||||
 | 
									part1_ean VARCHAR(255),
 | 
				
			||||||
 | 
									part2 VARCHAR(255),
 | 
				
			||||||
 | 
									part2_ean VARCHAR(255),
 | 
				
			||||||
 | 
									part3 VARCHAR(255),
 | 
				
			||||||
 | 
									part3_ean VARCHAR(255),
 | 
				
			||||||
 | 
									part4 VARCHAR(255),
 | 
				
			||||||
 | 
									part4_ean VARCHAR(255),
 | 
				
			||||||
 | 
									quantity INT(6)
 | 
				
			||||||
 | 
								)
 | 
				
			||||||
 | 
					        ";
 | 
				
			||||||
 | 
					        if ($conn->query($sqlCreateTable) === TRUE) {
 | 
				
			||||||
 | 
					            // Datenbank und Tabellen wurden erfolgreich erstellt
 | 
				
			||||||
 | 
					            // Konfigurationsdatei schreiben
 | 
				
			||||||
 | 
					            $configFile = '../config/config.php';
 | 
				
			||||||
 | 
					            $configData = '<?php return ' . var_export($_POST, true) . ';';
 | 
				
			||||||
 | 
					            file_put_contents($configFile, $configData);
 | 
				
			||||||
 | 
					            
 | 
				
			||||||
 | 
					            // Weiterleitung zur Index-Seite
 | 
				
			||||||
 | 
					            header('Location: index.php');
 | 
				
			||||||
 | 
					            exit;
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            echo "Error creating table: " . $conn->error;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					        echo "Error creating database: " . $conn->error;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Verbindung schließen
 | 
				
			||||||
 | 
					    $conn->close();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					?>
 | 
				
			||||||
 | 
					<!DOCTYPE html>
 | 
				
			||||||
 | 
					<html>
 | 
				
			||||||
 | 
					<head>
 | 
				
			||||||
 | 
					    <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet">
 | 
				
			||||||
 | 
					    <link rel="stylesheet" href="install.css">
 | 
				
			||||||
 | 
					    <title>Install</title>
 | 
				
			||||||
 | 
					</head>
 | 
				
			||||||
 | 
					<body>
 | 
				
			||||||
 | 
					    <div class="container">
 | 
				
			||||||
 | 
					        <div class="box">
 | 
				
			||||||
 | 
					            <h2>Database Configuration</h2>
 | 
				
			||||||
 | 
					            <form method="post">
 | 
				
			||||||
 | 
					                <label>Servername:</label>
 | 
				
			||||||
 | 
					                <input type="text" name="servername" required><br><br>
 | 
				
			||||||
 | 
					                <label>Username:</label>
 | 
				
			||||||
 | 
					                <input type="text" name="username" required><br><br>
 | 
				
			||||||
 | 
					                <label>Password:</label>
 | 
				
			||||||
 | 
					                <input type="password" name="password"><br><br>
 | 
				
			||||||
 | 
					                <label>Database:</label>
 | 
				
			||||||
 | 
					                <input type="text" name="database" required><br><br>
 | 
				
			||||||
 | 
					                <input type="submit" value="Submit">
 | 
				
			||||||
 | 
					            </form>
 | 
				
			||||||
 | 
					        </div>
 | 
				
			||||||
 | 
					    </div>
 | 
				
			||||||
 | 
					</body>
 | 
				
			||||||
 | 
					</html>
 | 
				
			||||||
		Reference in New Issue
	
	Block a user