diff --git a/error/tables-not-found.php b/error/tables-not-found.php
index 20fedcb..3469e51 100644
--- a/error/tables-not-found.php
+++ b/error/tables-not-found.php
@@ -14,17 +14,28 @@
The web interface has connected to the database, but could not find any tables generated by LiteBans.
- This means that the plugin has not successfully connected to this database before with the same configuration.
+ This means that the plugin has not successfully connected to this database before with the same
+ configuration.
LiteBans needs to be connected to this database before the web interface can display anything!
Solutions:
- - Check the startup logs to see if there are any errors.
+ - Check that LiteBans has successfully connected to a MySQL database using
/litebans
+ info
- - Ensure that the plugin is using the MySQL driver (not SQLite) to connect to the database.
-
- - Ensure that the table prefix is the same in config.yml and settings.php.
+ - Ensure that the plugin is using the MySQL driver (
driver: MySQL in config.yml) to
+ connect to the database.
+ host;
+ if ($host === "localhost" || $host === "127.0.0.1") {
+ echo("
- The web interface is connected to
$host. If LiteBans and the web interface are both connected to
$host, they should not be hosted on two separate servers.");
+ }
+ $table_prefix = $settings->table_prefix;
+ echo("
- Ensure that the table prefix is the same in config.yml and settings.php. The table prefix in settings.php is currently set to
\"$table_prefix\".")
+ ?>
- Ensure that you are using the latest version of LiteBans.
diff --git a/inc/settings.php b/inc/settings.php
index d7ba078..d160e6a 100644
--- a/inc/settings.php
+++ b/inc/settings.php
@@ -8,8 +8,8 @@ final class Settings {
$this->lang = 'en_US.utf8';
// Database information
- $host = 'localhost';
- $port = 3306;
+ $this->host = 'localhost';
+ $this->port = 3306;
$database = 'litebans';
@@ -17,7 +17,7 @@ final class Settings {
$password = '';
// If you set a table prefix in config.yml, set it here as well
- $table_prefix = "litebans_";
+ $this->table_prefix = "litebans_";
// Supported drivers: mysql, pgsql
$driver = 'mysql';
@@ -110,6 +110,7 @@ final class Settings {
if (!$this->show_inactive_bans) {
$this->active_query = "WHERE active=" . Settings::$TRUE;
}
+ $table_prefix = $this->table_prefix;
// Internal table names, do not translate.
$this->table = array(
@@ -126,6 +127,8 @@ final class Settings {
if ($username === "" && $password === "") {
$this->redirect("error/unconfigured.php");
}
+ $host = $this->host;
+ $port = $this->port;
$dsn = "$driver:dbname=$database;host=$host;port=$port";
if ($driver === 'mysql') {