Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $step = $_GET['step'];
- $host = $_SERVER['HTTP_HOST'];
- @include "../config.php";
- $path = substr(str_replace("/install/index.php", "", $_SERVER['SCRIPT_NAME']), '1');
- // Connect to the database
- $connection = @mysql_connect($server, $dbusername, $dbpassword);
- // Select the database
- @mysql_select_db($dbname);
- $mode = $_GET['mode'];
- // MySQL tables und datas
- include "mysql/tables.php";
- include "mysql/data.php";
- // Start installation-assistent
- if (!isset($step)) {
- echo "<div><b>Willkommen zur Installation</b></div>";
- echo "<div>";
- echo "Vielen Dank, dass Sie sich zur Installation von Palareas CMS entschieden hast. Um Palareas CMS zu installieren, klicken Sie bitte auf weiter. Wenn Sie Palareas CMS vergebens installiert haben, löschen sie die config.php und starten diesen Installationsassistenten erneut.";
- echo "<a href='index.php?step=1'>Weiter</a></div>";
- echo "</div>";
- }
- // Step 1: MySQL-Data
- if ($step == '1') {
- echo "<div><b>Installation - MySQL-Zugangsdaten</b></div>";
- echo "<div>";
- echo "Geben Sie hier bitte ihre MySQL-Zugangsdaten ein.";
- echo "<br>";
- echo "<form action='index.php?step=2' method='post'>";
- echo "<table width='100%'>";
- echo "<tr><td width='17%'>Server:</font></td><td> <input class='input' type='text' name='server' value='localhost' /></td></tr>";
- echo "<tr><td width='17%'>Username:</font></td><td> <input class='input' type='text' name='mysql_username' /></td></tr>";
- echo "<tr><td width='17%'>Passwort:</font></td><td> <input class='input' type='password' name='mysql_password' /></td></tr>";
- echo "<tr><td width='17%'>Datenbank:</font></td><td> <input class='input' type='text' name='mysql_db' /></td></tr>";
- echo "<tr><td width='17%'>Tabellen-Prefix:</font></td><td> <input class='input' type='text' name='mysql_prefix' value='Palareas CMS' /></td></tr>";
- echo "</table>";
- echo "<br>";
- if (!($handle = @fopen("../config.php", w))) {
- echo "<font color='red'><b>Deine config.php ist nicht beschreibbar!</b></font>";
- } else {
- echo "<font color='green'><b>Deine config.php ist beschreibbar.</b></font>";
- }
- echo "<br>";
- $_SESSION['prefix'] = $_POST['mysql_prefix'];
- echo "<input class='button' type='submit' value='Weiter'>";
- echo "</form></div>";
- }
- // Step 2: Check Connection
- if ($step == '2') {
- $server = $_POST['server'];
- $mysql_username = $_POST['mysql_username'];
- $mysql_password = $_POST['mysql_password'];
- $mysql_db = $_POST['mysql_db'];
- $mysql_prefix = $_POST['mysql_prefix'];
- // error MySQL-Username
- if (empty($mysql_username)) {
- echo "<div><b>Fehlende Angaben</b></div>";
- echo "<div>";
- echo "Sie haben vergessen einen MySQL-Usernamen anzugeben. Korrigiere Sie bitte ihre Angaben.";
- echo "<br>";
- echo "<a href='index.php?step=1' style='text-decoration: none'>Zurück</a>";
- echo "</div>";
- exit();
- }
- // error MySQL-Database
- if (empty($mysql_db)) {
- echo "<div><b>Fehlende Angaben</b></div>";
- echo "<div id='content'>";
- echo "Sie haben vergessen eine MySQL-Datenbank anzugeben. Korrigieren Sie bitte ihre Angaben.";
- echo "<br>";
- echo "<a href='index.php?step=1' style='text-decoration: none'>Zurück</a>";
- echo "</div>";
- exit();
- }
- // error config.php
- if (!($handle = @fopen("../config.php", w))) {
- echo "<div><b>Fehler</b></div>";
- echo "<div>";
- echo "Ihre <b>config.php</b> ist leider nicht beschreibbar. Sie müssen die Rechte der Datei auf <b>0777</b> setzen.";
- echo "<br>";
- echo "<a href='index.php?step=1' style='text-decoration: none'>Zurück</a></div>";
- } else {
- //
- // Let's go and write the config.php
- //
- $write_config = "<?php\n\n";
- $write_config .= "\$server = \"$server\";\n";
- $write_config .= "\$dbname = \"$mysql_db\";\n";
- $write_config .= "\$dbusername = \"$mysql_username\";\n";
- $write_config .= "\$dbpassword = \"$mysql_password\";\n";
- $write_config .= "\$dbprefix = \"$mysql_prefix\";\n\n";
- $write_config .= "\n\n?>";
- fwrite($handle, $write_config);
- fclose($handle);
- echo "<div><b>MySQL-Konfiguration abgeschlossen.</b></div>";
- echo "<div id='content'>";
- echo "Glückwunsch, das Erste haben Sie geschafft. Die config.php wurde erstellt. Jetzt muss nur noch der Administrator eingerichtet werden.";
- echo "<br>";
- echo "<a href='index.php?step=3' style='text-decoration: none'>Weiter</a></div>";
- }
- }
- // Step 3: Configurate the Administrator
- if ($step == '3') {
- if ($connection == false) {
- echo "<div><b>Falsche Zugangsdaten</b></div>";
- echo "<div>";
- echo "Die eingegebenen Zugangsdaten für Ihre Datenbank waren falsch. Bitte versuchen Sie es erneut.";
- echo "<br>";
- echo "<a href='index.php' style='text-decoration: none'>Zurück</a>";
- echo "</div>";
- @unlink("../config.php");
- exit();
- }
- echo "<div><b>Installation - Abschluss</b></div>";
- echo "<div>";
- echo "Bitte geben Sie hier noch die letzten Daten zur Konfiguration ihrer Homepage ein.";
- echo "<br><br>";
- echo "<b>Allgemeine Konfigurationsdaten</b>";
- echo "<br><br>";
- echo "<form action='index.php?step=4' method='post'>";
- echo "<table width='100%'>";
- echo "<tr><td width='20%'>Domainname:</font></td><td> <input class='input' type='text' name='domain_name' size='32' value='$host' /></td></tr>";
- echo "<tr><td width='20%'>Websitename:</font></td><td> <input class='input' type='text' name='website_name' size='32' /></td></tr>";
- echo "<tr><td width='20%'>Pfad:</font></td><td> <input class='input' type='text' name='path_name' size='32' value='$path' /></td></tr>";
- echo "<tr><td width='20%'>E-Mail-Adresse:</font></td><td> <input class='input' type='text' name='email' size='32' /></td></tr>";
- echo "<tr><td width='20%'>Footer-Titel:</font></td><td> <input class='input' type='text' name='footer_name' size='32' /></td></tr>";
- echo "</table>";
- echo "<br>";
- echo "<b>Zugangsdaten für den Administrator:</b>";
- echo "<br /><br />";
- echo "<table width='100%'>";
- echo "<tr><td width='20%'>Username:</font></td><td> <input class='input' type='text' name='username' /></td></tr>";
- echo "<tr><td width='20%'>Passwort:</font></td><td> <input class='input' type='password' name='password' /></td></tr>";
- echo "<tr><td width='20%'>E-Mail-Adresse:</font></td><td> <input class='input' type='text' name='admin_email' /></td></tr>";
- echo "</table>";
- echo "<br />";
- echo "<input class='button' type='submit' value='Weiter'/>";
- echo "</form></div>";
- }
- // Step 4: create and fill in mysql-tables
- if ($step == '4') {
- if (empty($dn) OR empty($email) OR empty($username) OR empty($md5_pass) OR empty($admin_email)) {
- echo "<div><b>Fehlende Angaben</b></div>";
- echo "<div>";
- echo "Sie haben vergessen, ein oder mehrere Felder auszufüllen. Bitte korregieren sie ihre Angaben.";
- echo "<br>";
- echo "<a href='index.php?step=3' style='text-decoration: none'>Zurück</a>";
- echo "</div>";
- exit();
- }
- mysql_query($create[abq]);
- mysql_query($insert[categories]);
- echo "<div><b>Installation erfolgreich!</b></div>";
- echo "<div>";
- echo "Vielen Dank, dass Sie sich für Palareas CMS entschieden haben. Die Installation war erfolgreich. Bitte löschen Sie unbedingt den Ordner <b>install/</b>!";
- echo "<br><br>";
- echo "<a href='../index.php' style='text-decoration: none'>Zur Startseite</a>";
- echo "</div>";
- }
- // fertig
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement