mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-07-20 19:46:10 +00:00
Trying to fix this monstrosity #1
This commit is contained in:
@@ -206,14 +206,6 @@ define("SQL_DB", "%SDB%");
|
||||
// ***** Database - Table Prefix
|
||||
define("TB_PREFIX", "%PREFIX%");
|
||||
|
||||
// ***** Database type
|
||||
// 0 = MYSQL
|
||||
// 1 = MYSQLi
|
||||
// default: 1
|
||||
define("DB_TYPE", %CONNECTT%);
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////
|
||||
// **** EXTRA SETTINGS **** //
|
||||
////////////////////////////////////
|
||||
|
||||
@@ -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;
|
||||
?>
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php include("templates/script.tpl");
|
||||
|
||||
if(!isset($_GET['s'])) {
|
||||
$_GET['s']=0;
|
||||
}
|
||||
|
||||
@@ -59,7 +59,6 @@ class Process {
|
||||
$text = preg_replace("'%SPASS%'", $_POST['spass'], $text);
|
||||
$text = preg_replace("'%SDB%'", $_POST['sdb'], $text);
|
||||
$text = preg_replace("'%PREFIX%'", $_POST['prefix'], $text);
|
||||
$text = preg_replace("'%CONNECTT%'", $_POST['connectt'], $text);
|
||||
$text = preg_replace("'%AEMAIL%'", $_POST['aemail'], $text);
|
||||
$text = preg_replace("'%ANAME%'", $_POST['aname'], $text);
|
||||
$text = preg_replace("'%SUBDOM%'", $_POST['subdom'], $text);
|
||||
|
||||
@@ -194,10 +194,7 @@ echo "<div class=\"headline\"><span class=\"f10 c5\">Error creating constant.php
|
||||
<td><span class="f9 c6">Password:</span></td><td><input type="password" name="spass" id="spass"></td></tr><tr>
|
||||
<td><span class="f9 c6">DB name:</span></td><td><input type="text" name="sdb" id="sdb"></td></tr><tr>
|
||||
<td><span class="f9 c6">Prefix:</span></td><td><input type="text" name="prefix" id="prefix" value="s1_" size="5"></td></tr>
|
||||
<td><span class="f9 c6">Type:</span></td><td><select name="connectt">
|
||||
<option value="0" selected="selected">MYSQL</option>
|
||||
<option value="1">MYSQLi</option>
|
||||
</select></td></tr>
|
||||
<td><span class="f9 c6">Type:</span></td><td>MYSQLi (MYSQL is deprecated)</td></tr>
|
||||
</table>
|
||||
</p>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user