Add unconfigured.php

This commit is contained in:
ruan 2016-01-11 08:10:11 +02:00
parent f77a5944d0
commit 676931a4a9
2 changed files with 34 additions and 2 deletions

28
error/unconfigured.php Normal file
View File

@ -0,0 +1,28 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<title>litebans-php - Unconfigured</title>
<link href="../inc/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="jumbotron">
<h2>Unconfigured</h2><br>
<div class="text-success">
Welcome to the LiteBans web interface!
<br>
To get started, edit <a class="text-warning">inc/settings.php</a> and fill in your database information.
<br>
After configuration has been completed, click <a class="text-warning">"Try Again"</a>.
<br>
</div>
<br>
<a href="../" class="btn btn-default">Try Again</a>
</div>
</div>
</body>
</html>

View File

@ -16,8 +16,8 @@ final class Settings {
$database = 'litebans';
$username = 'root';
$password = 'password';
$username = '';
$password = '';
// If you set a table prefix in config.yml, set it here as well
$table_prefix = "litebans_";
@ -96,6 +96,10 @@ final class Settings {
$this->driver = $driver;
if ($connect) {
if ($username === "" && $password === "") {
$this->redirect("error/unconfigured.php");
}
$dsn = "$driver:dbname=$database;host=$host;port=$port";
if ($driver === 'mysql') {
$dsn .= ';charset=utf8';