function resetInstall() { if (canConnect()) { require_once "config/db.php"; $mysqli = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME); $drop_sql = "drop table config; drop table servers; drop table users; drop table jars;"; mysqli_multi_query($mysqli, $drop_sql); } if (dbConfigExists()) { unlink("config/db.php"); } }
<?php require_once "php/install_functions.php"; if (isset($_POST['step']) || !dbConfigExists() || !canConnect() || !isPopulated()) { #echo("hola"); require_once "views/installation/install.php"; die; } // include the configs / constants for the database connection require_once "config/db.php"; //HEADER require_once "views/header.html"; $jar = False; $create = False; if (isset($_GET["jar"])) { $jar = True; } elseif (isset($_GET["create"])) { $create = True; } //NAV require_once "views/index/nav.php"; //CONTENT if (isset($_GET["jar"])) { require_once "views/index/jar.php"; } elseif (isset($_GET["create"])) { require_once "views/index/create.php"; } else { require_once "views/index/server.php"; } //FOOTER require_once "views/footer.html";
resetInstall(); echo addError("Couldnt setup Config File, Reseting Installation", "500"); die; } if (!createTables()) { #TODO: Request Specific error page resetInstall(); echo addError("Couldnt create Tables in given database, Reseting Installation", "500"); die; } require_once "views/installation/phase2.php"; break; case 3: // Step 3, Checking #Updates the tables, if everything is correct links to the index of the app if (!dbConfigExists() || !canConnect()) { echo addError("Instalation already Exist!", "403"); die; } $path = updatePath(); if (!createProyectFolder($path)) { #TODO: Request Specific error page resetInstall(); echo addError("Apache user must have write permissions on selected path (ie: /var/www/)", "400"); die; } require_once "views/installation/phase3.php"; break; } require_once "views/footer.html"; ?>