Trying to fix this monstrosity #1

This commit is contained in:
Domen Kajdič
2016-09-13 15:38:14 +02:00
parent 0e4b22d99f
commit 2cf2f3c343
22 changed files with 969 additions and 4733 deletions
+1 -35
View File
@@ -17,39 +17,5 @@ class MYSQLi_DB {
return mysqli_query($this->connection, $query);
}
};
class MYSQL_DB {
var $connection;
function MYSQL_DB() {
$this->connection = mysql_connect(SQL_SERVER, SQL_USER, SQL_PASS) or die(mysql_error());
mysql_select_db(SQL_DB, $this->connection) or die(mysql_error());
}
function mysql_exec_batch ($p_query, $p_transaction_safe = true) {
if ($p_transaction_safe) {
$p_query = 'START TRANSACTION;' . $p_query . '; COMMIT;';
};
$query_split = preg_split ("/[;]+/", $p_query);
foreach ($query_split as $command_line) {
$command_line = trim($command_line);
if ($command_line != '') {
$query_result = mysql_query($command_line);
if ($query_result == 0) {
break;
};
};
};
return $query_result;
}
function query($query) {
return mysql_query($query, $this->connection);
}
};
if(DB_TYPE) {
$database = new MYSQLi_DB;
}
else {
$database = new MYSQL_DB;
}
$database = new MYSQLi_DB;
?>
+3 -3
View File
@@ -6,12 +6,12 @@ $gameinstall = 1;
include ("../../GameEngine/Admin/database.php");
include ("../../GameEngine/Lang/" . LANG . ".php");
mysql_connect(SQL_SERVER, SQL_USER, SQL_PASS);
mysql_select_db(SQL_DB);
mysqli_connect(SQL_SERVER, SQL_USER, SQL_PASS);
mysqli_select_db(SQL_DB);
if(isset($_POST['mhpw'])) {
$password = $_POST['mhpw'];
mysql_query("UPDATE " . TB_PREFIX . "users SET password = '" . md5($password) . "' WHERE username = 'Multihunter'");
mysqli_query("UPDATE " . TB_PREFIX . "users SET password = '" . md5($password) . "' WHERE username = 'Multihunter'");
$wid = $admin->getWref(0, 0);
$uid = 5;
$status = $database->getVillageState($wid);
+2 -2
View File
@@ -8,8 +8,8 @@
include ("../../GameEngine/Admin/database.php");
mysql_connect(SQL_SERVER, SQL_USER, SQL_PASS);
mysql_select_db(SQL_DB);
mysqli_connect(SQL_SERVER, SQL_USER, SQL_PASS);
mysqli_select_db(SQL_DB);
$database->populateOasisdata();
$database->populateOasis();