refactored all cronjobs

main
hecht 8 years ago
parent ce6690a38b
commit 8c3d6e55e8

@ -19,7 +19,6 @@ $main_db_name = "otherdatabasename";
$GLOBALS['mumble_db_name'] = "anotheradatabasename"; $GLOBALS['mumble_db_name'] = "anotheradatabasename";
if(!isset($conn)){ if(!isset($conn)){
$conn = mysqli_connect($db_host, $db_user, $db_passwort); $GLOBALS['main_db'] = new mysqli($db_host, $db_user, $db_passwort, $db_name);
$db = mysql_select_db($db_name, $conn);
} }
?> ?>

@ -6,5 +6,6 @@
* *
*/ */
include "db.php"; 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'");

@ -7,6 +7,7 @@
*/ */
include "db.php"; include "db.php";
include_once('path.inc.php'); // get the path ;) 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/halloffame.inc.php');
include_once ('inclu/fruitdistribution.inc.php'); include_once ('inclu/fruitdistribution.inc.php');
include_once ('inclu/exp.inc.php'); include_once ('inclu/exp.inc.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 == 6) { $frucht_name = 43; } /////////43= ID FueR candy frucht
if($frucht_rate == 7) { $frucht_name = 44; } /////////44= ID FueR fluessigkeits 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]'");
?> ?>

@ -2,14 +2,15 @@
include('db.php'); include('db.php');
include('path.inc.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/clan.inc.php');
include_once(ROOT_PATH.'/include/elo.inc.php'); include_once(ROOT_PATH.'/include/elo.inc.php');
include_once(ROOT_PATH.'/include/semaphore.inc.php'); include_once(ROOT_PATH.'/include/semaphore.inc.php');
function getClanRanking() { 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(); $clan_ids = array();
while($res = mysql_fetch_row($qry)) while($res = mysqli_fetch_row($qry))
$clan_ids[] = $res; $clan_ids[] = $res;
return $clan_ids; 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! $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']; $sql = 'UPDATE clan SET elo = 1000, geld = geld + ' . $points . ' WHERE id = ' . $clan['id'];
echo $sql . ' <br>'; echo $sql . ' <br>';
mysql_query($sql); db_query($sql);
insertClanTickerMessage($clan['id'], 'Das Preisgeld von '.$points.' f&uuml;r den '.$i.' Platz in der Clanliga erhalten!'); insertClanTickerMessage($clan['id'], 'Das Preisgeld von '.$points.' f&uuml;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"); $time = date("Hid");
@ -38,7 +39,7 @@ if($time == 1) {
$results = getClanRanking(); $results = getClanRanking();
$sql2 = 'Select avg(level) as dlevel from chars order by level desc limit 100'; $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']); $dlevel = ceil($row['dlevel']);
$summe = 20000000/(1+exp(5-$dlevel/14)); $summe = 20000000/(1+exp(5-$dlevel/14));
@ -85,7 +86,7 @@ if(!semaphoreUP($ressource)) {
if($_clan_data1['elo_change'] == null) { 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']; $sql = 'UPDATE clan_challenge_clans SET elo_change = ' .$eloClan1 . ', exp_change = ' . $expClan1 . ' WHERE clan_challenge_id = ' . $id . ' AND clan_id = ' . $clan1['id'];
// echo $sql . '<br>'; // echo $sql . '<br>';
mysql_query($sql); db_query($sql);
addClanExp($clan1['id'], $expClan1); addClanExp($clan1['id'], $expClan1);
$appendum = null; $appendum = null;
if($winner == $clan1['id']) { if($winner == $clan1['id']) {
@ -94,13 +95,13 @@ if(!semaphoreUP($ressource)) {
$appendum = ', niederlagen = niederlagen + 1'; $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) { 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']; $sql = 'UPDATE clan_challenge_clans SET elo_change = ' .$eloClan2 . ', exp_change = ' . $expClan2 . ' WHERE clan_challenge_id = ' . $id . ' AND clan_id = ' . $clan2['id'];
// echo $sql . '<br>'; // echo $sql . '<br>';
mysql_query($sql); db_query($sql);
addClanExp($clan2['id'], $expClan2); addClanExp($clan2['id'], $expClan2);
$appendum = null; $appendum = null;
@ -110,7 +111,7 @@ if(!semaphoreUP($ressource)) {
$appendum = ', niederlagen = niederlagen + 1'; $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); semaphoreDown($ressource);

@ -14,10 +14,8 @@ $db_user ="username";
$db_passwort ="password"; $db_passwort ="password";
$db_name = "databasename"; $db_name = "databasename";
$conn = new mysqli($db_host, $db_user, $db_passwort, $db_name);
$conn = mysql_connect($db_host, $db_user, $db_passwort); $GLOBALS['main_db'] = $conn;
$db = mysql_select_db($db_name, $conn);
//////////////////Animegame NPC //////////////////Animegame NPC
$bebi = "2"; $bebi = "2";

@ -7,35 +7,36 @@
*/ */
include "db.php"; include "db.php";
include('path.inc.php'); include('path.inc.php');
include_once (ROOT_PATH.'/include/sqlwrapper.inc.php');
include_once(ROOT_PATH. "/include/random.inc.php"); include_once(ROOT_PATH. "/include/random.inc.php");
$mak_time = time(); $mak_time = time();
$z_time = time() - 86400; $z_time = time() - 86400;
$chars_k = mysql_query("SELECT charakter FROM kampf_list WHERE zeit < '$mak_time' and rasse != 'NPC'"); $chars_k = db_query("SELECT charakter FROM kampf_list WHERE zeit < '$mak_time' and rasse != 'NPC'");
while ($row4 = mysql_Fetch_array($chars_k)) { while ($row4 = mysqli_fetch_array($chars_k)) {
mysql_query("UPDATE chars SET status='Frei' WHERE id='$row4[charakter]'"); db_query("UPDATE chars SET status='Frei' WHERE id='$row4[charakter]'");
} }
mysql_query("DELETE FROM kampf_list WHERE zeit < '$mak_time' and rasse != 'NPC'"); db_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'"); //db_query("DELETE FROM user WHERE aktiv = 'nein' AND code_zeit < '$z_time'");
mysql_query("DELETE FROM top_kampf"); 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; $x = 0;
$mac_geld = 3000; $mac_geld = 3000;
while ($row = mysql_fetch_array($platz1)) { while ($row = mysqli_fetch_array($platz1)) {
$user = mysql_fetch_array(mysql_query("SELECT geld FROM user WHERE id='$row[besitzer]' LIMIT 3")); $user = mysqli_fetch_array(db_query("SELECT geld FROM user WHERE id='$row[besitzer]' LIMIT 3"));
$new_geld = $user[geld] + $mac_geld; $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; $mac_geld = $mac_geld -1000;
$x++; $x++;
} }
$row = ""; $row = "";
$platz1 = mysql_query("SELECT id, anzahl, preis FROM item"); $platz1 = db_query("SELECT id, anzahl, preis FROM item");
$x = 0; $x = 0;
while ($row = mysql_fetch_array($platz1)) { while ($row = mysqli_fetch_array($platz1)) {
if ($row[preis] >= 200000) { if ($row[preis] >= 200000) {
$anzahl = 1; $anzahl = 1;
} }
@ -78,22 +79,22 @@ while ($row = mysql_fetch_array($platz1)) {
if ($row[preis] < 80) { if ($row[preis] < 80) {
$anzahl = 5000; $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++; $x++;
} }
$row = ""; $row = "";
mysql_query("DELETE FROM liga_kampf"); db_query("DELETE FROM liga_kampf");
mysql_query("DELETE FROM wanted_kampf"); db_query("DELETE FROM wanted_kampf");
mysql_query("UPDATE chars SET status='Frei' WHERE status='Tod'"); db_query("UPDATE chars SET status='Frei' WHERE status='Tod'");
mysql_query("UPDATE user SET pw_fight='4'"); db_query("UPDATE user SET pw_fight='4'");
//////////////////////////////////NPCS!!!! //////////////////////////////////NPCS!!!!
$wahl = "starke+verteidigung+speed+ausdauer+glueck"; $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_hp = explode(",", $row[hp]);
$new_mp = explode(",", $row[mp]); $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_ausdauer = ($row[ausdauer] / 100) * mt_random_wrapper(75, 130);
$beste_glueck = ($row[glueck] / 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!!!! //////////////////////////////////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_hp = explode(",", $row[hp]);
$new_mp = explode(",", $row[mp]); $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_ausdauer = ($row[ausdauer] / 100) * mt_random_wrapper(100, 200);
$beste_glueck = ($row[glueck] / 100) * mt_random_wrapper(80, 100); $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 //////////////////NPC
$wahl = "starke+verteidigung+speed+ausdauer+glueck"; $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_hp = explode(",", $row[hp]);
$new_mp = explode(",", $row[mp]); $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_ausdauer = ($row[ausdauer] / 100) * mt_random_wrapper(60, 120);
$beste_glueck = ($row[glueck] / 100) * mt_random_wrapper(60, 200); $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 //////////////////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_hp = explode(",", $row[hp]);
$new_mp = explode(",", $row[mp]); $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_ausdauer = ($row[ausdauer] / 100) * mt_random_wrapper(80, 150);
$beste_glueck = ($row[glueck] / 100) * mt_random_wrapper(90, 100); $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");
?> ?>

@ -8,7 +8,7 @@
####################KAIOKEN SPIELER 1 ####################KAIOKEN SPIELER 1
if($technick1[type] == "frucht") { 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_mp[0] = $k_mp[0] - $technick1[mp];
$k_hp[0] = $k_hp[0] - $technick1[hp]; $k_hp[0] = $k_hp[0] - $technick1[hp];
if($k_mp[0] < 0) { if($k_mp[0] < 0) {
@ -28,7 +28,7 @@ $aktion_AV1[$x] = "nein";
####################KAIOKEN SPIELER 2 ####################KAIOKEN SPIELER 2
if($technick2[type] == "frucht") { 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_mp[1] = $k_mp[1] - $technick2[mp];
$k_hp[1] = $k_hp[1] - $technick2[hp]; $k_hp[1] = $k_hp[1] - $technick2[hp];
if($k_mp[1] < 0) { if($k_mp[1] < 0) {

@ -40,6 +40,7 @@ if ($argv) {
//include "inclu/char.inc.php"; //include "inclu/char.inc.php";
include('db.php'); include('db.php');
include('path.inc.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/char.inc.php');
include_once(ROOT_PATH.'/include/rassen.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"); $race_type = getRaceTypeName("NPC");
@ -175,8 +176,8 @@ if(is_numeric($maxlevel)){
$sql = 'SELECT count(*) as anzahl from chars where '.$auswahl_kriteria; $sql = 'SELECT count(*) as anzahl from chars where '.$auswahl_kriteria;
echo $sql.'<br>'; echo $sql.'<br>';
$qry = mysql_query($sql); $qry = db_query($sql);
$row = mysql_fetch_assoc($qry); $row = mysqli_fetch_assoc($qry);
if($row['anzahl'] < $anzahl){ if($row['anzahl'] < $anzahl){
echo $name.' konnte nicht mit '.$anzahl.' Chars gestartet werden, da es nur '.$row['anzahl'].' von '.$anzahl.' nötigen Chars gibt!<br>'; echo $name.' konnte nicht mit '.$anzahl.' Chars gestartet werden, da es nur '.$row['anzahl'].' von '.$anzahl.' nötigen Chars gibt!<br>';
@ -188,13 +189,13 @@ if($row['anzahl'] < $anzahl){
$cid = array(); $cid = array();
if($gain == 'Anmeldung'){ if($gain == 'Anmeldung'){
$sql = 'SELECT charakter as id FROM turnier1 t WHERE art = \''.$name.'\''; $sql = 'SELECT charakter as id FROM turnier1 t WHERE art = \''.$name.'\'';
$qry = mysql_query($sql); $qry = db_query($sql);
while($row = mysql_fetch_assoc($qry)){ while($row = mysqli_fetch_assoc($qry)){
$cid[] = $row['id']; $cid[] = $row['id'];
} }
$sql = 'DELETE FROM turnier1 WHERE art = \''.$name.'\''; $sql = 'DELETE FROM turnier1 WHERE art = \''.$name.'\'';
// echo $sql .'<br>'; // echo $sql .'<br>';
mysql_query($sql); // Lösche die Anmeldungsliste db_query($sql); // Lösche die Anmeldungsliste
if(count($cid) > 0){ if(count($cid) > 0){
$sql = 'SELECT id FROM chars where '.$auswahl_kriteria.' and id NOT IN('.join(',',$cid).') ORDER BY RAND()'; $sql = 'SELECT id FROM chars where '.$auswahl_kriteria.' and id NOT IN('.join(',',$cid).') ORDER BY RAND()';
} else { } else {
@ -212,8 +213,8 @@ if($gain == 'Anmeldung'){
} }
echo $sql.'<br>'; echo $sql.'<br>';
$qry = mysql_query($sql); $qry = db_query($sql);
while(($row = mysql_fetch_assoc($qry)) && count($cid) < $anzahl){ while(($row = mysqli_fetch_assoc($qry)) && count($cid) < $anzahl){
// echo $row['id'].'<br>'; // echo $row['id'].'<br>';
$cid[] = $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 $sql = 'SELECT id FROM chars WHERE id IN('.join(', ',$cid).') ORDER BY RAND()'; // Mischen der Teilnehmer
//echo $sql.'<br>'; //echo $sql.'<br>';
$qry = mysql_query($sql); $qry = db_query($sql);
$char_array = array(); $char_array = array();
while($row = mysql_fetch_assoc($qry)){ while($row = mysqli_fetch_assoc($qry)){
$char_array[] = $row['id']; $char_array[] = $row['id'];
} }
// So alle chars sind jetzt in den Arrays // So alle chars sind jetzt in den Arrays

@ -7,6 +7,7 @@
*/ */
include "db.php"; include "db.php";
include_once('path.inc.php'); // get the path ;) 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/messagefunctions.inc.php');
include_once ('inclu/halloffame.inc.php'); include_once ('inclu/halloffame.inc.php');
include_once ('inclu/fruitdistribution.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\' )'; $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(); $charids = array();
$qry1 = mysql_query($sql); $qry1 = db_query($sql);
while($row = mysql_fetch_assoc($qry1)){ while($row = mysqli_fetch_assoc($qry1)){
$charids[] = $row['x']; $charids[] = $row['x'];
} }
$sql2 = 'Select avg(level) as dlevel from chars where id in ('.join(',', $charids).')'; $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']); $dlevel = ceil($row['dlevel']);
@ -38,7 +39,7 @@ $rang1 = getChar($results[0][0]);
insertIntoHallOfFame('Weltturnier', $rang1['id'], $rang1['besitzer']); 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 ////////////////FRUCHT ARRAY
//include "array.php"; //include "array.php";

@ -7,6 +7,7 @@
*/ */
include "db.php"; include "db.php";
include_once('path.inc.php'); // get the path ;) 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/messagefunctions.inc.php');
include_once ('inclu/halloffame.inc.php'); include_once ('inclu/halloffame.inc.php');
include_once ('inclu/fruitdistribution.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.'\' )'; $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(); $charids = array();
$qry1 = mysql_query($sql); $qry1 = db_query($sql);
while($row = mysql_fetch_assoc($qry1)){ while($row = mysqli_fetch_assoc($qry1)){
$charids[] = $row['x']; $charids[] = $row['x'];
} }
$sql2 = 'Select avg(level) as dlevel from chars where id in ('.join(',', $charids).')'; $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']); $dlevel = ceil($row['dlevel']);
@ -42,7 +43,7 @@ $rang1 = getChar($results[0][0]);
insertIntoHallOfFame($turnier_name, $rang1['id'], $rang1['besitzer']); 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 ////////////////FRUCHT ARRAY
//include "array.php"; //include "array.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()'; $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) { if ($row['anzahl'] > 0) {
$GLOBALS['char_buffered_statuses'][$charid] = 'Turnier'; $GLOBALS['char_buffered_statuses'][$charid] = 'Turnier';
return 'Turnier'; return 'Turnier';
} }
$sql = 'SELECT count(*) as anzahl from quests where charid = ' . $charid; $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) { if ($row['anzahl'] > 0) {
$GLOBALS['char_buffered_statuses'][$charid] = 'Schatz Suche'; $GLOBALS['char_buffered_statuses'][$charid] = 'Schatz Suche';
return 'Schatz Suche'; return 'Schatz Suche';
} }
$sql = 'SELECT count(*) as anzahl from kampf where db_satz = ' . $charid; $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) { if ($row['anzahl'] > 0) {
$GLOBALS['char_buffered_statuses'][$charid] = 'Kampf'; $GLOBALS['char_buffered_statuses'][$charid] = 'Kampf';
return 'Kampf'; return 'Kampf';
} }
$sql = 'SELECT count(*) as anzahl FROM kampf_list where charakter = ' . $charid; $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) { if ($row['anzahl'] > 0) {
$GLOBALS['char_buffered_statuses'][$charid] = 'Kampf erstellt'; $GLOBALS['char_buffered_statuses'][$charid] = 'Kampf erstellt';
return 'Kampf erstellt'; return 'Kampf erstellt';
} }
$sql = 'SELECT count(*) as anzahl FROM turnier1 where charakter = ' . $charid; $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) { if ($row['anzahl'] > 0) {
$GLOBALS['char_buffered_statuses'][$charid] = 'Angemeldet'; $GLOBALS['char_buffered_statuses'][$charid] = 'Angemeldet';
return 'Angemeldet'; return 'Angemeldet';
@ -85,7 +85,7 @@ function getChar($charid, $buffer_enabled = true) {
// Wenn Char nicht im Puffer ist, oder nicht gepuffert werden soll // Wenn Char nicht im Puffer ist, oder nicht gepuffert werden soll
if ($GLOBALS['char_buffered_instances'][$charid] == null || !$buffer_enabled) { if ($GLOBALS['char_buffered_instances'][$charid] == null || !$buffer_enabled) {
// Lese das Charfeld aus der Datenbank aus // 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;} if(!$char){return null;}
// Speichere in $char['stauts'] den aktuellen Status des Chars (buffer-Strategie ist hierbei die selbe) // Speichere in $char['stauts'] den aktuellen Status des Chars (buffer-Strategie ist hierbei die selbe)
$char['status'] = getStatus($char['id'],$buffer_enabled); $char['status'] = getStatus($char['id'],$buffer_enabled);
@ -101,7 +101,7 @@ function getChar2($charid) {
if(!is_numeric($charid)){ if(!is_numeric($charid)){
return null; return null;
} else { } 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;} if(!$char){return null;}
// Speichere in $char['stauts'] den aktuellen Status des Chars (buffer-Strategie ist hierbei die selbe) // Speichere in $char['stauts'] den aktuellen Status des Chars (buffer-Strategie ist hierbei die selbe)
$char['status'] = getStatus($char['id'],$buffer_enabled); $char['status'] = getStatus($char['id'],$buffer_enabled);
@ -113,7 +113,7 @@ function getChar2($charid) {
function getCharWithBuffs($charid, $buffer_enabled = true){ function getCharWithBuffs($charid, $buffer_enabled = true){
$char = getChar($charid, $buffer_enabled); $char = getChar($charid, $buffer_enabled);
if($char['kampf_item'] != NULL && $char['kampf_item'] != ',,,,'){ 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['starke'] += $char_buffs['starke'];
$char['verteidigung'] += $char_buffs['verteidigung']; $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) { if ($GLOBALS['chars_read_out_user'][$userid] == null || !$buffer_enabled) {
$GLOBALS['chars_read_out_user'][$userid] = array(); $GLOBALS['chars_read_out_user'][$userid] = array();
$qry = mysql_query('Select * from chars where besitzer = '.$userid.' order by id'); $qry = db_query('Select * from chars where besitzer = '.$userid.' order by id');
while($char = mysql_fetch_assoc($qry)){ while($char = mysqli_fetch_assoc($qry)){
// Speichere in $char['stauts'] den aktuellen Status des Chars (buffer-Strategie ist hierbei die selbe) // Speichere in $char['stauts'] den aktuellen Status des Chars (buffer-Strategie ist hierbei die selbe)
$char['status'] = getStatus($char['id'],$buffer_enabled); $char['status'] = getStatus($char['id'],$buffer_enabled);
$char['bild'] = getPicture($char); $char['bild'] = getPicture($char);
@ -170,8 +170,8 @@ function deleteChar($userid, $charid){
} else if($char['status'] != 'Frei'){ } else if($char['status'] != 'Frei'){
return 'Char ist nicht Frei!'; return 'Char ist nicht Frei!';
} }
mysql_query('Delete from lernen where besitzer = '.$charid); db_query('Delete from lernen where besitzer = '.$charid);
mysql_query('Delete from chars where id = '.$charid); db_query('Delete from chars where id = '.$charid);
return true; return true;
} }
@ -211,7 +211,7 @@ function getPowerLevelWithBuffs($charid, $buffer_enabled = true){
return null; return null;
} }
if($char['kampf_item'] != NULL && $char['kampf_item'] != ',,,,'){ 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']; 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'];
} }

@ -58,15 +58,15 @@ function addAttackUsageToChar($char_id, $attacken){
// So jetzt nur noch die reqs einpflegen // 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; $sql = 'Update lernen set benutzt = benutzt + '.$attacken[$i]['anzahl'].' where name = \''.$attacken[$i]['a_name'].'\' and besitzer = '.$char_id;
// echo $sql.'<br>'; // echo $sql.'<br>';
mysql_query($sql); db_query($sql);
} }
// Sooo und nun gehts darum ob wir neue Attacken lernen können // Sooo und nun gehts darum ob wir neue Attacken lernen können
// Ersma die ganzen Infos laden // Ersma die ganzen Infos laden
$sql = 'SELECT * FROM lernen where besitzer = '.$char_id; $sql = 'SELECT * FROM lernen where besitzer = '.$char_id;
$qry = mysql_query($sql); $qry = db_query($sql);
while($row = mysql_fetch_assoc($qry)){ while($row = mysqli_fetch_assoc($qry)){
$lern[$row['at_id']] = $row; // Zum späteren Check ob die Reqs erfüllt sind $lern[$row['at_id']] = $row; // Zum späteren Check ob die Reqs erfüllt sind
$atkid[] = $row['at_id']; // Zum ausschliessen der Attacken $atkid[] = $row['at_id']; // Zum ausschliessen der Attacken
} }
@ -85,7 +85,7 @@ function addAttackUsageToChar($char_id, $attacken){
// echo $sql.'<br>'; // echo $sql.'<br>';
$qry = mysql_query($sql); $qry = db_query($sql);
// Das geht leider nicht mit dieser Datenstruktur direkt auszuwählen // Das geht leider nicht mit dieser Datenstruktur direkt auszuwählen
$raceid[] = getCharRaceId($char_id); $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 ... // 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) // Erstmal checken ob es eine Fruchtattacke ist (durch die SQL-Anweisung werden alle nicht zutreffenden Früchte ausgeblockt)
$learnable = false; $learnable = false;
if(!is_null($row['Frucht'])){ if(!is_null($row['Frucht'])){
@ -129,7 +129,7 @@ function addAttackUsageToChar($char_id, $attacken){
} }
if($learnable){ 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 '<script language="JavaScript">alert(\''.$char['name'].' hat die Technik '.$row['name'].' gelernt!\');</script>'; echo '<script language="JavaScript">alert(\''.$char['name'].' hat die Technik '.$row['name'].' gelernt!\');</script>';
} }
} }
@ -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; $sql = 'Update chars set exp = \''.$char_exp[0].','.$char_exp[1].'\' where id = '.$char_id;
} }
// echo $sql.'<br>'; // echo $sql.'<br>';
mysql_query($sql); db_query($sql);
$char = getChar($char_id, false); // We really want the actual char!! $char = getChar($char_id, false); // We really want the actual char!!
if($char['level'] > 25) { if($char['level'] > 25) {
// remove this char out of the registration of the beginners tournament // 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){ function addExpToArena($user_id, $n_exp){
$sql = 'SELECT * from arena where besitzer = '.$user_id; $sql = 'SELECT * from arena where besitzer = '.$user_id;
$qry = mysql_query($sql); $qry = db_query($sql);
$arena = mysql_fetch_assoc($qry); $arena = mysqli_fetch_assoc($qry);
$arena_exp = explode(',', $arena['exp']); $arena_exp = explode(',', $arena['exp']);
$arena_exp[0] += $n_exp; $arena_exp[0] += $n_exp;
$lvls = 0; $lvls = 0;
@ -186,11 +186,11 @@ function addExpToArena($user_id, $n_exp){
$arena_exp[1] = calculateRequiredExpArena($arena['level']); $arena_exp[1] = calculateRequiredExpArena($arena['level']);
} }
if($lvls > 0){ 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 '<script language="JavaScript">alert(\'Arena ist um '.$lvls.' Level gestiegen!\');</script>'; echo '<script language="JavaScript">alert(\'Arena ist um '.$lvls.' Level gestiegen!\');</script>';
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{ } 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);
} }
} }

@ -10,30 +10,30 @@ include_once(ROOT_PATH. "/include/random.inc.php");
function distributeFruit($user_id) { function distributeFruit($user_id) {
$sql = 'SELECT id FROM wochen_markt WHERE art=\'natur\''; $sql = 'SELECT id FROM wochen_markt WHERE art=\'natur\'';
$qry = mysql_query($sql); $qry = db_query($sql);
$amount = mysql_num_rows($qry); $amount = mysqli_num_rows($qry);
while($fruit = mysql_fetch_assoc($qry)) { while($fruit = mysqli_fetch_assoc($qry)) {
$fruits[] = $fruit; $fruits[] = $fruit;
} }
$choice = mt_random_wrapper(0,$amount-1); $choice = mt_random_wrapper(0,$amount-1);
$sql = 'INSERT wochen_ware SET item='.$fruits[$choice]['id'].', user='.$user_id; $sql = 'INSERT wochen_ware SET item='.$fruits[$choice]['id'].', user='.$user_id;
echo $sql . '<br>'; echo $sql . '<br>';
mysql_query($sql); db_query($sql);
} }
function distributeParamecia($user_id) { function distributeParamecia($user_id) {
$sql = 'SELECT id FROM wochen_markt WHERE kategorie=\'Paramecia\''; $sql = 'SELECT id FROM wochen_markt WHERE kategorie=\'Paramecia\'';
$qry = mysql_query($sql); $qry = db_query($sql);
$amount = mysql_num_rows($qry); $amount = mysqli_num_rows($qry);
while($fruit = mysql_fetch_assoc($qry)) { while($fruit = mysqli_fetch_assoc($qry)) {
$fruits[] = $fruit; $fruits[] = $fruit;
} }
$choice = mt_random_wrapper(0,$amount-1); $choice = mt_random_wrapper(0,$amount-1);
$sql = 'INSERT wochen_ware SET item='.$fruits[$choice]['id'].', user='.$user_id; $sql = 'INSERT wochen_ware SET item='.$fruits[$choice]['id'].', user='.$user_id;
echo $sql . '<br>'; echo $sql . '<br>';
mysql_query($sql); db_query($sql);
} }

@ -17,9 +17,9 @@ include_once('char.inc.php');
*/ */
function insertIntoHallOfFame($title, $charid, $userid){ function insertIntoHallOfFame($title, $charid, $userid){
echo 'insertIntoHallOfFame('.$title.', '.$charid.', '.$userid.')<br>'; echo 'insertIntoHallOfFame('.$title.', '.$charid.', '.$userid.')<br>';
$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); $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){ if(!$row){
echo 'insertIntoHallOfFame failed as the basic methods failed!<br>'; echo 'insertIntoHallOfFame failed as the basic methods failed!<br>';
@ -50,18 +50,18 @@ function insertIntoHallOfFameFull($round = '', $title = '', $charid = '', $charn
} }
$sql = 'INSERT INTO highscore('.$columns.') values('.$values.')'; $sql = 'INSERT INTO highscore('.$columns.') values('.$values.')';
// echo $sql.'<br>'; // echo $sql.'<br>';
$qry = mysql_query($sql); $qry = db_query($sql);
return mysql_affected_rows() > 0; return db_affected_rows() > 0;
} }
function getHallOfFame($title, $userid) { 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); return getHallOfFameFull($row['round'],$title, $userid);
} }
function getHallOfFameFull($round = '', $title = '', $userid = '') { function getHallOfFameFull($round = '', $title = '', $userid = '') {
$sql = 'select count(*) from highscore where runde='.$round.' and userid='.$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]; return $row[0];
} }

@ -18,8 +18,8 @@ function insertUserTickerMessage($userid, $message, $offset = 0){
} }
for($msgid = 0; $msgid < 100000; $msgid += mt_random_wrapper(1,1000)){ 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.'\')'; $sql = 'INSERT INTO user_ticker(userid, date, msgid, text) values('.$userid.', '.$timestamp.', '.$msgid.', \''.$message.'\')';
mysql_query($sql); db_query($sql);
if(mysql_affected_rows() == 1){ if(db_affected_rows() == 1){
// echo 'MYSQL success: '.$sql; // echo 'MYSQL success: '.$sql;
return; return;
} }
@ -35,8 +35,8 @@ function insertClanTickerMessage($clanid, $message, $offset = 0){
} }
for($msgid = 0; $msgid < 100000; $msgid += mt_random_wrapper(1,1000)){ 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.'\')'; $sql = 'INSERT INTO clan_ticker(clanid, date, msgid, text) values('.$clanid.', now(), '.$msgid.', \''.$message.'\')';
mysql_query($sql); db_query($sql);
if(mysql_affected_rows() == 1){ if(db_affected_rows() == 1){
// echo 'MYSQL success: '.$sql; // echo 'MYSQL success: '.$sql;
return; return;
} }

@ -25,9 +25,9 @@ function generateTournamentResults($name, $additionalExpPerRound, $additionalMon
$charids = array(); $charids = array();
// First calculate the money and exp the char gets just for doing good at fights ;) // 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']])) { if(!isset($charArray[$fight['char1']])) {
$charArray[$fight['char1']] = array('exp' => 0, 'money' => 0); $charArray[$fight['char1']] = array('exp' => 0, 'money' => 0);
$charids[$fight['char1']] = 1; $charids[$fight['char1']] = 1;
@ -46,9 +46,9 @@ function generateTournamentResults($name, $additionalExpPerRound, $additionalMon
$returnArray = array(); $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 ;)) // 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; $maxRank = -1;
while ($participant = mysql_fetch_assoc($qry)) { while ($participant = mysqli_fetch_assoc($qry)) {
$charids[$participant['win']] = 0; // okay we already proceeded this one :) $charids[$participant['win']] = 0; // okay we already proceeded this one :)
// okay, first add experience the the $charArray !! // okay, first add experience the the $charArray !!
$charArray[$participant['win']]['exp'] += $additionalExpPerRound * $participant['anzahl']; $charArray[$participant['win']]['exp'] += $additionalExpPerRound * $participant['anzahl'];
@ -63,7 +63,7 @@ function generateTournamentResults($name, $additionalExpPerRound, $additionalMon
$char = getChar($participant['win']); $char = getChar($participant['win']);
$sql = 'UPDATE user set geld = geld + ' . $charArray[$participant['win']]['money'] . ' WHERE id = ' . $char['besitzer']; $sql = 'UPDATE user set geld = geld + ' . $charArray[$participant['win']]['money'] . ' WHERE id = ' . $char['besitzer'];
echo $sql . ' <br>'; echo $sql . ' <br>';
mysql_query($sql); db_query($sql);
} }
foreach ($charids as $key => $value) { foreach ($charids as $key => $value) {
@ -75,7 +75,7 @@ function generateTournamentResults($name, $additionalExpPerRound, $additionalMon
$char = getChar($key); $char = getChar($key);
$sql = 'UPDATE user set geld = geld + ' . $charArray[$key]['money'] . ' WHERE id = ' . $char['besitzer']; $sql = 'UPDATE user set geld = geld + ' . $charArray[$key]['money'] . ' WHERE id = ' . $char['besitzer'];
echo $sql . ' <br>'; echo $sql . ' <br>';
mysql_query($sql); db_query($sql);
} }
} }
@ -111,7 +111,7 @@ function distributeShopPoints(array $prices, array $winners, $reason) {
$userid = $char['besitzer']; $userid = $char['besitzer'];
$sql = 'UPDATE user set pkt = pkt + '.$points.' WHERE id = '. $userid; $sql = 'UPDATE user set pkt = pkt + '.$points.' WHERE id = '. $userid;
echo $sql . ' <br>'; echo $sql . ' <br>';
mysql_query($sql); db_query($sql);
insertUserTickerMessage($userid, $points .' IP durch den '.generateRanglistString($i).' Platz im '.$reason.' erhalten!'); 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']; $userid = $char['besitzer'];
$sql = 'UPDATE user set geld = geld + '.$points.' WHERE id = '. $userid; $sql = 'UPDATE user set geld = geld + '.$points.' WHERE id = '. $userid;
echo $sql . ' <br>'; echo $sql . ' <br>';
mysql_query($sql); db_query($sql);
insertUserTickerMessage($userid, $points .' Preisgeld durch den '.generateRanglistString($i).' Platz im '.$reason.' erhalten!'); 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) { foreach($results[$i] as $winner) {
$char = getChar($winner); // buffered so will not cause in a sql statement all the time! $char = getChar($winner); // buffered so will not cause in a sql statement all the time!
$userid = $char['besitzer']; $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'])) { if(is_numeric($data['clan'])) {
$sql = 'UPDATE clan SET geld = geld + ' . $points . ' WHERE id = ' . $data['clan']; $sql = 'UPDATE clan SET geld = geld + ' . $points . ' WHERE id = ' . $data['clan'];
echo $sql . ' <br>'; echo $sql . ' <br>';
mysql_query($sql); db_query($sql);
insertClanTickerMessage($row['clan'], 'Das Preisgeld von '.$points.' f&uuml;r den '.generateRanglistString($i).' Platz im '.$reason.' erhalten!'); insertClanTickerMessage($row['clan'], 'Das Preisgeld von '.$points.' f&uuml;r den '.generateRanglistString($i).' Platz im '.$reason.' erhalten!');
} }
} }

@ -39,9 +39,9 @@ if($k_attacke1_2[$x]) {
} }
if($new_tech1 == 1) { 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; $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) { 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; $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"));
} }
} }

@ -7,16 +7,16 @@
*/ */
include_once(ROOT_PATH.'/include/config.inc.php'); 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_a = mysqli_fetch_array(db_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_a1 = mysqli_fetch_array(db_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_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]) { 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 { } 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) { if(!$user1 OR !$user2) {
echo "Fehler User wurde nicht gefunden oder der kampf Existiert nicht mehr"; echo "Fehler User wurde nicht gefunden oder der kampf Existiert nicht mehr";
@ -24,7 +24,7 @@ exit;
} }
if($chat_nachricht) { 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'");
?> ?>
<meta http-equiv="refresh" content="0.5; URL=<?php echo $PHPSELF; ?>?char_id=<?php echo $char_id; ?>"> <meta http-equiv="refresh" content="0.5; URL=<?php echo $PHPSELF; ?>?char_id=<?php echo $char_id; ?>">
<?php <?php
@ -57,7 +57,7 @@ echo "</SCRIPT>";
<tr> <tr>
<td height="100" valign="top"> <td height="100" valign="top">
<?php <?php
$all_mess = mysql_query("SELECT n.nachricht, w.nickname FROM kampf_nachricht n LEFT JOIN user w ON(n.user=w.id) WHERE (n.user='$user1[id]' OR n.user='$user2[id]') AND (n.charakter='$kampf_a1[id]' OR n.charakter='$kampf_a2[id]') ORDER BY n.id ASC"); $all_mess = db_query("SELECT n.nachricht, w.nickname FROM kampf_nachricht n LEFT JOIN user w ON(n.user=w.id) WHERE (n.user='$user1[id]' OR n.user='$user2[id]') AND (n.charakter='$kampf_a1[id]' OR n.charakter='$kampf_a2[id]') ORDER BY n.id ASC");
?> ?>
<form action=<?php echo $PHPSELF; ?>?char_id=<?php echo $char_id; ?> method=post> <form action=<?php echo $PHPSELF; ?>?char_id=<?php echo $char_id; ?> method=post>
<SCRIPT Language="JavaScript"> <SCRIPT Language="JavaScript">
@ -78,7 +78,7 @@ function scrolldown()
<?php <?php
while($row = mysql_fetch_array($all_mess)) { while($row = mysqli_fetch_array($all_mess)) {
echo "$row[nickname]: $row[nachricht] \n"; echo "$row[nickname]: $row[nachricht] \n";
} }
?> ?>

@ -16,10 +16,10 @@ if($exp_rows2[level] == 3) { $new_max_exp2 = 30000; }
if($exp_rows2[level] == 4) { $new_max_exp2 = 100000; } if($exp_rows2[level] == 4) { $new_max_exp2 = 100000; }
if($EXP_new1+$exp_rows1[min_exp] >= $exp_rows1[max_exp] AND $exp_rows1[level] != 5) { if($EXP_new1+$exp_rows1[min_exp] >= $exp_rows1[max_exp] AND $exp_rows1[level] != 5) {
mysql_query("UPDATE clan SET level=level+1, max_exp='$new_max_exp1', member=member+2 WHERE id='$clan1[$iws]'"); db_query("UPDATE clan SET level=level+1, max_exp='$new_max_exp1', member=member+2 WHERE id='$clan1[$iws]'");
} }
if($EXP_new2+$exp_rows2[min_exp] >= $exp_rows2[max_exp] AND $exp_rows2[level] != 5) { if($EXP_new2+$exp_rows2[min_exp] >= $exp_rows2[max_exp] AND $exp_rows2[level] != 5) {
mysql_query("UPDATE clan SET level=level+1, max_exp='$new_max_exp2', member=member+2 WHERE id='$clan2[$iws]'"); db_query("UPDATE clan SET level=level+1, max_exp='$new_max_exp2', member=member+2 WHERE id='$clan2[$iws]'");
} }

@ -9,17 +9,17 @@
include_once(ROOT_PATH.'/include/designfunctions.inc.php'); include_once(ROOT_PATH.'/include/designfunctions.inc.php');
include_once(ROOT_PATH.'/include/fehlerausgabe.inc.php'); include_once(ROOT_PATH.'/include/fehlerausgabe.inc.php');
$daten_ende = mysql_Fetch_array(mysql_query("SELECT * FROM kampf_new WHERE char1='$char_id' OR char2='$char_id' LIMIT 1")); $daten_ende = mysqli_fetch_array(db_query("SELECT * FROM kampf_new WHERE char1='$char_id' OR char2='$char_id' LIMIT 1"));
$daten_satz = mysql_fetch_array(mysql_query("SELECT id FROM kampf WHERE db_satz='$char_id' LIMIT 1")); $daten_satz = mysqli_fetch_array(db_query("SELECT id FROM kampf WHERE db_satz='$char_id' LIMIT 1"));
if($daten_satz[id]) { if($daten_satz[id]) {
displayErrorMessage(NULL,'Sie k&ouml;nnen ihren Charakter nun abholen!', displayHistoryBackLink()); displayErrorMessage(NULL,'Sie k&ouml;nnen ihren Charakter nun abholen!', displayHistoryBackLink());
exit; exit;
} }
$chara_1x = mysql_fetch_array(mysql_query("SELECT verteidigung, speed, ausdauer, glueck, starke FROM chars WHERE id='$daten_ende[char1]' LIMIT 1")); $chara_1x = mysqli_fetch_array(db_query("SELECT verteidigung, speed, ausdauer, glueck, starke FROM chars WHERE id='$daten_ende[char1]' LIMIT 1"));
$chara_2x = mysql_fetch_array(mysql_query("SELECT verteidigung, speed, ausdauer, glueck, starke FROM chars WHERE id='$daten_ende[char2]' LIMIT 1")); $chara_2x = mysqli_fetch_array(db_query("SELECT verteidigung, speed, ausdauer, glueck, starke FROM chars WHERE id='$daten_ende[char2]' LIMIT 1"));
//##################################### EXP!!!!!!!!! //##################################### EXP!!!!!!!!!
@ -60,7 +60,7 @@ $new_atks1 = explode(",", $daten_ende[atk1]);
$new_atks2 = explode(",", $daten_ende[atk2]); $new_atks2 = explode(",", $daten_ende[atk2]);
while($ze < count($new_atks1)) { while($ze < count($new_atks1)) {
$atks = mysql_fetch_array(mysql_query("SELECT name FROM lernen WHERE id='$new_atks1[$ze]' LIMIT 1")); $atks = mysqli_fetch_array(db_query("SELECT name FROM lernen WHERE id='$new_atks1[$ze]' LIMIT 1"));
$new_atku .=$atks[name]; $new_atku .=$atks[name];
if($ze<count($new_atks1)) { if($ze<count($new_atks1)) {
$new_atku .=","; $new_atku .=",";
@ -70,7 +70,7 @@ $ze++;
$ze = 0; $ze = 0;
while($ze < count($new_atks2)) { while($ze < count($new_atks2)) {
$atks = mysql_fetch_array(mysql_query("SELECT name FROM lernen WHERE id='$new_atks2[$ze]' LIMIT 1")); $atks = mysqli_fetch_array(db_query("SELECT name FROM lernen WHERE id='$new_atks2[$ze]' LIMIT 1"));
$new_atku .=$atks[name]; $new_atku .=$atks[name];
if($ze<count($new_atks2)) { if($ze<count($new_atks2)) {
$new_atku .=","; $new_atku .=",";
@ -78,18 +78,18 @@ $new_atku .=",";
$ze++; $ze++;
} }
mysql_query("INSERT kampf SET hp1='$daten_ende[hp1]', hp2='$daten_ende[hp2]', mp1='$daten_ende[mp1]', mp2='$daten_ende[mp2]', db_query("INSERT kampf SET hp1='$daten_ende[hp1]', hp2='$daten_ende[hp2]', mp1='$daten_ende[mp1]', mp2='$daten_ende[mp2]',
attacke1='$daten_ende[atk1]', attacke2='$daten_ende[atk2]', schaden1='$daten_ende[schaden1]', schaden2='$daten_ende[schaden2]', char1='$daten_ende[char1]', char2='$daten_ende[char2]', starke1='$daten_ende[starke1]', starke2='$daten_ende[starke2]', ver1='$daten_ende[ver1]', ver2='$daten_ende[ver2]', speed1='$daten_ende[speed1]',speed2='$daten_ende[speed2]', ausdauer1='$daten_ende[ausdauer1]', ausdauer2='$daten_ende[ausdauer2]' attacke1='$daten_ende[atk1]', attacke2='$daten_ende[atk2]', schaden1='$daten_ende[schaden1]', schaden2='$daten_ende[schaden2]', char1='$daten_ende[char1]', char2='$daten_ende[char2]', starke1='$daten_ende[starke1]', starke2='$daten_ende[starke2]', ver1='$daten_ende[ver1]', ver2='$daten_ende[ver2]', speed1='$daten_ende[speed1]',speed2='$daten_ende[speed2]', ausdauer1='$daten_ende[ausdauer1]', ausdauer2='$daten_ende[ausdauer2]'
,exp1='$new_exp1', exp2='$new_exp2', geld1='$new_geld1', geld2='$new_geld2', arena_geld='$arena_einkommen', besucher='$arena_besucher', win='$char_win', lose='$char_lose', arena_name='$arena[name]', dauer='0', db_satz ='$daten_ende[char1]'"); ,exp1='$new_exp1', exp2='$new_exp2', geld1='$new_geld1', geld2='$new_geld2', arena_geld='$arena_einkommen', besucher='$arena_besucher', win='$char_win', lose='$char_lose', arena_name='$arena[name]', dauer='0', db_satz ='$daten_ende[char1]'");
mysql_query("INSERT kampf SET hp1='$daten_ende[hp1]', hp2='$daten_ende[hp2]', mp1='$daten_ende[mp1]', mp2='$daten_ende[mp2]', db_query("INSERT kampf SET hp1='$daten_ende[hp1]', hp2='$daten_ende[hp2]', mp1='$daten_ende[mp1]', mp2='$daten_ende[mp2]',
attacke1='$daten_ende[atk1]', attacke2='$daten_ende[atk2]', schaden1='$daten_ende[schaden1]', schaden2='$daten_ende[schaden2]', char1='$daten_ende[char1]', char2='$daten_ende[char2]', starke1='$daten_ende[starke1]', starke2='$daten_ende[starke2]', ver1='$daten_ende[ver1]', ver2='$daten_ende[ver2]', speed1='$daten_ende[speed1]',speed2='$daten_ende[speed2]', ausdauer1='$daten_ende[ausdauer1]', ausdauer2='$daten_ende[ausdauer2]' attacke1='$daten_ende[atk1]', attacke2='$daten_ende[atk2]', schaden1='$daten_ende[schaden1]', schaden2='$daten_ende[schaden2]', char1='$daten_ende[char1]', char2='$daten_ende[char2]', starke1='$daten_ende[starke1]', starke2='$daten_ende[starke2]', ver1='$daten_ende[ver1]', ver2='$daten_ende[ver2]', speed1='$daten_ende[speed1]',speed2='$daten_ende[speed2]', ausdauer1='$daten_ende[ausdauer1]', ausdauer2='$daten_ende[ausdauer2]'
,exp1='$new_exp1', exp2='$new_exp2', geld1='$new_geld1', geld2='$new_geld2', arena_geld='$arena_einkommen', besucher='$arena_besucher', win='$char_win', lose='$char_lose', arena_name='$arena[name]', dauer='0', db_satz ='$daten_ende[char2]'"); ,exp1='$new_exp1', exp2='$new_exp2', geld1='$new_geld1', geld2='$new_geld2', arena_geld='$arena_einkommen', besucher='$arena_besucher', win='$char_win', lose='$char_lose', arena_name='$arena[name]', dauer='0', db_satz ='$daten_ende[char2]'");
mysql_query("DELETE FROM kampf_new1 WHERE char1='$daten_ende[char1]' AND char2='$daten_ende[char2]' LIMIT 1"); db_query("DELETE FROM kampf_new1 WHERE char1='$daten_ende[char1]' AND char2='$daten_ende[char2]' LIMIT 1");
mysql_query("DELETE FROM kampf_new WHERE char1='$daten_ende[char1]' AND char2='$daten_ende[char2]' LIMIT 1"); db_query("DELETE FROM kampf_new WHERE char1='$daten_ende[char1]' AND char2='$daten_ende[char2]' LIMIT 1");
mysql_query("UPDATE chars SET status='Kampf' WHERE id='$daten_ende[char1]' OR id='$daten_ende[char2]' LIMIT 2"); db_query("UPDATE chars SET status='Kampf' WHERE id='$daten_ende[char1]' OR id='$daten_ende[char2]' LIMIT 2");
if($daten_satz['id']) { if($daten_satz['id']) {
displayErrorMessage(NULL,'Sie k&ouml;nnen ihren Charakter nun abholen!', displayHistoryBackLink()); displayErrorMessage(NULL,'Sie k&ouml;nnen ihren Charakter nun abholen!', displayHistoryBackLink());

@ -9,7 +9,7 @@
####################KAIOKEN SPIELER 1 ####################KAIOKEN SPIELER 1
if($technick1[type] == "frucht") { 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_mp[0] = $k_mp[0] - $technick1[mp];
$k_hp[0] = $k_hp[0] - $technick1[hp]; $k_hp[0] = $k_hp[0] - $technick1[hp];
if($k_mp[0] < 0) { if($k_mp[0] < 0) {
@ -29,7 +29,7 @@ $aktion_AV1[$x] = "nein";
####################KAIOKEN SPIELER 2 ####################KAIOKEN SPIELER 2
if($technick2[type] == "frucht") { 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_mp[1] = $k_mp[1] - $technick2[mp];
$k_hp[1] = $k_hp[1] - $technick2[hp]; $k_hp[1] = $k_hp[1] - $technick2[hp];
if($k_mp[1] < 0) { if($k_mp[1] < 0) {

@ -9,7 +9,7 @@
if($runden_gif1) { if($runden_gif1) {
if($runden_gif1 > $x) { if($runden_gif1 > $x) {
$technick1_old = mysql_fetch_array(mysql_query("SELECT * FROM attacken WHERE id='$attacken_list[$runden_gif_technik1]' LIMIT 1")); $technick1_old = mysqli_fetch_array(db_query("SELECT * FROM attacken WHERE id='$attacken_list[$runden_gif_technik1]' LIMIT 1"));
$k_starke[1] = $k_starke[1] - $technick1_old[starke]; $k_starke[1] = $k_starke[1] - $technick1_old[starke];
$k_speed[1] = $k_speed[1] - $technick1_old[speed]; $k_speed[1] = $k_speed[1] - $technick1_old[speed];
@ -51,7 +51,7 @@ $aktion_AV1[$x] = "nein";
if($runden_gif2) { if($runden_gif2) {
if($runden_gif2 > $x) { if($runden_gif2 > $x) {
$technick2_old = mysql_fetch_array(mysql_query("SELECT * FROM attacken WHERE id='$attacken_list[$runden_gif_technik2]' LIMIT 1")); $technick2_old = mysqli_fetch_array(db_query("SELECT * FROM attacken WHERE id='$attacken_list[$runden_gif_technik2]' LIMIT 1"));
$k_starke[0] = $k_starke[0] - $technick2_old[starke]; $k_starke[0] = $k_starke[0] - $technick2_old[starke];
$k_speed[0] = $k_speed[0] - $technick2_old[speed]; $k_speed[0] = $k_speed[0] - $technick2_old[speed];

@ -9,7 +9,7 @@
if($runden_summon1) { if($runden_summon1) {
if($runden_summon1 == $x) { if($runden_summon1 == $x) {
$user_summon_id = mysql_fetch_array(mysql_query("SELECT f.starke, f.speed, f.verteidigung, f.ausdauer, f.hp, f.mp, f.level, m.name FROM user u LEFT JOIN quest_fang f ON(f.id=u.summon) LEFT JOIN quest_monster m ON(m.id=f.monster) WHERE u.id='$chara_1[besitzer]' LIMIT 1")); $user_summon_id = mysqli_fetch_array(db_query("SELECT f.starke, f.speed, f.verteidigung, f.ausdauer, f.hp, f.mp, f.level, m.name FROM user u LEFT JOIN quest_fang f ON(f.id=u.summon) LEFT JOIN quest_monster m ON(m.id=f.monster) WHERE u.id='$chara_1[besitzer]' LIMIT 1"));
$k_starke[0] = $k_starke[0] - $user_summon_id[starke]; $k_starke[0] = $k_starke[0] - $user_summon_id[starke];
$k_speed[0] = $k_speed[0] - $user_summon_id[speed]; $k_speed[0] = $k_speed[0] - $user_summon_id[speed];
@ -34,7 +34,7 @@ if($technick1[type] == "summon") {
} else { } else {
if(!$chara_1[besitzer]) { $chara_1[besitzer] = $charakter[besitzer]; } if(!$chara_1[besitzer]) { $chara_1[besitzer] = $charakter[besitzer]; }
$user_summon_id = mysql_fetch_array(mysql_query("SELECT f.starke, f.speed, f.verteidigung, f.ausdauer, f.hp, f.mp, m.level, m.name FROM user u LEFT JOIN quest_fang f ON(f.id=u.summon) LEFT JOIN quest_monster m ON(m.id=f.monster) WHERE u.id='$chara_1[besitzer]' LIMIT 1")); $user_summon_id = mysqli_fetch_array(db_query("SELECT f.starke, f.speed, f.verteidigung, f.ausdauer, f.hp, f.mp, m.level, m.name FROM user u LEFT JOIN quest_fang f ON(f.id=u.summon) LEFT JOIN quest_monster m ON(m.id=f.monster) WHERE u.id='$chara_1[besitzer]' LIMIT 1"));
if($user_summon_id[level]>$technick1[maxlvl]) { if($user_summon_id[level]>$technick1[maxlvl]) {
@ -63,7 +63,7 @@ if($runden_summon2) {
if($runden_summon2 == $x) { if($runden_summon2 == $x) {
$user_summon_id = mysql_fetch_array(mysql_query("SELECT f.starke, f.speed, f.verteidigung, f.ausdauer, f.hp, f.mp, f.level, m.name FROM user u LEFT JOIN quest_fang f ON(f.id=u.summon) LEFT JOIN quest_monster m ON(m.id=f.monster) WHERE u.id='$chara_2[besitzer]' LIMIT 1")); $user_summon_id = mysqli_fetch_array(db_query("SELECT f.starke, f.speed, f.verteidigung, f.ausdauer, f.hp, f.mp, f.level, m.name FROM user u LEFT JOIN quest_fang f ON(f.id=u.summon) LEFT JOIN quest_monster m ON(m.id=f.monster) WHERE u.id='$chara_2[besitzer]' LIMIT 1"));
$k_starke[1] = $k_starke[1] - $user_summon_id[starke]; $k_starke[1] = $k_starke[1] - $user_summon_id[starke];
$k_speed[1] = $k_speed[1] - $user_summon_id[speed]; $k_speed[1] = $k_speed[1] - $user_summon_id[speed];
@ -88,7 +88,7 @@ if($technick2[type] == "summon") {
$k_mp[1] = 0; $k_mp[1] = 0;
} else { } else {
$user_summon_id = mysql_fetch_array(mysql_query("SELECT f.starke, f.speed, f.verteidigung, f.ausdauer, f.hp, f.mp, m.level, m.name FROM user u LEFT JOIN quest_fang f ON(f.id=u.summon) LEFT JOIN quest_monster m ON(m.id=f.monster) WHERE u.id='$chara_2[besitzer]' LIMIT 1")); $user_summon_id = mysqli_fetch_array(db_query("SELECT f.starke, f.speed, f.verteidigung, f.ausdauer, f.hp, f.mp, m.level, m.name FROM user u LEFT JOIN quest_fang f ON(f.id=u.summon) LEFT JOIN quest_monster m ON(m.id=f.monster) WHERE u.id='$chara_2[besitzer]' LIMIT 1"));
if($user_summon_id[level]>$technick2[maxlvl]) { if($user_summon_id[level]>$technick2[maxlvl]) {
$schaden_2 = "$user_summon_id[name] ist zu Stark"; $schaden_2 = "$user_summon_id[name] ist zu Stark";

@ -15,7 +15,7 @@ $k_mp[0] = $k_mp[0] - $technick1[mp];
if($k_mp[0] >= 0) { if($k_mp[0] >= 0) {
$prozent_technik1 = 0; $prozent_technik1 = 0;
$technick1 = mysql_fetch_array(mysql_query("SELECT * FROM attacken WHERE id='$technick2[id]' LIMIT 10")); $technick1 = mysqli_fetch_array(db_query("SELECT * FROM attacken WHERE id='$technick2[id]' LIMIT 10"));
$technick1[speed]=$technick1[speed]+(($technick1[speed]/100)*$prozent_technik1); $technick1[speed]=$technick1[speed]+(($technick1[speed]/100)*$prozent_technik1);
@ -42,7 +42,7 @@ $k_mp[1] = $k_mp[1] - $technick2[mp];
if($k_mp[1] >= 0) { if($k_mp[1] >= 0) {
$prozent_technik2 = 0; $prozent_technik2 = 0;
$technick2 = mysql_fetch_array(mysql_query("SELECT * FROM attacken WHERE id='$technick1[id]' LIMIT 10")); $technick2 = mysqli_fetch_array(db_query("SELECT * FROM attacken WHERE id='$technick1[id]' LIMIT 10"));
$technick2[speed]=$technick2[speed]+(($technick2[speed]/100)*$prozent_technik2); $technick2[speed]=$technick2[speed]+(($technick2[speed]/100)*$prozent_technik2);
$technick2[verteidigung]=$technick2[verteidigung]+(($technick2[verteidigung]/100)*$prozent_technik2); $technick2[verteidigung]=$technick2[verteidigung]+(($technick2[verteidigung]/100)*$prozent_technik2);

@ -7,6 +7,7 @@
*/ */
include "db.php"; include "db.php";
include_once('path.inc.php'); // get the path ;) 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/halloffame.inc.php');
include_once ('inclu/turnier.inc.php'); include_once ('inclu/turnier.inc.php');
include_once ('inclu/char.inc.php'); include_once ('inclu/char.inc.php');
@ -27,7 +28,7 @@ insertIntoHallOfFame('Anf&auml;ngerturnier', $rang1['id'], $rang1['besitzer']);
/* FIXME: Before we can do this we have to resolve the include chaos!! /* FIXME: Before we can do this we have to resolve the include chaos!!
if(getHallOfFameEntryCount('Anf&auml;ngerturnier', $rang1['id']) >= 2) { if(getHallOfFameEntryCount('Anf&auml;ngerturnier', $rang1['id']) >= 2) {
// remove all chars that are registered // remove all chars that are registered
mysql_query('DELETE FROM turnier1 WHERE art = \'klein\' AND besitzer = '.$rang1['besitzer']); db_query('DELETE FROM turnier1 WHERE art = \'klein\' AND besitzer = '.$rang1['besitzer']);
} }
*/ */

@ -7,17 +7,18 @@
*/ */
include "db.php"; include "db.php";
include('path.inc.php'); include('path.inc.php');
include_once (ROOT_PATH.'/include/sqlwrapper.inc.php');
include_once ('inclu/messagefunctions.inc.php'); include_once ('inclu/messagefunctions.inc.php');
include_once ('inclu/halloffame.inc.php'); include_once ('inclu/halloffame.inc.php');
$platz1 = mysql_query("SELECT id, besitzer, name FROM chars order by liga_punkte DESC LIMIT 3"); $platz1 = db_query("SELECT id, besitzer, name FROM chars order by liga_punkte DESC LIMIT 3");
mysql_query("UPDATE chars SET liga_siege='0', liga_niederlagen='0', liga_punkte='0'"); db_query("UPDATE chars SET liga_siege='0', liga_niederlagen='0', liga_punkte='0'");
$x=0; $x=0;
$mac_geld = 50000; $mac_geld = 50000;
while($row = mysql_fetch_array($platz1)) { while($row = mysqli_fetch_array($platz1)) {
$user = mysql_fetch_array(mysql_query("SELECT geld, nickname FROM user WHERE id='$row[besitzer]' LIMIT 3")); $user = mysqli_fetch_array(db_query("SELECT geld, nickname FROM user WHERE id='$row[besitzer]' LIMIT 3"));
$new_geld = $user[geld] + $mac_geld; $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 - 20000; $mac_geld = $mac_geld - 20000;
if($x == 0) { if($x == 0) {
$platz_a = $row[name]; $platz_a = $row[name];
@ -27,12 +28,12 @@ while($row = mysql_fetch_array($platz1)) {
} }
$x++; $x++;
} }
$all_user = mysql_query("SELECT mail FROM user"); $all_user = db_query("SELECT mail FROM user");
//while($rowa = mysql_fetch_array($all_user)) { //while($rowa = mysqli_fetch_array($all_user)) {
//@mail($rowa[mail],"LIGA Sieger","Sieger: $platz_a \n Trainer: $platz_b", "From: "."Vegeta"."\nReply-To: "."vegeta@animegame.de"."\nX-Mailer: PHP/" . phpversion()); //@mail($rowa[mail],"LIGA Sieger","Sieger: $platz_a \n Trainer: $platz_b", "From: "."Vegeta"."\nReply-To: "."vegeta@animegame.de"."\nX-Mailer: PHP/" . phpversion());
//} //}
$ligas = mysql_fetch_array(mysql_query("SELECT liga FROM online WHERE id='1'")); $ligas = mysqli_fetch_array(db_query("SELECT liga FROM online WHERE id='1'"));
mysql_query("UPDATE online SET liga='$ligas[liga],$platz_a,$platz_b' WHERE id='1'"); db_query("UPDATE online SET liga='$ligas[liga],$platz_a,$platz_b' WHERE id='1'");
// insertIntoHallOfFame($title, $charid, $userid); // insertIntoHallOfFame($title, $charid, $userid);
insertIntoHallOfFame('Liga', $platz_a_id, $platz_b_id); insertIntoHallOfFame('Liga', $platz_a_id, $platz_b_id);

@ -8,8 +8,8 @@
include('db.php'); include('db.php');
include('path.inc.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/char.inc.php');
include_once(ROOT_PATH.'/include/sqlwrapper.inc.php');
include_once(ROOT_PATH. "/include/random.inc.php"); include_once(ROOT_PATH. "/include/random.inc.php");
set_time_limit(0); set_time_limit(0);
@ -38,7 +38,7 @@ foreach($races as $race) {
$exclude_race_ids[] = '\''.$race['id'].'\''; $exclude_race_ids[] = '\''.$race['id'].'\'';
} }
$max_charakter = mysql_num_rows(db_query('SELECT id FROM chars WHERE rasse NOT IN ('.implode(',', $exclude_race_ids).') LIMIT 250')); $max_charakter = mysqli_num_rows(db_query('SELECT id FROM chars WHERE rasse NOT IN ('.implode(',', $exclude_race_ids).') LIMIT 250'));
if($max_charakter<250) { if($max_charakter<250) {
echo "Not enough chars ($max_charakter)"; echo "Not enough chars ($max_charakter)";
@ -49,7 +49,7 @@ $charakter = db_query('SELECT name, id FROM chars WHERE rasse NOT IN('.implode('
while($row=mysql_fetch_array($charakter)) while($row=mysqli_fetch_array($charakter))
{ {
$test2[]=$row['id']; $test2[]=$row['id'];
} }
@ -69,8 +69,8 @@ while(current($test3)!=end($test2))
} }
$result=mysql_query("SELECT id FROM chars WHERE id IN(".$list.") LIMIT 250"); $result=db_query("SELECT id FROM chars WHERE id IN(".$list.") LIMIT 250");
while($row=mysql_fetch_array($result)) { while($row=mysqli_fetch_array($result)) {
// Nutze getChar um kompatibel mit Aenderungen der Datenstruktur zu bleiben! // Nutze getChar um kompatibel mit Aenderungen der Datenstruktur zu bleiben!
$charas[$row['id']]=getChar($row['id']); $charas[$row['id']]=getChar($row['id']);
} }

@ -84,17 +84,17 @@ $GLOBALS['kampf']['aussetzen'] = &$aussetzten_runde;
$x=0; $x=0;
mysql_query("INSERT liga_kampf SET hp1='$k_hp[0]', hp2='$k_hp[1]', mp1='$k_mp[0]', mp2='$k_mp[1]', schaden1='$schaden_1', schaden2='$schaden_2', attacke1='$technick1[name]', attacke2='$technick2[name]', char1='$chara_1[id]', char2='$chara_2[id]', starke1='$k_starke[0]', starke2='$k_starke[1]', ver1='$k_ver[0]', ver2='$k_ver[1]', speed1='$k_speed[0]', speed2='$k_speed[1]', ausdauer1='$k_ausdauer[0]', ausdauer2='$k_ausdauer[1]', glueck1='$k_glueck[0]', glueck2='$k_glueck[1]'"); db_query("INSERT liga_kampf SET hp1='$k_hp[0]', hp2='$k_hp[1]', mp1='$k_mp[0]', mp2='$k_mp[1]', schaden1='$schaden_1', schaden2='$schaden_2', attacke1='$technick1[name]', attacke2='$technick2[name]', char1='$chara_1[id]', char2='$chara_2[id]', starke1='$k_starke[0]', starke2='$k_starke[1]', ver1='$k_ver[0]', ver2='$k_ver[1]', speed1='$k_speed[0]', speed2='$k_speed[1]', ausdauer1='$k_ausdauer[0]', ausdauer2='$k_ausdauer[1]', glueck1='$k_glueck[0]', glueck2='$k_glueck[1]'");
while($k_hp[0] > $k_aufgabe[0] AND $k_hp[1] > $k_aufgabe[1] AND $x < 10) { while($k_hp[0] > $k_aufgabe[0] AND $k_hp[1] > $k_aufgabe[1] AND $x < 10) {
$technick1 = mysql_fetch_array(mysql_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke1[$x]' LIMIT 10")); $technick1 = mysqli_fetch_array(db_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke1[$x]' LIMIT 10"));
$prozent_technik1 = (20*$technick1[aktiv])-20; $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"));
$technick2 = mysql_fetch_array(mysql_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke2[$x]' LIMIT 10")); $technick2 = mysqli_fetch_array(db_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke2[$x]' LIMIT 10"));
$prozent_technik2 = (20*$technick2[aktiv])-20; $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"));
///////////////////Hier laedt er den RELOAD der technik wenn die zusammen setzung nicht stimmen sollte ///////////////////Hier laedt er den RELOAD der technik wenn die zusammen setzung nicht stimmen sollte
@ -133,9 +133,9 @@ include "include/kampf/kampf_rechnung.php";
$db_query = mysql_fetch_array(mysql_query("SELECT * FROM liga_kampf WHERE (char1='$chara_1[id]' OR char1='$chara_2[id]') AND dauer='0' order by id DESC LIMIT 1")); $db_query = mysqli_fetch_array(db_query("SELECT * FROM liga_kampf WHERE (char1='$chara_1[id]' OR char1='$chara_2[id]') AND dauer='0' order by id DESC LIMIT 1"));
mysql_query("UPDATE liga_kampf SET hp1='$db_query[hp1],$k_hp7[0]', hp2='$db_query[hp2],$k_hp7[1]', mp1='$db_query[mp1],$k_mp7[0]', mp2='$db_query[mp2],$k_mp7[1]', schaden1='$db_query[schaden1],$schaden_1', schaden2='$db_query[schaden2],$schaden_2', attacke1='$db_query[attacke1],$technick1[name]', attacke2='$db_query[attacke2],$technick2[name]', starke1='$db_query[starke1],$k_starke[0]', starke2='$db_query[starke2],$k_starke[1]', ver1='$db_query[ver1],$k_ver[0]', ver2='$db_query[ver2],$k_ver[1]', speed1='$db_query[speed1],$k_speed[0]', speed2='$db_query[speed2],$k_speed[1]', ausdauer1='$db_query[ausdauer1],$k_ausdauer[0]', ausdauer2='$db_query[ausdauer2],$k_ausdauer[1]', glueck1='$db_query[glueck1],$k_glueck[0]', glueck2='$db_query[glueck2],$k_glueck[1]' WHERE id='$db_query[id]'"); db_query("UPDATE liga_kampf SET hp1='$db_query[hp1],$k_hp7[0]', hp2='$db_query[hp2],$k_hp7[1]', mp1='$db_query[mp1],$k_mp7[0]', mp2='$db_query[mp2],$k_mp7[1]', schaden1='$db_query[schaden1],$schaden_1', schaden2='$db_query[schaden2],$schaden_2', attacke1='$db_query[attacke1],$technick1[name]', attacke2='$db_query[attacke2],$technick2[name]', starke1='$db_query[starke1],$k_starke[0]', starke2='$db_query[starke2],$k_starke[1]', ver1='$db_query[ver1],$k_ver[0]', ver2='$db_query[ver2],$k_ver[1]', speed1='$db_query[speed1],$k_speed[0]', speed2='$db_query[speed2],$k_speed[1]', ausdauer1='$db_query[ausdauer1],$k_ausdauer[0]', ausdauer2='$db_query[ausdauer2],$k_ausdauer[1]', glueck1='$db_query[glueck1],$k_glueck[0]', glueck2='$db_query[glueck2],$k_glueck[1]' WHERE id='$db_query[id]'");
$x++; $x++;
@ -194,9 +194,9 @@ $punkt_verlierer = 0;
$dauer_Z = time(); $dauer_Z = time();
mysql_query("UPDATE chars SET liga_siege=liga_siege+1, liga_punkte=liga_punkte+'$punkt_sieger' WHERE id='$sieger' LIMIT 1"); db_query("UPDATE chars SET liga_siege=liga_siege+1, liga_punkte=liga_punkte+'$punkt_sieger' WHERE id='$sieger' LIMIT 1");
mysql_query("UPDATE chars SET liga_niederlagen=liga_niederlagen+1, liga_punkte=liga_punkte+'$punkt_verlierer' WHERE id='$verlierer' LIMIT 1"); db_query("UPDATE chars SET liga_niederlagen=liga_niederlagen+1, liga_punkte=liga_punkte+'$punkt_verlierer' WHERE id='$verlierer' LIMIT 1");
mysql_query("UPDATE liga_kampf SET exp1='$k_exp[0]', win='$sieger', lose='$verlierer', exp2='$k_exp[1]', geld1='$k_geld[0]', geld2='$k_geld[1]', dauer='$dauer_Z' WHERE id='$db_query[id]'"); db_query("UPDATE liga_kampf SET exp1='$k_exp[0]', win='$sieger', lose='$verlierer', exp2='$k_exp[1]', geld1='$k_geld[0]', geld2='$k_geld[1]', dauer='$dauer_Z' WHERE id='$db_query[id]'");

@ -25,20 +25,20 @@ $max_member_count_delete = 1;
* Erstmal die ganzen SQL-Befehle definieren! * Erstmal die ganzen SQL-Befehle definieren!
*/ */
$res = mysql_fetch_assoc(mysql_query('Select max(channel_id) as mx FROM '.$mumbledb.'.channels where server_id = '.$serverid)); $res = mysqli_fetch_assoc(db_query('Select max(channel_id) as mx FROM '.$mumbledb.'.channels where server_id = '.$serverid));
$max_channel = $res['mx']; $max_channel = $res['mx'];
$res = mysql_fetch_assoc(mysql_query('Select max(group_id) as mx FROM '.$mumbledb.'.groups where server_id = '.$serverid)); $res = mysqli_fetch_assoc(db_query('Select max(group_id) as mx FROM '.$mumbledb.'.groups where server_id = '.$serverid));
$max_group = $res['mx']; $max_group = $res['mx'];
$res = mysql_fetch_assoc(mysql_query('Select channel_id FROM '.$mumbledb.'.channels where name = \''.$clan_chan_name.'\' and server_id = '.$serverid)); $res = mysqli_fetch_assoc(db_query('Select channel_id FROM '.$mumbledb.'.channels where name = \''.$clan_chan_name.'\' and server_id = '.$serverid));
$clan_chan = $res['channel_id']; $clan_chan = $res['channel_id'];
$rename_sql = 'UPDATE '.$mumbledb.'.users p inner join '.$ag_db.'.user u on p.user_id = u.id set p.name = u.nickname WHERE p.name != u.nickname and server_id = '.$serverid; $rename_sql = 'UPDATE '.$mumbledb.'.users p inner join '.$ag_db.'.user u on p.user_id = u.id set p.name = u.nickname WHERE p.name != u.nickname and server_id = '.$serverid;
$search_lost_players = 'Select p.user_id FROM '.$mumbledb.'.users as p left join '.$ag_db.'.user as u on p.user_id = u.id where p.user_id > 0 and u.nickname is null and p.server_id = '.$serverid; $search_lost_players = 'Select p.user_id FROM '.$mumbledb.'.users as p left join '.$ag_db.'.user as u on p.user_id = u.id where p.user_id > 0 and u.nickname is null and p.server_id = '.$serverid;
$qry = mysql_query($search_lost_players); $qry = db_query($search_lost_players);
while($row = mysql_fetch_assoc($qry)){ while($row = mysqli_fetch_assoc($qry)){
$player[] = $row['user_id']; $player[] = $row['user_id'];
} }
@ -51,13 +51,13 @@ if(count($player) > 0){
//$clan_channels_sql = 'SELECT distinct(clanname) as name from '.$mumbledb.'.channels c right join '.$ag_db.'.clan cl on c.name = cl.clanname where name is null'; //$clan_channels_sql = 'SELECT distinct(clanname) as name from '.$mumbledb.'.channels c right join '.$ag_db.'.clan cl on c.name = cl.clanname where name is null';
$clan_channels_sql = 'SELECT distinct(clanname) as name, count(u.clan) anzahl, name is not null as existance from '.$mumbledb.'.channels c right join '.$ag_db.'.clan cl on c.name = cl.clanname left join '.$ag_db.'.user u on cl.id = u.clan group by clanname'; $clan_channels_sql = 'SELECT distinct(clanname) as name, count(u.clan) anzahl, name is not null as existance from '.$mumbledb.'.channels c right join '.$ag_db.'.clan cl on c.name = cl.clanname left join '.$ag_db.'.user u on cl.id = u.clan group by clanname';
$qry = mysql_query($clan_channels_sql); $qry = db_query($clan_channels_sql);
$insert_clan_channels = 'INSERT INTO '.$mumbledb.'.channels(server_id, channel_id, parent_id, name, inheritacl) values'; $insert_clan_channels = 'INSERT INTO '.$mumbledb.'.channels(server_id, channel_id, parent_id, name, inheritacl) values';
$insert_clan_groups = 'INSERT INTO '.$mumbledb.'.groups(group_id, server_id, name, channel_id, inherit, inheritable) values'; $insert_clan_groups = 'INSERT INTO '.$mumbledb.'.groups(group_id, server_id, name, channel_id, inherit, inheritable) values';
$insert_acl = 'INSERT INTO '.$mumbledb.'.acl(server_id, channel_id, priority, group_name, apply_here, apply_sub, grantpriv, revokepriv) values'; $insert_acl = 'INSERT INTO '.$mumbledb.'.acl(server_id, channel_id, priority, group_name, apply_here, apply_sub, grantpriv, revokepriv) values';
$i=1; $i=1;
while($row = mysql_fetch_assoc($qry)){ while($row = mysqli_fetch_assoc($qry)){
$channelid = ($max_channel + $i); $channelid = ($max_channel + $i);
$groupid = ($max_group + $i); $groupid = ($max_group + $i);
if($row['existance'] == 0 && $row['anzahl'] >= $min_member_count_create){ if($row['existance'] == 0 && $row['anzahl'] >= $min_member_count_create){
@ -73,15 +73,15 @@ while($row = mysql_fetch_assoc($qry)){
} }
$i++; $i++;
} else if($row['existance'] == 1 && $row['anzahl'] <= $max_member_count_delete){ } else if($row['existance'] == 1 && $row['anzahl'] <= $max_member_count_delete){
mysql_query('DELETE FROM '.$mumbledb.'.channels WHERE parent_id = '.$clan_chan. ' and name = \''.$row['name'].'\' and server_id = '.$serverid); db_query('DELETE FROM '.$mumbledb.'.channels WHERE parent_id = '.$clan_chan. ' and name = \''.$row['name'].'\' and server_id = '.$serverid);
} }
} }
// Delete nonexistant Clan-Channels! // Delete nonexistant Clan-Channels!
$search_lost_channels = 'select channel_id FROM '.$mumbledb.'.channels left join '.$ag_db.'.clan on name = clanname where clanname is null and parent_id = '.$clan_chan.' and server_id = '.$serverid; $search_lost_channels = 'select channel_id FROM '.$mumbledb.'.channels left join '.$ag_db.'.clan on name = clanname where clanname is null and parent_id = '.$clan_chan.' and server_id = '.$serverid;
$qry = mysql_query($search_lost_channels); $qry = db_query($search_lost_channels);
while($row = mysql_fetch_assoc($qry)){ while($row = mysqli_fetch_assoc($qry)){
$channels[] = $row['channel_id']; $channels[] = $row['channel_id'];
} }
@ -117,34 +117,34 @@ $sql_user_select = 'Select p.user_id, ch.name as ch_name, ch2.name as ch2_name,
*/ */
mysql_query($rename_sql); db_query($rename_sql);
if(isset($delete_sql)){ if(isset($delete_sql)){
mysql_query($delete_sql); db_query($delete_sql);
} }
if($i!=1){ if($i!=1){
// echo $insert_clan_channels.'<br>'; // echo $insert_clan_channels.'<br>';
mysql_query($insert_clan_channels); db_query($insert_clan_channels);
mysql_query($insert_clan_groups); db_query($insert_clan_groups);
mysql_query($insert_acl); db_query($insert_acl);
} }
// Entferne Channels von Clans die es nicht mehr gibt! // Entferne Channels von Clans die es nicht mehr gibt!
mysql_query($remove_clan_channel_sql); db_query($remove_clan_channel_sql);
// Nun die User :) // Nun die User :)
$qry = mysql_query($sql_user_select); $qry = db_query($sql_user_select);
while($row = mysql_fetch_assoc($qry)){ while($row = mysqli_fetch_assoc($qry)){
// Zu Gruppe hinzufuegen oder aus gruppe entfernen? // Zu Gruppe hinzufuegen oder aus gruppe entfernen?
if($row['ch_name'] == NULL){ if($row['ch_name'] == NULL){
// Hinzufuegen // Hinzufuegen
$sql = 'INSERT INTO '.$mumbledb.'.group_members(group_id, server_id, user_id, addit) values('.$row['g2_group_id'].', '.$serverid.', '.$row['user_id'].',1)'; $sql = 'INSERT INTO '.$mumbledb.'.group_members(group_id, server_id, user_id, addit) values('.$row['g2_group_id'].', '.$serverid.', '.$row['user_id'].',1)';
// echo $sql.'<br>'; // echo $sql.'<br>';
mysql_query($sql); db_query($sql);
} else if($row['ch2_name'] == NULL){ } else if($row['ch2_name'] == NULL){
// Entfernen // Entfernen
$sql = 'DELETE FROM '.$mumbledb.'.group_members where group_id = '.$row['g_group_id'].' and server_id = '.$serverid.' and user_id = '.$row['user_id']; $sql = 'DELETE FROM '.$mumbledb.'.group_members where group_id = '.$row['g_group_id'].' and server_id = '.$serverid.' and user_id = '.$row['user_id'];
// echo $sql.'<br>'; // echo $sql.'<br>';
mysql_query($sql); db_query($sql);
} }
} }

@ -7,12 +7,12 @@
*/ */
include "db.php"; include "db.php";
$row2 = mysql_query("SELECT c1.lernpunkte AS c1lern, c2.lernpunkte AS c2lern, u.round, u.win, u.hp1, u.hp2,c1.hp AS c1hp, c2.hp AS c2hp, c1.mp AS c1mp, c2.mp AS c2mp, u.mp1, u.mp2, c1.id AS c1id, c2.id AS c2id, c1.exp AS c1exp, c2.exp AS c2exp, i1.geld AS i1geld, i2.geld AS i2geld, $row2 = db_query("SELECT c1.lernpunkte AS c1lern, c2.lernpunkte AS c2lern, u.round, u.win, u.hp1, u.hp2,c1.hp AS c1hp, c2.hp AS c2hp, c1.mp AS c1mp, c2.mp AS c2mp, u.mp1, u.mp2, c1.id AS c1id, c2.id AS c2id, c1.exp AS c1exp, c2.exp AS c2exp, i1.geld AS i1geld, i2.geld AS i2geld,
i1.id AS i1id, i2.id AS i2id FROM turnier_kampf u LEFT JOIN chars c1 ON(c1.id=u.char1) LEFT JOIN user i1 ON(i1.id=c1.besitzer) LEFT JOIN chars c2 ON(c2.id=u.char2) LEFT JOIN user i2 ON(i2.id=c2.besitzer) WHERE u.art='chu_pruef' ORDER BY u.round ASC"); i1.id AS i1id, i2.id AS i2id FROM turnier_kampf u LEFT JOIN chars c1 ON(c1.id=u.char1) LEFT JOIN user i1 ON(i1.id=c1.besitzer) LEFT JOIN chars c2 ON(c2.id=u.char2) LEFT JOIN user i2 ON(i2.id=c2.besitzer) WHERE u.art='chu_pruef' ORDER BY u.round ASC");
$x=0; $x=0;
while($row = mysql_fetch_array($row2)) { while($row = mysqli_fetch_array($row2)) {
if($row[round] == 4) { if($row[round] == 4) {
$new_geld1 = 200000; $new_geld1 = 200000;
@ -43,10 +43,10 @@ if($row[round] == 4) {
} }
mysql_query("UPDATE chars SET n_missionpunkte=n_missionpunkte+45000, training_points=training_points+'$trainings_points1', lernpunkte='$new_lernpunkte1' WHERE id='$weiter_1[0]' LIMIT 1"); db_query("UPDATE chars SET n_missionpunkte=n_missionpunkte+45000, training_points=training_points+'$trainings_points1', lernpunkte='$new_lernpunkte1' WHERE id='$weiter_1[0]' LIMIT 1");
mysql_query("UPDATE chars SET n_missionpunkte=n_missionpunkte+45000, training_points=training_points+'$trainings_points2', lernpunkte='$new_lernpunkte2' WHERE id='$weiter_1[1]' LIMIT 1"); db_query("UPDATE chars SET n_missionpunkte=n_missionpunkte+45000, training_points=training_points+'$trainings_points2', lernpunkte='$new_lernpunkte2' WHERE id='$weiter_1[1]' LIMIT 1");
/* /*
mysql_query("UPDATE user SET geld='$new_geld1' WHERE id='$row[i1id]' LIMIT 1"); db_query("UPDATE user SET geld='$new_geld1' WHERE id='$row[i1id]' LIMIT 1");
mysql_query("UPDATE user SET geld='$new_geld2' WHERE id='$row[i2id]' LIMIT 1"); db_query("UPDATE user SET geld='$new_geld2' WHERE id='$row[i2id]' LIMIT 1");
*/ */
?> ?>

@ -28,19 +28,19 @@ function rand_array($array)
include "db.php"; include "db.php";
$max_charakter = mysql_num_rows(mysql_query("SELECT id FROM n_turnier_reg LIMIT 16")); $max_charakter = mysqli_num_rows(db_query("SELECT id FROM n_turnier_reg LIMIT 16"));
if($max_charakter<16) { if($max_charakter<16) {
echo "Turnier kann nicht beginn."; echo "Turnier kann nicht beginn.";
exit; exit;
} }
mysql_query("DELETE FROM turnier_kampf WHERE art='$art_1'"); db_query("DELETE FROM turnier_kampf WHERE art='$art_1'");
$char1 = mysql_query("SELECT charakter FROM n_turnier_reg ORDER BY id ASC LIMIT 16"); $char1 = db_query("SELECT charakter FROM n_turnier_reg ORDER BY id ASC LIMIT 16");
while($row=mysql_fetch_array($char1)) while($row=mysqli_fetch_array($char1))
{ {
$test2[]=$row['charakter']; $test2[]=$row['charakter'];
} }
@ -56,9 +56,9 @@ while(current($test3)!=end($test2))
else $list.=','.next($test3); else $list.=','.next($test3);
} }
$result=mysql_query("SELECT * FROM chars WHERE id IN(".$list.") LIMIT 16"); $result=db_query("SELECT * FROM chars WHERE id IN(".$list.") LIMIT 16");
while($row=mysql_fetch_array($result)) while($row=mysqli_fetch_array($result))
{ {
$charas[$row['id']]=$row; $charas[$row['id']]=$row;
} }
@ -84,8 +84,8 @@ while($round < 4)
{ {
unset($test9); unset($test9);
$chars_win = mysql_Query("SELECT win FROM turnier_kampf WHERE round='$round' AND art='$art_1'"); $chars_win = db_query("SELECT win FROM turnier_kampf WHERE round='$round' AND art='$art_1'");
while($row9 = mysql_fetch_array($chars_win)) while($row9 = mysqli_fetch_array($chars_win))
{ {
$test9[]=$row9['win']; $test9[]=$row9['win'];
} }
@ -106,6 +106,6 @@ while($round < 4)
} }
mysql_query("DELETE FROM n_turnier_reg ORDER BY id ASC LIMIT 16"); db_query("DELETE FROM n_turnier_reg ORDER BY id ASC LIMIT 16");
?> ?>

@ -8,6 +8,7 @@
$test = date("H"); $test = date("H");
include_once('path.inc.php'); // get the path ;) include_once('path.inc.php'); // get the path ;)
include_once (ROOT_PATH.'/include/sqlwrapper.inc.php');
include "db.php"; include "db.php";
include_once ('inclu/messagefunctions.inc.php'); include_once ('inclu/messagefunctions.inc.php');
include_once (ROOT_PATH.'/include/usergroup.inc.php'); include_once (ROOT_PATH.'/include/usergroup.inc.php');
@ -31,13 +32,13 @@ if ($test == "10") {
} }
if ($test == "12") { if ($test == "12") {
//Jeden Tag gibts es was für Wanted //Jeden Tag gibts es was für Wanted
// $rangliste1 = mysql_query("SELECT besitzer, name, preis FROM chars order by preis"); // $rangliste1 = db_query("SELECT besitzer, name, preis FROM chars order by preis");
// while($row = mysql_fetch_array($rangliste1)) { // while($row = mysqli_fetch_array($rangliste1)) {
// insertUserTickerMessage($row['besitzer'], ' '.$row['preis'].' Geld durch deinen Wanted erhalten'); // insertUserTickerMessage($row['besitzer'], ' '.$row['preis'].' Geld durch deinen Wanted erhalten');
// mysql_query("UPDATE user SET geld= geld + '$row[preis]' WHERE id='$row[besitzer]'"); // db_query("UPDATE user SET geld= geld + '$row[preis]' WHERE id='$row[besitzer]'");
// if ($row['preis']>10000){ // if ($row['preis']>10000){
// $IP = $row['preis']/1000; // $IP = $row['preis']/1000;
// mysql_query("UPDATE user SET pkt= pkt + '$IP' WHERE id='$row[besitzer]'"); // db_query("UPDATE user SET pkt= pkt + '$IP' WHERE id='$row[besitzer]'");
// insertUserTickerMessage($row['besitzer'], ' '.$IP.' IP durch deinen Wanted erhalten, da du eine Grenze überschritten hast'); // insertUserTickerMessage($row['besitzer'], ' '.$IP.' IP durch deinen Wanted erhalten, da du eine Grenze überschritten hast');
// } // }
// } // }
@ -68,8 +69,8 @@ if ($i == 11) {
// select round(einnahmen*0.5/(1+EXP(2-einnahmen/100000))) from arena where einnahmen > 10000 // select round(einnahmen*0.5/(1+EXP(2-einnahmen/100000))) from arena where einnahmen > 10000
// Kann erstmal bleiben! // Kann erstmal bleiben!
mysql_query('Update arena set zustand = zustand - 1/4 where mietlasten >= 2 and einnahmen > 0'); db_query('Update arena set zustand = zustand - 1/4 where mietlasten >= 2 and einnahmen > 0');
mysql_query('Update arena set zustand = 0 where zustand < 0'); // No negatives any more db_query('Update arena set zustand = 0 where zustand < 0'); // No negatives any more
defineIfNotDefined('TAX_NOOB_MIN_TAX', 0.5, true); defineIfNotDefined('TAX_NOOB_MIN_TAX', 0.5, true);
defineIfNotDefined('TAX_NOOB_MAX_LEVEL', 10, true); defineIfNotDefined('TAX_NOOB_MAX_LEVEL', 10, true);
defineIfNotDefined('TAX_START_TAX', 0.85, true); defineIfNotDefined('TAX_START_TAX', 0.85, true);
@ -91,17 +92,17 @@ if ($i == 11) {
$steuerbetrag='ROUND((einnahmen - '.$freibetrag.')*'.$noob_rabatt.'*'.$steuersatz.')'; $steuerbetrag='ROUND((einnahmen - '.$freibetrag.')*'.$noob_rabatt.'*'.$steuersatz.')';
$sql = 'Update arena set mietlasten = mietlasten + 1, steuerlasten = steuerlasten + '.$steuerbetrag.' where '.$steuerbetrag.' > 0'; $sql = 'Update arena set mietlasten = mietlasten + 1, steuerlasten = steuerlasten + '.$steuerbetrag.' where '.$steuerbetrag.' > 0';
// echo $sql.'<br>'; // echo $sql.'<br>';
mysql_query($sql); db_query($sql);
mysql_query('Update arena set einnahmen = 0'); db_query('Update arena set einnahmen = 0');
// Inaktive Clans löschen (Clanräume werden automatisch gelöscht durch Fremdschlüssel) // Inaktive Clans löschen (Clanräume werden automatisch gelöscht durch Fremdschlüssel)
$sql = 'delete from clan where id NOT IN(SELECT distinct(clan) from user where clan is not null)'; $sql = 'delete from clan where id NOT IN(SELECT distinct(clan) from user where clan is not null)';
//echo $sql . '<br>'; //echo $sql . '<br>';
mysql_query($sql); db_query($sql);
// Räume die Ticker auf (Massivster Datenmüll!!) // Räume die Ticker auf (Massivster Datenmüll!!)
mysql_query('DELETE FROM clan_ticker WHERE date < TIMESTAMPADD(day, -7, now())'); db_query('DELETE FROM clan_ticker WHERE date < TIMESTAMPADD(day, -7, now())');
mysql_query('DELETE FROM user_ticker WHERE date < TIMESTAMPADD(day, -7, now())'); db_query('DELETE FROM user_ticker WHERE date < TIMESTAMPADD(day, -7, now())');
// Benutze Clan items!! // Benutze Clan items!!
// Folgende SQL-Anweisung ermittelt mit einer kleinen Hilfsfunktion die Summe der Miete und das Geld des Clans // Folgende SQL-Anweisung ermittelt mit einer kleinen Hilfsfunktion die Summe der Miete und das Geld des Clans
@ -109,10 +110,10 @@ if ($i == 11) {
$sql = 'SELECT cw.id as clan_train, if(count(ch.id)<'.$mindestchar.','.$mindestchar.',count(ch.id)) * miete as mietkosten, c.id as clan, c.geld as geld from clan_ware cw inner join clan_item ci on cw.item_id = ci.id inner join clan c on cw.clan = c.id inner join user u on u.clan = c.id left join chars ch on ch.clan_train = cw.id and ch.besitzer = u.id group by c.id, cw.id order by c.id'; $sql = 'SELECT cw.id as clan_train, if(count(ch.id)<'.$mindestchar.','.$mindestchar.',count(ch.id)) * miete as mietkosten, c.id as clan, c.geld as geld from clan_ware cw inner join clan_item ci on cw.item_id = ci.id inner join clan c on cw.clan = c.id inner join user u on u.clan = c.id left join chars ch on ch.clan_train = cw.id and ch.besitzer = u.id group by c.id, cw.id order by c.id';
// SQL-Anweisung, wenn Ungenutzte items nicht beruecksichtigt werden sollen -> 'SELECT ch.clan_train, if(count(ch.id)<40,40,count(ch.id)) * miete as mietkosten, c.id as clan, c.geld as geld from user u inner join clan c on u.clan = c.id inner join chars ch on u.id = ch.besitzer inner join clan_ware cw on cw.clan = c.id inner join clan_item ci on cw.item_id = ci.id and ch.clan_train = cw.id group by c.id, cw.id order by c.id' // SQL-Anweisung, wenn Ungenutzte items nicht beruecksichtigt werden sollen -> 'SELECT ch.clan_train, if(count(ch.id)<40,40,count(ch.id)) * miete as mietkosten, c.id as clan, c.geld as geld from user u inner join clan c on u.clan = c.id inner join chars ch on u.id = ch.besitzer inner join clan_ware cw on cw.clan = c.id inner join clan_item ci on cw.item_id = ci.id and ch.clan_train = cw.id group by c.id, cw.id order by c.id'
// echo '<br>'.$sql.'<br>'; // echo '<br>'.$sql.'<br>';
$clan_kosten = mysql_query($sql); $clan_kosten = db_query($sql);
$clan_raum_array = array(); $clan_raum_array = array();
while ($row = mysql_fetch_assoc($clan_kosten)){ while ($row = mysqli_fetch_assoc($clan_kosten)){
if($clan_raum_array[$row['clan']] === null){ if($clan_raum_array[$row['clan']] === null){
$clan_raum_array[$row['clan']] = $row; $clan_raum_array[$row['clan']] = $row;
} else{ } else{
@ -121,7 +122,7 @@ if ($i == 11) {
} }
$clans = array (); $clans = array ();
// while ($row = mysql_fetch_assoc($clan_kosten)) { // while ($row = mysqli_fetch_assoc($clan_kosten)) {
foreach($clan_raum_array as $row){ foreach($clan_raum_array as $row){
// print_r($row); // print_r($row);
// Ermittle das Vermoegen und die Useranzahl des Clans! // Ermittle das Vermoegen und die Useranzahl des Clans!
@ -133,17 +134,17 @@ if ($i == 11) {
// Clan kann miete bezahlen, also in Trainingsliste aufnehmen // Clan kann miete bezahlen, also in Trainingsliste aufnehmen
$clans[] = $row['clan']; $clans[] = $row['clan'];
// Clan die Miete abziehen // Clan die Miete abziehen
mysql_query('UPDATE clan SET geld = geld - ' . $row['mietkosten'] . ' WHERE id = ' . $row['clan']); db_query('UPDATE clan SET geld = geld - ' . $row['mietkosten'] . ' WHERE id = ' . $row['clan']);
insertClanTickerMessage($row['clan'], 'Die Miete f&uuml;r die R&auml;ume ('.displayMoney($row['mietkosten']).') wurde bezahlt!'); insertClanTickerMessage($row['clan'], 'Die Miete f&uuml;r die R&auml;ume ('.displayMoney($row['mietkosten']).') wurde bezahlt!');
} }
} }
// Ermittle die Kosten fuer die Nutzer (es werden nur Chars beruecksichtigt, die genug TP haben) // Ermittle die Kosten fuer die Nutzer (es werden nur Chars beruecksichtigt, die genug TP haben)
$sql = 'select besitzer, user.geld, sum(1/(1+exp(3-level/12)) * nutzung) as nutzkosten from user inner join chars on chars.besitzer = user.id inner join clan_ware on chars.clan_train = clan_ware.id inner join clan_item on clan_ware.item_id = clan_item.id where user.clan = clan_ware.clan and user.clan IN (' . join(',', $clans) . ') and clan_item.tp <= chars.training_points group by besitzer order by besitzer'; $sql = 'select besitzer, user.geld, sum(1/(1+exp(3-level/12)) * nutzung) as nutzkosten from user inner join chars on chars.besitzer = user.id inner join clan_ware on chars.clan_train = clan_ware.id inner join clan_item on clan_ware.item_id = clan_item.id where user.clan = clan_ware.clan and user.clan IN (' . join(',', $clans) . ') and clan_item.tp <= chars.training_points group by besitzer order by besitzer';
$user_kosten = mysql_query($sql); $user_kosten = db_query($sql);
// echo '<br>'.$sql.'<br>'; // echo '<br>'.$sql.'<br>';
$users = array (); $users = array ();
if (count($clans) != 0) { if (count($clans) != 0) {
while ($row = mysql_fetch_assoc($user_kosten)) { while ($row = mysqli_fetch_assoc($user_kosten)) {
if ($row['nutzkosten'] > $row['geld']) { if ($row['nutzkosten'] > $row['geld']) {
// User is pleite! // User is pleite!
insertUserTickerMessage($row['besitzer'], 'Die Nutzungsgeb&uuml;hren ('.displayMoney($row['nutzkosten']).') f&uuml;r die R&auml;ume konnte nicht bezahlt werden!'); insertUserTickerMessage($row['besitzer'], 'Die Nutzungsgeb&uuml;hren ('.displayMoney($row['nutzkosten']).') f&uuml;r die R&auml;ume konnte nicht bezahlt werden!');
@ -151,27 +152,27 @@ if ($i == 11) {
// User kann Nutzkosten bezahlen, also in Trainingsliste aufnehmen // User kann Nutzkosten bezahlen, also in Trainingsliste aufnehmen
$users[] = $row['besitzer']; $users[] = $row['besitzer'];
// Clan die Miete abziehen // Clan die Miete abziehen
mysql_query('UPDATE user SET geld = geld - ' . $row['nutzkosten'] . ' WHERE id = ' . $row['besitzer']); db_query('UPDATE user SET geld = geld - ' . $row['nutzkosten'] . ' WHERE id = ' . $row['besitzer']);
insertUserTickerMessage($row['besitzer'], 'Die Nutzungsgeb&uuml;hren ('.displayMoney($row['nutzkosten']).') f&uuml;r die R&auml;ume wurde bezahlt!'); insertUserTickerMessage($row['besitzer'], 'Die Nutzungsgeb&uuml;hren ('.displayMoney($row['nutzkosten']).') f&uuml;r die R&auml;ume wurde bezahlt!');
} }
} }
$sql = 'Update chars inner join user on chars.besitzer = user.id inner join clan_ware on chars.clan_train = clan_ware.id inner join clan_item on clan_ware.item_id = clan_item.id SET chars.starke = clan_item.staerke + chars.starke, chars.speed = chars.speed + clan_item.geschwindigkeit, chars.verteidigung = chars.verteidigung + clan_item.verteidigung, chars.glueck = chars.glueck + clan_item.glueck, chars.ausdauer = chars.ausdauer + clan_item.ausdauer, chars.training_points = chars.training_points - clan_item.tp WHERE user.clan = clan_ware.clan and chars.besitzer IN(' . join(',', $users) . ') and chars.training_points >= clan_item.tp'; $sql = 'Update chars inner join user on chars.besitzer = user.id inner join clan_ware on chars.clan_train = clan_ware.id inner join clan_item on clan_ware.item_id = clan_item.id SET chars.starke = clan_item.staerke + chars.starke, chars.speed = chars.speed + clan_item.geschwindigkeit, chars.verteidigung = chars.verteidigung + clan_item.verteidigung, chars.glueck = chars.glueck + clan_item.glueck, chars.ausdauer = chars.ausdauer + clan_item.ausdauer, chars.training_points = chars.training_points - clan_item.tp WHERE user.clan = clan_ware.clan and chars.besitzer IN(' . join(',', $users) . ') and chars.training_points >= clan_item.tp';
$check = mysql_query($sql); $check = db_query($sql);
} }
// echo '<br>'.$sql.'<br>'; // echo '<br>'.$sql.'<br>';
} }
#########################EXIT #########################EXIT
$char_info = mysql_query("SELECT training_points, id, training, starke, verteidigung, speed, ausdauer, glueck, mp, hp, level FROM chars"); $char_info = db_query("SELECT training_points, id, training, starke, verteidigung, speed, ausdauer, glueck, mp, hp, level FROM chars");
$x = 0; $x = 0;
while ($row = mysql_fetch_array($char_info)) { while ($row = mysqli_fetch_array($char_info)) {
$hp = explode(",", $row['hp']); $hp = explode(",", $row['hp']);
$mp = explode(",", $row['mp']); $mp = explode(",", $row['mp']);
$trains = explode(",", $row['training']); $trains = explode(",", $row['training']);
if (!$trains[$i] || $trains[$i] == 'ausruhen') { if (!$trains[$i] || $trains[$i] == 'ausruhen') {
mysql_query("UPDATE chars SET hp='$hp[1],$hp[1]', mp='$mp[1],$mp[1]' WHERE id='$row[id]' LIMIT 1"); db_query("UPDATE chars SET hp='$hp[1],$hp[1]', mp='$mp[1],$mp[1]' WHERE id='$row[id]' LIMIT 1");
} else { } else {
if ($row[training_points] > 1) { if ($row[training_points] > 1) {
@ -184,16 +185,16 @@ while ($row = mysql_fetch_array($char_info)) {
$zu[$x] = "$mp[0],$zu[$x]"; $zu[$x] = "$mp[0],$zu[$x]";
} }
// echo "UPDATE chars SET $trains[$i]='$zu[$x]', training_points=training_points-2 WHERE id='$row[id]' LIMIT 1<br>"; // echo "UPDATE chars SET $trains[$i]='$zu[$x]', training_points=training_points-2 WHERE id='$row[id]' LIMIT 1<br>";
mysql_query("UPDATE chars SET $trains[$i]='$zu[$x]', training_points=training_points-4 WHERE id='$row[id]' LIMIT 1"); db_query("UPDATE chars SET $trains[$i]='$zu[$x]', training_points=training_points-4 WHERE id='$row[id]' LIMIT 1");
} else { } else {
$event = mysql_fetch_assoc(mysql_query('SELECT CURRENT_TIMESTAMP between TIMESTAMP(\'2009-04-25 00:00:00\') and TIMESTAMP(\'2009-05-02 23:59:59\') as betw')); $event = mysqli_fetch_assoc(db_query('SELECT CURRENT_TIMESTAMP between TIMESTAMP(\'2009-04-25 00:00:00\') and TIMESTAMP(\'2009-05-02 23:59:59\') as betw'));
$step = 2 + ($event['betw']*3); $step = 2 + ($event['betw']*3);
$news2 = $trains[$i]; $news2 = $trains[$i];
$news[$x] = $row[$news2] + $step; $news[$x] = $row[$news2] + $step;
$step*=2; $step*=2;
$sql = "UPDATE chars SET $news2='$news[$x]', training_points=training_points-$step WHERE id='$row[id]' LIMIT 1"; $sql = "UPDATE chars SET $news2='$news[$x]', training_points=training_points-$step WHERE id='$row[id]' LIMIT 1";
// echo $sql.'<br>'."\n"; // echo $sql.'<br>'."\n";
mysql_query($sql); db_query($sql);
} }
} }
@ -201,50 +202,50 @@ while ($row = mysql_fetch_array($char_info)) {
$x++; $x++;
} }
mysql_query('DELETE FROM ag_chat where TIMESTAMPDIFF(Hour,zeit,now()) > 48'); db_query('DELETE FROM ag_chat where TIMESTAMPDIFF(Hour,zeit,now()) > 48');
mysql_query('DELETE FROM user_activation where TIMESTAMPDIFF(day, registerdate, now()) > 7'); db_query('DELETE FROM user_activation where TIMESTAMPDIFF(day, registerdate, now()) > 7');
// Loesche inaktive anons :) // Loesche inaktive anons :)
mysql_query('DELETE FROM anon_chatter WHERE TIMESTAMPDIFF(day, online, now()) > 35'); // 5 Wochen db_query('DELETE FROM anon_chatter WHERE TIMESTAMPDIFF(day, online, now()) > 35'); // 5 Wochen
// Loesche inaktive user! // Loesche inaktive user!
$sql = 'Select * from user where TIMESTAMPDIFF(week, online_zeit, now()) > 10 and id > 2 and id not in (SELECT user_id FROM user_gruppe_zuordnung WHERE gruppen_id = '.AKTIV_LOESCHSCHUTZ.' AND user_id = id)'; $sql = 'Select * from user where TIMESTAMPDIFF(week, online_zeit, now()) > 10 and id > 2 and id not in (SELECT user_id FROM user_gruppe_zuordnung WHERE gruppen_id = '.AKTIV_LOESCHSCHUTZ.' AND user_id = id)';
//echo $sql; //echo $sql;
$u_qry = mysql_query($sql); $u_qry = db_query($sql);
if (mysql_num_rows($u_qry) != 0) { if (mysqli_num_rows($u_qry) != 0) {
$user = array (); $user = array ();
while ($row = mysql_fetch_assoc($u_qry)) { while ($row = mysqli_fetch_assoc($u_qry)) {
$user[] = $row['id']; $user[] = $row['id'];
} }
$users = join(',', $user); $users = join(',', $user);
// echo 'Delete inactive Users ' . $users . '<br>'; // echo 'Delete inactive Users ' . $users . '<br>';
mysql_query('Delete from user where id in (' . $users . ')'); db_query('Delete from user where id in (' . $users . ')');
mysql_query('Delete from arena where besitzer in (' . $users . ')'); db_query('Delete from arena where besitzer in (' . $users . ')');
mysql_query('Delete from ware where user in (' . $users . ')'); db_query('Delete from ware where user in (' . $users . ')');
mysql_query('Delete from npc_ware where user in (' . $users . ')'); db_query('Delete from npc_ware where user in (' . $users . ')');
mysql_query('Delete from sp_ware where user in (' . $users . ')'); db_query('Delete from sp_ware where user in (' . $users . ')');
mysql_query('Delete from wochen_ware where user in (' . $users . ')'); db_query('Delete from wochen_ware where user in (' . $users . ')');
mysql_query('Delete from user_ticker where userid in (' . $users . ')'); db_query('Delete from user_ticker where userid in (' . $users . ')');
mysql_query('Delete from user_rename where userid in (' . $users . ')'); db_query('Delete from user_rename where userid in (' . $users . ')');
mysql_query('Delete from user_clan where userid in (' . $users . ')'); db_query('Delete from user_clan where userid in (' . $users . ')');
mysql_query('Delete from nachricht where besitzer in (' . $users . ')'); db_query('Delete from nachricht where besitzer in (' . $users . ')');
mysql_query('Delete from ignolist where user in (' . $users . ') or besitzer in (' . $users . ')'); db_query('Delete from ignolist where user in (' . $users . ') or besitzer in (' . $users . ')');
$char = array (); $char = array ();
$c_qry = mysql_query('Select id from chars where besitzer IN (' . $users . ')'); $c_qry = db_query('Select id from chars where besitzer IN (' . $users . ')');
while ($row = mysql_fetch_assoc($c_qry)) { while ($row = mysqli_fetch_assoc($c_qry)) {
$char[] = $char['id']; $char[] = $char['id'];
} }
$chars = join(',', $char); $chars = join(',', $char);
mysql_query('Delete from chars where id IN (' . $chars . ')'); db_query('Delete from chars where id IN (' . $chars . ')');
mysql_query('Delete from lernen where besitzer IN (' . $chars . ')'); db_query('Delete from lernen where besitzer IN (' . $chars . ')');
mysql_query('Delete from quests where charid IN (' . $chars . ')'); db_query('Delete from quests where charid IN (' . $chars . ')');
mysql_query('Delete from quests_fights where charid IN (' . $chars . ')'); db_query('Delete from quests_fights where charid IN (' . $chars . ')');
mysql_query('Delete from quests_rounds where charid IN (' . $chars . ')'); db_query('Delete from quests_rounds where charid IN (' . $chars . ')');
mysql_query('Delete from kampf where dbsatz IN (' . $chars . ')'); db_query('Delete from kampf where dbsatz IN (' . $chars . ')');
mysql_query('Delete from kampf_list where charakter IN (' . $chars . ')'); db_query('Delete from kampf_list where charakter IN (' . $chars . ')');
mysql_query('Delete from char_abholcodes where charid IN (' . $chars . ')'); db_query('Delete from char_abholcodes where charid IN (' . $chars . ')');
} }

@ -91,19 +91,19 @@ $GLOBALS['kampf']['schaden2'] = &$schaden_2;
$GLOBALS['kampf']['aussetzen'] = &$aussetzten_runde; $GLOBALS['kampf']['aussetzen'] = &$aussetzten_runde;
$sql = "INSERT turnier_kampf SET hp1='$k_hp[0]', hp2='$k_hp[1]', mp1='$k_mp[0]', mp2='$k_mp[1]', schaden1='$schaden_1', schaden2='$schaden_2', attacke1='$technick1[name]', attacke2='$technick2[name]', char1='$chara_1[id]', char2='$chara_2[id]', starke1='$k_starke[0]', starke2='$k_starke[1]', ver1='$k_ver[0]', ver2='$k_ver[1]', speed1='$k_speed[0]', speed2='$k_speed[1]', ausdauer1='$k_ausdauer[0]', ausdauer2='$k_ausdauer[1]', glueck1='$k_glueck[0]', glueck2='$k_glueck[1]'"; $sql = "INSERT turnier_kampf SET hp1='$k_hp[0]', hp2='$k_hp[1]', mp1='$k_mp[0]', mp2='$k_mp[1]', schaden1='$schaden_1', schaden2='$schaden_2', attacke1='$technick1[name]', attacke2='$technick2[name]', char1='$chara_1[id]', char2='$chara_2[id]', starke1='$k_starke[0]', starke2='$k_starke[1]', ver1='$k_ver[0]', ver2='$k_ver[1]', speed1='$k_speed[0]', speed2='$k_speed[1]', ausdauer1='$k_ausdauer[0]', ausdauer2='$k_ausdauer[1]', glueck1='$k_glueck[0]', glueck2='$k_glueck[1]'";
if(mysql_query($sql) === false){ if(db_query($sql) === false){
echo $sql.' Failed!!<br>'; echo $sql.' Failed!!<br>';
} }
while ($k_hp[0] > $k_aufgabe[0] AND $k_hp[1] > $k_aufgabe[1] AND $x < 10) { while ($k_hp[0] > $k_aufgabe[0] AND $k_hp[1] > $k_aufgabe[1] AND $x < 10) {
$technick1 = mysql_fetch_array(mysql_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke1[$x]' LIMIT 10")); $technick1 = mysqli_fetch_array(db_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke1[$x]' LIMIT 10"));
$prozent_technik1 = (20 * $technick1[aktiv]) - 20; $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"));
$technick2 = mysql_fetch_array(mysql_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke2[$x]' LIMIT 10")); $technick2 = mysqli_fetch_array(db_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke2[$x]' LIMIT 10"));
$prozent_technik2 = (20 * $technick2[aktiv]) - 20; $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"));
///////////////////Hier laedt er den RELOAD der technik wenn die zusammen setzung nicht stimmen sollte ///////////////////Hier laedt er den RELOAD der technik wenn die zusammen setzung nicht stimmen sollte
include "include/kampf/andere_technik.php"; /////////////////// Wenn man ne andere technik sich aussuchen will... include "include/kampf/andere_technik.php"; /////////////////// Wenn man ne andere technik sich aussuchen will...
@ -141,15 +141,15 @@ while ($k_hp[0] > $k_aufgabe[0] AND $k_hp[1] > $k_aufgabe[1] AND $x < 10) {
$sql = "SELECT * FROM turnier_kampf WHERE (char1='$chara_1[id]' OR char1='$chara_2[id]') AND dauer='0' order by id DESC LIMIT 1"; $sql = "SELECT * FROM turnier_kampf WHERE (char1='$chara_1[id]' OR char1='$chara_2[id]') AND dauer='0' order by id DESC LIMIT 1";
if(($qry = mysql_query($sql)) === false){ if(($qry = db_query($sql)) === false){
echo $sql.' Failed!!<br>'; echo $sql.' Failed!!<br>';
} }
$db_query = mysql_fetch_array($qry); $db_query = mysqli_fetch_array($qry);
$sql = "UPDATE turnier_kampf SET hp1='$db_query[hp1],$k_hp7[0]', hp2='$db_query[hp2],$k_hp7[1]', mp1='$db_query[mp1],$k_mp7[0]', mp2='$db_query[mp2],$k_mp7[1]', schaden1='$db_query[schaden1],$schaden_1', schaden2='$db_query[schaden2],$schaden_2', attacke1='$db_query[attacke1],$technick1[name]', attacke2='$db_query[attacke2],$technick2[name]', starke1='$db_query[starke1],$k_starke[0]', starke2='$db_query[starke2],$k_starke[1]', ver1='$db_query[ver1],$k_ver[0]', ver2='$db_query[ver2],$k_ver[1]', speed1='$db_query[speed1],$k_speed[0]', speed2='$db_query[speed2],$k_speed[1]', ausdauer1='$db_query[ausdauer1],$k_ausdauer[0]', ausdauer2='$db_query[ausdauer2],$k_ausdauer[1]', glueck1='$db_query[glueck1],$k_glueck[0]', glueck2='$db_query[glueck2],$k_glueck[1]' WHERE id='$db_query[id]'"; $sql = "UPDATE turnier_kampf SET hp1='$db_query[hp1],$k_hp7[0]', hp2='$db_query[hp2],$k_hp7[1]', mp1='$db_query[mp1],$k_mp7[0]', mp2='$db_query[mp2],$k_mp7[1]', schaden1='$db_query[schaden1],$schaden_1', schaden2='$db_query[schaden2],$schaden_2', attacke1='$db_query[attacke1],$technick1[name]', attacke2='$db_query[attacke2],$technick2[name]', starke1='$db_query[starke1],$k_starke[0]', starke2='$db_query[starke2],$k_starke[1]', ver1='$db_query[ver1],$k_ver[0]', ver2='$db_query[ver2],$k_ver[1]', speed1='$db_query[speed1],$k_speed[0]', speed2='$db_query[speed2],$k_speed[1]', ausdauer1='$db_query[ausdauer1],$k_ausdauer[0]', ausdauer2='$db_query[ausdauer2],$k_ausdauer[1]', glueck1='$db_query[glueck1],$k_glueck[0]', glueck2='$db_query[glueck2],$k_glueck[1]' WHERE id='$db_query[id]'";
// echo $sql.'<br>'; // echo $sql.'<br>';
mysql_query($sql); db_query($sql);
$x++; $x++;
} }
@ -222,6 +222,6 @@ while ($s < 2) {
} }
$dauer_Z = time(); $dauer_Z = time();
mysql_query("UPDATE turnier_kampf SET art='$art_1', round='$round', exp1='$k_exp[0]', win='$sieger', lose='$verlierer', exp2='$k_exp[1]', geld1='$k_geld[0]', geld2='$k_geld[1]', dauer='$dauer_Z' WHERE id='$db_query[id]'"); db_query("UPDATE turnier_kampf SET art='$art_1', round='$round', exp1='$k_exp[0]', win='$sieger', lose='$verlierer', exp2='$k_exp[1]', geld1='$k_geld[0]', geld2='$k_geld[1]', dauer='$dauer_Z' WHERE id='$db_query[id]'");
?> ?>

@ -10,13 +10,14 @@ ignore_user_abort(true);
include "db.php"; include "db.php";
include_once("path.inc.php"); include_once("path.inc.php");
include_once (ROOT_PATH.'/include/sqlwrapper.inc.php');
include_once(ROOT_PATH. "/include/defines.inc.php"); include_once(ROOT_PATH. "/include/defines.inc.php");
include_once(ROOT_PATH. "/include/random.inc.php"); include_once(ROOT_PATH. "/include/random.inc.php");
// Da es wichtig ist, dass die Querys korrekt abgehandelt werden wurde folgender Code eingefuehrt // Da es wichtig ist, dass die Querys korrekt abgehandelt werden wurde folgender Code eingefuehrt
function database_query($sql){ function database_query($sql){
$tmp = mysql_query($sql); $tmp = db_query($sql);
if(!$tmp){ if(!$tmp){
echo 'SQL-Anweisung '.$sql.' konnte nicht ausgefuehrt werden!!<br>'; echo 'SQL-Anweisung '.$sql.' konnte nicht ausgefuehrt werden!!<br>';
} }
@ -30,8 +31,8 @@ function bearbeiteAbgelaufeneAuktion($auktionsid){
// echo '<br>bearbeite '.$auktionsid.'</br>'; // echo '<br>bearbeite '.$auktionsid.'</br>';
$qry = database_query('SELECT u.nickname AS anbietername, u2.nickname AS bietername, a.auktionsid,a.anbieter,a.bieter,a.itemid,a.itemname,a.tablename,a.anzahl,a.startgebot,a.aktuellesgebot,a.deadline,a.startdate,a.cheatingverdacht, TIMESTAMPDIFF(Minute,now(),deadline) AS zeitdifferenz FROM auktion AS a INNER JOIN user as u ON a.anbieter = u.id LEFT JOIN user as u2 ON a.bieter = u2.id WHERE auktionsid = '.$auktionsid); $qry = database_query('SELECT u.nickname AS anbietername, u2.nickname AS bietername, a.auktionsid,a.anbieter,a.bieter,a.itemid,a.itemname,a.tablename,a.anzahl,a.startgebot,a.aktuellesgebot,a.deadline,a.startdate,a.cheatingverdacht, TIMESTAMPDIFF(Minute,now(),deadline) AS zeitdifferenz FROM auktion AS a INNER JOIN user as u ON a.anbieter = u.id LEFT JOIN user as u2 ON a.bieter = u2.id WHERE auktionsid = '.$auktionsid);
if(mysql_num_rows($qry) == 0){ return NULL; } if(mysqli_num_rows($qry) == 0){ return NULL; }
$result = mysql_fetch_assoc($qry); $result = mysqli_fetch_assoc($qry);
$itemreceiver = ''; $itemreceiver = '';
// Nun muss geprüft werden, ob überhaupt jemand geboten hat! // Nun muss geprüft werden, ob überhaupt jemand geboten hat!
@ -93,7 +94,7 @@ function bearbeiteAlleAbgelaufenenAuktionen(){
$qry = database_query('SELECT auktionsid from auktion where TIMESTAMPDIFF(Minute,now(),deadline) < 0'); $qry = database_query('SELECT auktionsid from auktion where TIMESTAMPDIFF(Minute,now(),deadline) < 0');
// Gehe alle Auktionen durch und bearbeite diese // Gehe alle Auktionen durch und bearbeite diese
$index = 0; $index = 0;
while($result = mysql_fetch_assoc($qry)){ while($result = mysqli_fetch_assoc($qry)){
bearbeiteAbgelaufeneAuktion($result['auktionsid']); bearbeiteAbgelaufeneAuktion($result['auktionsid']);
$index++; $index++;
} }
@ -120,22 +121,22 @@ function insertAuktionen(){
// Jeden Sonntag wird dieser Skript ausgefuehrt! // Jeden Sonntag wird dieser Skript ausgefuehrt!
// erstmal checken obs schon Auktionen für kommende Woche gibt // erstmal checken obs schon Auktionen für kommende Woche gibt
$number = mysql_num_rows(database_query('SELECT * FROM auktion WHERE anbieter = 1 and TIMESTAMPDIFF(Second,startdate,now()) < 0')); $number = mysqli_num_rows(database_query('SELECT * FROM auktion WHERE anbieter = 1 and TIMESTAMPDIFF(Second,startdate,now()) < 0'));
// echo $number.'= Number of effected rows'; // echo $number.'= Number of effected rows';
if($number == 0){ if($number == 0){
// So, also es sind noch keine Auktionen vorhanden!! // So, also es sind noch keine Auktionen vorhanden!!
// Nun 6 Auktionen erstellen 3x2 Auktionen (update 2x2) // Nun 6 Auktionen erstellen 3x2 Auktionen (update 2x2)
$date = mysql_fetch_assoc(database_query('Select current_date AS date')); $date = mysqli_fetch_assoc(database_query('Select current_date AS date'));
$qry = database_query('SELECT id FROM `wochen_markt` WHERE aktiv = \'ja\''); $qry = database_query('SELECT id FROM `wochen_markt` WHERE aktiv = \'ja\'');
$fruchtcount = 0; $fruchtcount = 0;
$frucht = array(); $frucht = array();
while($result = mysql_fetch_assoc($qry)){ while($result = mysqli_fetch_assoc($qry)){
$frucht[$fruchtcount++] = $result[id]; $frucht[$fruchtcount++] = $result[id];
} }
// Ermittle die "Niete" (das wertloseste Item auf der Schatzsuche) // Ermittle die "Niete" (das wertloseste Item auf der Schatzsuche)
$qry = database_query('Select id from `sp_item` where wert = (Select min(wert) from `sp_item`)'); $qry = database_query('Select id from `sp_item` where wert = (Select min(wert) from `sp_item`)');
$nieten_id = mysql_fetch_assoc($qry); $nieten_id = mysqli_fetch_assoc($qry);
$nieten_id = $nieten_id['id']; $nieten_id = $nieten_id['id'];
for($i = 0; $i<$anzahl_auktionen; $i++) { for($i = 0; $i<$anzahl_auktionen; $i++) {
@ -167,11 +168,11 @@ function insertAuktionen(){
function detectMultiAccounts(){ function detectMultiAccounts(){
$sql = 'Select u1.id as uid1, u2.id as uid2, u1.nickname as n1, u2.nickname as n2 , u1.ip as ip1, u2.ip as ip2, u1.online_zeit as o1, u2.online_zeit as o2 from user as u1 inner join user as u2 on u1.ip = u2.ip and u1.id < u2.id and u1.ip != \'\' and abs(TIMESTAMPDIFF(HOUR, u1.online_zeit, u2.online_zeit)) < 24 and (abs(TIMESTAMPDIFF(HOUR, now(), u1.online_zeit)) < 1 || abs(TIMESTAMPDIFF(HOUR, now(), u2.online_zeit)) < 1)'; $sql = 'Select u1.id as uid1, u2.id as uid2, u1.nickname as n1, u2.nickname as n2 , u1.ip as ip1, u2.ip as ip2, u1.online_zeit as o1, u2.online_zeit as o2 from user as u1 inner join user as u2 on u1.ip = u2.ip and u1.id < u2.id and u1.ip != \'\' and abs(TIMESTAMPDIFF(HOUR, u1.online_zeit, u2.online_zeit)) < 24 and (abs(TIMESTAMPDIFF(HOUR, now(), u1.online_zeit)) < 1 || abs(TIMESTAMPDIFF(HOUR, now(), u2.online_zeit)) < 1)';
$qry = mysql_query($sql); $qry = db_query($sql);
while($tmp = mysql_fetch_assoc($qry)){ while($tmp = mysqli_fetch_assoc($qry)){
$otime = min($tmp['o2'], $tmp['o1']); $otime = min($tmp['o2'], $tmp['o1']);
$sql = 'INSERT INTO multiuser(user1, user2, occured, type) values(\'' . $tmp['uid1'] . '\', \''.$tmp['uid2'].'\',\''.$otime.'\', \'IP_'.$tmp['ip1'].'\')'; $sql = 'INSERT INTO multiuser(user1, user2, occured, type) values(\'' . $tmp['uid1'] . '\', \''.$tmp['uid2'].'\',\''.$otime.'\', \'IP_'.$tmp['ip1'].'\')';
mysql_query($sql); db_query($sql);
} }
} }
@ -179,7 +180,7 @@ function detectMultiAccounts(){
function getAveragePrice($itemid, $tablename, $anzahl){ function getAveragePrice($itemid, $tablename, $anzahl){
$sql = 'SELECT avg(betrag) / avg(anzahl) AS average FROM auktion_transaktionen WHERE anbieter != 1 and itemid = '.$itemid.' and tablename = \''.$tablename.'\' and cheatingverdacht = 0'; $sql = 'SELECT avg(betrag) / avg(anzahl) AS average FROM auktion_transaktionen WHERE anbieter != 1 and itemid = '.$itemid.' and tablename = \''.$tablename.'\' and cheatingverdacht = 0';
$qry = database_query($sql); $qry = database_query($sql);
$row = mysql_fetch_assoc($qry); $row = mysqli_fetch_assoc($qry);
return round($row['average']*$anzahl); return round($row['average']*$anzahl);
} }

@ -8,6 +8,7 @@
include('db.php'); include('db.php');
include('path.inc.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/char.inc.php');
include_once(ROOT_PATH. "/include/random.inc.php"); include_once(ROOT_PATH. "/include/random.inc.php");
@ -38,7 +39,7 @@ foreach($races as $race) {
$exclude_race_ids[] = '\''.$race['id'].'\''; $exclude_race_ids[] = '\''.$race['id'].'\'';
} }
$max_charakter = mysql_num_rows(mysql_query('SELECT id FROM chars WHERE rasse NOT IN ('.implode(',', $exclude_race_ids).') LIMIT 500')); $max_charakter = mysqli_num_rows(db_query('SELECT id FROM chars WHERE rasse NOT IN ('.implode(',', $exclude_race_ids).') LIMIT 500'));
if($max_charakter%2!=0) { $max_charakter--; } if($max_charakter%2!=0) { $max_charakter--; }
@ -46,11 +47,11 @@ if($max_charakter==0) {
exit; exit;
} }
$charakter = mysql_query('SELECT name, id FROM chars WHERE rasse NOT IN ('.implode(',', $exclude_race_ids).') ORDER BY level DESC LIMIT '.$max_charakter); $charakter = db_query('SELECT name, id FROM chars WHERE rasse NOT IN ('.implode(',', $exclude_race_ids).') ORDER BY level DESC LIMIT '.$max_charakter);
while($row=mysql_fetch_array($charakter)) while($row=mysqli_fetch_array($charakter))
{ {
$test2[]=$row['id']; $test2[]=$row['id'];
} }
@ -70,8 +71,8 @@ while(current($test3)!=end($test2))
} }
$result=mysql_query("SELECT id FROM chars WHERE id IN(".$list.") LIMIT 500"); $result=db_query("SELECT id FROM chars WHERE id IN(".$list.") LIMIT 500");
while($row=mysql_fetch_array($result)) { while($row=mysqli_fetch_array($result)) {
// Nutze getChar um kompatibel mit Aenderungen der Datenstruktur zu bleiben! // Nutze getChar um kompatibel mit Aenderungen der Datenstruktur zu bleiben!
$charas[$row['id']]=getChar($row['id']); $charas[$row['id']]=getChar($row['id']);
} }

@ -84,17 +84,17 @@ $GLOBALS['kampf']['aussetzen'] = &$aussetzten_runde;
$x=0; $x=0;
mysql_query("INSERT wanted_kampf SET hp1='$k_hp[0]', hp2='$k_hp[1]', mp1='$k_mp[0]', mp2='$k_mp[1]', schaden1='$schaden_1', schaden2='$schaden_2', attacke1='$technick1[name]', attacke2='$technick2[name]', char1='$chara_1[id]', char2='$chara_2[id]', starke1='$k_starke[0]', starke2='$k_starke[1]', ver1='$k_ver[0]', ver2='$k_ver[1]', speed1='$k_speed[0]', speed2='$k_speed[1]', ausdauer1='$k_ausdauer[0]', ausdauer2='$k_ausdauer[1]', glueck1='$k_glueck[0]', glueck2='$k_glueck[1]'"); db_query("INSERT wanted_kampf SET hp1='$k_hp[0]', hp2='$k_hp[1]', mp1='$k_mp[0]', mp2='$k_mp[1]', schaden1='$schaden_1', schaden2='$schaden_2', attacke1='$technick1[name]', attacke2='$technick2[name]', char1='$chara_1[id]', char2='$chara_2[id]', starke1='$k_starke[0]', starke2='$k_starke[1]', ver1='$k_ver[0]', ver2='$k_ver[1]', speed1='$k_speed[0]', speed2='$k_speed[1]', ausdauer1='$k_ausdauer[0]', ausdauer2='$k_ausdauer[1]', glueck1='$k_glueck[0]', glueck2='$k_glueck[1]'");
while($k_hp[0] > $k_aufgabe[0] AND $k_hp[1] > $k_aufgabe[1] AND $x < 10) { while($k_hp[0] > $k_aufgabe[0] AND $k_hp[1] > $k_aufgabe[1] AND $x < 10) {
$technick1 = mysql_fetch_array(mysql_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke1[$x]' LIMIT 10")); $technick1 = mysqli_fetch_array(db_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke1[$x]' LIMIT 10"));
$prozent_technik1 = (20*$technick1[aktiv])-20; $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"));
$technick2 = mysql_fetch_array(mysql_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke2[$x]' LIMIT 10")); $technick2 = mysqli_fetch_array(db_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke2[$x]' LIMIT 10"));
$prozent_technik2 = (20*$technick2[aktiv])-20; $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"));
///////////////////Hier laedt er den RELOAD der technik wenn die zusammen setzung nicht stimmen sollte ///////////////////Hier laedt er den RELOAD der technik wenn die zusammen setzung nicht stimmen sollte
@ -132,9 +132,9 @@ include "include/kampf/kampf_rechnung.php";
$db_query = mysql_fetch_array(mysql_query("SELECT * FROM wanted_kampf WHERE (char1='$chara_1[id]' OR char1='$chara_2[id]') AND dauer='0' order by id DESC LIMIT 1")); $db_query = mysqli_fetch_array(db_query("SELECT * FROM wanted_kampf WHERE (char1='$chara_1[id]' OR char1='$chara_2[id]') AND dauer='0' order by id DESC LIMIT 1"));
mysql_query("UPDATE wanted_kampf SET hp1='$db_query[hp1],$k_hp7[0]', hp2='$db_query[hp2],$k_hp7[1]', mp1='$db_query[mp1],$k_mp7[0]', mp2='$db_query[mp2],$k_mp7[1]', schaden1='$db_query[schaden1],$schaden_1', schaden2='$db_query[schaden2],$schaden_2', attacke1='$db_query[attacke1],$technick1[name]', attacke2='$db_query[attacke2],$technick2[name]', starke1='$db_query[starke1],$k_starke[0]', starke2='$db_query[starke2],$k_starke[1]', ver1='$db_query[ver1],$k_ver[0]', ver2='$db_query[ver2],$k_ver[1]', speed1='$db_query[speed1],$k_speed[0]', speed2='$db_query[speed2],$k_speed[1]', ausdauer1='$db_query[ausdauer1],$k_ausdauer[0]', ausdauer2='$db_query[ausdauer2],$k_ausdauer[1]', glueck1='$db_query[glueck1],$k_glueck[0]', glueck2='$db_query[glueck2],$k_glueck[1]' WHERE id='$db_query[id]'"); db_query("UPDATE wanted_kampf SET hp1='$db_query[hp1],$k_hp7[0]', hp2='$db_query[hp2],$k_hp7[1]', mp1='$db_query[mp1],$k_mp7[0]', mp2='$db_query[mp2],$k_mp7[1]', schaden1='$db_query[schaden1],$schaden_1', schaden2='$db_query[schaden2],$schaden_2', attacke1='$db_query[attacke1],$technick1[name]', attacke2='$db_query[attacke2],$technick2[name]', starke1='$db_query[starke1],$k_starke[0]', starke2='$db_query[starke2],$k_starke[1]', ver1='$db_query[ver1],$k_ver[0]', ver2='$db_query[ver2],$k_ver[1]', speed1='$db_query[speed1],$k_speed[0]', speed2='$db_query[speed2],$k_speed[1]', ausdauer1='$db_query[ausdauer1],$k_ausdauer[0]', ausdauer2='$db_query[ausdauer2],$k_ausdauer[1]', glueck1='$db_query[glueck1],$k_glueck[0]', glueck2='$db_query[glueck2],$k_glueck[1]' WHERE id='$db_query[id]'");
$x++; $x++;
@ -204,9 +204,9 @@ $dauer_Z = time();
mysql_query("UPDATE chars SET preis='$new_preis1', dead_list='$new_dead_list1' WHERE id='$chara_1[id]' LIMIT 1"); db_query("UPDATE chars SET preis='$new_preis1', dead_list='$new_dead_list1' WHERE id='$chara_1[id]' LIMIT 1");
mysql_query("UPDATE chars SET preis='$new_preis2', dead_list='$new_dead_list2' WHERE id='$chara_2[id]' LIMIT 1"); db_query("UPDATE chars SET preis='$new_preis2', dead_list='$new_dead_list2' WHERE id='$chara_2[id]' LIMIT 1");
mysql_query("UPDATE wanted_kampf SET exp1='$k_exp[0]', win='$sieger', lose='$verlierer', exp2='$k_exp[1]', geld1='$k_geld[0]', geld2='$k_geld[1]', dauer='$dauer_Z' WHERE id='$db_query[id]'"); db_query("UPDATE wanted_kampf SET exp1='$k_exp[0]', win='$sieger', lose='$verlierer', exp2='$k_exp[1]', geld1='$k_geld[0]', geld2='$k_geld[1]', dauer='$dauer_Z' WHERE id='$db_query[id]'");

@ -7,6 +7,7 @@
*/ */
include "db.php"; include "db.php";
include_once('path.inc.php'); // get the path ;) 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/halloffame.inc.php');
include_once ('inclu/fruitdistribution.inc.php'); include_once ('inclu/fruitdistribution.inc.php');
include_once ('inclu/exp.inc.php'); include_once ('inclu/exp.inc.php');

Loading…
Cancel
Save