if (!empty($_GET["action"]) and $_GET["action"] == "w") { if (is_writable($path . "/libs/db.php")) { $fd = fopen($path . "/libs/db.php", "w+"); $foutput = "<?php\n"; $foutput .= "// Generate the " . date("j F, Y, h:i:s") . "\n"; $foutput .= "// For Php-pastebin\n"; $foutput .= "\$host = \"" . $_POST["hostname"] . "\";\n"; $foutput .= "\$user = \"" . $_POST["username"] . "\";\n"; $foutput .= "\$pass = \"" . $_POST["password"] . "\";\n"; $foutput .= "\$db = \"" . $_POST["database"] . "\";\n"; $foutput .= "// Please ! manipulate this file if you know what you made!\n"; $foutput .= ""; fwrite($fd, $foutput); fclose($fd); require $path . '/libs/startup.php'; executeQueryFile($path . "/libs/db.sql"); // Install OK :) $_SESSION['step_two'] = 'ok'; redirect("install.php?step=3"); } else { echo "<a href=\"install.php?step=2\" class=\"button\">Back</a><br /><br />"; echo mysql_error(); } } } if ($_GET["step"] == "3") { if (empty($_SESSION['step_two'])) { header('Location: install.php?step=2'); } else { if (isset($_GET['action']) && $_GET['action'] === 'update') { if (!empty($_POST['username'])) {
$fd = fopen($path . "/libs/db.php", "w+"); $foutput = "<?php\n"; $foutput .= "// Generate For Bittytorrent\n"; $foutput .= "\$dbhost = \"" . $_POST["hostname"] . "\";\n"; $foutput .= "\$dbuser = \"" . $_POST["username"] . "\";\n"; $foutput .= "\$dbpass = \"" . $_POST["password"] . "\";\n"; $foutput .= "\$dbname = \"" . $_POST["database"] . "\";\n"; $foutput .= "// Please ! manipulate this file if you know what you made!\n"; $foutput .= ""; fwrite($fd, $foutput); fclose($fd); } // var_dump($path); // require($path.'/libs/startup.php'); require $path . '/libs/db.php'; executeQueryFile($dbuser, $dbpass, $dbname, $dbhost); // Install OK :) $_SESSION['step_two'] = 'ok'; echo '<a href="install.php?step=3" class="button">Next step!!</a>'; // header("Location: install.php?step=3"); // exit(header("Location: install.php?step=3")); // redirect("install.php?step=3"); } } if ($_GET["step"] == "3") { if (empty($_SESSION['step_two'])) { header('Location: install.php?step=2'); } else { if (isset($_GET['action']) && $_GET['action'] === 'update') { if (!empty($_POST['path'])) { if (!empty($_POST['sitetitle'])) {
if (isset($_POST['namedb'])) { #si on veux creer la bdd directement sous mysql if (isset($_POST['createbd'])) { mysqli_query($link, "CREATE DATABASE " . $_POST['namedb'] . ";"); } #on selectionne la bdd $db = mysqli_select_db($link, $_POST['namedb']); #impossible de se connecter à la bdd if (!$db) { $msg .= '<div class="alert alert-dismissible alert-danger">'; $msg .= '<button type="button" class="close" data-dismiss="alert">X</button>'; $msg .= 'Impossible de se connecter à la base de donnée ' . $_POST['namedb'] . '!'; $msg .= '</div>'; } else { #on lis et execute le fichier sql executeQueryFile("banque.sql", $link); #on ouvre le fichier constantes.php en lecture/écriture $dz = fopen("constantes.php", "w"); #on arrive pas à l'ouvrir if (!$dz) { $msg .= '<div class="alert alert-dismissible alert-danger">'; $msg .= '<button type="button" class="close" data-dismiss="alert">X</button>'; $msg .= 'Impossible d\'ouvrir le fichier constante.php , merci de reporter le bug sur github !'; $msg .= '</div>'; } else { $fileData = <<<EOF <?php Define("db_serveur","{$_POST['serveur']}"); Define("db_dbname","{$_POST['namedb']}"); Define("db_user","{$_POST['identifiant']}"); Define("db_password","{$_POST['password']}");