} function GetPassword() { return $this->password; } function GetName() { return $this->name; } function GetServer() { return $this->server; } function GetConnection() { return $this->connection; } } $database = new Database(); $database->SetServer($DB_SERVER); $database->SetUsername($DB_USER); $database->SetPassword($DB_PASS); $database->SetName($DB_NAME); $database->Connect(); if ($module_name != "error") { if ($database->IsConnected()) { $database->SelectDB(); } else { echo "<script language='Javascript'>window.location = \"/" . $WEB_SITE . "pages/pgErrorDatabase.php\";</script>"; } }
} else { if (isset($credential['socket'])) { Database::ConnectSocket($credential['user'], $credential['password'], $credential['database'], $credential['socket'], $credential['driver'], $credential['charset']); } else { Lightwork::Log('Could not find fitting driver using current database configuration.', Lightwork::LOG_FATAL_ERROR); } } } } } else { Lightwork::Log('Tried to use unsupported database driver!', Lightwork::LOG_FATAL_ERROR); } } else { Lightwork::Log('Invalid database configuration!', Lightwork::LOG_FATAL_ERROR); } if (Database::IsConnected()) { if ($name != 'main') { Lightwork::Log('Running from backup database! Please check your database connection.', Lightwork::LOG_WARN); http_response_code(200); } break; } } unset($credentials); // Remove credentials so they can not be used anywhere else if (METHOD != 'CLI') { session_name('session'); // Prevent exposing PHP by renaming its session session_set_save_handler(new SessionHandler(), true); // Set the session handler to a Lightwork session handler session_set_cookie_params(2147483647 - time(), WEB_ROOT, DOMAIN, COOKIE_SSL, true);