\Lobby\Install::dbConfig(array("host" => $dbhost, "port" => $dbport, "dbname" => $dbname, "username" => $username, "password" => $password, "prefix" => $prefix)); /** * First, check if prefix is valid * Check if connection to database can be established using the credentials given by the user */ if ($prefix == "" || preg_match("/[^0-9,a-z,A-Z,\$,_]+/i", $prefix) != 0 || strlen($prefix) > 50) { ser("Error", "A Prefix should only contain basic Latin letters, digits 0-9, dollar, underscore and shouldn't exceed 50 characters. <a href='install.php?step=2'>Try Again</a>"); } elseif (\Lobby\Install::checkDatabaseConnection() !== false) { /** * Make the Config File */ \Lobby\Install::makeConfigFile(); /** * Create Tables */ if (\Lobby\Install::makeDatabase($prefix)) { sss("Success", "Database Tables and configuration file was successfully created."); /** * Enable app lEdit */ \Lobby::$installed = true; \Lobby\DB::init(); $App = new \Lobby\Apps("ledit"); $App->enableApp(); echo '<cl/><a href="?step=3" class="button">Proceed</a>'; } else { ser("Unable To Create Database Tables", "Are there any tables with the same name ? Or Does the user have the permissions to create tables ?<cl/>The <b>config.php</b> file is created. To try again, remove the <b>config.php</b> file and click the button. <cl/>" . \Lobby::l("/admin/install.php?step=2", "Try Again", "class='button'")); } } } else { ?>
} } else { $db_loc = $_POST['db_location']; $db_create = \Lobby\Install::createSQLiteDB($db_loc); /** * Prefix is "l_" and can't be changed */ if ($db_create && \Lobby\Install::makeDatabase("l_", "sqlite")) { /** * We give the database config to the Install Class */ \Lobby\Install::dbConfig(array("path" => str_replace(L_DIR, "", $db_loc), "prefix" => "l_")); /** * Make the Config File */ \Lobby\Install::makeConfigFile("sqlite"); /** * Enable app lEdit */ \Lobby::$installed = true; \Lobby\DB::__constructStatic(); $App = new \Lobby\Apps("ledit"); $App->enableApp(); echo sss("Success", "Database and <b>config.php</b> file was successfully created."); echo '<cl/><a href="?step=4' . CSRF::getParam() . '" class="btn">Proceed</a>'; } else { echo ser("Couldn't Make SQLite Database", "I was unable to make the database. Error :<blockquote>" . \Lobby\Install::$error . "</blockquote> <cl/>" . \Lobby::l("/admin/install.php?step=3&db_type=sqlite" . CSRF::getParam(), "Try Again", "class='btn'")); } } } else { if ($db_type === "mysql") {