Add table_prefix support

This commit is contained in:
Ruan 2015-02-19 13:38:01 +02:00
parent 2325022724
commit ecb03939f8
4 changed files with 10 additions and 3 deletions

View File

@ -7,7 +7,7 @@
// <<-----------------mysql Database Connection------------>> // // <<-----------------mysql Database Connection------------>> //
require 'includes/data/database.php'; 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); $retval = mysql_query($sql, $conn);
if (!$retval) { if (!$retval) {

View File

@ -3,8 +3,15 @@ $dbhost = 'localhost';
$dbuser = 'root'; $dbuser = 'root';
$dbpass = 'password'; $dbpass = 'password';
$conn = mysql_connect($dbhost, $dbuser, $dbpass); $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) { if (!$conn) {
die('Could not connect: ' . mysql_error()); die('Could not connect: ' . mysql_error());
} }
mysql_select_db('litebans'); mysql_select_db('litebans');
?> ?>

View File

@ -7,7 +7,7 @@
// <<-----------------mysql Database Connection------------>> // // <<-----------------mysql Database Connection------------>> //
require 'includes/data/database.php'; 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); $retval = mysql_query($sql, $conn);
if (!$retval) { if (!$retval) {

View File

@ -7,7 +7,7 @@
// <<-----------------mysql Database Connection------------>> // // <<-----------------mysql Database Connection------------>> //
require 'includes/data/database.php'; 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); $retval = mysql_query($sql, $conn);
if (!$retval) { if (!$retval) {