Advertisement
Palareas

install/index.php

Jun 19th, 2014
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 8.15 KB | None | 0 0
  1. <?php  
  2.  
  3. $step = $_GET['step'];  
  4. $host = $_SERVER['HTTP_HOST'];  
  5.  
  6. @include "../config.php";  
  7.  
  8. $path = substr(str_replace("/install/index.php", "", $_SERVER['SCRIPT_NAME']), '1');  
  9.  
  10. // Connect to the database  
  11. $connection = @mysql_connect($server, $dbusername, $dbpassword);  
  12.  
  13. // Select the database  
  14. @mysql_select_db($dbname);  
  15.  
  16. $mode = $_GET['mode'];  
  17.  
  18. // MySQL tables und datas  
  19.     include "mysql/tables.php";  
  20.     include "mysql/data.php";  
  21.  
  22. // Start installation-assistent  
  23. if (!isset($step)) {  
  24.     echo "<div><b>Willkommen zur Installation</b></div>";  
  25.     echo "<div>";  
  26.     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.";  
  27.     echo "<a href='index.php?step=1'>Weiter</a></div>";  
  28.     echo "</div>";  
  29. }  
  30.  
  31. // Step 1: MySQL-Data  
  32. if ($step == '1') {  
  33.     echo "<div><b>Installation - MySQL-Zugangsdaten</b></div>";  
  34.     echo "<div>";  
  35.     echo "Geben Sie hier bitte ihre MySQL-Zugangsdaten ein.";  
  36.     echo "<br>";  
  37.     echo "<form action='index.php?step=2' method='post'>";  
  38.     echo "<table width='100%'>";  
  39.     echo "<tr><td width='17%'>Server:</font></td><td>&nbsp;<input class='input' type='text' name='server' value='localhost' /></td></tr>";  
  40.     echo "<tr><td width='17%'>Username:</font></td><td>&nbsp;<input class='input' type='text' name='mysql_username' /></td></tr>";  
  41.     echo "<tr><td width='17%'>Passwort:</font></td><td>&nbsp;<input class='input' type='password' name='mysql_password' /></td></tr>";  
  42.     echo "<tr><td width='17%'>Datenbank:</font></td><td>&nbsp;<input class='input' type='text' name='mysql_db' /></td></tr>";  
  43.     echo "<tr><td width='17%'>Tabellen-Prefix:</font></td><td>&nbsp;<input class='input' type='text' name='mysql_prefix' value='Palareas CMS' /></td></tr>";  
  44.     echo "</table>";  
  45.     echo "<br>";  
  46.  
  47.     if (!($handle = @fopen("../config.php", w))) {  
  48.         echo "<font color='red'><b>Deine config.php ist nicht beschreibbar!</b></font>";  
  49.     } else {  
  50.         echo "<font color='green'><b>Deine config.php ist beschreibbar.</b></font>";  
  51.     }  
  52.  
  53.     echo "<br>";  
  54.     $_SESSION['prefix'] = $_POST['mysql_prefix'];  
  55.     echo "<input class='button' type='submit' value='Weiter'>";  
  56.     echo "</form></div>";  
  57. }  
  58.  
  59. // Step 2: Check Connection  
  60. if ($step == '2') {  
  61.     $server = $_POST['server'];  
  62.     $mysql_username = $_POST['mysql_username'];  
  63.     $mysql_password = $_POST['mysql_password'];  
  64.     $mysql_db = $_POST['mysql_db'];  
  65.     $mysql_prefix = $_POST['mysql_prefix'];  
  66.      
  67.     // error MySQL-Username  
  68.     if (empty($mysql_username)) {  
  69.         echo "<div><b>Fehlende Angaben</b></div>";  
  70.         echo "<div>";  
  71.         echo "Sie haben vergessen einen MySQL-Usernamen anzugeben. Korrigiere Sie bitte ihre Angaben.";  
  72.         echo "<br>";  
  73.         echo "<a href='index.php?step=1' style='text-decoration: none'>Zurück</a>";  
  74.         echo "</div>";  
  75.         exit();  
  76.     }  
  77.     // error MySQL-Database  
  78.     if (empty($mysql_db)) {  
  79.         echo "<div><b>Fehlende Angaben</b></div>";  
  80.         echo "<div id='content'>";  
  81.         echo "Sie haben vergessen eine MySQL-Datenbank anzugeben. Korrigieren Sie bitte ihre Angaben.";  
  82.         echo "<br>";  
  83.         echo "<a href='index.php?step=1' style='text-decoration: none'>Zurück</a>";  
  84.         echo "</div>";  
  85.         exit();  
  86.     }  
  87.      
  88.     // error config.php  
  89.     if (!($handle = @fopen("../config.php", w))) {  
  90.         echo "<div><b>Fehler</b></div>";  
  91.         echo "<div>";  
  92.         echo "Ihre <b>config.php</b> ist leider nicht beschreibbar. Sie müssen die Rechte der Datei auf <b>0777</b> setzen.";  
  93.         echo "<br>";  
  94.         echo "<a href='index.php?step=1' style='text-decoration: none'>Zurück</a></div>";  
  95.     } else {  
  96.         //  
  97.         // Let's go and write the config.php  
  98.         //  
  99.         $write_config = "<?php\n\n";  
  100.         $write_config .= "\$server = \"$server\";\n";  
  101.         $write_config .= "\$dbname = \"$mysql_db\";\n";  
  102.         $write_config .= "\$dbusername = \"$mysql_username\";\n";  
  103.         $write_config .= "\$dbpassword = \"$mysql_password\";\n";  
  104.         $write_config .= "\$dbprefix = \"$mysql_prefix\";\n\n";  
  105.         $write_config .= "\n\n?>";  
  106.         fwrite($handle, $write_config);  
  107.         fclose($handle);  
  108.         echo "<div><b>MySQL-Konfiguration abgeschlossen.</b></div>";  
  109.         echo "<div id='content'>";  
  110.         echo "Glückwunsch, das Erste haben Sie geschafft. Die config.php wurde erstellt. Jetzt muss nur noch der Administrator eingerichtet werden.";  
  111.         echo "<br>";  
  112.         echo "<a href='index.php?step=3' style='text-decoration: none'>Weiter</a></div>";  
  113.     }  
  114. }  
  115.  
  116. // Step 3: Configurate the Administrator  
  117. if ($step == '3') {  
  118.  
  119.     if ($connection == false) {  
  120.         echo "<div><b>Falsche Zugangsdaten</b></div>";  
  121.         echo "<div>";  
  122.         echo "Die eingegebenen Zugangsdaten für Ihre Datenbank waren falsch. Bitte versuchen Sie es erneut.";  
  123.         echo "<br>";  
  124.         echo "<a href='index.php' style='text-decoration: none'>Zurück</a>";  
  125.         echo "</div>";  
  126.         @unlink("../config.php");  
  127.         exit();  
  128.     }  
  129.  
  130.     echo "<div><b>Installation - Abschluss</b></div>";  
  131.     echo "<div>";  
  132.     echo "Bitte geben Sie hier noch die letzten Daten zur Konfiguration ihrer Homepage ein.";  
  133.     echo "<br><br>";  
  134.     echo "<b>Allgemeine Konfigurationsdaten</b>";  
  135.     echo "<br><br>";  
  136.     echo "<form action='index.php?step=4' method='post'>";  
  137.     echo "<table width='100%'>";  
  138.     echo "<tr><td width='20%'>Domainname:</font></td><td>&nbsp;<input class='input' type='text' name='domain_name' size='32' value='$host' /></td></tr>";  
  139.     echo "<tr><td width='20%'>Websitename:</font></td><td>&nbsp;<input class='input' type='text' name='website_name' size='32' /></td></tr>";  
  140.     echo "<tr><td width='20%'>Pfad:</font></td><td>&nbsp;<input class='input' type='text' name='path_name' size='32' value='$path' /></td></tr>";  
  141.     echo "<tr><td width='20%'>E-Mail-Adresse:</font></td><td>&nbsp;<input class='input' type='text' name='email' size='32' /></td></tr>";  
  142.     echo "<tr><td width='20%'>Footer-Titel:</font></td><td>&nbsp;<input class='input' type='text' name='footer_name' size='32' /></td></tr>";  
  143.     echo "</table>";  
  144.     echo "<br>";  
  145.     echo "<b>Zugangsdaten für den Administrator:</b>";  
  146.     echo "<br /><br />";  
  147.     echo "<table width='100%'>";  
  148.     echo "<tr><td width='20%'>Username:</font></td><td>&nbsp;<input class='input' type='text' name='username' /></td></tr>";  
  149.     echo "<tr><td width='20%'>Passwort:</font></td><td>&nbsp;<input class='input' type='password' name='password' /></td></tr>";  
  150.     echo "<tr><td width='20%'>E-Mail-Adresse:</font></td><td>&nbsp;<input class='input' type='text' name='admin_email' /></td></tr>";  
  151.     echo "</table>";  
  152.     echo "<br />";  
  153.     echo "<input class='button' type='submit' value='Weiter'/>";  
  154.     echo "</form></div>";  
  155. }  
  156.  
  157. // Step 4: create and fill in mysql-tables  
  158. if ($step == '4') {  
  159.     if (empty($dn) OR empty($email) OR empty($username) OR empty($md5_pass) OR empty($admin_email)) {  
  160.         echo "<div><b>Fehlende Angaben</b></div>";  
  161.         echo "<div>";  
  162.         echo "Sie haben vergessen, ein oder mehrere Felder auszufüllen. Bitte korregieren sie ihre Angaben.";  
  163.         echo "<br>";  
  164.         echo "<a href='index.php?step=3' style='text-decoration: none'>Zurück</a>";  
  165.         echo "</div>";  
  166.         exit();  
  167.     }  
  168.  
  169.     mysql_query($create[abq]);  
  170.     mysql_query($insert[categories]);  
  171.  
  172.     echo "<div><b>Installation erfolgreich!</b></div>";  
  173.     echo "<div>";  
  174.     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>!";  
  175.     echo "<br><br>";  
  176.     echo "<a href='../index.php' style='text-decoration: none'>Zur Startseite</a>";  
  177.     echo "</div>";  
  178. }  
  179.  
  180. // fertig  
  181.  
  182. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement