From ecb03939f840dd8f2400b4663f5e06876043f712 Mon Sep 17 00:00:00 2001 From: Ruan Date: Thu, 19 Feb 2015 13:38:01 +0200 Subject: [PATCH] Add table_prefix support --- bans.php | 2 +- includes/data/database.php | 7 +++++++ mutes.php | 2 +- warnings.php | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/bans.php b/bans.php index 7a2ff07..48a221c 100644 --- a/bans.php +++ b/bans.php @@ -7,7 +7,7 @@ // <<-----------------mysql Database Connection------------>> // require 'includes/data/database.php'; -$sql = 'SELECT time,until,reason,name,banned_by_name FROM bans INNER JOIN history on bans.uuid=history.uuid WHERE active=1 GROUP BY name ORDER BY time DESC LIMIT 20'; +$sql = 'SELECT time,until,reason,name,banned_by_name FROM ' . $table_bans . ' INNER JOIN history on bans.uuid=history.uuid WHERE active=1 GROUP BY name ORDER BY time DESC LIMIT 20'; $retval = mysql_query($sql, $conn); if (!$retval) { diff --git a/includes/data/database.php b/includes/data/database.php index f16e415..29f1798 100644 --- a/includes/data/database.php +++ b/includes/data/database.php @@ -3,8 +3,15 @@ $dbhost = 'localhost'; $dbuser = 'root'; $dbpass = 'password'; $conn = mysql_connect($dbhost, $dbuser, $dbpass); + +$table_prefix = ""; +$table_bans = $table_prefix . "bans"; +$table_mutes = $table_prefix . "mutes"; +$table_warnings = $table_prefix . "warnings"; + if (!$conn) { die('Could not connect: ' . mysql_error()); } + mysql_select_db('litebans'); ?> \ No newline at end of file diff --git a/mutes.php b/mutes.php index 6133840..c90c52c 100644 --- a/mutes.php +++ b/mutes.php @@ -7,7 +7,7 @@ // <<-----------------mysql Database Connection------------>> // require 'includes/data/database.php'; -$sql = 'SELECT time,until,reason,name,banned_by_name FROM mutes INNER JOIN history on mutes.uuid=history.uuid WHERE active=1 GROUP BY name ORDER BY time DESC LIMIT 20'; +$sql = 'SELECT time,until,reason,name,banned_by_name FROM ' . $table_mutes . ' INNER JOIN history on mutes.uuid=history.uuid WHERE active=1 GROUP BY name ORDER BY time DESC LIMIT 20'; $retval = mysql_query($sql, $conn); if (!$retval) { diff --git a/warnings.php b/warnings.php index 92a0a03..0e3e5cc 100644 --- a/warnings.php +++ b/warnings.php @@ -7,7 +7,7 @@ // <<-----------------mysql Database Connection------------>> // require 'includes/data/database.php'; -$sql = 'SELECT time,until,reason,name,banned_by_name FROM warnings INNER JOIN history on warnings.uuid=history.uuid WHERE active=1 GROUP BY name ORDER BY time DESC LIMIT 20'; +$sql = 'SELECT time,until,reason,name,banned_by_name FROM ' . $table_warnings . ' INNER JOIN history on warnings.uuid=history.uuid WHERE active=1 GROUP BY name ORDER BY time DESC LIMIT 20'; $retval = mysql_query($sql, $conn); if (!$retval) {