summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--public_html/class/mysql.php8
-rw-r--r--public_html/functions.php4
-rw-r--r--public_html/setup.php2
3 files changed, 9 insertions, 5 deletions
diff --git a/public_html/class/mysql.php b/public_html/class/mysql.php
index 0031eec..d0c6949 100644
--- a/public_html/class/mysql.php
+++ b/public_html/class/mysql.php
@@ -12,7 +12,7 @@ class vfsdb {
try {
$this->db = new mysqli(DBHOST, DBUSER, DBPASSWORD, DBNAME);
} catch (Exception $e){
- failure($e->getMessage(), '<p>500 Server Failure</p>', false, '<h1>Failed to open database.</h1>');
+ failure("<p>".$e->getMessage()."</p>", '500 Server Failure', false, '<h1>Failed to open database connection.</h1>');
}
if ( $this->db->connect_errno() ){
@@ -24,7 +24,7 @@ class vfsdb {
}
if ( ! $this->db->set_charset(DBCHARSET) ){
- failure("<p>Can't set UTF-8 as a charset on your MySQL server.</p>" , '500 Server Failure', false, "<h1>Setting Charset failed!</h1>");
+ failure("<p>Can't set " . DBCHARSET . " as the charset on your MySQL server.</p>" , '500 Server Failure', false, "<h1>Setting Charset failed!</h1>");
}
}
@@ -73,6 +73,7 @@ class vfsdb {
color_folder VARCHAR(70),
color_file VARCHAR(70))
ENGINE=InnoDB;';
+
$files_table =
'CREATE TABLE IF NOT EXISTS ' . DBPREFIX . 'files
( files_id INTEGER AUTO_INCREMENT NOT NULL, PRIMARY KEY(files_id),
@@ -90,6 +91,7 @@ class vfsdb {
FOREIGN KEY(files_id) REFERENCES user(id) ON DELETE CASCADE
)
ENGINE=InnoDB;';
+
$banned_user_table =
'CREATE TABLE IF NOT EXISTS ' . DBPREFIX . 'banned_user
( banned_id INTEGER AUTO_INCREMENT NOT NULL, PRIMARY KEY(banned_id),
@@ -102,7 +104,7 @@ class vfsdb {
ENGINE=InnoDB;';
if ( ! $this->db->query($user_table . ' ' . $files_table . ' ' . $banned_user_table) )
- failure("<p>Setting up the database failed.</p>", '500 Server Failure', false, "<h1>CREATE TABLE FAILED");
+ failure("<p>There was a problem during bootstrapping the database schema. " . $this->db->error . "</p>", '500 Server Failure', false, "<h1>CREATE TABLE FAILED</h1>");
}
public function __destruct(){
diff --git a/public_html/functions.php b/public_html/functions.php
index c185bd5..51979da 100644
--- a/public_html/functions.php
+++ b/public_html/functions.php
@@ -5,13 +5,15 @@ function failure($reason, $httpcode, $ajax = true, $heading = NULL){
# send header with $httpcode
header($_SERVER['SERVER_PROTOCOL'] . " " . $httpcode)
+ # just echo the reason to the ajax response
if($ajax){
- # just echo the reason to the ajax response
echo htmlentities($reason);
exit
}
// TODO: Put pretty HTML here, please
+
+ # print full error page
if($heading != NULL)
echo htmlentities($heading);
diff --git a/public_html/setup.php b/public_html/setup.php
index 74b0e10..8781a5f 100644
--- a/public_html/setup.php
+++ b/public_html/setup.php
@@ -6,7 +6,7 @@ $vfsdb = new vfsdb();
$vfsdb->createTables();
$vfsdb->close();
-echo "<p>Successfully created the database.";
+echo "<p>Successfully created the database.</p>";
# rename this file to avoid setting up the tables twice
rename(ABSPATH . 'setup.php', ABSPATH . '_setup.php');