コード例 #1
0
ファイル: step-2.php プロジェクト: SkeletonEye/ProjectEngine
 }
 // Adds mysql access data to config
 Application::setConfigValue("mysql/access/database", "\"" . $_REQUEST["database"] . "\"");
 Application::setConfigValue("mysql/access/hostname", "\"" . $_REQUEST["hostname"] . "\"");
 Application::setConfigValue("mysql/access/port", "\"" . $_REQUEST["port"] . "\"");
 if ($_REQUEST["password"] == "") {
     Application::setConfigValue("mysql/access/password", "null");
 } else {
     Application::setConfigValue("mysql/access/password", "\"" . $_REQUEST["password"] . "\"");
 }
 Application::setConfigValue("mysql/access/username", "\"" . $_REQUEST["username"] . "\"");
 Application::setConfigValue("mysql/driver", "\"pdo\"");
 // Adds the other options to config
 Application::setConfigValue("authentication/guests", $_REQUEST["guests"]);
 // Adds some default values to config
 Application::setConfigValue("mode", "true");
 // Tests MySQL connection
 Application::initalize();
 $success = true;
 try {
     Application::$connection->connect();
 } catch (MySQLException $exception) {
     $success = false;
     $error = $exception->getError();
 }
 // Redirects to the next step or shows an error message
 if ($success) {
     $file = fopen("../local/installer.txt", "w");
     fwrite($file, "3");
     fclose($file);
     header("Location: " . preg_replace("/\\?.*/", "", $_SERVER["REQUEST_URI"]));