diff --git a/ag/include/config/db_example.inc.php b/ag/include/config/db_example.inc.php
index 7c6895e..c4809cb 100644
--- a/ag/include/config/db_example.inc.php
+++ b/ag/include/config/db_example.inc.php
@@ -19,7 +19,6 @@ $main_db_name = "otherdatabasename";
$GLOBALS['mumble_db_name'] = "anotheradatabasename";
if(!isset($conn)){
- $conn = mysqli_connect($db_host, $db_user, $db_passwort);
- $db = mysql_select_db($db_name, $conn);
+ $GLOBALS['main_db'] = new mysqli($db_host, $db_user, $db_passwort, $db_name);
}
?>
\ No newline at end of file
diff --git a/cronjob/3.php b/cronjob/3.php
index d62baa9..15fc4cf 100644
--- a/cronjob/3.php
+++ b/cronjob/3.php
@@ -6,5 +6,6 @@
*
*/
include "db.php";
+include_once (ROOT_PATH.'/include/sqlwrapper.inc.php');
-mysql_query("UPDATE chars SET status='Frei' WHERE status='Turnier'");
+db_query("UPDATE chars SET status='Frei' WHERE status='Turnier'");
diff --git a/cronjob/Turnier2.php b/cronjob/Turnier2.php
index 4187cfc..b081a6b 100644
--- a/cronjob/Turnier2.php
+++ b/cronjob/Turnier2.php
@@ -7,6 +7,7 @@
*/
include "db.php";
include_once('path.inc.php'); // get the path ;)
+include_once (ROOT_PATH.'/include/sqlwrapper.inc.php');
include_once ('inclu/halloffame.inc.php');
include_once ('inclu/fruitdistribution.inc.php');
include_once ('inclu/exp.inc.php');
diff --git a/cronjob/array.php b/cronjob/array.php
index 41bfeb1..016f568 100644
--- a/cronjob/array.php
+++ b/cronjob/array.php
@@ -18,5 +18,5 @@ if($frucht_rate == 5) { $frucht_name = 6; } /////////6= ID FueR SMOKE FRUCHT
if($frucht_rate == 6) { $frucht_name = 43; } /////////43= ID FueR candy frucht
if($frucht_rate == 7) { $frucht_name = 44; } /////////44= ID FueR fluessigkeits frucht
-mysql_query("INSERT wochen_ware SET item='$frucht_name', user='$win_user[besitzer]'");
+db_query("INSERT wochen_ware SET item='$frucht_name', user='$win_user[besitzer]'");
?>
\ No newline at end of file
diff --git a/cronjob/clan_fight_auswertung.php b/cronjob/clan_fight_auswertung.php
index b969977..0b80d54 100755
--- a/cronjob/clan_fight_auswertung.php
+++ b/cronjob/clan_fight_auswertung.php
@@ -2,14 +2,15 @@
include('db.php');
include('path.inc.php');
+include_once (ROOT_PATH.'/include/sqlwrapper.inc.php');
include_once(ROOT_PATH.'/include/clan.inc.php');
include_once(ROOT_PATH.'/include/elo.inc.php');
include_once(ROOT_PATH.'/include/semaphore.inc.php');
function getClanRanking() {
- $qry = mysql_query('SELECT id, elo from clan ORDER by elo desc LIMIT 10');
+ $qry = db_query('SELECT id, elo from clan ORDER by elo desc LIMIT 10');
$clan_ids = array();
- while($res = mysql_fetch_row($qry))
+ while($res = mysqli_fetch_row($qry))
$clan_ids[] = $res;
return $clan_ids;
@@ -25,11 +26,11 @@ function distributeClanPrices(array $prices, array $results) {
$clan = getClan($winner); // buffered so will not cause in a sql statement all the time!
$sql = 'UPDATE clan SET elo = 1000, geld = geld + ' . $points . ' WHERE id = ' . $clan['id'];
echo $sql . '
';
- mysql_query($sql);
+ db_query($sql);
insertClanTickerMessage($clan['id'], 'Das Preisgeld von '.$points.' für den '.$i.' Platz in der Clanliga erhalten!');
}
}
- mysql_query('UPDATE clan SET elo = 1000');
+ db_query('UPDATE clan SET elo = 1000');
}
$time = date("Hid");
@@ -38,7 +39,7 @@ if($time == 1) {
$results = getClanRanking();
$sql2 = 'Select avg(level) as dlevel from chars order by level desc limit 100';
- $row = mysql_fetch_assoc(mysql_query($sql2));
+ $row = mysqli_fetch_assoc(db_query($sql2));
$dlevel = ceil($row['dlevel']);
$summe = 20000000/(1+exp(5-$dlevel/14));
@@ -85,7 +86,7 @@ if(!semaphoreUP($ressource)) {
if($_clan_data1['elo_change'] == null) {
$sql = 'UPDATE clan_challenge_clans SET elo_change = ' .$eloClan1 . ', exp_change = ' . $expClan1 . ' WHERE clan_challenge_id = ' . $id . ' AND clan_id = ' . $clan1['id'];
// echo $sql . '
';
- mysql_query($sql);
+ db_query($sql);
addClanExp($clan1['id'], $expClan1);
$appendum = null;
if($winner == $clan1['id']) {
@@ -94,13 +95,13 @@ if(!semaphoreUP($ressource)) {
$appendum = ', niederlagen = niederlagen + 1';
}
- mysql_query('UPDATE clan SET elo = elo + ' .$eloClan1 . $appendum . ' WHERE id = ' . $clan1['id']);
+ db_query('UPDATE clan SET elo = elo + ' .$eloClan1 . $appendum . ' WHERE id = ' . $clan1['id']);
}
if($_clan_data2['elo_change'] == null) {
$sql = 'UPDATE clan_challenge_clans SET elo_change = ' .$eloClan2 . ', exp_change = ' . $expClan2 . ' WHERE clan_challenge_id = ' . $id . ' AND clan_id = ' . $clan2['id'];
// echo $sql . '
';
- mysql_query($sql);
+ db_query($sql);
addClanExp($clan2['id'], $expClan2);
$appendum = null;
@@ -110,7 +111,7 @@ if(!semaphoreUP($ressource)) {
$appendum = ', niederlagen = niederlagen + 1';
}
- mysql_query('UPDATE clan SET elo = elo + ' .$eloClan2 . $appendum . ' WHERE id = ' . $clan2['id']);
+ db_query('UPDATE clan SET elo = elo + ' .$eloClan2 . $appendum . ' WHERE id = ' . $clan2['id']);
}
}
semaphoreDown($ressource);
diff --git a/cronjob/db_example.php b/cronjob/db_example.php
index b935c6a..315b792 100644
--- a/cronjob/db_example.php
+++ b/cronjob/db_example.php
@@ -14,10 +14,8 @@ $db_user ="username";
$db_passwort ="password";
$db_name = "databasename";
-
-$conn = mysql_connect($db_host, $db_user, $db_passwort);
-$db = mysql_select_db($db_name, $conn);
-
+$conn = new mysqli($db_host, $db_user, $db_passwort, $db_name);
+$GLOBALS['main_db'] = $conn;
//////////////////Animegame NPC
$bebi = "2";
diff --git a/cronjob/delete.php b/cronjob/delete.php
index df9ec16..0673f19 100644
--- a/cronjob/delete.php
+++ b/cronjob/delete.php
@@ -7,35 +7,36 @@
*/
include "db.php";
include('path.inc.php');
+include_once (ROOT_PATH.'/include/sqlwrapper.inc.php');
include_once(ROOT_PATH. "/include/random.inc.php");
$mak_time = time();
$z_time = time() - 86400;
-$chars_k = mysql_query("SELECT charakter FROM kampf_list WHERE zeit < '$mak_time' and rasse != 'NPC'");
-while ($row4 = mysql_Fetch_array($chars_k)) {
- mysql_query("UPDATE chars SET status='Frei' WHERE id='$row4[charakter]'");
+$chars_k = db_query("SELECT charakter FROM kampf_list WHERE zeit < '$mak_time' and rasse != 'NPC'");
+while ($row4 = mysqli_fetch_array($chars_k)) {
+ db_query("UPDATE chars SET status='Frei' WHERE id='$row4[charakter]'");
}
-mysql_query("DELETE FROM kampf_list WHERE zeit < '$mak_time' and rasse != 'NPC'");
-//mysql_query("DELETE FROM user WHERE aktiv = 'nein' AND code_zeit < '$z_time'");
-mysql_query("DELETE FROM top_kampf");
+db_query("DELETE FROM kampf_list WHERE zeit < '$mak_time' and rasse != 'NPC'");
+//db_query("DELETE FROM user WHERE aktiv = 'nein' AND code_zeit < '$z_time'");
+db_query("DELETE FROM top_kampf");
-$platz1 = mysql_query("SELECT id, besitzer FROM chars WHERE level<'150' order by preis DESC LIMIT 3");
+$platz1 = db_query("SELECT id, besitzer FROM chars WHERE level<'150' order by preis DESC LIMIT 3");
$x = 0;
$mac_geld = 3000;
-while ($row = mysql_fetch_array($platz1)) {
- $user = mysql_fetch_array(mysql_query("SELECT geld FROM user WHERE id='$row[besitzer]' LIMIT 3"));
+while ($row = mysqli_fetch_array($platz1)) {
+ $user = mysqli_fetch_array(db_query("SELECT geld FROM user WHERE id='$row[besitzer]' LIMIT 3"));
$new_geld = $user[geld] + $mac_geld;
- mysql_query("UPDATE user SET geld='$new_geld' WHERE id='$row[besitzer]'");
+ db_query("UPDATE user SET geld='$new_geld' WHERE id='$row[besitzer]'");
$mac_geld = $mac_geld -1000;
$x++;
}
$row = "";
-$platz1 = mysql_query("SELECT id, anzahl, preis FROM item");
+$platz1 = db_query("SELECT id, anzahl, preis FROM item");
$x = 0;
-while ($row = mysql_fetch_array($platz1)) {
+while ($row = mysqli_fetch_array($platz1)) {
if ($row[preis] >= 200000) {
$anzahl = 1;
}
@@ -78,22 +79,22 @@ while ($row = mysql_fetch_array($platz1)) {
if ($row[preis] < 80) {
$anzahl = 5000;
}
- mysql_query("UPDATE item SET anzahl='$anzahl' WHERE id='$row[id]'");
+ db_query("UPDATE item SET anzahl='$anzahl' WHERE id='$row[id]'");
$x++;
}
$row = "";
-mysql_query("DELETE FROM liga_kampf");
-mysql_query("DELETE FROM wanted_kampf");
-mysql_query("UPDATE chars SET status='Frei' WHERE status='Tod'");
-mysql_query("UPDATE user SET pw_fight='4'");
+db_query("DELETE FROM liga_kampf");
+db_query("DELETE FROM wanted_kampf");
+db_query("UPDATE chars SET status='Frei' WHERE status='Tod'");
+db_query("UPDATE user SET pw_fight='4'");
//////////////////////////////////NPCS!!!!
$wahl = "starke+verteidigung+speed+ausdauer+glueck";
-$row = mysql_fetch_array(mysql_query("SELECT name, level, starke, speed, verteidigung, ausdauer, glueck, hp, mp FROM chars WHERE level<'150' AND rasse!='NPC' ORDER BY ($wahl) DESC LIMIT 1"));
+$row = mysqli_fetch_array(db_query("SELECT name, level, starke, speed, verteidigung, ausdauer, glueck, hp, mp FROM chars WHERE level<'150' AND rasse!='NPC' ORDER BY ($wahl) DESC LIMIT 1"));
$new_hp = explode(",", $row[hp]);
$new_mp = explode(",", $row[mp]);
@@ -107,11 +108,11 @@ $beste_verteidigung = ($row[verteidigung] / 100) * mt_random_wrapper(75, 110);
$beste_ausdauer = ($row[ausdauer] / 100) * mt_random_wrapper(75, 130);
$beste_glueck = ($row[glueck] / 100) * mt_random_wrapper(75, 130);
-mysql_query("UPDATE chars SET hp='$beste_hp,$beste_hp', mp='$beste_mp,$beste_mp', starke='$beste_starke', speed='$beste_speed', verteidigung='$beste_verteidigung', ausdauer='$beste_ausdauer', glueck='$beste_glueck' WHERE id='$brolly' LIMIT 1");
+db_query("UPDATE chars SET hp='$beste_hp,$beste_hp', mp='$beste_mp,$beste_mp', starke='$beste_starke', speed='$beste_speed', verteidigung='$beste_verteidigung', ausdauer='$beste_ausdauer', glueck='$beste_glueck' WHERE id='$brolly' LIMIT 1");
//////////////////////////////////NPCS!!!!
-$row = mysql_fetch_array(mysql_query("SELECT name, level, starke, speed, verteidigung, ausdauer, glueck, hp, mp FROM chars WHERE level<'150' AND rasse!='NPC' ORDER BY starke DESC LIMIT 1"));
+$row = mysqli_fetch_array(db_query("SELECT name, level, starke, speed, verteidigung, ausdauer, glueck, hp, mp FROM chars WHERE level<'150' AND rasse!='NPC' ORDER BY starke DESC LIMIT 1"));
$new_hp = explode(",", $row[hp]);
$new_mp = explode(",", $row[mp]);
@@ -125,11 +126,11 @@ $beste_verteidigung = ($row[verteidigung] / 100) * mt_random_wrapper(100, 150);
$beste_ausdauer = ($row[ausdauer] / 100) * mt_random_wrapper(100, 200);
$beste_glueck = ($row[glueck] / 100) * mt_random_wrapper(80, 100);
-mysql_query("UPDATE chars SET hp='$beste_hp,$beste_hp', mp='$beste_mp,$beste_mp', starke='$beste_starke', speed='$beste_speed', verteidigung='$beste_verteidigung', ausdauer='$beste_ausdauer', glueck='$beste_glueck' WHERE id='$bebi' LIMIT 1");
+db_query("UPDATE chars SET hp='$beste_hp,$beste_hp', mp='$beste_mp,$beste_mp', starke='$beste_starke', speed='$beste_speed', verteidigung='$beste_verteidigung', ausdauer='$beste_ausdauer', glueck='$beste_glueck' WHERE id='$bebi' LIMIT 1");
//////////////////NPC
$wahl = "starke+verteidigung+speed+ausdauer+glueck";
-$row = mysql_fetch_array(mysql_query("SELECT hp, mp, name, level, starke, speed, verteidigung, ausdauer, glueck FROM chars WHERE level<'150' AND rasse!='NPC' ORDER BY level DESC LIMIT 1"));
+$row = mysqli_fetch_array(db_query("SELECT hp, mp, name, level, starke, speed, verteidigung, ausdauer, glueck FROM chars WHERE level<'150' AND rasse!='NPC' ORDER BY level DESC LIMIT 1"));
$new_hp = explode(",", $row[hp]);
$new_mp = explode(",", $row[mp]);
@@ -143,10 +144,10 @@ $beste_verteidigung = ($row[verteidigung] / 100) * mt_random_wrapper(80, 100);
$beste_ausdauer = ($row[ausdauer] / 100) * mt_random_wrapper(60, 120);
$beste_glueck = ($row[glueck] / 100) * mt_random_wrapper(60, 200);
-mysql_query("UPDATE chars SET hp='$beste_hp,$beste_hp', mp='$beste_mp,$beste_mp', starke='$beste_starke', speed='$beste_speed', verteidigung='$beste_verteidigung', ausdauer='$beste_ausdauer', glueck='$beste_glueck' WHERE id='$flamingo' LIMIT 1");
+db_query("UPDATE chars SET hp='$beste_hp,$beste_hp', mp='$beste_mp,$beste_mp', starke='$beste_starke', speed='$beste_speed', verteidigung='$beste_verteidigung', ausdauer='$beste_ausdauer', glueck='$beste_glueck' WHERE id='$flamingo' LIMIT 1");
//////////////////NPC
-$row = mysql_fetch_array(mysql_query("SELECT hp, mp, name, level, starke, speed, verteidigung, ausdauer, glueck FROM chars WHERE level<'150' AND rasse!='NPC' ORDER BY speed DESC LIMIT 1"));
+$row = mysqli_fetch_array(db_query("SELECT hp, mp, name, level, starke, speed, verteidigung, ausdauer, glueck FROM chars WHERE level<'150' AND rasse!='NPC' ORDER BY speed DESC LIMIT 1"));
$new_hp = explode(",", $row[hp]);
$new_mp = explode(",", $row[mp]);
@@ -160,5 +161,5 @@ $beste_verteidigung = ($row[verteidigung] / 100) * mt_random_wrapper(80, 120);
$beste_ausdauer = ($row[ausdauer] / 100) * mt_random_wrapper(80, 150);
$beste_glueck = ($row[glueck] / 100) * mt_random_wrapper(90, 100);
-mysql_query("UPDATE chars SET hp='$beste_hp,$beste_hp', mp='$beste_mp,$beste_mp', starke='$beste_starke', speed='$beste_speed', verteidigung='$beste_verteidigung', ausdauer='$beste_ausdauer', glueck='$beste_glueck' WHERE id='$mihawk' LIMIT 1");
+db_query("UPDATE chars SET hp='$beste_hp,$beste_hp', mp='$beste_mp,$beste_mp', starke='$beste_starke', speed='$beste_speed', verteidigung='$beste_verteidigung', ausdauer='$beste_ausdauer', glueck='$beste_glueck' WHERE id='$mihawk' LIMIT 1");
?>
diff --git a/cronjob/frucht.php b/cronjob/frucht.php
index 59b395d..97f99ab 100644
--- a/cronjob/frucht.php
+++ b/cronjob/frucht.php
@@ -8,7 +8,7 @@
####################KAIOKEN SPIELER 1
if($technick1[type] == "frucht") {
-$frucht_stats1 = mysql_fetch_array(mysql_query("SELECT starke, ver, speed, ausdauer, glueck FROM wochen_markt WHERE item='$chara_1[frucht]' LIMIT 1"));
+$frucht_stats1 = mysqli_fetch_array(db_query("SELECT starke, ver, speed, ausdauer, glueck FROM wochen_markt WHERE item='$chara_1[frucht]' LIMIT 1"));
$k_mp[0] = $k_mp[0] - $technick1[mp];
$k_hp[0] = $k_hp[0] - $technick1[hp];
if($k_mp[0] < 0) {
@@ -28,7 +28,7 @@ $aktion_AV1[$x] = "nein";
####################KAIOKEN SPIELER 2
if($technick2[type] == "frucht") {
-$frucht_stats2 = mysql_fetch_array(mysql_query("SELECT starke, ver, speed, ausdauer, glueck FROM wochen_markt WHERE item='$chara_2[frucht]' LIMIT 1"));
+$frucht_stats2 = mysqli_fetch_array(db_query("SELECT starke, ver, speed, ausdauer, glueck FROM wochen_markt WHERE item='$chara_2[frucht]' LIMIT 1"));
$k_mp[1] = $k_mp[1] - $technick2[mp];
$k_hp[1] = $k_hp[1] - $technick2[hp];
if($k_mp[1] < 0) {
diff --git a/cronjob/generic_turnier.php b/cronjob/generic_turnier.php
index 00a2b16..95925dc 100644
--- a/cronjob/generic_turnier.php
+++ b/cronjob/generic_turnier.php
@@ -40,6 +40,7 @@ if ($argv) {
//include "inclu/char.inc.php";
include('db.php');
include('path.inc.php');
+include_once (ROOT_PATH.'/include/sqlwrapper.inc.php');
include_once(ROOT_PATH.'/include/char.inc.php');
include_once(ROOT_PATH.'/include/rassen.inc.php');
@@ -125,7 +126,7 @@ if($gruppenphase == 1){
}
}
-mysql_query('DELETE FROM turnier_kampf WHERE art=\''.$name.'\'');
+db_query('DELETE FROM turnier_kampf WHERE art=\''.$name.'\'');
$race_type = getRaceTypeName("NPC");
@@ -175,8 +176,8 @@ if(is_numeric($maxlevel)){
$sql = 'SELECT count(*) as anzahl from chars where '.$auswahl_kriteria;
echo $sql.'
';
-$qry = mysql_query($sql);
-$row = mysql_fetch_assoc($qry);
+$qry = db_query($sql);
+$row = mysqli_fetch_assoc($qry);
if($row['anzahl'] < $anzahl){
echo $name.' konnte nicht mit '.$anzahl.' Chars gestartet werden, da es nur '.$row['anzahl'].' von '.$anzahl.' nötigen Chars gibt!
';
@@ -188,13 +189,13 @@ if($row['anzahl'] < $anzahl){
$cid = array();
if($gain == 'Anmeldung'){
$sql = 'SELECT charakter as id FROM turnier1 t WHERE art = \''.$name.'\'';
- $qry = mysql_query($sql);
- while($row = mysql_fetch_assoc($qry)){
+ $qry = db_query($sql);
+ while($row = mysqli_fetch_assoc($qry)){
$cid[] = $row['id'];
}
$sql = 'DELETE FROM turnier1 WHERE art = \''.$name.'\'';
// echo $sql .'
';
- mysql_query($sql); // Lösche die Anmeldungsliste
+ db_query($sql); // Lösche die Anmeldungsliste
if(count($cid) > 0){
$sql = 'SELECT id FROM chars where '.$auswahl_kriteria.' and id NOT IN('.join(',',$cid).') ORDER BY RAND()';
} else {
@@ -212,8 +213,8 @@ if($gain == 'Anmeldung'){
}
echo $sql.'
';
-$qry = mysql_query($sql);
-while(($row = mysql_fetch_assoc($qry)) && count($cid) < $anzahl){
+$qry = db_query($sql);
+while(($row = mysqli_fetch_assoc($qry)) && count($cid) < $anzahl){
// echo $row['id'].'
';
$cid[] = $row['id'];
}
@@ -222,9 +223,9 @@ while(($row = mysql_fetch_assoc($qry)) && count($cid) < $anzahl){
$sql = 'SELECT id FROM chars WHERE id IN('.join(', ',$cid).') ORDER BY RAND()'; // Mischen der Teilnehmer
//echo $sql.'
';
-$qry = mysql_query($sql);
+$qry = db_query($sql);
$char_array = array();
-while($row = mysql_fetch_assoc($qry)){
+while($row = mysqli_fetch_assoc($qry)){
$char_array[] = $row['id'];
}
// So alle chars sind jetzt in den Arrays
diff --git a/cronjob/gross_Turnier2.php b/cronjob/gross_Turnier2.php
index f0fcb30..089fe0d 100644
--- a/cronjob/gross_Turnier2.php
+++ b/cronjob/gross_Turnier2.php
@@ -7,6 +7,7 @@
*/
include "db.php";
include_once('path.inc.php'); // get the path ;)
+include_once (ROOT_PATH.'/include/sqlwrapper.inc.php');
include_once ('inclu/messagefunctions.inc.php');
include_once ('inclu/halloffame.inc.php');
include_once ('inclu/fruitdistribution.inc.php');
@@ -19,13 +20,13 @@ include_once ('inclu/char.inc.php');
$sql = '(Select distinct(char1) as x from turnier_kampf where art = \'gross\' ) union (Select distinct(char2) as x from turnier_kampf where art = \'gross\' )';
$charids = array();
-$qry1 = mysql_query($sql);
-while($row = mysql_fetch_assoc($qry1)){
+$qry1 = db_query($sql);
+while($row = mysqli_fetch_assoc($qry1)){
$charids[] = $row['x'];
}
$sql2 = 'Select avg(level) as dlevel from chars where id in ('.join(',', $charids).')';
-$row = mysql_fetch_assoc(mysql_query($sql2));
+$row = mysqli_fetch_assoc(db_query($sql2));
$dlevel = ceil($row['dlevel']);
@@ -38,7 +39,7 @@ $rang1 = getChar($results[0][0]);
insertIntoHallOfFame('Weltturnier', $rang1['id'], $rang1['besitzer']);
-//$natur_frucht = mysql_num_rows(mysql_query("SELECT id FROM wochen_markt WHERE art='natur'")); ///wieviel TF gibt es?.
+//$natur_frucht = mysqli_num_rows(db_query("SELECT id FROM wochen_markt WHERE art='natur'")); ///wieviel TF gibt es?.
////////////////FRUCHT ARRAY
//include "array.php";
diff --git a/cronjob/grossst_Turnier2.php b/cronjob/grossst_Turnier2.php
index 6b23648..a1a8a49 100644
--- a/cronjob/grossst_Turnier2.php
+++ b/cronjob/grossst_Turnier2.php
@@ -7,6 +7,7 @@
*/
include "db.php";
include_once('path.inc.php'); // get the path ;)
+include_once (ROOT_PATH.'/include/sqlwrapper.inc.php');
include_once ('inclu/messagefunctions.inc.php');
include_once ('inclu/halloffame.inc.php');
include_once ('inclu/fruitdistribution.inc.php');
@@ -23,13 +24,13 @@ $turnier_name = 'Weltturnier Non-Fusion';
$sql = '(Select distinct(char1) as x from turnier_kampf where art = \''.$turnier_kurz.'\' ) union (Select distinct(char2) as x from turnier_kampf where art = \''.$turnier_kurz.'\' )';
$charids = array();
-$qry1 = mysql_query($sql);
-while($row = mysql_fetch_assoc($qry1)){
+$qry1 = db_query($sql);
+while($row = mysqli_fetch_assoc($qry1)){
$charids[] = $row['x'];
}
$sql2 = 'Select avg(level) as dlevel from chars where id in ('.join(',', $charids).')';
-$row = mysql_fetch_assoc(mysql_query($sql2));
+$row = mysqli_fetch_assoc(db_query($sql2));
$dlevel = ceil($row['dlevel']);
@@ -42,7 +43,7 @@ $rang1 = getChar($results[0][0]);
insertIntoHallOfFame($turnier_name, $rang1['id'], $rang1['besitzer']);
-//$natur_frucht = mysql_num_rows(mysql_query("SELECT id FROM wochen_markt WHERE art='natur'")); ///wieviel TF gibt es?.
+//$natur_frucht = mysqli_num_rows(db_query("SELECT id FROM wochen_markt WHERE art='natur'")); ///wieviel TF gibt es?.
////////////////FRUCHT ARRAY
//include "array.php";
diff --git a/cronjob/inclu/char.inc.php b/cronjob/inclu/char.inc.php
index 59e5c19..81ed958 100644
--- a/cronjob/inclu/char.inc.php
+++ b/cronjob/inclu/char.inc.php
@@ -33,32 +33,32 @@ function getStatus($charid, $buffer_enabled = true) {
}
$sql = 'SELECT count(*) as anzahl FROM turnier_kampf t where art != \'gross\' and (win = ' . $charid . ' or lose = ' . $charid . ') and dauer > now()';
- $row = mysql_fetch_assoc(mysql_query($sql));
+ $row = mysqli_fetch_assoc(db_query($sql));
if ($row['anzahl'] > 0) {
$GLOBALS['char_buffered_statuses'][$charid] = 'Turnier';
return 'Turnier';
}
$sql = 'SELECT count(*) as anzahl from quests where charid = ' . $charid;
- $row = mysql_fetch_assoc(mysql_query($sql));
+ $row = mysqli_fetch_assoc(db_query($sql));
if ($row['anzahl'] > 0) {
$GLOBALS['char_buffered_statuses'][$charid] = 'Schatz Suche';
return 'Schatz Suche';
}
$sql = 'SELECT count(*) as anzahl from kampf where db_satz = ' . $charid;
- $row = mysql_fetch_assoc(mysql_query($sql));
+ $row = mysqli_fetch_assoc(db_query($sql));
if ($row['anzahl'] > 0) {
$GLOBALS['char_buffered_statuses'][$charid] = 'Kampf';
return 'Kampf';
}
$sql = 'SELECT count(*) as anzahl FROM kampf_list where charakter = ' . $charid;
- $row = mysql_fetch_assoc(mysql_query($sql));
+ $row = mysqli_fetch_assoc(db_query($sql));
if ($row['anzahl'] > 0) {
$GLOBALS['char_buffered_statuses'][$charid] = 'Kampf erstellt';
return 'Kampf erstellt';
}
$sql = 'SELECT count(*) as anzahl FROM turnier1 where charakter = ' . $charid;
- $row = mysql_fetch_assoc(mysql_query($sql));
+ $row = mysqli_fetch_assoc(db_query($sql));
if ($row['anzahl'] > 0) {
$GLOBALS['char_buffered_statuses'][$charid] = 'Angemeldet';
return 'Angemeldet';
@@ -85,7 +85,7 @@ function getChar($charid, $buffer_enabled = true) {
// Wenn Char nicht im Puffer ist, oder nicht gepuffert werden soll
if ($GLOBALS['char_buffered_instances'][$charid] == null || !$buffer_enabled) {
// Lese das Charfeld aus der Datenbank aus
- $char = mysql_fetch_assoc(mysql_query('Select * from chars where id = '.$charid));
+ $char = mysqli_fetch_assoc(db_query('Select * from chars where id = '.$charid));
if(!$char){return null;}
// Speichere in $char['stauts'] den aktuellen Status des Chars (buffer-Strategie ist hierbei die selbe)
$char['status'] = getStatus($char['id'],$buffer_enabled);
@@ -101,7 +101,7 @@ function getChar2($charid) {
if(!is_numeric($charid)){
return null;
} else {
- $char = mysql_fetch_assoc(mysql_query('Select * from chars where id = '.$charid));
+ $char = mysqli_fetch_assoc(db_query('Select * from chars where id = '.$charid));
if(!$char){return null;}
// Speichere in $char['stauts'] den aktuellen Status des Chars (buffer-Strategie ist hierbei die selbe)
$char['status'] = getStatus($char['id'],$buffer_enabled);
@@ -113,7 +113,7 @@ function getChar2($charid) {
function getCharWithBuffs($charid, $buffer_enabled = true){
$char = getChar($charid, $buffer_enabled);
if($char['kampf_item'] != NULL && $char['kampf_item'] != ',,,,'){
- $char_buffs = mysql_fetch_assoc(mysql_query('SELECT sum(i.hp) as hp, sum(i.mp) as mp, sum(i.starke) as starke, sum(i.verteidigung) as verteidigung, sum(i.speed) as speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id IN (' . $char['kampf_item'] . ')'));
+ $char_buffs = mysqli_fetch_assoc(db_query('SELECT sum(i.hp) as hp, sum(i.mp) as mp, sum(i.starke) as starke, sum(i.verteidigung) as verteidigung, sum(i.speed) as speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id IN (' . $char['kampf_item'] . ')'));
}
$char['starke'] += $char_buffs['starke'];
$char['verteidigung'] += $char_buffs['verteidigung'];
@@ -149,8 +149,8 @@ function getCharsOfUser($userid, $buffer_enabled = true) {
if ($GLOBALS['chars_read_out_user'][$userid] == null || !$buffer_enabled) {
$GLOBALS['chars_read_out_user'][$userid] = array();
- $qry = mysql_query('Select * from chars where besitzer = '.$userid.' order by id');
- while($char = mysql_fetch_assoc($qry)){
+ $qry = db_query('Select * from chars where besitzer = '.$userid.' order by id');
+ while($char = mysqli_fetch_assoc($qry)){
// Speichere in $char['stauts'] den aktuellen Status des Chars (buffer-Strategie ist hierbei die selbe)
$char['status'] = getStatus($char['id'],$buffer_enabled);
$char['bild'] = getPicture($char);
@@ -170,8 +170,8 @@ function deleteChar($userid, $charid){
} else if($char['status'] != 'Frei'){
return 'Char ist nicht Frei!';
}
- mysql_query('Delete from lernen where besitzer = '.$charid);
- mysql_query('Delete from chars where id = '.$charid);
+ db_query('Delete from lernen where besitzer = '.$charid);
+ db_query('Delete from chars where id = '.$charid);
return true;
}
@@ -211,7 +211,7 @@ function getPowerLevelWithBuffs($charid, $buffer_enabled = true){
return null;
}
if($char['kampf_item'] != NULL && $char['kampf_item'] != ',,,,'){
- $char_buffs = mysql_fetch_assoc(mysql_query('SELECT sum(i.hp) as hp, sum(i.mp) as mp, sum(i.starke) as starke, sum(i.verteidigung) as verteidigung, sum(i.speed) as speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id IN (' . $char['kampf_item'] . ')'));
+ $char_buffs = mysqli_fetch_assoc(db_query('SELECT sum(i.hp) as hp, sum(i.mp) as mp, sum(i.starke) as starke, sum(i.verteidigung) as verteidigung, sum(i.speed) as speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id IN (' . $char['kampf_item'] . ')'));
}
return $char_buffs['starke']+$char_buffs['verteidigung']+$char_buffs['speed']+$char_buffs['ausdauer']+$char_buffs['glueck']+$char['starke']+$char['verteidigung']+$char['speed']+$char['ausdauer']+$char['glueck'];
}
diff --git a/cronjob/inclu/exp.inc.php b/cronjob/inclu/exp.inc.php
index cd6fcb4..c8bf860 100644
--- a/cronjob/inclu/exp.inc.php
+++ b/cronjob/inclu/exp.inc.php
@@ -58,15 +58,15 @@ function addAttackUsageToChar($char_id, $attacken){
// So jetzt nur noch die reqs einpflegen
$sql = 'Update lernen set benutzt = benutzt + '.$attacken[$i]['anzahl'].' where name = \''.$attacken[$i]['a_name'].'\' and besitzer = '.$char_id;
// echo $sql.'
';
- mysql_query($sql);
+ db_query($sql);
}
// Sooo und nun gehts darum ob wir neue Attacken lernen können
// Ersma die ganzen Infos laden
$sql = 'SELECT * FROM lernen where besitzer = '.$char_id;
- $qry = mysql_query($sql);
- while($row = mysql_fetch_assoc($qry)){
+ $qry = db_query($sql);
+ while($row = mysqli_fetch_assoc($qry)){
$lern[$row['at_id']] = $row; // Zum späteren Check ob die Reqs erfüllt sind
$atkid[] = $row['at_id']; // Zum ausschliessen der Attacken
}
@@ -85,7 +85,7 @@ function addAttackUsageToChar($char_id, $attacken){
// echo $sql.'
';
- $qry = mysql_query($sql);
+ $qry = db_query($sql);
// Das geht leider nicht mit dieser Datenstruktur direkt auszuwählen
$raceid[] = getCharRaceId($char_id);
@@ -94,7 +94,7 @@ function addAttackUsageToChar($char_id, $attacken){
}
// So und nun arbeite jede Attacke durch die nur im geringsten Lernbar sein könnte ...
- while($row = mysql_fetch_assoc($qry)) {
+ while($row = mysqli_fetch_assoc($qry)) {
// Erstmal checken ob es eine Fruchtattacke ist (durch die SQL-Anweisung werden alle nicht zutreffenden Früchte ausgeblockt)
$learnable = false;
if(!is_null($row['Frucht'])){
@@ -129,7 +129,7 @@ function addAttackUsageToChar($char_id, $attacken){
}
if($learnable){
- mysql_query('INSERT lernen SET name=\''.$row['name'].'\', at_id=\''.$row['id'].'\', besitzer=\''.$char_id.'\', aktiv=\'1\'');
+ db_query('INSERT lernen SET name=\''.$row['name'].'\', at_id=\''.$row['id'].'\', besitzer=\''.$char_id.'\', aktiv=\'1\'');
echo '';
}
}
@@ -161,19 +161,19 @@ function addExpToChar($char_id, $n_exp){
$sql = 'Update chars set exp = \''.$char_exp[0].','.$char_exp[1].'\' where id = '.$char_id;
}
// echo $sql.'
';
- mysql_query($sql);
+ db_query($sql);
$char = getChar($char_id, false); // We really want the actual char!!
if($char['level'] > 25) {
// remove this char out of the registration of the beginners tournament
- mysql_query('Delete from turnier1 where art = \'klein\' and charakter = \''.$char_id.'\'');
+ db_query('Delete from turnier1 where art = \'klein\' and charakter = \''.$char_id.'\'');
}
}
function addExpToArena($user_id, $n_exp){
$sql = 'SELECT * from arena where besitzer = '.$user_id;
- $qry = mysql_query($sql);
- $arena = mysql_fetch_assoc($qry);
+ $qry = db_query($sql);
+ $arena = mysqli_fetch_assoc($qry);
$arena_exp = explode(',', $arena['exp']);
$arena_exp[0] += $n_exp;
$lvls = 0;
@@ -186,11 +186,11 @@ function addExpToArena($user_id, $n_exp){
$arena_exp[1] = calculateRequiredExpArena($arena['level']);
}
if($lvls > 0){
-// mysql_query("UPDATE arena SET exp='$ne_exp1,$new_exp', level='$level1', skill='$skill_points' WHERE besitzer='$user_ida[id]' LIMIT 1");
+// db_query("UPDATE arena SET exp='$ne_exp1,$new_exp', level='$level1', skill='$skill_points' WHERE besitzer='$user_ida[id]' LIMIT 1");
echo '';
- mysql_query('Update arena set exp=\''.$arena_exp[0].','.$arena_exp[1].'\', level='.$arena['level'].', skill=skill+'.$lvls.' WHERE besitzer='.$user_id);
+ db_query('Update arena set exp=\''.$arena_exp[0].','.$arena_exp[1].'\', level='.$arena['level'].', skill=skill+'.$lvls.' WHERE besitzer='.$user_id);
} else{
- mysql_query('Update arena set exp=\''.$arena_exp[0].','.$arena_exp[1].'\' WHERE besitzer='.$user_id);
+ db_query('Update arena set exp=\''.$arena_exp[0].','.$arena_exp[1].'\' WHERE besitzer='.$user_id);
}
}
diff --git a/cronjob/inclu/fruitdistribution.inc.php b/cronjob/inclu/fruitdistribution.inc.php
index 86b64ca..21e2530 100644
--- a/cronjob/inclu/fruitdistribution.inc.php
+++ b/cronjob/inclu/fruitdistribution.inc.php
@@ -10,30 +10,30 @@ include_once(ROOT_PATH. "/include/random.inc.php");
function distributeFruit($user_id) {
$sql = 'SELECT id FROM wochen_markt WHERE art=\'natur\'';
- $qry = mysql_query($sql);
- $amount = mysql_num_rows($qry);
- while($fruit = mysql_fetch_assoc($qry)) {
+ $qry = db_query($sql);
+ $amount = mysqli_num_rows($qry);
+ while($fruit = mysqli_fetch_assoc($qry)) {
$fruits[] = $fruit;
}
$choice = mt_random_wrapper(0,$amount-1);
$sql = 'INSERT wochen_ware SET item='.$fruits[$choice]['id'].', user='.$user_id;
echo $sql . '
';
- mysql_query($sql);
+ db_query($sql);
}
function distributeParamecia($user_id) {
$sql = 'SELECT id FROM wochen_markt WHERE kategorie=\'Paramecia\'';
- $qry = mysql_query($sql);
- $amount = mysql_num_rows($qry);
- while($fruit = mysql_fetch_assoc($qry)) {
+ $qry = db_query($sql);
+ $amount = mysqli_num_rows($qry);
+ while($fruit = mysqli_fetch_assoc($qry)) {
$fruits[] = $fruit;
}
$choice = mt_random_wrapper(0,$amount-1);
$sql = 'INSERT wochen_ware SET item='.$fruits[$choice]['id'].', user='.$user_id;
echo $sql . '
';
- mysql_query($sql);
+ db_query($sql);
}
diff --git a/cronjob/inclu/halloffame.inc.php b/cronjob/inclu/halloffame.inc.php
index 7b81de1..482a255 100644
--- a/cronjob/inclu/halloffame.inc.php
+++ b/cronjob/inclu/halloffame.inc.php
@@ -17,9 +17,9 @@ include_once('char.inc.php');
*/
function insertIntoHallOfFame($title, $charid, $userid){
echo 'insertIntoHallOfFame('.$title.', '.$charid.', '.$userid.')
';
- $row = mysql_fetch_assoc(mysql_query('Select max(id) as round from online'));
+ $row = mysqli_fetch_assoc(db_query('Select max(id) as round from online'));
$char = getChar($charid);
- $user = mysql_fetch_assoc(mysql_query('Select * from user where id = '.$userid));
+ $user = mysqli_fetch_assoc(db_query('Select * from user where id = '.$userid));
if(!$row){
echo 'insertIntoHallOfFame failed as the basic methods failed!
';
@@ -50,18 +50,18 @@ function insertIntoHallOfFameFull($round = '', $title = '', $charid = '', $charn
}
$sql = 'INSERT INTO highscore('.$columns.') values('.$values.')';
// echo $sql.'
';
- $qry = mysql_query($sql);
- return mysql_affected_rows() > 0;
+ $qry = db_query($sql);
+ return db_affected_rows() > 0;
}
function getHallOfFame($title, $userid) {
- $row = mysql_fetch_assoc(mysql_query('Select max(id) as round from online'));
+ $row = mysqli_fetch_assoc(db_query('Select max(id) as round from online'));
return getHallOfFameFull($row['round'],$title, $userid);
}
function getHallOfFameFull($round = '', $title = '', $userid = '') {
$sql = 'select count(*) from highscore where runde='.$round.' and userid='.$userid;
- $row = mysql_fetch_row($sql);
+ $row = mysqli_fetch_row($sql);
return $row[0];
}
diff --git a/cronjob/inclu/messagefunctions.inc.php b/cronjob/inclu/messagefunctions.inc.php
index ae0d0c5..e492801 100644
--- a/cronjob/inclu/messagefunctions.inc.php
+++ b/cronjob/inclu/messagefunctions.inc.php
@@ -18,8 +18,8 @@ function insertUserTickerMessage($userid, $message, $offset = 0){
}
for($msgid = 0; $msgid < 100000; $msgid += mt_random_wrapper(1,1000)){
$sql = 'INSERT INTO user_ticker(userid, date, msgid, text) values('.$userid.', '.$timestamp.', '.$msgid.', \''.$message.'\')';
- mysql_query($sql);
- if(mysql_affected_rows() == 1){
+ db_query($sql);
+ if(db_affected_rows() == 1){
// echo 'MYSQL success: '.$sql;
return;
}
@@ -35,8 +35,8 @@ function insertClanTickerMessage($clanid, $message, $offset = 0){
}
for($msgid = 0; $msgid < 100000; $msgid += mt_random_wrapper(1,1000)){
$sql = 'INSERT INTO clan_ticker(clanid, date, msgid, text) values('.$clanid.', now(), '.$msgid.', \''.$message.'\')';
- mysql_query($sql);
- if(mysql_affected_rows() == 1){
+ db_query($sql);
+ if(db_affected_rows() == 1){
// echo 'MYSQL success: '.$sql;
return;
}
diff --git a/cronjob/inclu/turnier.inc.php b/cronjob/inclu/turnier.inc.php
index 5e0ef82..5575ee6 100644
--- a/cronjob/inclu/turnier.inc.php
+++ b/cronjob/inclu/turnier.inc.php
@@ -25,9 +25,9 @@ function generateTournamentResults($name, $additionalExpPerRound, $additionalMon
$charids = array();
// First calculate the money and exp the char gets just for doing good at fights ;)
- $qry = mysql_query('select char1, char2, exp1, exp2, geld1, geld2, round from turnier_kampf where art = \''.$name.'\' order by round asc');
+ $qry = db_query('select char1, char2, exp1, exp2, geld1, geld2, round from turnier_kampf where art = \''.$name.'\' order by round asc');
- while($fight = mysql_fetch_assoc($qry)) {
+ while($fight = mysqli_fetch_assoc($qry)) {
if(!isset($charArray[$fight['char1']])) {
$charArray[$fight['char1']] = array('exp' => 0, 'money' => 0);
$charids[$fight['char1']] = 1;
@@ -46,9 +46,9 @@ function generateTournamentResults($name, $additionalExpPerRound, $additionalMon
$returnArray = array();
// Now calculate the money and exp the char gets just for proceeding in the tournament (in this case ... order the chars right away ;))
- $qry = mysql_query('Select count(win) as anzahl, win from turnier_kampf where art = \''.$name.'\' group by win order by count(win) desc');
+ $qry = db_query('Select count(win) as anzahl, win from turnier_kampf where art = \''.$name.'\' group by win order by count(win) desc');
$maxRank = -1;
- while ($participant = mysql_fetch_assoc($qry)) {
+ while ($participant = mysqli_fetch_assoc($qry)) {
$charids[$participant['win']] = 0; // okay we already proceeded this one :)
// okay, first add experience the the $charArray !!
$charArray[$participant['win']]['exp'] += $additionalExpPerRound * $participant['anzahl'];
@@ -63,7 +63,7 @@ function generateTournamentResults($name, $additionalExpPerRound, $additionalMon
$char = getChar($participant['win']);
$sql = 'UPDATE user set geld = geld + ' . $charArray[$participant['win']]['money'] . ' WHERE id = ' . $char['besitzer'];
echo $sql . '
';
- mysql_query($sql);
+ db_query($sql);
}
foreach ($charids as $key => $value) {
@@ -75,7 +75,7 @@ function generateTournamentResults($name, $additionalExpPerRound, $additionalMon
$char = getChar($key);
$sql = 'UPDATE user set geld = geld + ' . $charArray[$key]['money'] . ' WHERE id = ' . $char['besitzer'];
echo $sql . '
';
- mysql_query($sql);
+ db_query($sql);
}
}
@@ -111,7 +111,7 @@ function distributeShopPoints(array $prices, array $winners, $reason) {
$userid = $char['besitzer'];
$sql = 'UPDATE user set pkt = pkt + '.$points.' WHERE id = '. $userid;
echo $sql . '
';
- mysql_query($sql);
+ db_query($sql);
insertUserTickerMessage($userid, $points .' IP durch den '.generateRanglistString($i).' Platz im '.$reason.' erhalten!');
}
}
@@ -127,7 +127,7 @@ function distributeUserPrices(array $prices, array $winners, $reason) {
$userid = $char['besitzer'];
$sql = 'UPDATE user set geld = geld + '.$points.' WHERE id = '. $userid;
echo $sql . '
';
- mysql_query($sql);
+ db_query($sql);
insertUserTickerMessage($userid, $points .' Preisgeld durch den '.generateRanglistString($i).' Platz im '.$reason.' erhalten!');
}
}
@@ -142,11 +142,11 @@ function distributeClanPrices(array $prices, array $results, $reason) {
foreach($results[$i] as $winner) {
$char = getChar($winner); // buffered so will not cause in a sql statement all the time!
$userid = $char['besitzer'];
- $data = mysql_fetch_assoc(mysql_query('Select clan from user where id = ' .$userid ));
+ $data = mysqli_fetch_assoc(db_query('Select clan from user where id = ' .$userid ));
if(is_numeric($data['clan'])) {
$sql = 'UPDATE clan SET geld = geld + ' . $points . ' WHERE id = ' . $data['clan'];
echo $sql . '
';
- mysql_query($sql);
+ db_query($sql);
insertClanTickerMessage($row['clan'], 'Das Preisgeld von '.$points.' für den '.generateRanglistString($i).' Platz im '.$reason.' erhalten!');
}
}
diff --git a/cronjob/kampf/andere_technik.php b/cronjob/kampf/andere_technik.php
index f329d26..b4e0240 100644
--- a/cronjob/kampf/andere_technik.php
+++ b/cronjob/kampf/andere_technik.php
@@ -39,9 +39,9 @@ if($k_attacke1_2[$x]) {
}
if($new_tech1 == 1) {
-$technick1 = mysql_fetch_array(mysql_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke1_2[$x]' LIMIT 10"));
+$technick1 = mysqli_fetch_array(db_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke1_2[$x]' LIMIT 10"));
$prozent_technik1 = (20*$technick1[aktiv])-20;
-$technick1 = mysql_fetch_array(mysql_query("SELECT * FROM attacken WHERE id='$technick1[at_id]' LIMIT 10"));
+$technick1 = mysqli_fetch_array(db_query("SELECT * FROM attacken WHERE id='$technick1[at_id]' LIMIT 10"));
}
}
@@ -79,8 +79,8 @@ if($k_attacke2_2[$x]) {
}
if($new_tech2 == 1) {
-$technick2 = mysql_fetch_array(mysql_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke2_2[$x]' LIMIT 10"));
+$technick2 = mysqli_fetch_array(db_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke2_2[$x]' LIMIT 10"));
$prozent_technik2 = (20*$technick2[aktiv])-20;
-$technick2 = mysql_fetch_array(mysql_query("SELECT * FROM attacken WHERE id='$technick2[at_id]' LIMIT 10"));
+$technick2 = mysqli_fetch_array(db_query("SELECT * FROM attacken WHERE id='$technick2[at_id]' LIMIT 10"));
}
}
diff --git a/cronjob/kampf/chat.php b/cronjob/kampf/chat.php
index c1d5faa..8f02380 100644
--- a/cronjob/kampf/chat.php
+++ b/cronjob/kampf/chat.php
@@ -7,16 +7,16 @@
*/
include_once(ROOT_PATH.'/include/config.inc.php');
-$user1 = mysql_Fetch_array(mysql_query("SELECT id, nickname FROM user WHERE nickname='$name' LIMIT 1"));
+$user1 = mysqli_fetch_array(db_query("SELECT id, nickname FROM user WHERE nickname='$name' LIMIT 1"));
-$kampf_a = mysql_fetch_array(mysql_query("SELECT char1, char2, id, dauer FROM kampf WHERE db_satz='$char_id' LIMIT 1"));
-$kampf_a1 = mysql_fetch_array(mysql_query("SELECT name, besitzer, id FROM chars WHERE id='$kampf_a[char1]' LIMIT 1"));
-$kampf_a2 = mysql_fetch_array(mysql_query("SELECT name, besitzer, id FROM chars WHERE id='$kampf_a[char2]' LIMIT 1"));
+$kampf_a = mysqli_fetch_array(db_query("SELECT char1, char2, id, dauer FROM kampf WHERE db_satz='$char_id' LIMIT 1"));
+$kampf_a1 = mysqli_fetch_array(db_query("SELECT name, besitzer, id FROM chars WHERE id='$kampf_a[char1]' LIMIT 1"));
+$kampf_a2 = mysqli_fetch_array(db_query("SELECT name, besitzer, id FROM chars WHERE id='$kampf_a[char2]' LIMIT 1"));
if($kampf_a1[besitzer] == $user1[id]) {
-$user2 = mysql_Fetch_array(mysql_query("SELECT id, nickname FROM user WHERE id='$kampf_a2[besitzer]' LIMIT 1"));
+$user2 = mysqli_fetch_array(db_query("SELECT id, nickname FROM user WHERE id='$kampf_a2[besitzer]' LIMIT 1"));
} else {
-$user2 = mysql_Fetch_array(mysql_query("SELECT id, nickname FROM user WHERE id='$kampf_a1[besitzer]' LIMIT 1"));
+$user2 = mysqli_fetch_array(db_query("SELECT id, nickname FROM user WHERE id='$kampf_a1[besitzer]' LIMIT 1"));
}
if(!$user1 OR !$user2) {
echo "Fehler User wurde nicht gefunden oder der kampf Existiert nicht mehr";
@@ -24,7 +24,7 @@ exit;
}
if($chat_nachricht) {
-mysql_query("INSERT kampf_nachricht SET nachricht='$_POST[chat_nachricht]', user='$user1[id]', charakter='$char_id'");
+db_query("INSERT kampf_nachricht SET nachricht='$_POST[chat_nachricht]', user='$user1[id]', charakter='$char_id'");
?>
";