diff --git a/ag/abholen.php b/ag/abholen.php index 5a98483..bc54731 100644 --- a/ag/abholen.php +++ b/ag/abholen.php @@ -36,7 +36,7 @@ if($char_1['besitzer'] != $user['id']) { } // Ermittle den Abholcode (Eingefuehrt um das nutzen von Bots zu erschweren!) -$code_row = mysql_fetch_assoc(mysql_query('Select * from char_abholcodes where charid = '.$char_id)); +$code_row = mysqli_fetch_assoc(db_query('Select * from char_abholcodes where charid = '.$char_id)); if($code_row){ $abholstring = 'char_id='.$char_id.'&code='.$code_row['code']; } else{ @@ -45,7 +45,7 @@ if($code_row){ #######################Kampf if($ab == "Kampf") { -$kampf_a = mysql_fetch_array(mysql_query("SELECT char1, char2, id, dauer FROM kampf WHERE db_satz='$char_id' order by id DESC LIMIT 1")); +$kampf_a = mysqli_fetch_array(db_query("SELECT char1, char2, id, dauer FROM kampf WHERE db_satz='$char_id' order by id DESC LIMIT 1")); $kampf_a1 = getChar($kampf_a['char1']); $kampf_a2 = getChar($kampf_a['char2']); @@ -143,7 +143,7 @@ $zeit_in_sek = getEventStatusBlocked($char_id); #######################Schatz Suche Kampf if($ab == "Schatz Suche") { -$kampf_a = mysql_fetch_array(mysql_query('select Timestampdiff(Second,now(),dauer) as dauer, Timestampdiff(Second,now(),cancel) as cancel from quests where charid = '.$char_id)); +$kampf_a = mysqli_fetch_array(db_query('select Timestampdiff(Second,now(),dauer) as dauer, Timestampdiff(Second,now(),cancel) as cancel from quests where charid = '.$char_id)); $zeit_in_sek = $kampf_a['dauer']; $cancel_zeit_in_sek = $kampf_a['cancel']; diff --git a/ag/ag_popupchat.php b/ag/ag_popupchat.php index a25b9c0..581ea36 100644 --- a/ag/ag_popupchat.php +++ b/ag/ag_popupchat.php @@ -39,19 +39,19 @@ if(isset($user_ida['nickname'])){ } // Wechsel der IP if($_SESSION['anon_ip'] != $_SERVER['REMOTE_ADDR']){ - mysql_query('Update anon_chatter set ip = \''.$_SERVER['REMOTE_ADDR'].'\' where ip = \''.$_SESSION['anon_ip'].'\''); + db_query('Update anon_chatter set ip = \''.$_SERVER['REMOTE_ADDR'].'\' where ip = \''.$_SESSION['anon_ip'].'\''); $_SESSION['anon_ip'] = $_SERVER['REMOTE_ADDR']; } - $usr = mysql_fetch_assoc(mysql_query('Select * from anon_chatter where ip = \''.$_SESSION['anon_ip'].'\'')); + $usr = mysqli_fetch_assoc(db_query('Select * from anon_chatter where ip = \''.$_SESSION['anon_ip'].'\'')); while(!$usr){ - mysql_query('Insert into anon_chatter(ip, anon_id) values(\''.$_SESSION['anon_ip'].'\', '.mt_random_wrapper(90000,99999).')'); - $usr = mysql_fetch_assoc(mysql_query('Select * from anon_chatter where ip = \''.$_SESSION['anon_ip'].'\'')); + db_query('Insert into anon_chatter(ip, anon_id) values(\''.$_SESSION['anon_ip'].'\', '.mt_random_wrapper(90000,99999).')'); + $usr = mysqli_fetch_assoc(db_query('Select * from anon_chatter where ip = \''.$_SESSION['anon_ip'].'\'')); } $user_ida['id'] = $usr['anon_id']; $user_ida['nickname'] = 'anon_' . $usr['anon_id']; $anon_block = $usr['muted']==0?false:true; - mysql_query('UPDATE anon_chatter SET online = now() WHERE anon_ip = '.$usr['anon_id']); + db_query('UPDATE anon_chatter SET online = now() WHERE anon_ip = '.$usr['anon_id']); } // diff --git a/ag/aktiv.php b/ag/aktiv.php index 8691680..f68d1ba 100644 --- a/ag/aktiv.php +++ b/ag/aktiv.php @@ -22,7 +22,7 @@ $serial = validateString($_GET['serial']); $charm = $_GET['charm']; if($charm) { - $user_k = mysql_fetch_assoc(mysql_query('SELECT * FROM user_activation WHERE username=\''.$nick_name.'\' AND code=\''.$serial.'\'')); + $user_k = mysqli_fetch_assoc(db_query('SELECT * FROM user_activation WHERE username=\''.$nick_name.'\' AND code=\''.$serial.'\'')); if(!$user_k['username']) { displayErrorMessage(NULL,'Account konnte nicht aktiviert werden!', displayHistoryBackLink()); exit; @@ -30,11 +30,11 @@ if($charm) { #########USER AKTIVIERUNG - mysql_query('INSERT INTO user(nickname, mail, passwort, agb) values(\''.$user_k['username'].'\',\''.$user_k['mail'].'\', \''.$user_k['passwort'].'\', \'ja\')'); - $user_ida_nach = mysql_fetch_array(mysql_query('SELECT id FROM user WHERE nickname=\''.$nick_name.'\'')); + db_query('INSERT INTO user(nickname, mail, passwort, agb) values(\''.$user_k['username'].'\',\''.$user_k['mail'].'\', \''.$user_k['passwort'].'\', \'ja\')'); + $user_ida_nach = mysqli_fetch_array(db_query('SELECT id FROM user WHERE nickname=\''.$nick_name.'\'')); $sql = 'INSERT arena(besitzer, exp) values (\''.$user_ida_nach['id'].'\', \'0,'.calculateRequiredExpArena(1).'\')'; - mysql_query($sql); - mysql_query('DELETE from user_activation where username = \''.$user_k['username'].'\''); + db_query($sql); + db_query('DELETE from user_activation where username = \''.$user_k['username'].'\''); displayErrorMessage(NULL,'Account wurde aktiviert!', 'weiter'); sendMessage('Die Animegame Crew', $user_ida_nach['id'], 'Herzlich Willkommen bei AG', 'Herzlich Willkommen beim Animegame,'."\n".' dem Spiel in dem die Welten von One Piece und Dragonball aufeinanderprallen.'."\n\n".'Zu Anfang sieht AnimeGame ziemlich kompliziert aus, deshalb liest Du dir am besten erstmal den Anfängerguide in unserem Wiki durch:'."\n".'[url='.$GLOBALS['noobguide_url'].'][color=yellow]Anfängerguide[/color][/url]'."\n\n".'Wenn danach noch Fragen offen sind, findest Du bestimmt eine Antwort in der FAQ-Abteilung:'."\n".'[url='.$GLOBALS['faq_url'].'][color=red]Häufig gestellte Fragen[/color][/url]'."\n\n".'Falls du danach immer noch Fragen haben solltest, kannst du diese auch gerne im Chat oder im Forum stellen. Die anderen Mitspieler werden dir bestimmt gerne weiterhelfen.'."\n\n".'Viel Spass'."\n".'Das Animegame Team'); exit; diff --git a/ag/anmeldung.php b/ag/anmeldung.php index 93887fc..add5684 100644 --- a/ag/anmeldung.php +++ b/ag/anmeldung.php @@ -66,10 +66,10 @@ if ($charm) { $sql = 'SELECT nickname,mail FROM user WHERE nickname=\'' . $nick_name . '\' OR mail=\'' . $mail . '\''; //echo $sql.'
'; - $user_a = mysql_fetch_assoc(mysql_query($sql)); + $user_a = mysqli_fetch_assoc(db_query($sql)); $sql = 'SELECT username,mail FROM user_activation WHERE username=\'' . $nick_name . '\' OR mail=\'' . $mail . '\''; //echo $sql.'
'; - $user_b = mysql_fetch_assoc(mysql_query($sql)); + $user_b = mysqli_fetch_assoc(db_query($sql)); if ($user_a != FALSE || $user_b != FALSE) { if ($user_a['nickname'] == $nick_name || $user_b['username'] == $nick_name) { @@ -101,7 +101,7 @@ if ($charm) { $pw_1 = md5($pw_1); - mysql_query('INSERT INTO user_activation(username, code, passwort, mail, registerdate) values(\'' . $nick_name . '\', \'' . $serial_1 . '\', \'' . $pw_1 . '\', \'' . $mail . '\', now())'); + db_query('INSERT INTO user_activation(username, code, passwort, mail, registerdate) values(\'' . $nick_name . '\', \'' . $serial_1 . '\', \'' . $pw_1 . '\', \'' . $mail . '\', now())'); displayErrorMessage(NULL, 'Erfolgreich angemeldet | Schauen sie in ihr Postfach', 'weiter'); exit; diff --git a/ag/arena.php b/ag/arena.php index a473609..1f387d8 100644 --- a/ag/arena.php +++ b/ag/arena.php @@ -171,9 +171,9 @@ function displayAusbau2($user, $arena, $arena_name, $steh, $sitz, $loge, $vermoe } else{ $sql = 'UPDATE arena set name = \''.$arena_name.'\', steh = '.$steh.', sitz = '.$sitz.', loge = '.$loge.' WHERE id = '.$arena['id']; // echo $sql; - mysql_query($sql); - if(mysql_affected_rows() > 0){ - mysql_query('UPDATE user set geld = geld - '.$gesamtkosten.' where id = '.$user['id']); + db_query($sql); + if(db_affected_rows() > 0){ + db_query('UPDATE user set geld = geld - '.$gesamtkosten.' where id = '.$user['id']); displayErrorMessage(NULL, 'Umbau durchgeführt!', 'weiter'); } else{ displayErrorMessage(NULL, 'Umbau konnte nicht durchgeführt werden!', displayHistoryBackLink()); @@ -248,9 +248,9 @@ if($charmax !== NULL || $hausmeister !== NULL || $luxus !== NULL){ } else{ $n_skill = $arena['skill'] - ($cm + $hm + $lu); $sql = 'Update arena SET skill = '.$n_skill.', hausmeister = '.($arena['hausmeister']+$hm).', luxus = '.($arena['luxus']+$lu).' WHERE id = '.$arena['id']; - mysql_query($sql); + db_query($sql); if($cm != 0){ - mysql_query('Update user SET char_max = '.($user['char_max']+$cm).' WHERE id = '.$user['id']); + db_query('Update user SET char_max = '.($user['char_max']+$cm).' WHERE id = '.$user['id']); } displayErrorMessage(NULL, 'Die Skill-Points wurden erfolgreich verteilt!', 'weiter'); } @@ -306,8 +306,8 @@ function renovate($user, $arena, $vermoegen){ if($costs > $vermoegen){ displayErrorMessage(NULL, 'Nicht genug Geld für die Renovierung!', displayHistoryBackLink()); } else{ - mysql_query('Update user set geld = geld - '.$costs.' WHERE id = '.$user['id']); - mysql_query('Update arena set zustand = 1 WHERE id = '.$arena['id']); + db_query('Update user set geld = geld - '.$costs.' WHERE id = '.$user['id']); + db_query('Update arena set zustand = 1 WHERE id = '.$arena['id']); displayErrorMessage(NULL, 'Renovierung durchgeführt!', displayHistoryBackLink()); } } @@ -315,7 +315,7 @@ function renovate($user, $arena, $vermoegen){ $arena = getArena($user_ida['id']); -$auktionensumme = mysql_fetch_assoc(mysql_query('SELECT SUM(aktuellesgebot) as summe FROM auktion WHERE bieter = '.$user_ida['id'].' GROUP BY bieter')); +$auktionensumme = mysqli_fetch_assoc(db_query('SELECT SUM(aktuellesgebot) as summe FROM auktion WHERE bieter = '.$user_ida['id'].' GROUP BY bieter')); $auktionensumme = $auktionensumme['summe']; $vermoegen = $user['geld'] - $auktionensumme; $unterhalt = calculateUnterhaltsKosten($arena); @@ -325,9 +325,9 @@ if($action == 'miete'){ if($vermoegen < $unterhalt){ displayErrorMessage(NULL, 'Du hast nicht genug Geld um die Unterhaltskosten zu bezahlen!', displayHistoryBackLink()); } else{ - mysql_query('Update user set geld = geld - '.$unterhalt.' WHERE id = '.$user_ida['id']); - mysql_query('Update arena set mietlasten = 0, steuerlasten = 0 WHERE id = '.$arena['id']); - $arena = mysql_fetch_assoc(mysql_query('SELECT * FROM arena where besitzer = \''.$user_ida['id'].'\'')); + db_query('Update user set geld = geld - '.$unterhalt.' WHERE id = '.$user_ida['id']); + db_query('Update arena set mietlasten = 0, steuerlasten = 0 WHERE id = '.$arena['id']); + $arena = mysqli_fetch_assoc(db_query('SELECT * FROM arena where besitzer = \''.$user_ida['id'].'\'')); displayArena($arena); } } else if($action == 'ausbau1'){ diff --git a/ag/auser.php b/ag/auser.php index de39d49..f250b7c 100644 --- a/ag/auser.php +++ b/ag/auser.php @@ -19,14 +19,14 @@ $firstLetter = validateString($_GET['firstLetter']); if($firstLetter == 'Numeric'){ - $auser = mysql_query('SELECT * FROM user where SUBSTRING(nickname,1,1) < \'a\' order by nickname ASC LIMIT '.($pagenum*50).', 50'); - $total = mysql_fetch_assoc(mysql_query('SELECT count(id) as anzahl FROM user where SUBSTRING(nickname,1,1) < \'a\'')); + $auser = db_query('SELECT * FROM user where SUBSTRING(nickname,1,1) < \'a\' order by nickname ASC LIMIT '.($pagenum*50).', 50'); + $total = mysqli_fetch_assoc(db_query('SELECT count(id) as anzahl FROM user where SUBSTRING(nickname,1,1) < \'a\'')); } else if($firstLetter == null){ - $auser = mysql_query('SELECT * FROM user order by nickname ASC LIMIT '.($pagenum*50).', 50'); - $total = mysql_fetch_assoc(mysql_query('SELECT count(id) as anzahl FROM user')); + $auser = db_query('SELECT * FROM user order by nickname ASC LIMIT '.($pagenum*50).', 50'); + $total = mysqli_fetch_assoc(db_query('SELECT count(id) as anzahl FROM user')); } else{ - $auser = mysql_query('SELECT * FROM user where nickname like \''.$firstLetter.'%\' order by nickname ASC LIMIT '.($pagenum*50).', 50'); - $total = mysql_fetch_assoc(mysql_query('SELECT count(id) as anzahl FROM user where nickname like \''.$firstLetter.'%\'')); + $auser = db_query('SELECT * FROM user where nickname like \''.$firstLetter.'%\' order by nickname ASC LIMIT '.($pagenum*50).', 50'); + $total = mysqli_fetch_assoc(db_query('SELECT count(id) as anzahl FROM user where nickname like \''.$firstLetter.'%\'')); } $total = $total['anzahl']; @@ -53,7 +53,7 @@ $total = $total['anzahl']; Homepage diff --git a/ag/char.php b/ag/char.php index 653d24a..bac553e 100644 --- a/ag/char.php +++ b/ag/char.php @@ -370,7 +370,7 @@ function handleThirdPhaseForTester($type, $name, $char_lvl, $random, $user){ '; - $char1_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 (' . $my_charz['kampf_item'] . ')')); + $char1_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 (' . $my_charz['kampf_item'] . ')')); } $c_starke = ($char1_buffs['starke']==0)?$my_charz['starke']:($my_charz['starke']).' (+'.$char1_buffs['starke'].')'; $c_verteidigung = ($char1_buffs['verteidigung']==0)?$my_charz['verteidigung']:($my_charz['verteidigung']).' (+'.$char1_buffs['verteidigung'].')'; @@ -83,11 +83,11 @@ foreach($chars as $my_charz){ } elseif($my_charz['status'] == 'Angemeldet' OR $my_charz['status'] == 'Kampf erstellt') { $temp = 'Status: '.$my_charz['status']; } elseif($my_charz['status'] == 'Kampf') { - $kampf_a = mysql_fetch_assoc(mysql_query("SELECT dauer FROM kampf WHERE db_satz='".$my_charz['id']."' order by id DESC LIMIT 1")); + $kampf_a = mysqli_fetch_assoc(db_query("SELECT dauer FROM kampf WHERE db_satz='".$my_charz['id']."' order by id DESC LIMIT 1")); $zeit_in_sek[$char_zahl] = $kampf_a['dauer'] - time(); $temp = 'Status: '.$my_charz['status'].'
'; } elseif($my_charz['status'] == 'Schatz Suche') { - $kampf_a = mysql_fetch_array(mysql_query('select Timestampdiff(Second,now(),dauer) as dauer from quests where charid = '.$my_charz['id'])); + $kampf_a = mysqli_fetch_array(db_query('select Timestampdiff(Second,now(),dauer) as dauer from quests where charid = '.$my_charz['id'])); $zeit_in_sek[$char_zahl] = $kampf_a['dauer']; $temp = 'Status: '.$my_charz['status'].'
'; } else { diff --git a/ag/char_profil.php b/ag/char_profil.php index 79752f0..e363d23 100644 --- a/ag/char_profil.php +++ b/ag/char_profil.php @@ -51,11 +51,11 @@ function stelledar($char_id,$user_ida,$name) { $normfight_attset_name = getAttackNames($normfight_attset); //Rüstung laden - $e_schuhe = mysql_query("SELECT i.name, w.id, i.level FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE (i.type='$char_1[type]' OR i.type='ALL') AND w.user='$user_ida[id]' AND w.ru_mal='1' AND i.s_type='Schuhe' AND i.level <='$char_1[level]' group by i.name order by i.level desc"); - $e_schwert = mysql_query("SELECT i.name, w.id, i.level FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE (i.type='$char_1[type]' OR i.type='ALL') AND w.user='$user_ida[id]' AND w.ru_mal='1' AND i.s_type='Schwert' AND i.level <='$char_1[level]' group by i.name order by i.level desc"); - $e_rustung = mysql_query("SELECT i.name, w.id, i.level FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE (i.type='$char_1[type]' OR i.type='ALL') AND w.user='$user_ida[id]' AND w.ru_mal='1' AND i.s_type='Ruestung' AND i.level <='$char_1[level]' group by i.name order by i.level desc"); - $e_schild = mysql_query("SELECT i.name, w.id, i.level FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE (i.type='$char_1[type]' OR i.type='ALL') AND w.user='$user_ida[id]' AND w.ru_mal='1' AND i.s_type='Schild' AND i.level <='$char_1[level]' group by i.name order by i.level desc"); - $e_helm = mysql_query("SELECT i.name, w.id, i.level FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE (i.type='$char_1[type]' OR i.type='ALL') AND w.user='$user_ida[id]' AND w.ru_mal='1' AND i.s_type='Helm' AND i.level <='$char_1[level]' group by i.name order by i.level desc"); + $e_schuhe = db_query("SELECT i.name, w.id, i.level FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE (i.type='$char_1[type]' OR i.type='ALL') AND w.user='$user_ida[id]' AND w.ru_mal='1' AND i.s_type='Schuhe' AND i.level <='$char_1[level]' group by i.name order by i.level desc"); + $e_schwert = db_query("SELECT i.name, w.id, i.level FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE (i.type='$char_1[type]' OR i.type='ALL') AND w.user='$user_ida[id]' AND w.ru_mal='1' AND i.s_type='Schwert' AND i.level <='$char_1[level]' group by i.name order by i.level desc"); + $e_rustung = db_query("SELECT i.name, w.id, i.level FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE (i.type='$char_1[type]' OR i.type='ALL') AND w.user='$user_ida[id]' AND w.ru_mal='1' AND i.s_type='Ruestung' AND i.level <='$char_1[level]' group by i.name order by i.level desc"); + $e_schild = db_query("SELECT i.name, w.id, i.level FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE (i.type='$char_1[type]' OR i.type='ALL') AND w.user='$user_ida[id]' AND w.ru_mal='1' AND i.s_type='Schild' AND i.level <='$char_1[level]' group by i.name order by i.level desc"); + $e_helm = db_query("SELECT i.name, w.id, i.level FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE (i.type='$char_1[type]' OR i.type='ALL') AND w.user='$user_ida[id]' AND w.ru_mal='1' AND i.s_type='Helm' AND i.level <='$char_1[level]' group by i.name order by i.level desc"); $checked = explode(',',$char_1['kampf_item']); ?> @@ -251,7 +251,7 @@ function stelledar($char_id,$user_ida,$name) {   verlassen)'; @@ -89,10 +89,10 @@ function displayClanProfileReadOnly($clan, $ownclan, $userid){ } } - $inv_qry = mysql_query('SELECT userid, TIMESTAMPDIFF(HOUR, now(), valid) as till FROM user_clan_invitations WHERE clanid = '.$clan['id'].' and valid > now()'); + $inv_qry = db_query('SELECT userid, TIMESTAMPDIFF(HOUR, now(), valid) as till FROM user_clan_invitations WHERE clanid = '.$clan['id'].' and valid > now()'); $invited = array(); - while($row = mysql_fetch_assoc($inv_qry)) { + while($row = mysqli_fetch_assoc($inv_qry)) { $invited[] = generateUserLinkByID($row['userid']) . ' (noch ' . $row['till'] . 'h gültig)'; } @@ -256,10 +256,10 @@ function displayClanProfileReadOnly($clan, $ownclan, $userid){ } function displayClanProfileEditable($clan, $userid){ - $member_qry = mysql_query('Select id from user where clan = '.$clan['id']); + $member_qry = db_query('Select id from user where clan = '.$clan['id']); $member = array(); - $count = mysql_num_rows($member_qry); - while($row = mysql_fetch_assoc($member_qry)){ + $count = mysqli_stmt_num_rows($member_qry); + while($row = mysqli_fetch_assoc($member_qry)){ $tmp = generateUserLinkByID($row['id']); $kickable = true; @@ -278,10 +278,10 @@ function displayClanProfileEditable($clan, $userid){ } } - $inv_qry = mysql_query('SELECT userid, TIMESTAMPDIFF(HOUR, now(), valid) as till FROM user_clan_invitations WHERE clanid = '.$clan['id'].' and valid > now()'); + $inv_qry = db_query('SELECT userid, TIMESTAMPDIFF(HOUR, now(), valid) as till FROM user_clan_invitations WHERE clanid = '.$clan['id'].' and valid > now()'); $invited = array(); - while($row = mysql_fetch_assoc($inv_qry)) { + while($row = mysqli_fetch_assoc($inv_qry)) { $invited[] = generateUserLinkByID($row['userid']) . ' (noch ' . $row['till'] . 'h gültig, zurückziehen)'; } @@ -498,23 +498,23 @@ function setProfile($user, $what, $value1, $value2, $clanid, $rootlvl){ } switch($what){ case 'Homepage': - mysql_query('UPDATE clan SET homepage = \''.$value1.'\' where id = '.$clanid); + db_query('UPDATE clan SET homepage = \''.$value1.'\' where id = '.$clanid); return NULL; case 'Clanzeichen': if(strlen($value1.$value2) > MAX_CHARS_CLANSIGN) { return 'Clanzeichen sind ungültig: Summe aus beiden Teilen darf nicht größer als '.MAX_CHARS_CLANSIGN.' Zeichen sein!'; } - mysql_query('UPDATE clan SET clanz_pre = \''.$value1.'\', clanz_suff = \''.$value2.'\' where id = '.$clanid); + db_query('UPDATE clan SET clanz_pre = \''.$value1.'\', clanz_suff = \''.$value2.'\' where id = '.$clanid); return NULL; case 'Banner': - mysql_query('UPDATE clan SET banner = \''.$value1.'\' where id = '.$clanid); + db_query('UPDATE clan SET banner = \''.$value1.'\' where id = '.$clanid); return NULL; case 'Info': - mysql_query('UPDATE clan SET Info = \''.$value1.'\' where id = '.$clanid); + db_query('UPDATE clan SET Info = \''.$value1.'\' where id = '.$clanid); return NULL; case 'Background': - if(isClanBackgroundAvailable($clanid)) { mysql_query('UPDATE clan SET background = \''.$value1.'\' where id = '.$clanid) ;} + if(isClanBackgroundAvailable($clanid)) { db_query('UPDATE clan SET background = \''.$value1.'\' where id = '.$clanid) ;} return NULL; case 'Leadership': $clan = getClan($clanid); @@ -537,11 +537,11 @@ function setProfile($user, $what, $value1, $value2, $clanid, $rootlvl){ if($rootlvl == 1){ // the co leader may only set the co leader XD $sql = 'UPDATE clan SET co_leader = '.$value2.' where id = '.$clanid; //echo $sql.'
'; - mysql_query($sql); + db_query($sql); } else if($rootlvl == 2) { // the leader may set the leader and the co leader $sql = 'UPDATE clan SET leader = '.$value1.', co_leader = '.$value2.' where id = '.$clanid; // echo $sql.'
'; - mysql_query($sql); + db_query($sql); } return NULL; case 'Member': @@ -588,10 +588,10 @@ function displayEdit($what, $clanid, $rootlvl){ $content = ''; break; case 'Leadership': - $member_qry = mysql_query('Select id, nickname from user where clan = '.$clanid); + $member_qry = db_query('Select id, nickname from user where clan = '.$clanid); $member[] = ''; $member2[] = ''; - while($row = mysql_fetch_assoc($member_qry)){ + while($row = mysqli_fetch_assoc($member_qry)){ if($row['id'] == $clan['leader']) { $member[] = ''; } else { @@ -618,11 +618,11 @@ function displayEdit($what, $clanid, $rootlvl){ $content .= ''.PHP_EOL; $content .= ''.PHP_EOL; $content .= ''.PHP_EOL; - $member_qry = mysql_query('Select id from user where clan = '.$clan['id']); + $member_qry = db_query('Select id from user where clan = '.$clan['id']); $authorized = getAuthorizedClanfightCoordinatorIDs($clanid); $leader = NULL; $coleader = NULL; - while($row = mysql_fetch_assoc($member_qry)){ + while($row = mysqli_fetch_assoc($member_qry)){ $row['nickname'] = generateUserLinkByID($row['id'], false); if($row['id'] == $clan['leader']){ $leader = $row; @@ -704,7 +704,7 @@ if($action !== NULL) { // this is done to not require to reprogramm the whole st switch ($action) { case 'edit': $errorMsg = NULL; - $row = mysql_fetch_assoc(mysql_query('SELECT leader, co_leader from clan where id = '.$user_ida['clan'])); + $row = mysqli_fetch_assoc(db_query('SELECT leader, co_leader from clan where id = '.$user_ida['clan'])); if($row['leader'] != $user_ida['id'] && $row['co_leader'] != $user_ida['id']){ displayErrorMessage(NULL, 'Du bist weder Leader noch Co-Leader des Clans!', displayHistoryBackLink()); $displayMore = false; diff --git a/ag/clan/kampf_anzeige.php b/ag/clan/kampf_anzeige.php index acc2fdc..5bd9af4 100644 --- a/ag/clan/kampf_anzeige.php +++ b/ag/clan/kampf_anzeige.php @@ -30,9 +30,9 @@ function getEventChars($challenge_id, $event_id) { $sql = 'SELECT * FROM clan_challenge_participants ccp INNER JOIN event_chars ec ON ccp.char_id=ec.event_char_id INNER JOIN event_fights ef ON ccp.slot=ef.event_fight_id WHERE ccp.clan_challenge_id = '.$challenge_id.' AND ec.event_id= '.$event_id.' AND ef.event_id= '.$event_id.' ORDER BY slot;'; - $qry = mysql_query($sql); + $qry = db_query($sql); $chars = array(); - while($row = mysql_fetch_array($qry)) { + while($row = mysqli_fetch_array($qry)) { $chars[] = $row; } return $chars; @@ -41,9 +41,9 @@ function getEventChars($challenge_id, $event_id) { function getChallengeClans($challenge_id) { $sql = 'SELECT ccc.id, c.clanname, ccc.elo_change, ccc.exp_change, c.id as clan_id, ccc.points FROM clan_challenge_clans ccc INNER JOIN clan c ON ccc.clan_id=c.id WHERE clan_challenge_id='.$challenge_id.';'; - $qry = mysql_query($sql); + $qry = db_query($sql); $clans = array(); - while($row = mysql_fetch_array($qry)) { + while($row = mysqli_fetch_array($qry)) { $clans[$row['id']] = array('name' => $row['clanname'], 'id' => $row['clan_id'], 'elo' => $row['elo_change'], 'xp' => $row['exp_change'], 'points' => $row['points']); } return $clans; diff --git a/ag/clan/kampf_info.php b/ag/clan/kampf_info.php index 12955ad..7fea6fa 100644 --- a/ag/clan/kampf_info.php +++ b/ag/clan/kampf_info.php @@ -231,7 +231,7 @@ function displayShowChallenge($clan_challenge_id, $user) { $row['user_name']); } diff --git a/ag/clan/new.php b/ag/clan/new.php index fb87746..ecdb6b2 100644 --- a/ag/clan/new.php +++ b/ag/clan/new.php @@ -52,7 +52,7 @@ if ($charm == 1) { $sql = 'SELECT id, clanname FROM clan WHERE clanname = \'' .$clan_name. '\''; // echo $sql.'
'; - $dup = mysql_fetch_assoc(mysql_query($sql)); + $dup = mysqli_fetch_assoc(db_query($sql)); if($dup) { // we have a clan that has the same name!! @@ -62,14 +62,14 @@ if ($charm == 1) { if($error == null) { $sql = 'INSERT into clan(clanname,clanz_pre,clanz_suff,info, leader) values(\''.$clan_name.'\', \''.$clan_for.'\', \''.$clan_back.'\', \''.$clan_info.'\', '.$user_ida['id'].')'; // echo $sql.'
'; - mysql_query($sql); - if(mysql_affected_rows() > 0){ // Erstellen des Clans geglueckt - $c_id = mysql_fetch_assoc(mysql_query('Select * from clan where clanname = \''.$clan_name.'\'')); - mysql_query('UPDATE user SET clan='.$c_id['id'].', geld = geld - '.CLAN_CREATION_FEE.' WHERE id='.$user_ida['id']); + db_query($sql); + if(db_affected_rows() > 0){ // Erstellen des Clans geglueckt + $c_id = mysqli_fetch_assoc(db_query('Select * from clan where clanname = \''.$clan_name.'\'')); + db_query('UPDATE user SET clan='.$c_id['id'].', geld = geld - '.CLAN_CREATION_FEE.' WHERE id='.$user_ida['id']); displayErrorMessage(NULL, 'Clan erfolgreich Erstellt.', 'weiter...'); } else{ $sql = 'Select * from clan where clanname = \''.$clan_name.'\''; - $c_id = mysql_fetch_assoc(mysql_query($sql)); + $c_id = mysqli_fetch_assoc(db_query($sql)); if($c_id){ $error = 'Clanname besteht schon!'; } else{ diff --git a/ag/clan/post.php b/ag/clan/post.php index 8cd4325..d2eda91 100644 --- a/ag/clan/post.php +++ b/ag/clan/post.php @@ -29,7 +29,7 @@ function handleInvitation($user, $username, $clan){ displayErrorMessage(NULL, 'Fehler! Nutzer existiert nicht!'); return false; } - $row = mysql_fetch_assoc(mysql_query('SELECT * FROM user where nickname = \''. $username.'\'')); + $row = mysqli_fetch_assoc(db_query('SELECT * FROM user where nickname = \''. $username.'\'')); $userid = $row['id']; if($row['clan'] == $user['clan']){ displayErrorMessage(NULL, 'Fehler! Nutzer ist schon in deinem Clan!', displayHistoryBackLink()); @@ -39,12 +39,12 @@ function handleInvitation($user, $username, $clan){ if($row){ $sql = 'INSERT INTO user_clan_invitations(userid, clanid, valid) values('.$userid.','.$user['clan'].',TIMESTAMPADD(DAY, 5, now()))'; // echo $sql.'
'; - mysql_query($sql); - if(mysql_affected_rows() <= 0){ // Fehler? + db_query($sql); + if(db_affected_rows() <= 0){ // Fehler? $sql = 'UPDATE user_clan_invitations SET valid = TIMESTAMPADD(DAY, 5, now()) where userid = '.$userid.' and clanid = '.$user['clan']; // echo $sql.'
'; - mysql_query($sql); - if(mysql_affected_rows() <= 0){ // Fehler? + db_query($sql); + if(db_affected_rows() <= 0){ // Fehler? displayErrorMessage(NULL, 'Fehler! Konnte Nutzer nicht einladen!', displayHistoryBackLink()); return false; } else{ @@ -64,8 +64,8 @@ function sendClanNewsletter($user, $clan, $text){ return; } $sql = 'SELECT id FROM user WHERE clan='.$clan['id']; - $clans = mysql_query($sql); - while($row = mysql_fetch_assoc($clans)) { + $clans = db_query($sql); + while($row = mysqli_fetch_assoc($clans)) { sendMessage($user['id'], $row['id'], $clan['clanname'].' Nachricht', $text); } displayErrorMessage(NULL,'Nachricht erfolgreich verschickt', 'weiter...'); @@ -76,8 +76,8 @@ function revertInvitation($user, $clan, $userid){ displayErrorMessage(NULL, 'Nur der Leader, bzw. der Co-Leader kann Einladungen zurückziehen!!', displayHistoryBackLink()); return false; } - mysql_query('DELETE FROM user_clan_invitations WHERE clan = '.$clan['id'].' AND userid = '.$userid); - if(mysql_affected_rows() > 0){ + db_query('DELETE FROM user_clan_invitations WHERE clan = '.$clan['id'].' AND userid = '.$userid); + if(db_affected_rows() > 0){ displayErrorMessage('Zurückgezogen','Du hast die Einladung erfolgreich zurückgezogen!','weiter'); } else{ displayErrorMessage(NULL,'Einladung konnte nicht zurückgezogen werden!',displayHistoryBackLink()); @@ -87,7 +87,7 @@ function revertInvitation($user, $clan, $userid){ } -$clan = mysql_fetch_assoc(mysql_query('SELECT * from clan where id = '.$user_ida['clan'])); +$clan = mysqli_fetch_assoc(db_query('SELECT * from clan where id = '.$user_ida['clan'])); if($action == 'newsletter') { sendClanNewsletter($user_ida, $clan, $text); @@ -126,8 +126,8 @@ if($action == 'newsletter') { now();'; - $qry = mysql_query($sql); - while($row = mysql_fetch_assoc($qry)){ + $qry = db_query($sql); + while($row = mysqli_fetch_assoc($qry)){ ?> diff --git a/ag/clan/spende.php b/ag/clan/spende.php index 6c472a6..884fff5 100644 --- a/ag/clan/spende.php +++ b/ag/clan/spende.php @@ -18,12 +18,12 @@ $charm=$_GET['charm']; $mindestchar = 12; -$clan = mysql_fetch_array(mysql_query("SELECT geld FROM clan WHERE id='$user_ida[clan]' LIMIT 1")); -$user = mysql_fetch_array(mysql_Query("SELECT nickname, geld FROM user WHERE id='$user_ida[id]' LIMIT 1")); +$clan = mysqli_fetch_array(db_query("SELECT geld FROM clan WHERE id='$user_ida[clan]' LIMIT 1")); +$user = mysqli_fetch_array(db_query("SELECT nickname, geld FROM user WHERE id='$user_ida[id]' LIMIT 1")); if ($charm == 1) { if($clan_geld <= 0) { - mysql_query("INSERT INTO cheater values('$user_ida[id]','Versuchte mehr weniger als 0 zu Spenden! (Eingabe:".$clan_geld.")',now())"); + db_query("INSERT INTO cheater values('$user_ida[id]','Versuchte mehr weniger als 0 zu Spenden! (Eingabe:".$clan_geld.")',now())"); displayErrorMessage(NULL,'Geld darf nicht unter 0 sein!', 'weiter...'); exit; } @@ -33,19 +33,19 @@ if ($charm == 1) { // Um Pufferueberlaeufe zu vermeiden, einfach die Laenge der Zeichenkette abfragen, ab der 8ten stelle also uerbe 99 Mio geht nicht aufeinmal! if(strlen($clan_geld)>8) { - mysql_query("INSERT INTO cheater values('$user_ida[id]','Versuchte mehr als 99.999.999 aufeinmal zu Spenden! (Eingabe:".$clan_geld.")',now())"); + db_query("INSERT INTO cheater values('$user_ida[id]','Versuchte mehr als 99.999.999 aufeinmal zu Spenden! (Eingabe:".$clan_geld.")',now())"); displayErrorMessage(NULL,'Es kann nicht mehr als 99.999.999 aufeinmal gespendet werden!', 'weiter...'); exit; } if($clan_geld <= 0) { - mysql_query("INSERT INTO cheater values('$user_ida[id]','Versuchte mehr weniger als 0 zu Spenden! (Eingabe:".$clan_geld.")',now())"); + db_query("INSERT INTO cheater values('$user_ida[id]','Versuchte mehr weniger als 0 zu Spenden! (Eingabe:".$clan_geld.")',now())"); displayErrorMessage(NULL,'Geld darf nicht unter 0 sein!', 'weiter...'); exit; } // Damit das minus nicht ausgenutzt wird!! -$auktionensumme = mysql_fetch_assoc(mysql_query('SELECT SUM(aktuellesgebot) as summe FROM auktion WHERE bieter = '.$user_ida['id'].' GROUP BY bieter')); +$auktionensumme = mysqli_fetch_assoc(db_query('SELECT SUM(aktuellesgebot) as summe FROM auktion WHERE bieter = '.$user_ida['id'].' GROUP BY bieter')); $auktionensumme = $auktionensumme['summe']; @@ -54,12 +54,12 @@ if($clan_geld+$auktionensumme>$user['geld']) { exit; } -mysql_query("UPDATE clan SET geld=geld+'$clan_geld' WHERE id='$user_ida[clan]'"); -mysql_query('Update user SET geld=geld-'.$clan_geld.' WHERE id='.$user_ida['id']); -mysql_query('UPDATE user_clan SET spende = spende + '.$clan_geld.' WHERE clanid = '.$user_ida['clan'].' and userid = '.$user_ida['id']); +db_query("UPDATE clan SET geld=geld+'$clan_geld' WHERE id='$user_ida[clan]'"); +db_query('Update user SET geld=geld-'.$clan_geld.' WHERE id='.$user_ida['id']); +db_query('UPDATE user_clan SET spende = spende + '.$clan_geld.' WHERE clanid = '.$user_ida['clan'].' and userid = '.$user_ida['id']); -if(mysql_affected_rows() == 0){ - mysql_query('INSERT INTO user_clan(spende,clanid,userid) values('.$clan_geld.','.$user_ida['clan'].','.$user_ida['id'].')'); +if(db_affected_rows() == 0){ + db_query('INSERT INTO user_clan(spende,clanid,userid) values('.$clan_geld.','.$user_ida['clan'].','.$user_ida['id'].')'); } displayErrorMessage(NULL,'An Clan Erfolgreich Gespendet', 'weiter...'); @@ -125,10 +125,10 @@ function stopp() //$sql = 'SELECT miete as mietkosten, item_id from clan_ware inner join clan_item on clan_item.id = clan_ware.item_id where clan = '.$user_ida['clan'].' group by clan'; $sql ='SELECT miete, item_id, name, clan_ware.id from clan_ware inner join clan_item on clan_item.id = clan_ware.item_id where clan = '.$user_ida['clan'].' order by item_id asc'; //echo $sql.'
'; -$qry = mysql_query($sql); +$qry = db_query($sql); $clanraum = array(); $clanraum_a = array(); -while($row = mysql_fetch_assoc($qry)){ +while($row = mysqli_fetch_assoc($qry)){ $clanraum[$row['id']] = $row; // print_r($row); $clanraum_a[] = $row; @@ -137,10 +137,10 @@ $raumanzahl = count($clanraum_a); //echo 'Raumanzahl = '.$raumanzahl.'
'; $sql = 'SELECT chars.clan_train, count(chars.id) as anzahl from chars inner join user on chars.besitzer = user.id where user.clan = '.$user_ida['clan'].' and chars.clan_train != 0 group by chars.clan_train'; //echo $sql.'
'; -$qry = mysql_query($sql); +$qry = db_query($sql); $clanrauminfo = array(); -while($row = mysql_fetch_assoc($qry)){ +while($row = mysqli_fetch_assoc($qry)){ $clanrauminfo[$row['clan_train']] = $row; } @@ -148,25 +148,25 @@ while($row = mysql_fetch_assoc($qry)){ $sql = 'select clan_ware.id as clan_warenid, user.id as userid, count(chars.id) as anzahl, clan.id as clanid from clan inner join clan_ware on clan.id = clan_ware.clan inner join clan_item on clan_item.id = clan_ware.item_id inner join user on clan.id = user.clan left join chars on user.id = chars.besitzer and clan_ware.id = chars.clan_train where clan.id = '.$user_ida['clan'].' group by userid, clan_warenid order by userid, clan_warenid'; //echo $sql.'
'; -$qry = mysql_query($sql); +$qry = db_query($sql); $user_raum = array(); // Anzahl der Chars pro Raum pro User -while($row = mysql_fetch_assoc($qry)){ +while($row = mysqli_fetch_assoc($qry)){ $user_raum[$row['userid']][$row['clan_warenid']] = $row; } //print_r($user_raum); -$clans_spend = mysql_query('SELECT spende, nickname, user.id as userid FROM user left join user_clan on user.id = user_clan.userid and user.clan = user_clan.clanid WHERE user.clan = '.$user_ida['clan'].' ORDER BY spende DESC'); -$member = mysql_num_rows($clans_spend); +$clans_spend = db_query('SELECT spende, nickname, user.id as userid FROM user left join user_clan on user.id = user_clan.userid and user.clan = user_clan.clanid WHERE user.clan = '.$user_ida['clan'].' ORDER BY spende DESC'); +$member = mysqli_stmt_num_rows($clans_spend); $sql = 'select besitzer, round(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 = '.$user_ida['clan'].' group by besitzer order by besitzer'; //echo $sql.'
'; -$qry = mysql_query($sql); +$qry = db_query($sql); $user_nutz = array(); -while($row = mysql_fetch_assoc($qry)){ +while($row = mysqli_fetch_assoc($qry)){ $user_nutz[$row['besitzer']] = $row; } @@ -208,7 +208,7 @@ $cols = 4; @@ -240,8 +240,8 @@ while($row = mysql_fetch_assoc($clans_spend)) { weiter'); } else{ - mysql_query('INSERT sp_ware SET item=11, user='.$user['id']); // 1 - mysql_query('INSERT sp_ware SET item=11, user='.$user['id']); // 2 - mysql_query('INSERT sp_ware SET item=11, user='.$user['id']); // 3 - mysql_query('INSERT sp_ware SET item=11, user='.$user['id']); // 4 - mysql_query('INSERT sp_ware SET item=11, user='.$user['id']); // 5 - mysql_query('INSERT sp_ware SET item=11, user='.$user['id']); // 6 - mysql_query('INSERT sp_ware SET item=11, user='.$user['id']); // 7 + db_query('INSERT sp_ware SET item=11, user='.$user['id']); // 1 + db_query('INSERT sp_ware SET item=11, user='.$user['id']); // 2 + db_query('INSERT sp_ware SET item=11, user='.$user['id']); // 3 + db_query('INSERT sp_ware SET item=11, user='.$user['id']); // 4 + db_query('INSERT sp_ware SET item=11, user='.$user['id']); // 5 + db_query('INSERT sp_ware SET item=11, user='.$user['id']); // 6 + db_query('INSERT sp_ware SET item=11, user='.$user['id']); // 7 } semaphoreDown($ressource); return; @@ -172,7 +172,7 @@ function worker($charm,$wunsch,$user,$newname){ function displayWuensche($user){ -$items = mysql_query('SELECT distinct(i1.id) FROM sp_ware i INNER JOIN sp_item i1 ON(i.item=i1.id) WHERE i.user='.$user['id']); +$items = db_query('SELECT distinct(i1.id) FROM sp_ware i INNER JOIN sp_item i1 ON(i.item=i1.id) WHERE i.user='.$user['id']); ?> @@ -192,7 +192,7 @@ $items = mysql_query('SELECT distinct(i1.id) FROM sp_ware i INNER JOIN sp_item i '; - mysql_query($sql); + db_query($sql); } function showActionLog(){ - $qry = mysql_query('Select g.time, u.nickname, g.ip, g.message from gm_actions as g inner join user as u on g.userid = u.id order by time desc LIMIT 100'); - while($row = mysql_fetch_assoc($qry)){ + $qry = db_query('Select g.time, u.nickname, g.ip, g.message from gm_actions as g inner join user as u on g.userid = u.id order by time desc LIMIT 100'); + while($row = mysqli_fetch_assoc($qry)){ echo $row['time'].' '.$row['nickname'].' ('.$row['ip'].'): '.$row['message'].'
'."\n"; } echo 'Zum Hauptmenu'; @@ -71,8 +71,8 @@ function checkLoginData($userid, $password){ function loginUser($user,$pass){ if(checkLoginPassword($user,$pass)){ $test = 'SELECT * from user where nickname = \''.$user.'\''; - $qry = mysql_query($test); - $result = mysql_fetch_assoc($qry); + $qry = db_query($test); + $result = mysqli_fetch_assoc($qry); $usergroups = getUserGroups($user); if(isUserInGroup($usergroups, ADMIN)) { diff --git a/ag/gm/include/attacken.inc.php b/ag/gm/include/attacken.inc.php index 4d48d60..2ff66b9 100644 --- a/ag/gm/include/attacken.inc.php +++ b/ag/gm/include/attacken.inc.php @@ -101,7 +101,7 @@ function searchfirstAttack($action) { } function searchsecondAttack($action, $attackname) { - $qry = mysql_query('Select name,id from attacken where name like \'%'.$attackname.'%\''); + $qry = db_query('Select name,id from attacken where name like \'%'.$attackname.'%\''); ?> '."\n"; - while($row = mysql_fetch_assoc($qry)){ + while($row = mysqli_fetch_assoc($qry)){ echo "\t".''."\n"; for($i=0;$i'.$row[$d_array[$i]].''."\n"; @@ -524,7 +524,7 @@ function displayAttackenTypenOverview($page) { echo "\t".''."\n"; } - $total = mysql_num_rows(db_query('SELECT '.join($d_array,',').' FROM attackentyp')); + $total = mysqli_stmt_num_rows(db_query('SELECT '.join($d_array,',').' FROM attackentyp')); $url = '###LABEL###'; echo "\t".''."\n"; echo "\t".''."\n"; @@ -544,7 +544,7 @@ function displayAttackenTypenInfo($action, $task, $attid) { if($task == TASK_EDIT) { $sql = 'SELECT * FROM attackentyp WHERE id = '.$attid.';'; $qry = db_query($sql); - $row = mysql_fetch_assoc($qry); + $row = mysqli_fetch_assoc($qry); } $colspan = 2; @@ -584,7 +584,7 @@ function editAttackentyp($attid, $data) { $u = db_query($sql); $log = 0; - if(mysql_affected_rows() == 0 || $u === FALSE) { + if(db_affected_rows() == 0 || $u === FALSE) { echo "\t\t\t".''; } else{ echo "\t\t\t".''; @@ -614,7 +614,7 @@ function createAttackentyp($data) { $sql .= '\''.$data['kategorie'].'\''; } $sql .= ');'; - $identifier = mysql_query($sql); + $identifier = db_query($sql); if($identifier == FALSE){ echo "\t".''."\n"; } else { @@ -628,7 +628,7 @@ function deleteAttackentyp($attid) { $colspan = 1; $sql = 'DELETE FROM attackentyp WHERE id = '.$attid.';'; $qry = db_query($sql); - if($qry === FALSE || mysql_affected_rows() <= 0){ + if($qry === FALSE || db_affected_rows() <= 0){ echo "\t".''."\n";; } else { echo "\t".''."\n";; @@ -641,7 +641,7 @@ function displayDeleteAttackentyp($attid) { $sql = 'SELECT * FROM attackentyp WHERE id = '.$attid; $qry = db_query($sql); - $row = mysql_fetch_assoc($qry); + $row = mysqli_fetch_assoc($qry); echo "\t".''."\n"; echo "\t".''."\n"; diff --git a/ag/gm/include/bilderschau.inc.php b/ag/gm/include/bilderschau.inc.php index 04e2e8a..79d9b5c 100644 --- a/ag/gm/include/bilderschau.inc.php +++ b/ag/gm/include/bilderschau.inc.php @@ -38,10 +38,10 @@ function zeigeBilder($begin, $bildurl, $sure, $view, $letter, $date_from, $date_ echo ''; $test = 'SELECT name, nickname, bild FROM chars inner join user on chars.besitzer = user.id where bild != \'design/bilder/avatare/noavart.gif\' and bild != \'\' and bild_edit is not null and bild_edit between '.$date_from.' and '.$date_until.' group by besitzer, bild order by nickname'; // echo $test.'
'; - $qry = mysql_query($test); + $qry = db_query($test); $actual = ''; $i = 0; - while($result = mysql_fetch_assoc($qry)){ + while($result = mysqli_fetch_assoc($qry)){ if($actual == '' || $result['nickname'] != $actual){ // Fuelle die Leeren Felder aus for(;$i<8;$i++){ @@ -59,12 +59,12 @@ function zeigeBilder($begin, $bildurl, $sure, $view, $letter, $date_from, $date_ } else if($view == 'Random'){ $colspan = ' colspan=5'; $sql = 'SELECT name, nickname, bild FROM chars inner join user on chars.besitzer = user.id where besitzer > 2 and bild != \'design/bilder/avatare/noavart.gif\' and bild != \'\' group by bild order by rand() limit 20'; - $qry = mysql_query($sql); + $qry = db_query($sql); echo 'Avatar Zufall'; for($i=0;$i<4;$i++){ echo ''; for($t=0;$t<5;$t++){ - $tmp = mysql_fetch_assoc($qry); + $tmp = mysqli_fetch_assoc($qry); if($tmp){ echo ''; } else { @@ -94,28 +94,28 @@ function zeigeBilder($begin, $bildurl, $sure, $view, $letter, $date_from, $date_ echo '
MemberKickCF Rechte

Aktion
Member
Type:


'.displayPagelinksNew(20, $total, $page, $url).'
Fehler aufgetreten!
Änderungen wurden übernommen!
Es gab Probleme beim erstellen des Attacktyps!
Der Attackentyp '.$row['name'].' konnte nicht gelöscht werden!
Der Attackentyp '.$row['name'].' wurde gelöscht!

Attackentyp löschen

Soll der Attackentyp '.$row['name'].' wirklich gelöscht werden?
Von:Bis:
'.$tmp['name'].'
'; if($letter == 'Numeric'){ - $auser = mysql_query('SELECT distinct(user.nickname) FROM chars inner join user on chars.besitzer = user.id where SUBSTRING(nickname,1,1) < \'a\' and bild != \'design/bilder/avatare/noavart.gif\' and bild != \'\' group by user.id order by nickname ASC LIMIT '.($begin*10).', 10'); - $total = mysql_fetch_assoc(mysql_query('SELECT count(distinct(user.id)) as anzahl FROM chars inner join user on chars.besitzer = user.id where SUBSTRING(nickname,1,1) < \'a\' and bild != \'design/bilder/avatare/noavart.gif\' and bild != \'\'')); + $auser = db_query('SELECT distinct(user.nickname) FROM chars inner join user on chars.besitzer = user.id where SUBSTRING(nickname,1,1) < \'a\' and bild != \'design/bilder/avatare/noavart.gif\' and bild != \'\' group by user.id order by nickname ASC LIMIT '.($begin*10).', 10'); + $total = mysqli_fetch_assoc(db_query('SELECT count(distinct(user.id)) as anzahl FROM chars inner join user on chars.besitzer = user.id where SUBSTRING(nickname,1,1) < \'a\' and bild != \'design/bilder/avatare/noavart.gif\' and bild != \'\'')); } else if($letter == null){ - $auser = mysql_query('SELECT * FROM chars inner join user on chars.besitzer = user.id where bild != \'design/bilder/avatare/noavart.gif\' and bild != \'\' group by user.id order by nickname ASC LIMIT '.($begin*10).', 10'); - $total = mysql_fetch_assoc(mysql_query('SELECT count(distinct(user.id)) as anzahl FROM chars inner join user on chars.besitzer = user.id where bild != \'design/bilder/avatare/noavart.gif\' and bild != \'\'')); + $auser = db_query('SELECT * FROM chars inner join user on chars.besitzer = user.id where bild != \'design/bilder/avatare/noavart.gif\' and bild != \'\' group by user.id order by nickname ASC LIMIT '.($begin*10).', 10'); + $total = mysqli_fetch_assoc(db_query('SELECT count(distinct(user.id)) as anzahl FROM chars inner join user on chars.besitzer = user.id where bild != \'design/bilder/avatare/noavart.gif\' and bild != \'\'')); } else{ - $auser = mysql_query('SELECT * FROM chars inner join user on chars.besitzer = user.id where nickname like \''.$letter.'%\' and bild != \'design/bilder/avatare/noavart.gif\' and bild != \'\' group by user.id order by nickname ASC LIMIT '.($begin*10).', 10'); - $total = mysql_fetch_assoc(mysql_query('SELECT count(distinct(user.id)) as anzahl FROM chars inner join user on chars.besitzer = user.id where nickname like \''.$letter.'%\' and bild != \'design/bilder/avatare/noavart.gif\' and bild != \'\'')); + $auser = db_query('SELECT * FROM chars inner join user on chars.besitzer = user.id where nickname like \''.$letter.'%\' and bild != \'design/bilder/avatare/noavart.gif\' and bild != \'\' group by user.id order by nickname ASC LIMIT '.($begin*10).', 10'); + $total = mysqli_fetch_assoc(db_query('SELECT count(distinct(user.id)) as anzahl FROM chars inner join user on chars.besitzer = user.id where nickname like \''.$letter.'%\' and bild != \'design/bilder/avatare/noavart.gif\' and bild != \'\'')); } $total = $total['anzahl']; $users = array(); - while($row = mysql_fetch_assoc($auser)){ + while($row = mysqli_fetch_assoc($auser)){ // echo 'User: '.$row['id'].'
'; $users[] = $row['id']; } echo ''.displayPagelinksNew(10, $total, $begin, '###LABEL###').''; $test = 'SELECT name, nickname, bild FROM chars inner join user on chars.besitzer = user.id where besitzer IN ('.join(',', $users).') and bild != \'design/bilder/avatare/noavart.gif\' and bild != \'\' group by besitzer, bild order by nickname'; - $qry = mysql_query($test); + $qry = db_query($test); $actual = ''; $i = 0; - while($result = mysql_fetch_assoc($qry)){ + while($result = mysqli_fetch_assoc($qry)){ if($actual == '' || $result['nickname'] != $actual){ // Fuelle die Leeren Felder aus for(;$i<8;$i++){ @@ -134,14 +134,14 @@ function zeigeBilder($begin, $bildurl, $sure, $view, $letter, $date_from, $date_ if($bildurl !== NULL && $sure == 'yes'){ echo ''; echo ''; - mysql_query('Update chars SET bild=\'\' where bild = \''.urldecode($bildurl).'\' '); + db_query('Update chars SET bild=\'\' where bild = \''.urldecode($bildurl).'\' '); } else if($bildurl !== NULL){ $colspan = ' colspan=2'; - $qry = mysql_query('SELECT name, nickname, bild FROM chars inner join user on chars.besitzer = user.id where bild=\''.urldecode($bildurl).'\''); + $qry = db_query('SELECT name, nickname, bild FROM chars inner join user on chars.besitzer = user.id where bild=\''.urldecode($bildurl).'\''); echo 'Wollen sie dieses Bild wirklich löschen?'; echo ''; echo ''; - while($row = mysql_fetch_assoc($qry)) { + while($row = mysqli_fetch_assoc($qry)) { echo ''; } echo ''; diff --git a/ag/gm/include/clan.inc.php b/ag/gm/include/clan.inc.php index 3bac025..526a86d 100644 --- a/ag/gm/include/clan.inc.php +++ b/ag/gm/include/clan.inc.php @@ -12,7 +12,7 @@ defineIfNotDefined("CLAN_CREATION_FEE", 20000); function displayClanItems() { - $raume_qry = mysql_query('SELECT * FROM clan_item order by tp'); + $raume_qry = db_query('SELECT * FROM clan_item order by tp'); ?>
Bild wurde zurückgesetztZurück
Betroffener UserBetroffener Char
'.$row['nickname'].''.$row['name'].'
janein
@@ -36,7 +36,7 @@ function displayClanItems() { '; } ?> @@ -91,19 +91,19 @@ function displayEditOrCreateClanRoom($action, $raumid, $raumname, $staerke, $ver if($action == 'editrooms'){ logaction('Der Raum '.$raumname.' wurde editiert!'); $sql ='Update clan_item set name = \''.$raumname.'\', staerke = '.$staerke.', verteidigung = '.$verteidigung.', ausdauer = '.$ausdauer.', geschwindigkeit = '.$geschwindigkeit.', glueck = '.$glueck.', preis = '.$kaufpreis.', miete = '.$miete.', nutzung = '.$nutz.', tp = '.$tp.', info = \''.$info.'\', req_level = '.$level.' where id = '.$raumid.''; - $res = mysql_query($sql); + $res = db_query($sql); if(!$res) echo $sql . '
'; } else if($action == 'createrooms'){ logaction('Der Raum '.$raumname.' wurde erstellt!'); $sql = 'INSERT INTO clan_item(name, staerke, verteidigung, ausdauer, geschwindigkeit, glueck, preis, miete, nutzung, tp, info, req_level) values(\''.$raumname.'\', '.$staerke.', '.$verteidigung.', '.$ausdauer.', '.$geschwindigkeit.', '.$glueck.', '.$kaufpreis.', '.$miete.', '.$nutz.', '.$tp.', \''.$info.'\', '.$level.')'; - $res = mysql_query($sql); + $res = db_query($sql); if(!$res) echo $sql . '
'; } } if($action == 'editrooms'){ - $raum = mysql_fetch_assoc(mysql_query('SELECT * FROM clan_item WHERE id = '.$raumid)); + $raum = mysqli_fetch_assoc(db_query('SELECT * FROM clan_item WHERE id = '.$raumid)); $aLabel = 'editieren'; } else{ $aLabel = 'erstellen'; @@ -200,8 +200,8 @@ function displayDeleteClanRoom($raumname, $raumid) {

'.$res['name'].''.$res['staerke'].''.$res['verteidigung'].''.$res['glueck'].''.$res['ausdauer'].''.$res['geschwindigkeit'].''.$res['preis'].''.$res['miete'].''.$res['nutzung'].''.$res['tp'].''.$res['req_level'].'edit | delete
Der Raum "" @@ -209,7 +209,7 @@ if($raumname !== NULL){
Den Raum "" diff --git a/ag/gm/include/info.inc.php b/ag/gm/include/info.inc.php index 763540d..0028e49 100644 --- a/ag/gm/include/info.inc.php +++ b/ag/gm/include/info.inc.php @@ -188,9 +188,9 @@ function displayNews($action, $username, $newsid, $header, $value){ $header = addslashes($header); $value = urldecode($value); $value = encodeNoHTMLWithBB($value); - mysql_query('INSERT INTO ff11_news(name, betreff, text, zeit, datum)' . + db_query('INSERT INTO ff11_news(name, betreff, text, zeit, datum)' . ' values(\''.$username.'\',\''.$header.'\',\''.$value.'\',CURRENT_TIME, CURRENT_DATE)'); - if(mysql_affected_rows() > 0){ + if(db_affected_rows() > 0){ logaction('News '.$header.' wurde erstellt!'); echo 'news erfolgreich erstellt!
'; } else { @@ -203,8 +203,8 @@ function displayNews($action, $username, $newsid, $header, $value){ $value = encodeNoHTMLWithBB($value); $sql = 'UPDATE ff11_news set betreff = \''.$header.'\', text = \''.$value.'\' where id ='.$newsid; echo $sql.'
'; - mysql_query($sql); - if(mysql_affected_rows() > 0){ + db_query($sql); + if(db_affected_rows() > 0){ logaction('News '.$header.' wurde editiert!'); echo 'news erfolgreich editiert!
'; } else { @@ -217,7 +217,7 @@ function displayNews($action, $username, $newsid, $header, $value){ $buttonval = 'erstellen'; } else{ $topic = 'Newseintrag editieren'; - $row = mysql_fetch_assoc(mysql_query('Select * from ff11_news where id = '.$newsid)); + $row = mysqli_fetch_assoc(db_query('Select * from ff11_news where id = '.$newsid)); $header = debbcode($row['betreff']); $value = debbcode($row['text']); $buttonval = 'editieren'; @@ -265,14 +265,14 @@ function displayNews($action, $username, $newsid, $header, $value){ '."\n";; $o_array = array('-Alle-', 'Markt Items', 'Schatzsuche Items', 'Auktionsitems'); @@ -57,7 +57,7 @@ function displayItems($action, $task, $itemid, $itemtable, $searchstring, $s_ite echo "\t\t\t".''."\n"; - while($row = mysql_fetch_assoc($qry)){ + while($row = mysqli_fetch_assoc($qry)){ echo "\t\t\t".''; echo ''."\n"; } @@ -87,8 +87,8 @@ function displayItems($action, $task, $itemid, $itemtable, $searchstring, $s_ite } if(!$error){ $sql = 'SELECT '.join(',', $d_array).' FROM '.$itemtable.' where id = '.$itemid; - $qry = mysql_query($sql); - $row = mysql_fetch_assoc($qry); + $qry = db_query($sql); + $row = mysqli_fetch_assoc($qry); echo "\t\t".''."\n"; for($i = 1;$i'."\n"; @@ -120,7 +120,7 @@ function displayItems($action, $task, $itemid, $itemtable, $searchstring, $s_ite if(!$error){ - $row = mysql_fetch_assoc(mysql_query($sql)); + $row = mysqli_fetch_assoc(db_query($sql)); echo "\t\t\t".''."\n"; echo "\t\t\t".''."\n"; } @@ -139,7 +139,7 @@ function displayItems($action, $task, $itemid, $itemtable, $searchstring, $s_ite if(!$error){ $sql = 'UPDATE '.$itemtable.' SET '; - $row = mysql_fetch_assoc(mysql_query('Select '.$d_array[0].' from '.$itemtable.' WHERE id = '.$itemid)); + $row = mysqli_fetch_assoc(db_query('Select '.$d_array[0].' from '.$itemtable.' WHERE id = '.$itemid)); $sql .= $d_array[0].' = \''.encodeNoHTMLWithBB($data[$d_array[0]]).'\''; @@ -149,21 +149,21 @@ function displayItems($action, $task, $itemid, $itemtable, $searchstring, $s_ite $sql .= ' WHERE id=\''.$itemid.'\''; // echo $sql.'
'; - $u = mysql_query($sql); - if(mysql_affected_rows() == 0 || $u === FALSE){ + $u = db_query($sql); + if(db_affected_rows() == 0 || $u === FALSE){ echo "\t\t\t".''; } else{ logaction('Ein Item wurde geändert (@'.$itemtable.', id = '.$itemid.','.encodeNoHTMLWithBB(join($data,',')).')'); echo "\t\t\t".''; - mysql_query('UPDATE chars set frucht = \''.encodeNoHTMLWithBB($data[$d_array[0]]).'\' where frucht = \''.$row[$d_array[0]].'\''); + db_query('UPDATE chars set frucht = \''.encodeNoHTMLWithBB($data[$d_array[0]]).'\' where frucht = \''.$row[$d_array[0]].'\''); if($itemtable == 'wochen_markt'){ $sql = 'Update sp_item set name = \''.encodeNoHTMLWithBB($data[$d_array[0]]).'\' where name = \''.$row[$d_array[0]].'\''; echo $sql.'
'; - mysql_query($sql); + db_query($sql); } else if($itemtable == 'sp_item'){ $sql = 'Update wochen_markt set item = \''.encodeNoHTMLWithBB($data[$d_array[0]]).'\' where item = \''.$row[$d_array[0]].'\''; echo $sql.'
'; - mysql_query($sql); + db_query($sql); } } } @@ -188,11 +188,11 @@ function displayItems($action, $task, $itemid, $itemtable, $searchstring, $s_ite $error = true; } if(!$error){ - $row = mysql_fetch_assoc(mysql_query($sql)); + $row = mysqli_fetch_assoc(db_query($sql)); - if(mysql_query($d_sql) === FALSE || mysql_affected_rows() == 0){ + if(db_query($d_sql) === FALSE || db_affected_rows() == 0){ echo "\t\t\t".''; - } else if(mysql_query($d_sql_2) === FALSE){ + } else if(db_query($d_sql_2) === FALSE){ logaction('Ein Item wurde gelöscht (@'.$itemtable.', id = '.$itemid.','.$row['name'].')'); echo "\t\t\t".''; } else{ @@ -225,8 +225,8 @@ function displayItems($action, $task, $itemid, $itemtable, $searchstring, $s_ite if(!$error){ // We create an itemtable-wide unique id!! - $row = mysql_fetch_assoc(mysql_query('select max(max_id) + 1 as id from (select max(s.id) as max_id from sp_item s union select max(i.id) as max_id from item i union select max(w.id) as max_id from wochen_markt w) gno')); -// $row = mysql_fetch_assoc(mysql_query('SELECT max(id) +1 as id FROM '.$itemtable)); + $row = mysqli_fetch_assoc(db_query('select max(max_id) + 1 as id from (select max(s.id) as max_id from sp_item s union select max(i.id) as max_id from item i union select max(w.id) as max_id from wochen_markt w) gno')); +// $row = mysqli_fetch_assoc(db_query('SELECT max(id) +1 as id FROM '.$itemtable)); $itemid = $row['id']; $sql = 'INSERT INTO '.$itemtable.' (id, '.join($d_array,', ').') values('.$itemid; @@ -238,8 +238,8 @@ function displayItems($action, $task, $itemid, $itemtable, $searchstring, $s_ite $sql .= ')'; // echo $sql.'
'; - $u = mysql_query($sql); - if(mysql_affected_rows() == 0 || $u === FALSE){ + $u = db_query($sql); + if(db_affected_rows() == 0 || $u === FALSE){ echo "\t\t\t".''; displayItems($action, null, null, $itemtable, $searchstring, $s_itemtable,$page, $data); } else{ @@ -335,8 +335,8 @@ function displayItems($action, $task, $itemid, $itemtable, $searchstring, $s_ite $sql = 'SELECT '.join($d_array,',').' FROM '.$itemtable; - $qry = mysql_query($sql); - while($row = mysql_fetch_assoc($qry)){ + $qry = db_query($sql); + while($row = mysqli_fetch_assoc($qry)){ echo "\t\t\t".''; for($i=1;$i'.$row[$d_array[$i]].''; diff --git a/ag/gm/include/monster.inc.php b/ag/gm/include/monster.inc.php index a8c5b0b..9ee99bb 100644 --- a/ag/gm/include/monster.inc.php +++ b/ag/gm/include/monster.inc.php @@ -12,7 +12,7 @@ function displayQuestNPC($action, $name, $starke, $speed, $verteidigung, $ausdauer, $hp, $mp, $level, $orte,$id, $anzahl, $confirm, $glueck){ if($action != 'delete' && $action != 'change' && $action != 'create'){ $sql = 'SELECT id , name FROM `quest_monster` order by name asc'; - $result = mysql_query($sql); + $result = db_query($sql); ?>
News bearbeiten (Auswahl)
@@ -335,8 +335,8 @@ function displayPolls($action,$openumfrage,$closeumfrage,$thema,$optionen,$text, 0'); - while($result = mysql_fetch_assoc($qry)){ + $qry = db_query('SELECT * from poll WHERE TIMESTAMPDIFF(Minute, close, now()) > 0'); + while($result = mysqli_fetch_assoc($qry)){ echo ''; } ?> @@ -385,9 +385,9 @@ function displayPolls($action,$openumfrage,$closeumfrage,$thema,$optionen,$text, $pollid = $closeumfrage; } if(is_numeric($pollid) && $pollid >= 0){ - $result = mysql_fetch_assoc(mysql_query('SELECT * FROM poll WHERE pollid='.$pollid)); - $qry = mysql_query('SELECT * FROM poll_options WHERE pollid='.$pollid); - while($opts = mysql_fetch_assoc($qry)){ + $result = mysqli_fetch_assoc(db_query('SELECT * FROM poll WHERE pollid='.$pollid)); + $qry = db_query('SELECT * FROM poll_options WHERE pollid='.$pollid); + while($opts = mysqli_fetch_assoc($qry)){ $options[$opts['polloptionid']] = $opts['text']; } ?> @@ -470,20 +470,20 @@ function displayPolls($action,$openumfrage,$closeumfrage,$thema,$optionen,$text, '; } } diff --git a/ag/gm/include/item.inc.php b/ag/gm/include/item.inc.php index 7e4f8bd..5b0c766 100644 --- a/ag/gm/include/item.inc.php +++ b/ag/gm/include/item.inc.php @@ -37,9 +37,9 @@ function displayItems($action, $task, $itemid, $itemtable, $searchstring, $s_ite . ' union' . ' SELECT i.id, i.item AS name, \'wochen_markt\' as tablename FROM wochen_markt i'; } - $qry = mysql_query($sql.' LIMIT '.($page*20).', 20'); + $qry = db_query($sql.' LIMIT '.($page*20).', 20'); // echo $sql.' LIMIT '.($page*30).', 30'; - $anzahlSeiten = ceil(mysql_num_rows(mysql_query($sql))/20); + $anzahlSeiten = ceil(mysqli_stmt_num_rows(db_query($sql))/20); $colspan = 3; echo "\t\t\t".'

Bearbeiten


'.$row['name'].'EditDelete
'.$desc_array[0].''.$row[$d_array[0]].'
'.$desc_array[$i].'
Soll Item "'.$row['name'].'" wirklich gelöscht werden?
ja, nein, vielleicht
Fehler! Änderungen konnten nicht übernommen werden!
Änderungen wurden übernommen!
Item "'.$row['name'].'" konnte nicht gelöscht werden!
Item "'.$row['name'].'" wurde zwar gelöscht, bei der Warentabelle ist jedoch ein Fehler aufgetreten!
Fehler! Konnte Item nicht erstellen!
@@ -25,7 +25,7 @@ function displayQuestNPC($action, $name, $starke, $speed, $verteidigung, $ausdau @@ -48,7 +48,7 @@ function displayQuestNPC($action, $name, $starke, $speed, $verteidigung, $ausdau echo 'Löschen!!
'; } else{ $sql = 'DELETE FROM `quest_monster` where id = '.$id; - $result = mysql_query($sql); + $result = db_query($sql); logaction('Das Monster mit der ID '.$id.' wurde geloescht!!'); echo 'Das Monster mit der ID '.$id.' wurde gelöscht
'; } @@ -61,32 +61,32 @@ function displayQuestNPC($action, $name, $starke, $speed, $verteidigung, $ausdau if($name != null){ $sql = 'Update `quest_monster` set name = \''.$name.'\', starke = '.$starke.', speed = '.$speed.', verteidigung = '.$verteidigung.', ausdauer = '.$ausdauer.', hp = '.$hp.', mp = '.$mp.', anzahl = \''.$anzahl.'\', `level` = '.$level.', glueck = '.$glueck.' where id = '.$id; - mysql_query('Delete from quest_monster_orte where monsterid = '.$id); + db_query('Delete from quest_monster_orte where monsterid = '.$id); for($i=0;$i
@@ -173,11 +173,11 @@ function displayQuestNPC($action, $name, $starke, $speed, $verteidigung, $ausdau } else if($action == 'create'){ if($name != null){ $sql = 'Insert into `quest_monster`(name, starke, speed, verteidigung, ausdauer, hp, mp, anzahl, `level`) values(\''.$name.'\', '.$starke.', '.$speed.', '.$verteidigung.', '.$ausdauer.', '.$hp.', '.$mp.', \''.$anzahl.'\', '.$level.')'; - $query = mysql_query($sql); - $id = mysql_fetch_assoc(mysql_query('Select id from quest_monster where name = \''.$name.'\'')); + $query = db_query($sql); + $id = mysqli_fetch_assoc(db_query('Select id from quest_monster where name = \''.$name.'\'')); $monsterid = $id['id']; for($i=0;$i"; @@ -189,8 +189,8 @@ function displayQuestNPC($action, $name, $starke, $speed, $verteidigung, $ausdau } // Jetzt die Orte auslesen die zu Bereisen sind $sql = 'Select * from quest_ort order by stadt'; - $qry = mysql_query($sql); - while($row = mysql_fetch_assoc($qry)){ + $qry = db_query($sql); + while($row = mysqli_fetch_assoc($qry)){ $orte_array[] = $row; } diff --git a/ag/gm/include/npc.inc.php b/ag/gm/include/npc.inc.php index fc03076..4a7061f 100644 --- a/ag/gm/include/npc.inc.php +++ b/ag/gm/include/npc.inc.php @@ -34,7 +34,7 @@ function getDropItemsAsOptions(){ $qry = db_query($query); // Damit waeren alle noetigen Datenbankaufrufe erledigt! - while($row = mysql_fetch_assoc($qry)){ + while($row = mysqli_fetch_assoc($qry)){ $result[$index++] = ''; } @@ -59,14 +59,14 @@ function istrinstr($source, $insert, $search) { function getNPCUser() { $qry = db_query('SELECT * FROM user WHERE nickname = "'.NPC_USER_NAME.'";'); - return mysql_fetch_assoc($qry); + return mysqli_fetch_assoc($qry); } function getNPCAttacks() { $qry = db_query('SELECT name,id FROM attacken a WHERE info like "%NPC%";'); $set = array(); - while ($result = mysql_fetch_assoc($qry)) { + while ($result = mysqli_fetch_assoc($qry)) { $set[$result['id']] = $result['name']; } @@ -79,7 +79,7 @@ function learnNewAttacks($charid, $att_ids) { $qry = db_query($sql); $learned_atts = array(); - while($result = mysql_fetch_assoc($qry)) { + while($result = mysqli_fetch_assoc($qry)) { $learned_atts[$result['at_id']] = $result['id']; } @@ -88,7 +88,7 @@ function learnNewAttacks($charid, $att_ids) { $qry = db_query($sql); $att_names = array(); - while($result = mysql_fetch_assoc($qry)) { + while($result = mysqli_fetch_assoc($qry)) { $att_names[$result['id']] = $result['name']; } @@ -110,7 +110,7 @@ function getNPCAttackSet($charid, $att_ids) { $qry = db_query($sql); $learned_atts = array(); - while($result = mysql_fetch_assoc($qry)) { + while($result = mysqli_fetch_assoc($qry)) { $learned_atts[$result['at_id']] = $result['id']; } @@ -166,7 +166,7 @@ function displayNPCInfo($action, $task, $charid) { //$sql = 'SELECT * FROM chars c inner join kampf_list kl on c.id = kl.charakter WHERE c.id ='.$charid; //echo $sql."
"; $qry = db_query($sql); - $row = mysql_fetch_assoc($qry); + $row = mysqli_fetch_assoc($qry); // Fetch the char array by getChar method (for backwards compat) with no caching enabled! $char_data = getChar($charid, false); foreach( $char_data as $key => $value ) { @@ -276,7 +276,7 @@ function editNPC($charid, $data, $att_ids) { $u = db_query($sql); $log = 0; - if(mysql_affected_rows() == 0 || $u === FALSE) { + if(db_affected_rows() == 0 || $u === FALSE) { echo "\t\t\t".'
'; } else{ echo "\t\t\t".''; @@ -316,7 +316,7 @@ function createNPC($data, $att_ids) { if($success) { //Char ID holen $qry = db_query('SELECT id FROM chars c WHERE name = "'.$data['name'].'";'); - $result = mysql_fetch_assoc($qry); + $result = mysqli_fetch_assoc($qry); $char_id = $result['id']; //zur Kampfliste hinzufügen :) @@ -370,7 +370,7 @@ function deleteNPC($charid) { $colspan = 1; $sql = 'DELETE FROM chars WHERE id = '.$charid.';'; $qry = db_query($sql); - if($qry === FALSE || mysql_affected_rows() <= 0){ + if($qry === FALSE || db_affected_rows() <= 0){ echo "\t".''."\n";; } else { echo "\t".''."\n";; @@ -401,7 +401,7 @@ function displayNPCOverview($page) { echo "\t".''."\n"; - while($row = mysql_fetch_assoc($qry)){ + while($row = mysqli_fetch_assoc($qry)){ echo "\t".''."\n"; for($i=1;$i'.$row[$d_array[$i]].''."\n"; @@ -417,7 +417,7 @@ function displayNPCOverview($page) { echo "\t".''."\n"; } - $total = mysql_num_rows(db_query('SELECT '.join($d_array,',').' from chars where rasse IN ('.implode(',', $include_race_ids).')')); + $total = mysqli_stmt_num_rows(db_query('SELECT '.join($d_array,',').' from chars where rasse IN ('.implode(',', $include_race_ids).')')); $url = '###LABEL###'; echo "\t".''."\n"; echo "\t".''."\n"; diff --git a/ag/gm/include/rassen.inc.php b/ag/gm/include/rassen.inc.php index a6cf0cb..0db474d 100644 --- a/ag/gm/include/rassen.inc.php +++ b/ag/gm/include/rassen.inc.php @@ -240,7 +240,7 @@ function displayRassen($request) { '; } else { diff --git a/ag/gm/include/rezept.inc.php b/ag/gm/include/rezept.inc.php index eb7ba1a..2e98fc1 100644 --- a/ag/gm/include/rezept.inc.php +++ b/ag/gm/include/rezept.inc.php @@ -10,19 +10,19 @@ function getItemsMap() { $items_map = array(); $qry = db_query('SELECT * from sp_item WHERE type != \'Teufels Frucht\''); - while( $row = mysql_fetch_assoc($qry) ) { + while( $row = mysqli_fetch_assoc($qry) ) { $row['table_name'] = 'sp_item'; $items_map['sp_item'][$row['id']] = $row; } $qry = db_query('SELECT * from item'); - while( $row = mysql_fetch_assoc($qry)) { + while( $row = mysqli_fetch_assoc($qry)) { $row['table_name'] = 'item'; $items_map['item'][$row['id']] = $row; } $qry = db_query('SELECT * from wochen_markt'); - while( $row = mysql_fetch_assoc($qry) ) { + while( $row = mysqli_fetch_assoc($qry) ) { $row['name'] = $row['item']; $row['table_name'] = 'wochen_markt'; $items_map['wochen_markt'][$row['id']] = $row; @@ -43,12 +43,12 @@ function get_set_definitions() { $qry = db_query('SELECT * from sp_sets'); $sets = array(); - while( $row = mysql_fetch_assoc($qry) ) { + while( $row = mysqli_fetch_assoc($qry) ) { $set = array(); $set['item'] = $items_map[$row['table_name']][$row['item_id']]; $dep_items = array(); $qry2 = db_query('SELECT * from sp_set_ingredient WHERE set_id = '.$row['set_id']); - while( $row2 = mysql_fetch_assoc($qry2) ) { + while( $row2 = mysqli_fetch_assoc($qry2) ) { $dep_items[] = $items_map[$row2['table_name']][$row2['item_id']]; } $set['deps'] = $dep_items; @@ -141,11 +141,11 @@ function itemEquals($lhs, $rhs) { function createRezeptEntry($set) { $qry = db_query('Select max(set_id) FROM sp_sets'); - $new_id = mysql_fetch_row($qry)[0]; + $new_id = mysqli_fetch_row($qry)[0]; do { $new_id++; db_query('INSERT sp_sets(set_id, table_name, item_id) values('.$new_id.',\''.$set['item']['table_name'].'\','.$set['item']['id'].')'); - } while(mysql_affected_rows() == 0); + } while(db_affected_rows() == 0); return $new_id; } diff --git a/ag/gm/include/shop.inc.php b/ag/gm/include/shop.inc.php index c040deb..894301b 100644 --- a/ag/gm/include/shop.inc.php +++ b/ag/gm/include/shop.inc.php @@ -11,7 +11,7 @@
Aktion
Stats wurden nicht geändert oder es gab Fehler!
Änderungen wurden übernommen!
Der NPC '.$row['name'].' konnte nicht gelöscht werden!
Der NPC '.$row['name'].' wurde gelöscht!


'.displayPagelinksNew(20, $total, $page, $url).'
Aktion
setup rassen database
@@ -25,7 +25,7 @@ function displayShop($action, $s_id, $info, $s_name, $s2_name, $s3_name, $s_typ '; @@ -53,7 +53,7 @@ function displayShop($action, $s_id, $info, $s_name, $s2_name, $s3_name, $s_typ logaction('Das Angebot für '.$s3_name.' wurde editiert!'); } - mysql_query($sql); + db_query($sql); echo $sql; } else if($action == 'erstellen'){ @@ -67,12 +67,12 @@ function displayShop($action, $s_id, $info, $s_name, $s2_name, $s3_name, $s_typ $sql = 'INSERT INTO shop(item, datensatz, preis, preis_req, mal, com) values(\''.$s3_name.'\', \''.$s_typ.'\', '.$preis.', '.$frei.', '.$anzahl.', \''.$info.'\')'; } - mysql_query($sql); + db_query($sql); echo $sql; } } if($action == 'edit'){ - $angebot = mysql_fetch_assoc(mysql_query('SELECT * FROM shop WHERE id = '.$s_id)); + $angebot = mysqli_fetch_assoc(db_query('SELECT * FROM shop WHERE id = '.$s_id)); $aLabel = 'editieren'; } else{ $aLabel = 'erstellen'; @@ -106,12 +106,12 @@ function displayShop($action, $s_id, $info, $s_name, $s2_name, $s3_name, $s_typ @@ -195,7 +195,7 @@ function displayShop($action, $s_id, $info, $s_name, $s2_name, $s3_name, $s_typ
NameIDArt PreisFreischaltenAnzahlbearbeiten
'.$res['item'].''.$res['id'].''.$res['datensatz'].' '.$res['preis'].''.$res['preis_req'].''.$res['mal'].' edit|delete
Bei SS Items Bei Markt Items Teufelsfrüchte
diff --git a/ag/gm/include/test_cf.php b/ag/gm/include/test_cf.php index d43da51..22da4c2 100644 --- a/ag/gm/include/test_cf.php +++ b/ag/gm/include/test_cf.php @@ -12,44 +12,44 @@ include_once(ROOT_PATH.'/include/clan_fights.inc.php'); function doTheClanfightTest($acceptTestCase, $amount) { -mysql_query('UPDATE user SET clan = null'); // clean all clans +db_query('UPDATE user SET clan = null'); // clean all clans $ids = getClanFightCapableClanIds(); -$row = mysql_fetch_row(mysql_query('SELECT COUNT(*) FROM user WHERE 0 < (SELECT COUNT(*) FROM chars WHERE besitzer = user.id)')); +$row = mysqli_fetch_row(db_query('SELECT COUNT(*) FROM user WHERE 0 < (SELECT COUNT(*) FROM chars WHERE besitzer = user.id)')); if(count($ids) < $row[0] / MIN_MEMBERS) { //echo 'We may optimize the user('.$row[0].')/clan('.count($ids).') ratio
'; - mysql_query('UPDATE user SET clan = null'); // clean all clans - mysql_query('UPDATE clan SET leader = null, co_leader = null'); + db_query('UPDATE user SET clan = null'); // clean all clans + db_query('UPDATE clan SET leader = null, co_leader = null'); $sql = 'SELECT id FROM clan ORDER BY ID ASC'; - $qry = mysql_query($sql); - while( $row = mysql_fetch_assoc($qry)) { + $qry = db_query($sql); + while( $row = mysqli_fetch_assoc($qry)) { $sql = 'UPDATE user SET clan = ' .$row['id'] . ' WHERE clan is null AND 0 < (SELECT COUNT(*) FROM chars WHERE besitzer = user.id) LIMIT 5'; //echo $sql . '
'; - mysql_query($sql); + db_query($sql); - if(mysql_affected_rows() == 0) { + if(db_affected_rows() == 0) { break; } } - $qry = mysql_query('SELECT clan, min(id) as id FROM user WHERE clan is not null GROUP BY clan'); - while($row = mysql_fetch_assoc($qry)) { + $qry = db_query('SELECT clan, min(id) as id FROM user WHERE clan is not null GROUP BY clan'); + while($row = mysqli_fetch_assoc($qry)) { $sql = 'UPDATE clan SET leader = '.$row['id'].' WHERE id = '.$row['clan']; //echo $sql . '
'; - mysql_query($sql); + db_query($sql); } } -mysql_query('DELETE FROM clan_challenge_requests'); -mysql_query('DELETE FROM clan_challenges'); -mysql_query('DELETE FROM events'); -mysql_query('DELETE FROM clan_locked'); +db_query('DELETE FROM clan_challenge_requests'); +db_query('DELETE FROM clan_challenges'); +db_query('DELETE FROM events'); +db_query('DELETE FROM clan_locked'); diff --git a/ag/gm/include/user.inc.php b/ag/gm/include/user.inc.php index 3407fae..20f8da8 100644 --- a/ag/gm/include/user.inc.php +++ b/ag/gm/include/user.inc.php @@ -18,16 +18,16 @@ function getOtherUserGroups($user) { if(is_numeric($user)) { $test = 'SELECT gruppen_id, gruppen_name FROM user_gruppe WHERE gruppen_id not in (SELECT gruppen_id FROM user_gruppe_zuordnung WHERE user_id = \''.$user.'\')'; - $qry = mysql_query($test); + $qry = db_query($test); } else if (validateString($user) != null) { $test = 'SELECT gruppen_id, gruppen_name FROM user_gruppe WHERE gruppen_id not in (SELECT ugz.gruppen_id FROM user u INNER JOIN user_gruppe_zuordnung ugz ON u.id=ugz.user_id WHERE nickname = \''.$user.'\')'; - $qry = mysql_query($test); + $qry = db_query($test); } $i = 0; - while ($result = mysql_fetch_assoc($qry)) { + while ($result = mysqli_fetch_assoc($qry)) { $groups[$i] = array("gruppen_id" => $result['gruppen_id'], "gruppen_name" => $result['gruppen_name']); $i++; } @@ -115,7 +115,7 @@ function displayUserGroups($action, $name, $ugname, $delete, $add) { $sqlqry = 'SELECT u.nickname FROM user_gruppe_zuordnung ugz INNER JOIN user_gruppe ug ON ug.gruppen_id=ugz.gruppen_id INNER JOIN user u ON ugz.user_id=u.id WHERE ug.gruppen_name = \''.$ugname.'\' ORDER BY u.nickname;'; - $usergroups_qry = mysql_query($sqlqry); + $usergroups_qry = db_query($sqlqry); ?> @@ -127,7 +127,7 @@ function displayUserGroups($action, $name, $ugname, $delete, $add) { '; $x = 0; - while($row = mysql_fetch_assoc($usergroups_qry)){ + while($row = mysqli_fetch_assoc($usergroups_qry)){ echo ''; $x++; if($x % 4 == 0) { @@ -174,8 +174,8 @@ function displayUserGroups($action, $name, $ugname, $delete, $add) { '; @@ -225,7 +225,7 @@ function displayCheater($action, $from, $until, $user1, $user2, $tradeid, $verif @@ -254,8 +254,8 @@ function displayCheater($action, $from, $until, $user1, $user2, $tradeid, $verif = \''.$low.' 00:00:00\' and occured <= \''.$high.' 23:59:59\' group by u1i, u2i order by anzahl'); - while($row = mysql_fetch_assoc($cheater_qry)){ + $cheater_qry = db_query('Select u1.nickname as u1n, u1.id as u1i, u2.nickname u2n, u2.id u2i, count(occured) as anzahl from multiuser left join user as u1 on multiuser.user1 = u1.id left join user as u2 on multiuser.user2 = u2.id where occured >= \''.$low.' 00:00:00\' and occured <= \''.$high.' 23:59:59\' group by u1i, u2i order by anzahl'); + while($row = mysqli_fetch_assoc($cheater_qry)){ echo ''; } ?> @@ -281,7 +281,7 @@ function displayCheater($action, $from, $until, $user1, $user2, $tradeid, $verif } else if($action == 'trades'){ // Hier ist wichtig, zu hohe Trades und Trades in den Clans - $minmax = mysql_fetch_assoc(mysql_query('SELECT DATE(min(deadline)) as min, DATE(max(deadline)) as max FROM auktion_transaktionen')); + $minmax = mysqli_fetch_assoc(db_query('SELECT DATE(min(deadline)) as min, DATE(max(deadline)) as max FROM auktion_transaktionen')); $low = $from===null?$minmax['min']:$from; $high = $until===null?$minmax['max']:$until; ?> @@ -316,8 +316,8 @@ function displayCheater($action, $from, $until, $user1, $user2, $tradeid, $verif = \''.$low.' 00:00:00\' and deadline <= \''.$high.' 23:59:59\''; - $cheater_qry = mysql_query($sql); - while($row = mysql_fetch_assoc($cheater_qry)){ + $cheater_qry = db_query($sql); + while($row = mysqli_fetch_assoc($cheater_qry)){ $name = $row['i_name']!=null?$row['i_name']:($row['w_name']!=null?$row['w_name']:$row['s_name']); $cheatv = $row['cheatingverdacht']==0?'OK':'WARNUNG'; echo ''; @@ -344,7 +344,7 @@ function displayCheater($action, $from, $until, $user1, $user2, $tradeid, $verif Action= \''.$$low.' 0:00:00\' and occured <= \''.$high.' 23:59:59\' order by occured desc'; - $cheater_qry = mysql_query($sql); - while($row = mysql_fetch_assoc($cheater_qry)){ + $cheater_qry = db_query($sql); + while($row = mysqli_fetch_assoc($cheater_qry)){ echo ''; } ?> @@ -403,8 +403,8 @@ function displayCheater($action, $from, $until, $user1, $user2, $tradeid, $verif = \''.$low.' 00:00:00\' and deadline <= \''.$high.' 23:59:59\''; // echo $sql.'
'; - $cheater_qry = mysql_query($sql); - while($row = mysql_fetch_assoc($cheater_qry)){ + $cheater_qry = db_query($sql); + while($row = mysqli_fetch_assoc($cheater_qry)){ $name = $row['i_name']!=null?$row['i_name']:($row['w_name']!=null?$row['w_name']:$row['s_name']); $cheatv = $row['cheatingverdacht']==0?'OK':'WARNUNG'; echo ''; @@ -435,17 +435,17 @@ function displayCheater($action, $from, $until, $user1, $user2, $tradeid, $verif } else if($action == 'vwarn'){ // Spricht eine Verwarnung zwischen 2 Usern aus if($verify == 1){ - $qry = mysql_query('select id, nickname from user where id in ('.$user1.', '.$user2.')'); - while($row = mysql_fetch_assoc($qry)){ + $qry = db_query('select id, nickname from user where id in ('.$user1.', '.$user2.')'); + while($row = mysqli_fetch_assoc($qry)){ $users[] = $row['nickname']; } displayErrorMessage('Verwarnung ausgesprochen', 'Die User '.join(' und ',$users).' sind nun verwarnt!', 'weiter'); - mysql_query('INSERT INTO nachricht(betreff, von, datum, text, besitzer) values(\'Verwarnung\', \'AG-Team\', now(), \'Es kam zwischen den Accounts '.join(' und ',$users).' zu Überschneidungen, wir bitten euch dies zu unterlassen, da wir uns sonst gezwungen sehen diese Aktivitäten zu bestrafen!\', '.$user1.')'); - mysql_query('INSERT INTO nachricht(betreff, von, datum, text, besitzer) values(\'Verwarnung\', \'AG-Team\', now(), \'Es kam zwischen den Accounts '.join(' und ',$users).' zu Überschneidungen, wir bitten euch dies zu unterlassen, da wir uns sonst gezwungen sehen diese Aktivitäten zu bestrafen!\', '.$user2.')'); + db_query('INSERT INTO nachricht(betreff, von, datum, text, besitzer) values(\'Verwarnung\', \'AG-Team\', now(), \'Es kam zwischen den Accounts '.join(' und ',$users).' zu Überschneidungen, wir bitten euch dies zu unterlassen, da wir uns sonst gezwungen sehen diese Aktivitäten zu bestrafen!\', '.$user1.')'); + db_query('INSERT INTO nachricht(betreff, von, datum, text, besitzer) values(\'Verwarnung\', \'AG-Team\', now(), \'Es kam zwischen den Accounts '.join(' und ',$users).' zu Überschneidungen, wir bitten euch dies zu unterlassen, da wir uns sonst gezwungen sehen diese Aktivitäten zu bestrafen!\', '.$user2.')'); logaction('Die User '.join(' und ',$users).' wurden verwarnt!'); } else{ - $qry = mysql_query('select id, nickname from user where id in ('.$user1.', '.$user2.')'); - while($row = mysql_fetch_assoc($qry)){ + $qry = db_query('select id, nickname from user where id in ('.$user1.', '.$user2.')'); + while($row = mysqli_fetch_assoc($qry)){ $users[] = $row['nickname']; } displayErrorMessage('Verwarnen', 'Sollen die User '.join(' und ',$users).' wirklich verwarnt werden?', 'weiter | '.displayHistoryBackLink()); @@ -453,18 +453,18 @@ function displayCheater($action, $from, $until, $user1, $user2, $tradeid, $verif } else if($action == 'ban'){ // Bannt zwei Accounts if($verify == 1){ - $qry = mysql_query('select id, nickname from user where id in ('.$user1.', '.$user2.')'); - while($row = mysql_fetch_assoc($qry)){ + $qry = db_query('select id, nickname from user where id in ('.$user1.', '.$user2.')'); + while($row = mysqli_fetch_assoc($qry)){ $users[] = $row['nickname']; } displayErrorMessage('Bann vollzogen!', 'Die User '.join(' und ',$users).' sind nun verwarnt!', 'weiter'); - mysql_query('INSERT INTO nachricht(betreff, von, datum, text, besitzer) values(\'Bann\', \'AG-Team\', now(), \'Es kam zwischen den Accounts '.join(' und ',$users).' zu Überschneidungen. Deswegen sahen wir uns gezwungen diese Aktivitäten zu bestrafen!\', '.$user1.')'); - mysql_query('INSERT INTO nachricht(betreff, von, datum, text, besitzer) values(\'Bann\', \'AG-Team\', now(), \'Es kam zwischen den Accounts '.join(' und ',$users).' zu Überschneidungen. Deswegen sahen wir uns gezwungen diese Aktivitäten zu bestrafen!\', '.$user2.')'); - mysql_query('Update user set bann = \'ja\' where id IN('.$user1.', '.$user2.')'); + db_query('INSERT INTO nachricht(betreff, von, datum, text, besitzer) values(\'Bann\', \'AG-Team\', now(), \'Es kam zwischen den Accounts '.join(' und ',$users).' zu Überschneidungen. Deswegen sahen wir uns gezwungen diese Aktivitäten zu bestrafen!\', '.$user1.')'); + db_query('INSERT INTO nachricht(betreff, von, datum, text, besitzer) values(\'Bann\', \'AG-Team\', now(), \'Es kam zwischen den Accounts '.join(' und ',$users).' zu Überschneidungen. Deswegen sahen wir uns gezwungen diese Aktivitäten zu bestrafen!\', '.$user2.')'); + db_query('Update user set bann = \'ja\' where id IN('.$user1.', '.$user2.')'); logaction('Die User '.join(' und ',$users).' wurden gebannt!'); } else{ - $qry = mysql_query('select id, nickname from user where id in ('.$user1.', '.$user2.')'); - while($row = mysql_fetch_assoc($qry)){ + $qry = db_query('select id, nickname from user where id in ('.$user1.', '.$user2.')'); + while($row = mysqli_fetch_assoc($qry)){ $users[] = $row['nickname']; } displayErrorMessage('Bannen', 'Sollen die User '.join(' und ',$users).' wirklich gebannt werden?', 'weiter | '.displayHistoryBackLink()); @@ -474,12 +474,12 @@ function displayCheater($action, $from, $until, $user1, $user2, $tradeid, $verif displayErrorMessage(NULL, 'not yet implemented', displayHistoryBackLink()); } else if($action == 'markok'){ if($verify == 1){ - $trade = mysql_fetch_assoc(mysql_query('SELECT u1.nickname as u1n, u1.id as u1i, u2.nickname u2n, u2.id u2i, at.anzahl, betrag, deadline, cheatingverdacht, it.name as i_name, si.name as s_name, wm.item as w_name, itemid, tablename FROM auktion_transaktionen at left join sp_item si on tablename = \'sp_ware\' and itemid = si.id left join item as it on tablename = \'ware\' and itemid = it.id left join wochen_markt as wm on tablename = \'wochen_ware\' and itemid = wm.id left join user as u1 on at.anbieter = u1.id left join user as u2 on at.bieter = u2.id where transaktionsid = '.$tradeid)); + $trade = mysqli_fetch_assoc(db_query('SELECT u1.nickname as u1n, u1.id as u1i, u2.nickname u2n, u2.id u2i, at.anzahl, betrag, deadline, cheatingverdacht, it.name as i_name, si.name as s_name, wm.item as w_name, itemid, tablename FROM auktion_transaktionen at left join sp_item si on tablename = \'sp_ware\' and itemid = si.id left join item as it on tablename = \'ware\' and itemid = it.id left join wochen_markt as wm on tablename = \'wochen_ware\' and itemid = wm.id left join user as u1 on at.anbieter = u1.id left join user as u2 on at.bieter = u2.id where transaktionsid = '.$tradeid)); displayErrorMessage('Trade validiert!', 'Der Handel zwischen '.$trade['u1n'].' und '.$trade['u2n'].' ist nun als \'Ok\' markiert!', 'weiter'); logaction('Der Handel zwischen '.$trade['u1n'].' und '.$trade['u2n'].' wurde als \'Ok\' markiert (Tradeid = '.$tradeid.')!'); - mysql_query('Update auktion_transaktionen set cheatingverdacht = 0 where transaktionsid = '.$tradeid); + db_query('Update auktion_transaktionen set cheatingverdacht = 0 where transaktionsid = '.$tradeid); } else{ - $trade = mysql_fetch_assoc(mysql_query('SELECT u1.nickname as u1n, u1.id as u1i, u2.nickname u2n, u2.id u2i, at.anzahl, betrag, deadline, cheatingverdacht, it.name as i_name, si.name as s_name, wm.item as w_name, itemid, tablename FROM auktion_transaktionen at left join sp_item si on tablename = \'sp_ware\' and itemid = si.id left join item as it on tablename = \'ware\' and itemid = it.id left join wochen_markt as wm on tablename = \'wochen_ware\' and itemid = wm.id left join user as u1 on at.anbieter = u1.id left join user as u2 on at.bieter = u2.id where transaktionsid = '.$tradeid)); + $trade = mysqli_fetch_assoc(db_query('SELECT u1.nickname as u1n, u1.id as u1i, u2.nickname u2n, u2.id u2i, at.anzahl, betrag, deadline, cheatingverdacht, it.name as i_name, si.name as s_name, wm.item as w_name, itemid, tablename FROM auktion_transaktionen at left join sp_item si on tablename = \'sp_ware\' and itemid = si.id left join item as it on tablename = \'ware\' and itemid = it.id left join wochen_markt as wm on tablename = \'wochen_ware\' and itemid = wm.id left join user as u1 on at.anbieter = u1.id left join user as u2 on at.bieter = u2.id where transaktionsid = '.$tradeid)); displayErrorMessage('Trade validieren!', 'Sollen der Handel zwischen '.$trade['u1n'].' und '.$trade['u2n'].' als \'Ok\' markiert werden?', 'weiter | '.displayHistoryBackLink()); } } @@ -523,7 +523,7 @@ function displayBannOptions($action, $username,$opfer,$gamebann,$shoutbann,$fore
'.$row['nickname'].'Usergruppe Beschreibung ' .$row['gruppen_name'].''.$row['gruppen_beschreibung'].'
Anzahl Action
'.$row['u1n'].''.$row['u2n'].''.$row['anzahl'].'Nachweis | Verwarnen | Bannen
Action
'.$row['u1n'].''.$row['u2n'].''.$name.''.$row['betrag'].''.$row['anzahl'].''.$row['deadline'].''.$cheatv.'Nachweis | Rückgängig | OK | Verwarnen | Bannen
'.$row['u1n'].''.$row['u2n'].''.$row['occured'].''.$row['type'].'Verwarnen | Bannen
'.$row['u1n'].''.$row['u2n'].''.$name.''.$row['betrag'].''.$row['anzahl'].''.$row['deadline'].''.$cheatv.'
@@ -539,7 +539,7 @@ function displayBannOptions($action, $username,$opfer,$gamebann,$shoutbann,$fore Username'; // now get the round data :D $sql = 'SELECT * from event_fight_rounds WHERE event_id = ' .$event_id . ' AND event_fight_id = ' .$event_fight_id . ' and visible <= now()'; - $qry = mysql_query($sql); - while($row = mysql_fetch_assoc($qry)) { + $qry = db_query($sql); + while($row = mysqli_fetch_assoc($qry)) { if($event_fight_data['host'] == $row['event_char_id']) { $char1_rounds[$row['round']] = $row; } else { @@ -404,9 +404,9 @@ function displayEventFight($event_id, $event_fight_id) { // readout the meta-data of this fight :D $sql = 'SELECT * FROM event_fight_metadata WHERE event_id = ' .$event_id . ' AND event_fight_id = ' .$event_fight_id; - $qry = mysql_query($sql); + $qry = db_query($sql); $event_fight_metadata = array(); - while($row = mysql_fetch_assoc($qry)) { + while($row = mysqli_fetch_assoc($qry)) { $event_fight_metadata[$row['key']] = $row['value']; } diff --git a/ag/include/kampf_wrapper.inc.php b/ag/include/kampf_wrapper.inc.php index 1e73e4f..584cdf0 100644 --- a/ag/include/kampf_wrapper.inc.php +++ b/ag/include/kampf_wrapper.inc.php @@ -20,11 +20,11 @@ function convertLearnIDToAttackID (array $learnids, $char_id) { $sql = 'SELECT id, at_id FROM lernen WHERE id IN ('.implode(',', $learnids).') AND besitzer = ' . $char_id; // echo $sql .'
'; - $qry = mysql_query($sql); + $qry = db_query($sql); if (!$qry) { return array(); } - while($row = mysql_fetch_assoc($qry)) { + while($row = mysqli_fetch_assoc($qry)) { for($i=0;$i 0) { $sql = 'SELECT * FROM attacken WHERE id IN(' .implode(',', $kombined) . ')'; // echo $sql .'
'; - $qry = mysql_query($sql); + $qry = db_query($sql); $attack_data = array(); - while($row = mysql_fetch_assoc($qry)) { + while($row = mysqli_fetch_assoc($qry)) { $attack_data[$row['id']] = $row; } } diff --git a/ag/include/messagefunctions.inc.php b/ag/include/messagefunctions.inc.php index 5918ce2..838f1dc 100644 --- a/ag/include/messagefunctions.inc.php +++ b/ag/include/messagefunctions.inc.php @@ -32,8 +32,8 @@ function sendMessage($von, $besitzer, $betreff, $text){ $sql = 'INSERT INTO nachricht(von, besitzer, betreff, text) VALUES (\''.$von.'\', '.$besitzer.', \''.$betreff.'\', \''.$text.'\')'; // echo $sql.'
'; - mysql_query($sql); - return mysql_affected_rows() != 0; + db_query($sql); + return db_affected_rows() != 0; } function colorize($text){ @@ -63,7 +63,7 @@ function sendChatMessage($user,$text, $usergroups){ $nick = displayUserNameByID($user['id']); } if($text != '' && !is_null($text)){ - mysql_query('INSERT ag_chat SET nachricht=\''.$text.'\', user=\''.$nick.'\''); + db_query('INSERT ag_chat SET nachricht=\''.$text.'\', user=\''.$nick.'\''); } } @@ -71,7 +71,7 @@ function getChatMessages($userid, $messageid = 0, $asc = true, $limit = 25){ if(!is_numeric($messageid)){ $messageid = 0; } - $row = mysql_fetch_row(db_query('Select max(id), count(id) from ag_chat')); + $row = mysqli_fetch_row(db_query('Select max(id), count(id) from ag_chat')); $maxid = $row[0]; $count = $row[1]; if($maxid === null) { @@ -89,7 +89,7 @@ function getChatMessages($userid, $messageid = 0, $asc = true, $limit = 25){ $result = db_query('SELECT *, Minute(zeit) as m, Hour(zeit) as h FROM ag_chat WHERE id > '.$minid.' ORDER BY ID ASC LIMIT '.$limit); - while ($row = mysql_fetch_assoc($result)) { + while ($row = mysqli_fetch_assoc($result)) { $h = $row['h']; if($h < 10){ $h = '0'.$h;} $m = $row['m']; @@ -119,8 +119,8 @@ function insertUserTickerMessage($userid, $message, $offset = 0){ } for($msgid = 0; $msgid < 100000; $msgid += mt_random_wrapper(1,1000)){ $sql = 'INSERT INTO user_ticker(userid, date, msgid, text) values('.$userid.', '.$timestamp.', '.$msgid.', \''.$message.'\')'; - mysql_query($sql); - if(mysql_affected_rows() == 1){ + db_query($sql); + if(db_affected_rows() == 1){ // echo 'MYSQL success: '.$sql; return; } @@ -136,8 +136,8 @@ function insertClanTickerMessage($clanid, $message, $offset = 0){ } for($msgid = 0; $msgid < 100000; $msgid += mt_random_wrapper(1,1000)){ $sql = 'INSERT INTO clan_ticker(clanid, date, msgid, text) values('.$clanid.', now(), '.$msgid.', \''.$message.'\')'; - mysql_query($sql); - if(mysql_affected_rows() == 1){ + db_query($sql); + if(db_affected_rows() == 1){ // echo 'MYSQL success: '.$sql; return; } diff --git a/ag/include/mumble.inc.php b/ag/include/mumble.inc.php index 7432cf1..b1adaa2 100644 --- a/ag/include/mumble.inc.php +++ b/ag/include/mumble.inc.php @@ -9,12 +9,12 @@ function insertUser($user_name, $password){ $sql = 'SELECT * FROM user WHERE nickname like \''.$user_name.'\''; - $user = mysql_fetch_assoc(mysql_query($sql)); + $user = mysqli_fetch_assoc(db_query($sql)); // Insert User into mumble! $sql = 'Insert into '.$GLOBALS['mumble_db_name'].'.players(server_id, player_id, name, pw) values(1, '.$user['id'].', \''.$user['nickname'].'\', sha(\''.$password.'\'))'; // Should do the trick! - mysql_query($sql); + db_query($sql); } ?> \ No newline at end of file diff --git a/ag/include/online.inc.php b/ag/include/online.inc.php index 0ab7e16..bb9d066 100644 --- a/ag/include/online.inc.php +++ b/ag/include/online.inc.php @@ -7,9 +7,9 @@ */ // Online-Berechnungen -$online_r = mysql_fetch_assoc(mysql_query('Select count(*) as anzahl from user WHERE online_zeit between TIMESTAMPADD(Minute, -15, now()) and now()')); +$online_r = mysqli_fetch_assoc(db_query('Select count(*) as anzahl from user WHERE online_zeit between TIMESTAMPADD(Minute, -15, now()) and now()')); $online_r = $online_r['anzahl']; -$online_rekord_1_0 = mysql_fetch_assoc(mysql_query('SELECT * FROM online WHERE id=1')); +$online_rekord_1_0 = mysqli_fetch_assoc(db_query('SELECT * FROM online WHERE id=1')); ?> diff --git a/ag/include/pollfunctions.inc.php b/ag/include/pollfunctions.inc.php index d0b9bf2..cbcccd1 100644 --- a/ag/include/pollfunctions.inc.php +++ b/ag/include/pollfunctions.inc.php @@ -18,29 +18,29 @@ include_once "parse.inc.php"; function stimme($pollid, $polloptionid, $userid, $kommentar){ - if(mysql_num_rows(mysql_query('SELECT * FROM poll_votes WHERE pollid = '.$pollid.' and userid = '.$userid)) == 0){ + if(mysqli_stmt_num_rows(db_query('SELECT * FROM poll_votes WHERE pollid = '.$pollid.' and userid = '.$userid)) == 0){ // NEU einfuegen! $sql = 'INSERT INTO poll_votes(pollid, polloptionid, userid, comment) values ('.$pollid.','.$polloptionid.','.$userid.',\''.$kommentar.'\')'; - mysql_query($sql); + db_query($sql); //echo $sql.'
'; } else{ - mysql_query('UPDATE poll_votes SET polloptionid='.$polloptionid.', comment = \''.encodeNoHTMLNoBB($kommentar).'\' WHERE pollid='.$pollid.' and userid = '.$userid); + db_query('UPDATE poll_votes SET polloptionid='.$polloptionid.', comment = \''.encodeNoHTMLNoBB($kommentar).'\' WHERE pollid='.$pollid.' and userid = '.$userid); } } // Liefert den Datensatz der Stimme (Nr und eigener Kommentar) function getStimme($pollid, $userid){ - $qry = mysql_query('SELECT * FROM poll_votes WHERE pollid = '.$pollid.' and userid = '.$userid); - $result = mysql_fetch_assoc($qry); + $qry = db_query('SELECT * FROM poll_votes WHERE pollid = '.$pollid.' and userid = '.$userid); + $result = mysqli_fetch_assoc($qry); return $result; } function getUmfrage($pollid){ $umfrage = array(); - $qry = mysql_query('SELECT p.thema, p.pollid, p.text, u.nickname FROM poll as p inner join user as u on p.ersteller = u.id WHERE pollid='.$pollid); - $umfrage['poll'] = mysql_fetch_assoc($qry); - $qry = mysql_query('SELECT * FROM poll_options WHERE pollid ='.$pollid); - while($result = mysql_fetch_assoc($qry)){ + $qry = db_query('SELECT p.thema, p.pollid, p.text, u.nickname FROM poll as p inner join user as u on p.ersteller = u.id WHERE pollid='.$pollid); + $umfrage['poll'] = mysqli_fetch_assoc($qry); + $qry = db_query('SELECT * FROM poll_options WHERE pollid ='.$pollid); + while($result = mysqli_fetch_assoc($qry)){ $umfrage['options'][$result['polloptionid']] = $result; } return $umfrage; @@ -48,41 +48,41 @@ function getUmfrage($pollid){ function getUmfragen($entries, $page){ $returnArray = array(); - $qry = mysql_query('SELECT p.thema, p.pollid, u.nickname FROM poll as p inner join user as u on p.ersteller = u.id LIMIT '.$entries*$page.','.$entries); + $qry = db_query('SELECT p.thema, p.pollid, u.nickname FROM poll as p inner join user as u on p.ersteller = u.id LIMIT '.$entries*$page.','.$entries); $i=0; - while($result=mysql_fetch_assoc($qry)){ + while($result=mysqli_fetch_assoc($qry)){ $returnArray[$i++] = $result; } return $returnArray; } function getUmfragenCount(){ - $temp = mysql_fetch_assoc(mysql_query('SELECT count(*) as anzahl FROM poll')); + $temp = mysqli_fetch_assoc(db_query('SELECT count(*) as anzahl FROM poll')); return $temp['anzahl']; } function getComments($pollid, $entries, $page){ $returnArray = array(); $sql = 'SELECT polloptionid, comment FROM poll_votes where comment != \'\' and pollid= '.$pollid.' LIMIT '.$entries*$page.','.$entries; - $qry = mysql_query($sql); + $qry = db_query($sql); // echo '
'.$sql.'
'; - for($i=0;($result = mysql_fetch_assoc($qry)) != null && $i<$entries;$i++){ + for($i=0;($result = mysqli_fetch_assoc($qry)) != null && $i<$entries;$i++){ $returnArray[$i] = $result; } return $returnArray; } function getCommentCount($pollid){ - $temp = mysql_fetch_assoc(mysql_query('Select count(*) as anzahl from poll_votes where comment != \'\' and pollid= '.$pollid)); + $temp = mysqli_fetch_assoc(db_query('Select count(*) as anzahl from poll_votes where comment != \'\' and pollid= '.$pollid)); return $temp['anzahl']; } function getPollResult($pollid){ $returnArray = array(); $sql = 'SELECT text, pv.polloptionid, count(pv.polloptionid) as anzahl FROM poll_votes as pv inner join poll_options as po on pv.polloptionid = po.polloptionid and pv.pollid = po.pollid where pv.pollid = '.$pollid.' group by polloptionid'; - $qry = mysql_query($sql); + $qry = db_query($sql); // echo '
'.$sql.'
'; - while($result = mysql_fetch_assoc($qry)){ + while($result = mysqli_fetch_assoc($qry)){ $returnArray[$result['polloptionid']] = $result['anzahl']; } return $returnArray; @@ -91,8 +91,8 @@ function getPollResult($pollid){ function isOpen($pollid){ $sql = 'SELECT count(*) as anzahl from poll where pollid ='.$pollid.' AND (close is null OR close > now())'; - $qry = mysql_query($sql); - $row = mysql_fetch_assoc($qry); + $qry = db_query($sql); + $row = mysqli_fetch_assoc($qry); if($row['anzahl'] > 0){ return true; } diff --git a/ag/include/rassen.inc.php b/ag/include/rassen.inc.php index a5f1184..9a0025b 100644 --- a/ag/include/rassen.inc.php +++ b/ag/include/rassen.inc.php @@ -25,9 +25,9 @@ function getRassen() { */ function getRaces() { if(count($GLOBALS['char_buffered_races']) == 0) { - $qry = mysql_query('select * from rassen'); + $qry = db_query('select * from rassen'); // FIXME: This is a simulated SQL Request! - while($race = mysql_fetch_assoc($qry)) { + while($race = mysqli_fetch_assoc($qry)) { $GLOBALS['char_buffered_races'][$race['id']] = $race; } } @@ -40,8 +40,8 @@ function getRassenTypeMapping() { function getRaceTypes(){ if(count($GLOBALS['char_buffered_race_types']) == 0) { - $qry = mysql_query('select * from rassen_type'); - while($racetype = mysql_fetch_assoc($qry)) { + $qry = db_query('select * from rassen_type'); + while($racetype = mysqli_fetch_assoc($qry)) { $GLOBALS['char_buffered_race_types'][$racetype['id']] = $racetype; } } diff --git a/ag/include/schatz.inc.php b/ag/include/schatz.inc.php index b10b8da..b603d8c 100644 --- a/ag/include/schatz.inc.php +++ b/ag/include/schatz.inc.php @@ -17,14 +17,14 @@ defineIfNotDefined('ATTACK_SET_SCHATZSUCHE', 2); function interruptSchatzSuche($charid){ - mysql_query('Delete from quest_rounds where charid ='.$charid); - mysql_query('Delete from quest_fights where charid ='.$charid); - mysql_query('Delete from quests where charid ='.$charid); - mysql_query('Update chars set status = \'Frei\' where id = '.$charid); + db_query('Delete from quest_rounds where charid ='.$charid); + db_query('Delete from quest_fights where charid ='.$charid); + db_query('Delete from quests where charid ='.$charid); + db_query('Update chars set status = \'Frei\' where id = '.$charid); } function getMonsterCount($ort){ - return mysql_fetch_assoc(mysql_query('Select count(*) as arten, sum(anzahl) as anzahl from quest_monster_orte as qma inner join quest_monster as qm on qma.monsterid = qm.id where ortid = '.$ort)); + return mysqli_fetch_assoc(db_query('Select count(*) as arten, sum(anzahl) as anzahl from quest_monster_orte as qma inner join quest_monster as qm on qma.monsterid = qm.id where ortid = '.$ort)); } // Die Monsterauswahl in eine Funktion gekapselt um es spaeter optimieren zu koennen! @@ -37,10 +37,10 @@ function getMonster($char_level, $city_id, $min, $max){ $rechnung = 'ROUND(1/SQRT(PI()*2) * EXP(-1/(('.$top.'-'.$bottom.')*2.5)*POW((level-floor(('.$bottom.'+'.$min_l.')/2)),2))*250) as guete'; $sql = 'select *, '.$rechnung.' from quest_monster as qm inner join quest_monster_orte as qmo on qm.id = qmo.monsterid where ortid = '.$city_id.' and level <= 20 + '.$char_level.' order by rand()'; // echo $sql.'
'; - $qry = mysql_query($sql); // Lade alle Monster - // while($monster[] = mysql_fetch_assoc($qry)); // Lade alle monster in einen Array + $qry = db_query($sql); // Lade alle Monster + // while($monster[] = mysqli_fetch_assoc($qry)); // Lade alle monster in einen Array $gesamtguete = 0; - while($row = mysql_fetch_assoc($qry)){ + while($row = mysqli_fetch_assoc($qry)){ if($row['guete'] == 0){ $row['guete'] += 1; } @@ -89,7 +89,7 @@ function monsterfight_neu($chara_1, $fight_monster, $std, $ort){ if($chara_1['kampf_item'] != NULL && $chara_1['kampf_item'] != ',,,,'){ // echo 'Problematic Entry = '.$chara_1['kampf_item'].'
'; - $char1_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 (' . $chara_1['kampf_item'] . ')')); + $char1_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 (' . $chara_1['kampf_item'] . ')')); } // Retrieve the attack set for the treasure hunt! @@ -130,10 +130,10 @@ function monsterfight_neu($chara_1, $fight_monster, $std, $ort){ $in_hp_max.', '. $in_mp_max.')'; // echo 'Debug-Message: '.$sql.'
'; - mysql_query($sql); + db_query($sql); $Dead1 = 0; - // while ($chara_2 = mysql_fetch_assoc($fight_monster)) { // Schleife in monsterfight.inc.php rein!!! + // while ($chara_2 = mysqli_fetch_assoc($fight_monster)) { // Schleife in monsterfight.inc.php rein!!! for($i=0;$i'; - mysql_query($sql); + db_query($sql); // Werte uebernehmen $k_starke[0] = $in_starke; $k_speed[0] = $in_speed; @@ -186,7 +186,7 @@ function monsterfight_neu($chara_1, $fight_monster, $std, $ort){ $k_starke[1].','.$k_speed[1].','.$k_ver[1].','.$k_hp[1].','.$k_mp[1].','.$k_ausdauer[1].','.$k_glueck[1]. ')'; // echo 'Debug Message: '.$sql.'
'; - mysql_query($sql); + db_query($sql); $statChange_Char1 = array(); $statChange_Char2 = array(); @@ -207,9 +207,9 @@ function monsterfight_neu($chara_1, $fight_monster, $std, $ort){ $GLOBALS['kampf']['aussetzen'] = &$aussetzten_runde; while ($k_hp[0] > $k_aufgabe[0] AND $k_hp[1] > 0 AND $x < 10) { - $technick1 = mysql_fetch_assoc(mysql_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke1[$x]' LIMIT 10")); + $technick1 = mysqli_fetch_assoc(db_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke1[$x]' LIMIT 10")); $prozent_technik1 = (20 * $technick1['aktiv']) - 20; - $technick1 = mysql_fetch_assoc(mysql_query("SELECT * FROM attacken WHERE id='$technick1[at_id]' LIMIT 10")); + $technick1 = mysqli_fetch_assoc(db_query("SELECT * FROM attacken WHERE id='$technick1[at_id]' LIMIT 10")); include (ROOT_PATH . '/include/kampf/andere_technik.php'); @@ -274,7 +274,7 @@ function monsterfight_neu($chara_1, $fight_monster, $std, $ort){ $k_starke[1].','.$k_speed[1].','.$k_ver[1].','.$k_hp[1].','.$k_mp[1].','.$k_ausdauer[1].','.$k_glueck[1]. ')'; // echo $sql.'
'; - mysql_query($sql); + db_query($sql); } ###########################EXP VERTEILUNG @@ -300,9 +300,9 @@ function monsterfight_neu($chara_1, $fight_monster, $std, $ort){ $geld = 0; } // With money on SS - // mysql_query('Update quest_fights set exp = '.$exp.', geld = '.$geld.', sieger = '.$sieger.' where charid = '.$chara_1['id'].' and fightnr = '.$i); + // db_query('Update quest_fights set exp = '.$exp.', geld = '.$geld.', sieger = '.$sieger.' where charid = '.$chara_1['id'].' and fightnr = '.$i); // No money - mysql_query('Update quest_fights set exp = '.$exp.', geld = 0, sieger = '.$sieger.' where charid = '.$chara_1['id'].' and fightnr = '.$i); + db_query('Update quest_fights set exp = '.$exp.', geld = 0, sieger = '.$sieger.' where charid = '.$chara_1['id'].' and fightnr = '.$i); } } // Just wait (so users can not determinate the success of the SS by calculation time) @@ -319,8 +319,8 @@ function getSchatzItems($monster_count){ $items = array(); $sql = 'SELECT * FROM sp_item where FLOOR(RAND()*wert/'.$divisor.') = 0'; // echo $sql.' ('.$monster_count.')
'; - $qry = mysql_query($sql); - while($items[] = mysql_fetch_assoc($qry)); + $qry = db_query($sql); + while($items[] = mysqli_fetch_assoc($qry)); return $items; } @@ -345,9 +345,9 @@ function submitCharChanges($charid, $items, $exp, $geld, $ort, $hp, $mp, $attack $mp[0] = $mp[1]; } // Erstmal aufräumen - mysql_query('Delete from quests where charid = '.$charid); - mysql_query('Delete from quest_fights where charid = '.$charid); - mysql_query('Delete from quest_rounds where charid = '.$charid); + db_query('Delete from quests where charid = '.$charid); + db_query('Delete from quest_fights where charid = '.$charid); + db_query('Delete from quest_rounds where charid = '.$charid); // Das leveln :) // Erfahrung @@ -358,29 +358,29 @@ function submitCharChanges($charid, $items, $exp, $geld, $ort, $hp, $mp, $attack // Schaden und den neuen Ort eintragen (und den Status nicht vergessen :) $sql = 'Update chars set hp=\''.$hp[0].','.$hp[1].'\', mp=\''.$mp[0].','.$mp[1].'\', ort = '.$ort.', status = \'Frei\' where id = '.$charid; // echo $sql.'
'; - mysql_query($sql); + db_query($sql); // // Kohle gibts ja nichmehr :) // $sql = 'Update user set geld = geld + '.$geld.' where id = '.$char['besitzer']; //// echo $sql.'
'; - // mysql_query($sql); + // db_query($sql); // Nun gehts zum auffinden der Items :) for($i=0;$items[$i];$i++){ // Ermittle ob es eine Teufelsfrucht ist! $sql = 'Select name, type from sp_item where id = '.$items[$i]['id']; - $row = mysql_fetch_assoc(mysql_query($sql)); + $row = mysqli_fetch_assoc(db_query($sql)); if($row['type'] == 'Teufels Frucht'){ $sql = 'Select id from wochen_markt where item = \''.$row['name'].'\''; - $row2 = mysql_fetch_assoc(mysql_query($sql)); + $row2 = mysqli_fetch_assoc(db_query($sql)); $sql = 'INSERT INTO wochen_ware(item, user) values('.$row2['id'].','.$char['besitzer'].')'; - mysql_query($sql); + db_query($sql); } else{ $sql = 'Insert into sp_ware(item, user) values('.$items[$i]['id'].','.$char['besitzer'].')'; // echo $sql.'
'; - mysql_query($sql); + db_query($sql); } } } diff --git a/ag/include/schnell_start.inc.php b/ag/include/schnell_start.inc.php index 7d1b0d7..84bf211 100644 --- a/ag/include/schnell_start.inc.php +++ b/ag/include/schnell_start.inc.php @@ -13,7 +13,7 @@ function renderSchnellleiste($user){ $Schnell_my_chars = getCharsOfUser($user['id']); $char_zahl = 0; - while($my_charz = mysql_fetch_assoc($Schnell_my_chars)) { + while($my_charz = mysqli_fetch_assoc($Schnell_my_chars)) { $POWERLEVEL5 = $my_charz['starke']+$my_charz['verteidigung']+$my_charz['speed']+$my_charz['ausdauer']+$my_charz['glueck']; diff --git a/ag/include/semaphore.inc.php b/ag/include/semaphore.inc.php index d8e59da..d3bfa02 100644 --- a/ag/include/semaphore.inc.php +++ b/ag/include/semaphore.inc.php @@ -41,12 +41,12 @@ function semaphoreUP($resource){ // echo 'DEBUG: kritischer Bereich betreten
'; } // Loesche alte Ressourcen - mysql_query('DELETE FROM semaphore WHERE TIMESTAMPDIFF(MINUTE, zeit, now()) > 5 and ressource = \''.$resource.'\''); + db_query('DELETE FROM semaphore WHERE TIMESTAMPDIFF(MINUTE, zeit, now()) > 5 and ressource = \''.$resource.'\''); $sql = 'INSERT INTO semaphore(ressource) values(\''.$resource.'\')'; - mysql_query($sql); - if(mysql_affected_rows() > 0){ -// echo 'DEBUG: Semaphore fuer '.$ressource.' belegt!('.mysql_affected_rows().')
'; + db_query($sql); + if(db_affected_rows() > 0){ +// echo 'DEBUG: Semaphore fuer '.$ressource.' belegt!('.db_affected_rows().')
'; $GLOBALS['semaphorecount']++; return true; } @@ -61,8 +61,8 @@ function semaphoreUP($resource){ // @Returns TRUE if ok, FALSE on Semaphore error, NULL on MYQL Error function semaphoreDown($resource){ $sql = 'DELETE FROM semaphore where ressource = \''.$resource.'\''; - mysql_query($sql); - if(mysql_affected_rows() == 0){ + db_query($sql); + if(db_affected_rows() == 0){ // echo 'DEBUG: Semaphore '.$ressource.' war schon freigegeben
'; return false; } @@ -81,7 +81,7 @@ function semaphoreDown($resource){ * returns true, wenn Semaphore belegt ist, false wenn nicht */ function isSemaphoreUP($ressource){ - return mysql_fetch_assoc(mysql_query('Select * from semaphore where WHERE TIMESTAMPDIFF(MINUTE, zeit, now()) > 5 and ressource = \''.$ressource.'\'')) != false; + return mysqli_fetch_assoc(db_query('Select * from semaphore where WHERE TIMESTAMPDIFF(MINUTE, zeit, now()) > 5 and ressource = \''.$ressource.'\'')) != false; } function installSemaphoreDatabase(){ @@ -94,8 +94,8 @@ function installSemaphoreDatabase(){ ')' . 'ENGINE = MYISAM ' . 'COMMENT = \'Die Tabelle, die hoffentlich alle Zugriffsprobleme loesen wird\''; - mysql_query($sql1); - mysql_query($sql2); + db_query($sql1); + db_query($sql2); } ?> \ No newline at end of file diff --git a/ag/include/sqlwrapper.inc.php b/ag/include/sqlwrapper.inc.php index 9759b56..1dc3bc5 100755 --- a/ag/include/sqlwrapper.inc.php +++ b/ag/include/sqlwrapper.inc.php @@ -7,10 +7,14 @@ */ function db_query($sql) { - $qry = mysql_query($sql); + $qry = mysqli_query($GLOBALS['main_db'], $sql); if(!$qry) { echo $sql . '
'; } return $qry; } +function db_affected_rows() { + return mysqli_affected_rows($GLOBALS['main_db']); +} + diff --git a/ag/include/tasking.inc.php b/ag/include/tasking.inc.php index b1e4f95..376c4fe 100644 --- a/ag/include/tasking.inc.php +++ b/ag/include/tasking.inc.php @@ -79,7 +79,7 @@ function getAllTaskIds() { if(!$qry) return array(); $result = array(); - while($row = mysql_fetch_row($qry)) { + while($row = mysqli_fetch_row($qry)) { $result[] = $row[0]; } return $result; @@ -96,7 +96,7 @@ function getPassedTaskIds($timestamp = NULL) { if(!$qry) return array(); $result = array(); - while($row = mysql_fetch_row($qry)) { + while($row = mysqli_fetch_row($qry)) { $result[] = $row[0]; } return $result; @@ -110,7 +110,7 @@ function getTask($task_id) { $qry = db_query('SELECT * FROM tasking WHERE task_id = ' . $task_id); if(!$qry) return null; - return mysql_fetch_assoc($qry); + return mysqli_fetch_assoc($qry); } /** diff --git a/ag/include/user.inc.php b/ag/include/user.inc.php index 91a42e8..93b1719 100644 --- a/ag/include/user.inc.php +++ b/ag/include/user.inc.php @@ -19,7 +19,7 @@ function getUser($userid, $buffer_enabled = true) { } // Wenn Char nicht im Puffer ist, oder nicht gepuffert werden soll if ($GLOBALS['user_buffered_instances'][$userid] == null || !$buffer_enabled) { - $user = mysql_fetch_assoc(db_query('SELECT *, (online_zeit between TIMESTAMPADD(Minute, -15, now()) and now()) as online FROM user WHERE id = '.$userid)); + $user = mysqli_fetch_assoc(db_query('SELECT *, (online_zeit between TIMESTAMPADD(Minute, -15, now()) and now()) as online FROM user WHERE id = '.$userid)); $GLOBALS['user_buffered_instances'][$userid] = $user; } return $GLOBALS['user_buffered_instances'][$userid]; @@ -42,12 +42,12 @@ function getOwnerOfChar($charid, $buffer_enabled = true) { return null; } - $user = mysql_fetch_assoc(mysql_query('SELECT u.id FROM user u INNER JOIN chars ch ON ch.besitzer=u.id WHERE ch.id = '.$charid)); + $user = mysqli_fetch_assoc(db_query('SELECT u.id FROM user u INNER JOIN chars ch ON ch.besitzer=u.id WHERE ch.id = '.$charid)); return getUser($user['id']); } function addMoneyToUser($userid, $amount) { - mysql_query('update user set geld = geld + ' . $amount . ' WHERE id = ' .$userid); + db_query('update user set geld = geld + ' . $amount . ' WHERE id = ' .$userid); } /** @@ -56,7 +56,7 @@ function addMoneyToUser($userid, $amount) { */ function getRelevantMoney($userid) { $user = getUser($userid); - $auktionensumme = mysql_fetch_assoc(mysql_query('SELECT SUM(aktuellesgebot) as summe FROM auktion WHERE bieter = ' . $user['id'] . ' GROUP BY bieter')); + $auktionensumme = mysqli_fetch_assoc(db_query('SELECT SUM(aktuellesgebot) as summe FROM auktion WHERE bieter = ' . $user['id'] . ' GROUP BY bieter')); $auktionensumme = $auktionensumme['summe']; if ($auktionensumme == 0) { @@ -69,7 +69,7 @@ function getRelevantMoney($userid) { function checkSessionPasswort($userid, $password){ $sql = 'SELECT passwort from user where id = \''.$userid.'\''; - $row = mysql_fetch_assoc(mysql_query($sql)); + $row = mysqli_fetch_assoc(db_query($sql)); if($row['passwort'] != null){ // echo $password.' == '.$row['passwort']; return $password == $row['passwort']; @@ -81,7 +81,7 @@ function checkSessionPasswort($userid, $password){ function checkCookiePassword($username, $password){ $sql = 'SELECT passwort from user where nickname = \''.$username.'\''; - $row = mysql_fetch_assoc(mysql_query($sql)); + $row = mysqli_fetch_assoc(db_query($sql)); if($row['passwort'] != null){ return $password == $row['passwort']; } else{ @@ -95,7 +95,7 @@ function checkLoginPassword($username, $password){ $sql = 'SELECT SHA1(AES_ENCRYPT(\''.$password.'\',\''.$GLOBALS['PW_AES_KEY'].'\')) as encrypt_password, passwort from user where nickname = \''.$username.'\''; // echo $sql.'
'; - $row = mysql_fetch_assoc(mysql_query($sql)); + $row = mysqli_fetch_assoc(db_query($sql)); if($row){ if($row['passwort'] == $pw) { return true; // already bcrypt based! @@ -120,7 +120,7 @@ function setPassword($username, $password){ $pw = encryptPassword($password); $sql = 'UPDATE user set passwort = \''.$pw.'\' where nickname = \''.$username.'\''; // echo $sql.'
'; - mysql_query($sql); + db_query($sql); } function encryptPassword($password){ @@ -130,7 +130,7 @@ function encryptPassword($password){ function getUserMetaData($userid) { $sql = 'SELECT * FROM user_meta_data WHERE user_id = ' . $userid; - $qry = mysql_query($sql); + $qry = db_query($sql); $result = array(); if(!$qry) @@ -139,7 +139,7 @@ function getUserMetaData($userid) { return $result; } - while ($row = mysql_fetch_assoc($qry)) { + while ($row = mysqli_fetch_assoc($qry)) { $result[$row['key']] = $row['value']; } return $result; @@ -147,15 +147,15 @@ function getUserMetaData($userid) { function setUserMetaDataEntry($userid, $key, $value) { $sql = 'UPDATE user_meta_data SET `value` = \''.$value.'\' WHERE user_id = \''.$userid.'\' and `key` = \''.$key.'\''; - $qry = mysql_query($sql); + $qry = db_query($sql); if(!qry) return; - if(mysql_affected_rows() > 0) + if(db_affected_rows() > 0) return; $sql = 'INSERT INTO user_meta_data(user_id, `key`, `value`) values (\''.$userid.'\',\''.$key.'\',\''.$value.'\')'; - $qry = mysql_query($sql); + $qry = db_query($sql); } diff --git a/ag/include/usergroup.inc.php b/ag/include/usergroup.inc.php index 61c5efe..57951ad 100644 --- a/ag/include/usergroup.inc.php +++ b/ag/include/usergroup.inc.php @@ -41,7 +41,7 @@ function getUserGroups($user) { $i = 0; if($qry) { - while ($result = mysql_fetch_assoc($qry)) { + while ($result = mysqli_fetch_assoc($qry)) { $groups[] = array("gruppen_id" => $result['gruppen_id'], "gruppen_name" => $result['gruppen_name']); } } diff --git a/ag/index.php b/ag/index.php index 9b34ca8..996ea40 100644 --- a/ag/index.php +++ b/ag/index.php @@ -21,7 +21,7 @@ include_once(ROOT_PATH.'/include/messagefunctions.inc.php'); // Fuer den Transit von register_globals auf normal $name = $user_ida['nickname']; $passwort = $user_ida['passwort']; -$nnn_nn = mysql_num_rows(mysql_query("SELECT id FROM nachricht WHERE besitzer='$user_ida[id]' AND ag='neu'")); +$nnn_nn = mysqli_stmt_num_rows(db_query("SELECT id FROM nachricht WHERE besitzer='$user_ida[id]' AND ag='neu'")); $as = $_REQUEST['as']; $agb = $_REQUEST['agb']; @@ -332,7 +332,7 @@ if($as != "irc" AND $as != "login" AND $as != "anmeldung" AND $as != "info/logs" if($user_ida['agb'] == "nein" && $as != "info/agb") { if($agb == 'ok'){ - mysql_query("UPDATE user SET agb='ja' WHERE id='$user_ida[id]' LIMIT 1"); + db_query("UPDATE user SET agb='ja' WHERE id='$user_ida[id]' LIMIT 1"); } echo 'Die Regeln haben sich verändert. Bist du mit den neuen Regeln einverstanden? Hier Klicken um die neuen Regeln zu lesen
'; exit; diff --git a/ag/info.php b/ag/info.php index 645ff76..5ae6263 100644 --- a/ag/info.php +++ b/ag/info.php @@ -28,7 +28,7 @@ $charm = $_GET['charm']; function isNickChanged($user){ - $row = mysql_fetch_assoc(mysql_query('Select count(*) as anzahl from user_rename where userid = '.$user['id'])); + $row = mysqli_fetch_assoc(db_query('Select count(*) as anzahl from user_rename where userid = '.$user['id'])); return $row['anzahl'] != 0; } @@ -108,9 +108,9 @@ function display1($char_id){ function display2($user_id, $userage, $user_ida){ if($userage != NULL){ - $user_a = mysql_fetch_assoc(mysql_query('SELECT * FROM user WHERE nickname=\''.$userage.'\'')); + $user_a = mysqli_fetch_assoc(db_query('SELECT * FROM user WHERE nickname=\''.$userage.'\'')); } else{ - $user_a = mysql_fetch_assoc(mysql_query('SELECT * FROM user WHERE id='.$user_id)); + $user_a = mysqli_fetch_assoc(db_query('SELECT * FROM user WHERE id='.$user_id)); } if(!is_numeric($user_id)) { $user_id = $user_a['id']; @@ -134,18 +134,18 @@ function display2($user_id, $userage, $user_ida){ if($user_a['clan'] == NULL){ echo 'Keiner'; } else{ - $clan = mysql_fetch_assoc(mysql_query('SELECT * FROM clan WHERE id = '.$user_a['clan'])); + $clan = mysqli_fetch_assoc(db_query('SELECT * FROM clan WHERE id = '.$user_a['clan'])); echo displayClanLink ($clan['id'], $clan['clanname']) ; } // Now could it be that the user is in an other clan and we may invite him ;), check if current user is a leader! - $qry = mysql_query('Select id from clan where leader = ' . $user_ida['id'] . ' or co_leader = ' . $user_ida['id']); - $clan = mysql_fetch_assoc($qry); + $qry = db_query('Select id from clan where leader = ' . $user_ida['id'] . ' or co_leader = ' . $user_ida['id']); + $clan = mysqli_fetch_assoc($qry); // is there data available and if yes does the other user have the same clan? if($clan && $clan['id'] !== $user_a['clan']) { // check if we already invited him. Then renew invitation -> - $qry = mysql_query('Select count(*) as anzahl from user_clan_invitations where clanid = '.$clan['id'].' AND userid = ' . $user_id); - $row = mysql_fetch_assoc($qry); + $qry = db_query('Select count(*) as anzahl from user_clan_invitations where clanid = '.$clan['id'].' AND userid = ' . $user_id); + $row = mysqli_fetch_assoc($qry); if ($row['anzahl'] > 0) { $action = 'Einladung erneuern'; @@ -165,8 +165,8 @@ function display2($user_id, $userage, $user_ida){ @@ -212,7 +212,7 @@ function display3($tablename, $itemid){ return; } -$item_a = mysql_fetch_assoc(mysql_query('SELECT * FROM '.$tabletogo.' WHERE id='.$itemid)); +$item_a = mysqli_fetch_assoc(db_query('SELECT * FROM '.$tabletogo.' WHERE id='.$itemid)); ?>
'."\n"; @@ -39,7 +39,7 @@ echo ' '."\n"; // Now generate the strings -while($row = mysql_fetch_assoc($qry)){ +while($row = mysqli_fetch_assoc($qry)){ if($old != $row['art']){ $eventhighscore[$row['art']] .= ''."\n"; $eventhighscore[$row['art']] .= ' '."\n"; diff --git a/ag/inclu/char.php b/ag/inclu/char.php index f4eabef..53f6099 100644 --- a/ag/inclu/char.php +++ b/ag/inclu/char.php @@ -28,8 +28,8 @@ $mptemp = explode(",", $my_charz['mp']); $mpleft[$char_zahl] = $mptemp['0'] / $mptemp['1'] * 100; $exptemp = explode(",", $my_charz['exp']); - $room = mysql_query('SELECT ci.name FROM clan_item ci inner join clan_ware cw on ci.id = cw.item_id WHERE cw.id='.$my_charz['clan_train']); - $clanroom=mysql_fetch_assoc($room); + $room = db_query('SELECT ci.name FROM clan_item ci inner join clan_ware cw on ci.id = cw.item_id WHERE cw.id='.$my_charz['clan_train']); + $clanroom=mysqli_fetch_assoc($room); if($clanroom['name']=="") $clanroom['name']="kein"; @@ -45,7 +45,7 @@ if($my_charz['kampf_item'] != NULL && $my_charz['kampf_item'] != ',,,,'){ // echo 'Problematic Entry = '.$chara_1['kampf_item'].'
'; - $char1_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 (' . $my_charz['kampf_item'] . ')')); + $char1_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 (' . $my_charz['kampf_item'] . ')')); } $c_starke = $char1_buffs['starke']==0?$my_charz['starke']:($my_charz['starke']).' (+'.$char1_buffs['starke'].')'; $c_verteidigung = $char1_buffs['verteidigung']==0?$my_charz['verteidigung']:($my_charz['verteidigung']).' (+'.$char1_buffs['verteidigung'].')'; diff --git a/ag/inclu/user-controll.php b/ag/inclu/user-controll.php index 17eb8df..f110dc5 100644 --- a/ag/inclu/user-controll.php +++ b/ag/inclu/user-controll.php @@ -11,18 +11,18 @@ include_once(ROOT_PATH.'//include/designfunctions.inc.php'); include_once (ROOT_PATH . '/include/clan.inc.php'); include_once (ROOT_PATH . '/include/clan_chat.inc.php'); -$itemsx1 = mysql_num_rows(mysql_query("SELECT id FROM sp_ware WHERE item='1' AND user='$user_ida[id]'")); -$itemsz1 = mysql_fetch_array(mysql_query("SELECT id FROM sp_ware WHERE item='1' AND user='$user_ida[id]' LIMIT 1")); +$itemsx1 = mysqli_stmt_num_rows(db_query("SELECT id FROM sp_ware WHERE item='1' AND user='$user_ida[id]'")); +$itemsz1 = mysqli_fetch_array(db_query("SELECT id FROM sp_ware WHERE item='1' AND user='$user_ida[id]' LIMIT 1")); -$itemsx2 = mysql_num_rows(mysql_query("SELECT id FROM sp_ware WHERE item='2' AND user='$user_ida[id]'")); -$itemsz2 = mysql_fetch_array(mysql_query("SELECT id FROM sp_ware WHERE item='2' AND user='$user_ida[id]' LIMIT 1")); +$itemsx2 = mysqli_stmt_num_rows(db_query("SELECT id FROM sp_ware WHERE item='2' AND user='$user_ida[id]'")); +$itemsz2 = mysqli_fetch_array(db_query("SELECT id FROM sp_ware WHERE item='2' AND user='$user_ida[id]' LIMIT 1")); -$anmeldungen = mysql_num_rows(mysql_Query("SELECT id FROM user")); -$db_info = mysql_num_rows(mysql_Query("SELECT id FROM sp_ware WHERE user='$user_ida[id]' AND item='11'")); +$anmeldungen = mysqli_stmt_num_rows(db_query("SELECT id FROM user")); +$db_info = mysqli_stmt_num_rows(db_query("SELECT id FROM sp_ware WHERE user='$user_ida[id]' AND item='11'")); -$user_info_test = mysql_Fetch_array(mysql_Query("SELECT geld FROM user WHERE nickname='$name' LIMIT 1")); +$user_info_test = mysqli_fetch_array(db_query("SELECT geld FROM user WHERE nickname='$name' LIMIT 1")); -//$nnn_nn = mysql_num_rows(mysql_query("SELECT id FROM nachricht WHERE besitzer='$user_ida[id]' AND ag='neu'")); +//$nnn_nn = mysqli_stmt_num_rows(db_query("SELECT id FROM nachricht WHERE besitzer='$user_ida[id]' AND ag='neu'")); //echo $nnn_nn; $zeit = date("H:i:s"); $date = date("d.m.y"); @@ -89,7 +89,7 @@ if ($name AND $passwort) { // $clan_009 .= "Clan Kämpfe Anzeige
"; // Ist user der leader? -// $chiefs = mysql_fetch_assoc(mysql_query('Select co_leader, leader from clan where id = '.$user_ida['clan'])); +// $chiefs = mysqli_fetch_assoc(db_query('Select co_leader, leader from clan where id = '.$user_ida['clan'])); // if($chiefs['co_leader'] == $user_ida['id'] || $chiefs['leader'] == $user_ida['id']){ // $clan_009 .= 'Clan Kämpfe
'; // } @@ -105,7 +105,7 @@ if ($name AND $passwort) { Halle der Helden
Letzten 20 Kämpfe
"; - $auktionensumme = mysql_fetch_assoc(mysql_query('SELECT SUM(aktuellesgebot) as summe FROM auktion WHERE bieter = ' . $user_ida['id'] . ' GROUP BY bieter')); + $auktionensumme = mysqli_fetch_assoc(db_query('SELECT SUM(aktuellesgebot) as summe FROM auktion WHERE bieter = ' . $user_ida['id'] . ' GROUP BY bieter')); $auktionensumme = $auktionensumme['summe']; if ($auktionensumme == 0) { @@ -138,7 +138,7 @@ if ($name AND $passwort) { Passwort Vergessen?
"; } - $active = mysql_fetch_assoc(mysql_query('select count(*) as anzahl from user where online_zeit between TIMESTAMPADD(DAY, -7, now()) and now()')); + $active = mysqli_fetch_assoc(db_query('select count(*) as anzahl from user where online_zeit between TIMESTAMPADD(DAY, -7, now()) and now()')); $o_datum = preg_split('# #',$online_rekord_1_0['datum']); $info_019 = " diff --git a/ag/include/abholcodes.inc.php b/ag/include/abholcodes.inc.php index 0456b59..2246b15 100644 --- a/ag/include/abholcodes.inc.php +++ b/ag/include/abholcodes.inc.php @@ -11,12 +11,12 @@ include_once(ROOT_PATH.'/include/random.inc.php'); function createAbholcode($charid){ $code = mt_random_wrapper(0, 44*$charid); $code = md5($code.time()); - mysql_query('DELETE from char_abholcodes where charid = '.$charid); - mysql_query('INSERT INTO char_abholcodes(charid, code) values('.$charid.', \''.$code.'\')'); + db_query('DELETE from char_abholcodes where charid = '.$charid); + db_query('INSERT INTO char_abholcodes(charid, code) values('.$charid.', \''.$code.'\')'); } function checkAbholcode($charid, $code){ - $code_row = mysql_fetch_assoc(mysql_query('Select * from char_abholcodes where charid = '.$charid)); + $code_row = mysqli_fetch_assoc(db_query('Select * from char_abholcodes where charid = '.$charid)); if($code_row){ return $code == $code_row['code']; } diff --git a/ag/include/arena.inc.php b/ag/include/arena.inc.php index 77549b8..9805fc2 100644 --- a/ag/include/arena.inc.php +++ b/ag/include/arena.inc.php @@ -23,7 +23,7 @@ function calculateArenaData($owner_id, $char_1, $char_2, $factor){ $arena['loge'] = 1000000; $arena['zustand'] = 1; } else { - $arena = mysql_fetch_assoc(mysql_query('SELECT * FROM arena WHERE besitzer = '.$owner_id)); + $arena = mysqli_fetch_assoc(db_query('SELECT * FROM arena WHERE besitzer = '.$owner_id)); } $wert_char1 = max(0.75,min(1.25,$char_1['siege']/($char_1['niederlagen'] + 0.01))) * getPowerLevelWithBuffs($char_1['id']); @@ -58,13 +58,13 @@ function calculateRenovierungsKosten($arena){ function getArena($user_id) { $sql_select = 'SELECT * FROM arena where besitzer = \''.$user_id.'\''; - $qry = mysql_query($sql_select); - if(mysql_num_rows($qry) == 0) { + $qry = db_query($sql_select); + if(mysqli_stmt_num_rows($qry) == 0) { $sql = 'INSERT arena(besitzer, exp) values (\''.$user_id.'\', \'0,'.calculateRequiredExpArena(1).'\')'; - mysql_query($sql); - $qry = mysql_query($sql_select); + db_query($sql); + $qry = db_query($sql_select); } - $arena = mysql_fetch_assoc($qry); + $arena = mysqli_fetch_assoc($qry); return $arena; } diff --git a/ag/include/attacke.inc.php b/ag/include/attacke.inc.php index 8921a4f..5d2110c 100644 --- a/ag/include/attacke.inc.php +++ b/ag/include/attacke.inc.php @@ -15,7 +15,7 @@ function getAttack($attack_id, $buffer = TRUE) { } if(!isset($GLOBALS['attack_buffered'][$attack_id])) { - $GLOBALS['attack_buffered'][$attack_id] = mysql_fetch_assoc(mysql_query('SELECT * FROM attacken WHERE id = ' . $attack_id)); + $GLOBALS['attack_buffered'][$attack_id] = mysqli_fetch_assoc(db_query('SELECT * FROM attacken WHERE id = ' . $attack_id)); } return $GLOBALS['attack_buffered'][$attack_id]; } diff --git a/ag/include/attackenset.inc.php b/ag/include/attackenset.inc.php index 1e34eb9..2805f21 100644 --- a/ag/include/attackenset.inc.php +++ b/ag/include/attackenset.inc.php @@ -30,7 +30,7 @@ function createAttackSet($char_id, $type) { } $qry = 'INSERT INTO attackenset VALUES '.$values.';'; - return mysql_query($qry); + return db_query($qry); } function deleteAttackSet($char_id, $type) { @@ -39,7 +39,7 @@ function deleteAttackSet($char_id, $type) { } $qry = 'DELETE FROM attackenset WHERE char_id = '.$char_id.' AND type = '.$type.';'; - return mysql_query($qry); + return db_query($qry); } function getAttackSet($char_id, $type) { @@ -49,7 +49,7 @@ function getAttackSet($char_id, $type) { $qry = db_query('SELECT attack_id, round FROM attackenset WHERE char_id = '.$char_id.' AND type = '.$type); $set = array(); - while ($result = mysql_fetch_assoc($qry)) { + while ($result = mysqli_fetch_assoc($qry)) { $set[$result['round']] = $result['attack_id']; } return $set; @@ -64,7 +64,7 @@ function updateAttackSet($char_id, $type, $newSet) { for ($i = 1; $i < KAMPF_RUNDEN + 1; $i++) { if($oldset[$i] != $newSet[$i]) { $qry = 'UPDATE attackenset SET attack_id = '.$newSet[$i].' WHERE char_id = '.$char_id.' AND type = '.$type.' AND round = '.$i.';'; - mysql_query($qry); + db_query($qry); } } return true; @@ -75,9 +75,9 @@ function getAttackNames($attackSet) { return array(); } - $qry = mysql_query('SELECT l.id,a.name FROM attacken a INNER JOIN lernen l ON a.id=l.at_id WHERE l.id in ('.implode(',', $attackSet).');'); + $qry = db_query('SELECT l.id,a.name FROM attacken a INNER JOIN lernen l ON a.id=l.at_id WHERE l.id in ('.implode(',', $attackSet).');'); - while ($result = mysql_fetch_assoc($qry)) { + while ($result = mysqli_fetch_assoc($qry)) { $set[$result['id']] = $result['name']; } @@ -89,8 +89,8 @@ function getAttackTypes($attackSet) { return array(); } - $qry = mysql_query('SELECT l.id,a.type,a.options FROM attacken a INNER JOIN lernen l ON a.id=l.at_id WHERE l.id in ('.implode(',', $attackSet).');'); - while ($result = mysql_fetch_assoc($qry)) { + $qry = db_query('SELECT l.id,a.type,a.options FROM attacken a INNER JOIN lernen l ON a.id=l.at_id WHERE l.id in ('.implode(',', $attackSet).');'); + while ($result = mysqli_fetch_assoc($qry)) { if($result['type'] == 'generic') { $options = json_decode($result['options'], true); $set[$result['id']] = $options['type']; @@ -116,9 +116,9 @@ function validateAttackSet($attackSet) { } //Alle Attackentypen auslesen - $qry = mysql_query('SELECT name, anzahl, kategorie FROM attackentyp;'); + $qry = db_query('SELECT name, anzahl, kategorie FROM attackentyp;'); $types = array(); - while ($row = mysql_fetch_assoc($qry)) { + while ($row = mysqli_fetch_assoc($qry)) { $types[$row['name']] = array('anzahl' => $row['anzahl'], 'kategorie' => $row['kategorie']); } diff --git a/ag/include/auktion_functions.inc.php b/ag/include/auktion_functions.inc.php index cbe2d6c..32360e2 100644 --- a/ag/include/auktion_functions.inc.php +++ b/ag/include/auktion_functions.inc.php @@ -27,11 +27,11 @@ include_once(ROOT_PATH.'/include/semaphore.inc.php'); // Returns Mindestgebot // @Return Integer function aktuellesMindestgebot($auktionsid){ - $qry = mysql_query('SELECT aktuellesgebot, startgebot FROM auktion WHERE auktionsid = '.$auktionsid); - if(mysql_num_rows($qry) != 1){ // Auktion nicht vorhanden?? + $qry = db_query('SELECT aktuellesgebot, startgebot FROM auktion WHERE auktionsid = '.$auktionsid); + if(mysqli_stmt_num_rows($qry) != 1){ // Auktion nicht vorhanden?? return -1; } - $result = mysql_fetch_assoc($qry); // Hole dir den einen Datensatz + $result = mysqli_fetch_assoc($qry); // Hole dir den einen Datensatz // Aktuelles Gebot vorhanden?? if($result['aktuellesgebot']!=NULL){ $minBetrag = $result['aktuellesgebot']*1.02; // Mindestens 2% mehr muss geboten werden @@ -49,9 +49,9 @@ function aktuellesMindestgebot($auktionsid){ */ function getUserAvailableMoney($userid) { //Nun muss noch geprueft werden ob der User genug Geld hat und auch mit allen Geboten gesamt nicht in den Minusbereich kommt - $user_a = mysql_fetch_assoc(mysql_query('SELECT nickname, geld FROM user WHERE id = '.$userid)); + $user_a = mysqli_fetch_assoc(db_query('SELECT nickname, geld FROM user WHERE id = '.$userid)); $usermoney = $user_a['geld']; - $auktionensumme = mysql_fetch_assoc(mysql_query('SELECT SUM(aktuellesgebot) as summe FROM auktion WHERE bieter = '.$userid)); + $auktionensumme = mysqli_fetch_assoc(db_query('SELECT SUM(aktuellesgebot) as summe FROM auktion WHERE bieter = '.$userid)); $auktionensumme = $auktionensumme['summe']; return $usermoney - $auktionensumme; @@ -99,9 +99,9 @@ function biete($userid, $auktionsid, $gebot){ //Nun muss noch geprueft werden ob der User genug Geld hat und auch mit allen Geboten gesamt nicht in den Minusbereich kommt - $user_a = mysql_fetch_assoc(mysql_query('SELECT nickname, geld FROM user WHERE id = '.$userid)); + $user_a = mysqli_fetch_assoc(db_query('SELECT nickname, geld FROM user WHERE id = '.$userid)); $usermoney = $user_a['geld']; - $auktionensumme = mysql_fetch_assoc(mysql_query('SELECT SUM(aktuellesgebot) as summe FROM auktion WHERE bieter = '.$userid.' AND auktionsid != '.$auktionsid.' GROUP BY bieter')); + $auktionensumme = mysqli_fetch_assoc(db_query('SELECT SUM(aktuellesgebot) as summe FROM auktion WHERE bieter = '.$userid.' AND auktionsid != '.$auktionsid.' GROUP BY bieter')); $auktionensumme = $auktionensumme['summe']; if($usermoney < $auktionensumme + $gebot){ @@ -110,18 +110,18 @@ function biete($userid, $auktionsid, $gebot){ //Wenn 10 minuten vor Deadline-ende geboten wird wird die deadline um 10 Minuten verschoben if($zeitdifferenz < 10){ - mysql_query('UPDATE auktion SET bieter='.$userid.', aktuellesgebot='.$gebot.', deadline=TIMESTAMPADD(Minute,10,TIMESTAMPADD(Second,-second(now()),now())) WHERE auktionsid='.$auktionsid); + db_query('UPDATE auktion SET bieter='.$userid.', aktuellesgebot='.$gebot.', deadline=TIMESTAMPADD(Minute,10,TIMESTAMPADD(Second,-second(now()),now())) WHERE auktionsid='.$auktionsid); // Speichern der neuen deadline in die deadlinevariable - $res_deadline = mysql_fetch_assoc(mysql_query('SELECT deadline FROM auktion WHERE auktionsid = '.$auktionsid)); + $res_deadline = mysqli_fetch_assoc(db_query('SELECT deadline FROM auktion WHERE auktionsid = '.$auktionsid)); $deadline = $res_deadline['deadline']; } else{ // Ansonsten nur die Grundwerte - mysql_query('UPDATE auktion SET bieter='.$userid.', aktuellesgebot='.$gebot.' WHERE auktionsid='.$auktionsid); + db_query('UPDATE auktion SET bieter='.$userid.', aktuellesgebot='.$gebot.' WHERE auktionsid='.$auktionsid); } // Nun noch den aktuellen bieter eine Nachricht senden sendMessage('Auktionsmarkt', $bieter, 'Überboten worden', 'Sie sind von '.$user_a['nickname'].' überboten worden, er bietet '.$gebot.' für das Item '.debbcode($itemname).'. Deadline: '.$deadline.' Link: [url='.$GLOBALS['server_url_long'].ROOT_URL.'/index.php?as=auktion&action=1&auktionsid='.$auktionsid.']Auktion[/url]'); -// mysql_query($new_query); +// db_query($new_query); // echo '

'.$new_query.'

'; return ''; // Leerer String, also kein Fehler! } @@ -139,9 +139,9 @@ function getItemOptions($userid,$preselected){ union SELECT i.id, i.item AS name, count(i.id) AS anzahl, \'wochen_ware\' as tablename FROM wochen_ware w INNER JOIN wochen_markt i ON(i.id=w.item) WHERE w.user = '.$userid.' GROUP BY (i.id)'; - $qry = mysql_query($query); + $qry = db_query($query); // Damit waeren alle noetigen Datenbankaufrufe erledigt! - while($row = mysql_fetch_assoc($qry)){ + while($row = mysqli_fetch_assoc($qry)){ if($row['id'] == $preselected){ $result[$index++] = ''; } @@ -189,23 +189,23 @@ function insertItem($userid,$id_db_mix, $anzahl, $startgebot){ // Nun die Anzahl vergleichen $test = 'SELECT count(i.id) AS anzahl FROM '.$db[0].' as w INNER JOIN '.$db[1].' as i ON(i.id=w.'.$db[2].') where w.user= '.$userid.' AND i.id = '.$id; - $result = mysql_fetch_assoc(mysql_query($test)); + $result = mysqli_fetch_assoc(db_query($test)); // echo $test; if($result['anzahl'] < $anzahl){ return 'Nicht genug Items (Vorhanden:'.$result['anzahl'].', Eingetragen:'.$anzahl.')'; } $test = 'SELECT '.$db[3].' AS name FROM '.$db[1].' WHERE id ='.$id; - $itemname = mysql_fetch_assoc(mysql_query($test)); + $itemname = mysqli_fetch_assoc(db_query($test)); // echo $test; // Nun werden dem User die Items abgezogen und in die auktionstabelle eingefuegt. - $qry = mysql_query('DELETE FROM '.$db[0].' WHERE '.$db[2].'='.$id.' AND user='.$userid.' LIMIT '.$anzahl); - $anzahl2 = mysql_affected_rows(); + $qry = db_query('DELETE FROM '.$db[0].' WHERE '.$db[2].'='.$id.' AND user='.$userid.' LIMIT '.$anzahl); + $anzahl2 = db_affected_rows(); if($anzahl2 == 0){ return 'Cheater!!'; } else if($anzahl != $anzahl2){ - mysql_query('INSERT INTO auktion (itemid, itemname, tablename, anbieter, anzahl, deadline, startgebot, startdate) VALUES('.$id.',\''.$itemname['name'].'\',\''.$db[0].'\','.$userid.','.$anzahl2.',TIMESTAMPADD(Day,3,TIMESTAMPADD(Second,-second(now()),now())),'.$startgebot.',now())'); + db_query('INSERT INTO auktion (itemid, itemname, tablename, anbieter, anzahl, deadline, startgebot, startdate) VALUES('.$id.',\''.$itemname['name'].'\',\''.$db[0].'\','.$userid.','.$anzahl2.',TIMESTAMPADD(Day,3,TIMESTAMPADD(Second,-second(now()),now())),'.$startgebot.',now())'); } else{ - mysql_query('INSERT INTO auktion (itemid, itemname, tablename, anbieter, anzahl, deadline, startgebot, startdate) VALUES('.$id.',\''.$itemname['name'].'\',\''.$db[0].'\','.$userid.','.$anzahl.',TIMESTAMPADD(Day,3,TIMESTAMPADD(Second,-second(now()),now())),'.$startgebot.',now())'); + db_query('INSERT INTO auktion (itemid, itemname, tablename, anbieter, anzahl, deadline, startgebot, startdate) VALUES('.$id.',\''.$itemname['name'].'\',\''.$db[0].'\','.$userid.','.$anzahl.',TIMESTAMPADD(Day,3,TIMESTAMPADD(Second,-second(now()),now())),'.$startgebot.',now())'); } return ''; } @@ -214,8 +214,8 @@ function insertItem($userid,$id_db_mix, $anzahl, $startgebot){ // Diese Funktion erstellt die Auktionstabelle und die Transaktionentabelle function createTables(){ // Erstellen der Auktionstabelle - mysql_query('DROP TABLE auktion'); - mysql_query(' + db_query('DROP TABLE auktion'); + db_query(' CREATE TABLE `auktion` ( `auktionsid` int(10) unsigned NOT NULL auto_increment, `anbieter` int(10) unsigned NOT NULL, @@ -233,8 +233,8 @@ function createTables(){ ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=0 ; '); - mysql_query('DROP TABLE auktion_transaktionen'); - mysql_query(' + db_query('DROP TABLE auktion_transaktionen'); + db_query(' CREATE TABLE `auktion_transaktionen` ( `transaktionsid` int(10) unsigned NOT NULL auto_increment, `anbieter` int(10) unsigned NOT NULL, @@ -267,11 +267,11 @@ function getAuktionTotalCount($kategorie,$itemnamepart,$maxPrice){ $stringDelimiter = ' AND itemname LIKE \'%'.$itemnamepart.'%\' '; } $test = 'SELECT count(auktionsid) as anzahl FROM auktion WHERE 1 '.$kategorieDelimitier.$stringDelimiter.$priceDelimiter.' AND TIMESTAMPDIFF(Minute,now(),deadline) >= 0'; - $qry = mysql_query($test); - if(mysql_num_rows($qry) == 0){ + $qry = db_query($test); + if(mysqli_stmt_num_rows($qry) == 0){ return 0; } - $result = mysql_fetch_assoc($qry); + $result = mysqli_fetch_assoc($qry); return $result['anzahl']; } @@ -294,9 +294,9 @@ function getAuktionEntries($kategorie,$itemnamepart,$entriesPerSite,$pageNumber, } $index = 0; $test = 'SELECT a.auktionsid, u.nickname AS anbietername, u2.nickname AS bietername, a.deadline, a.aktuellesgebot, a.startgebot, a.anzahl, a.itemname, a.bieter, a.anbieter, a.itemid, a.tablename 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 1 '.$kategorieDelimitier.$stringDelimiter.$priceDelimiter.' AND TIMESTAMPDIFF(Minute,now(),deadline) >= 0 ORDER BY '.$order.' '.$dir.' '.$interval; - $qry = mysql_query($test); + $qry = db_query($test); //echo '
'.$test.'
'; - while($result = mysql_fetch_assoc($qry)){ + while($result = mysqli_fetch_assoc($qry)){ $returnArray[$index++] = $result; } return $returnArray; @@ -304,9 +304,9 @@ function getAuktionEntries($kategorie,$itemnamepart,$entriesPerSite,$pageNumber, function getEntryInformation($auktionsid){ if(!is_numeric($auktionsid)){return;} - $qry = mysql_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; } - return mysql_fetch_assoc($qry); + $qry = db_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(mysqli_stmt_num_rows($qry) == 0){ return NULL; } + return mysqli_fetch_assoc($qry); } function getKategorieOptions($preselect){ @@ -318,8 +318,8 @@ function getKategorieOptions($preselect){ $total = 0; $select = false; - $qry = mysql_query('SELECT tablename,count(tablename) as anzahl FROM auktion WHERE TIMESTAMPDIFF(Minute,now(),deadline) >= 0 AND itemname != \'Geheim!\' GROUP BY tablename'); - while($row = mysql_fetch_assoc($qry)){ + $qry = db_query('SELECT tablename,count(tablename) as anzahl FROM auktion WHERE TIMESTAMPDIFF(Minute,now(),deadline) >= 0 AND itemname != \'Geheim!\' GROUP BY tablename'); + while($row = mysqli_fetch_assoc($qry)){ if($preselect == $row['tablename']){ $result[$index++] = ''; $select = true; @@ -349,10 +349,10 @@ function zurueckziehen($userid, $auktionsid, $pay){ return 'Es wurde zwischenzeitlich geboten! Zurückziehen nur mit Gebühr möglich!'; } $gebuehr = floor($auktionsdaten['aktuellesgebot'] * 0.1); - mysql_query('UPDATE user SET geld=geld-'.$gebuehr.' WHERE id='.$userid); + db_query('UPDATE user SET geld=geld-'.$gebuehr.' WHERE id='.$userid); - mysql_query('DELETE FROM auktion WHERE auktionsid='.$auktionsid); - $anzahl2 = mysql_affected_rows(); + db_query('DELETE FROM auktion WHERE auktionsid='.$auktionsid); + $anzahl2 = db_affected_rows(); if($anzahl2 == 0){ return 'CHEATER!!'; } @@ -361,23 +361,23 @@ function zurueckziehen($userid, $auktionsid, $pay){ if($auktionsdaten['tablename'] == 'ware'){$item_row_name = 'item_id';} while($anzahl-- > 0){ $sql = 'INSERT INTO '.$auktionsdaten['tablename'].' ('.$item_row_name.', user) VALUES('.$auktionsdaten['itemid'].','.$userid.')'; - mysql_query($sql); + db_query($sql); // echo '
'.$sql.'
'; } $sql = 'INSERT INTO nachricht(von, besitzer, betreff, text) VALUES (\'Auktionsmarkt\', '.$auktionsdaten['anbieter'].', \'Item zurückgezogen!\', \' Sie haben das Item '.$auktionsdaten['itemname'].' für eine Gebühr von '.$gebuehr.' zurückgezogen!\')'; - mysql_query($sql); + db_query($sql); // echo '
'.$sql.'
'; if($auktionsdaten['bieter'] != NULL){ $sql = 'INSERT INTO nachricht(von, besitzer, betreff, text) VALUES (\'Auktionsmarkt\', '.$auktionsdaten['bieter'].', \'Item zurückgezogen!\', \' Das Item '.$auktionsdaten['itemname'].' wurde von '.$auktionsdaten['anbietername'].' zurückgezogen!\')'; - mysql_query($sql); + db_query($sql); // echo '
'.$sql.'
'; } } 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 and TIMESTAMPADD(DAY,30,deadline) > CURRENT_TIMESTAMP'; - $qry = mysql_query($sql); - $row = mysql_fetch_assoc($qry); + $qry = db_query($sql); + $row = mysqli_fetch_assoc($qry); return round($row['average']*$anzahl); } diff --git a/ag/include/bann.inc.php b/ag/include/bann.inc.php index ae6466b..d1c7a70 100644 --- a/ag/include/bann.inc.php +++ b/ag/include/bann.inc.php @@ -6,7 +6,7 @@ * */ function isSpammer($id){ - $result = mysql_fetch_assoc(mysql_query('SELECT TIMESTAMPDIFF(Second,max(bann_until),now()) as anzahl from spammer WHERE userid='.$id.' group by userid')); + $result = mysqli_fetch_assoc(db_query('SELECT TIMESTAMPDIFF(Second,max(bann_until),now()) as anzahl from spammer WHERE userid='.$id.' group by userid')); if($result['anzahl'] < 0){ return true; } else{ @@ -17,11 +17,11 @@ function isSpammer($id){ function becomeSpammer($id,$nick,$text){ // Es gibt 2 indikatoren ein Spammer zu sein // Man schreibt min 10 posts innerhalb von 20 Sekunden - $result1 = mysql_num_rows(mysql_query('SELECT * FROM ag_chat WHERE user=\''.$nick.'\' and TIMESTAMPDIFF(Second,zeit,now()) <= 20')); + $result1 = mysqli_stmt_num_rows(db_query('SELECT * FROM ag_chat WHERE user=\''.$nick.'\' and TIMESTAMPDIFF(Second,zeit,now()) <= 20')); // Man schreibt min 30 Posts innerhalb einer Minute - $result2 = mysql_num_rows(mysql_query('SELECT * FROM ag_chat WHERE user=\''.$nick.'\' and TIMESTAMPDIFF(Second,zeit,now()) <= 60')); + $result2 = mysqli_stmt_num_rows(db_query('SELECT * FROM ag_chat WHERE user=\''.$nick.'\' and TIMESTAMPDIFF(Second,zeit,now()) <= 60')); // Innerhalb einer halben Minute 4 mal den selben Post!! - $result3 = mysql_num_rows(mysql_query('SELECT * FROM ag_chat WHERE user=\''.$nick.'\' AND TIMESTAMPDIFF(Second,zeit,now()) <= 30 AND nachricht = \''.$text.'\'')); + $result3 = mysqli_stmt_num_rows(db_query('SELECT * FROM ag_chat WHERE user=\''.$nick.'\' AND TIMESTAMPDIFF(Second,zeit,now()) <= 30 AND nachricht = \''.$text.'\'')); // Und nun noch ein paar Aergernisse @@ -40,21 +40,21 @@ function becomeSpammer($id,$nick,$text){ } function setSpamblock($id){ - $anzahl = mysql_num_rows(mysql_query('SELECT * FROM spammer WHERE userid='.$id.' AND TIMESTAMPDIFF(Day,bann_until,now()) <=14')); + $anzahl = mysqli_stmt_num_rows(db_query('SELECT * FROM spammer WHERE userid='.$id.' AND TIMESTAMPDIFF(Day,bann_until,now()) <=14')); $zeit = pow(5,($anzahl+1)); - mysql_query('INSERT INTO spammer(userid, bann_until) values('.$id.',TIMESTAMPADD(Minute,'.$zeit.',now()))'); + db_query('INSERT INTO spammer(userid, bann_until) values('.$id.',TIMESTAMPADD(Minute,'.$zeit.',now()))'); } function releaseSpamblock($id){ - mysql_query('DELETE from spammer where userid='.$id.' and TIMESTAMPDIFF(Second,bann_until,now()) < 0'); + db_query('DELETE from spammer where userid='.$id.' and TIMESTAMPDIFF(Second,bann_until,now()) < 0'); } function bannAccount($id){ - mysql_query('UPDATE user SET bann = \'ja\' WHERE id='.$id); + db_query('UPDATE user SET bann = \'ja\' WHERE id='.$id); } function unbannAccount($id){ - mysql_query('UPDATE user SET bann = \'nein\' WHERE id='.$id); + db_query('UPDATE user SET bann = \'nein\' WHERE id='.$id); } ?> diff --git a/ag/include/char.inc.php b/ag/include/char.inc.php index 8988fd4..ad8cdf9 100644 --- a/ag/include/char.inc.php +++ b/ag/include/char.inc.php @@ -39,32 +39,32 @@ function getStatus($charid, $buffer_enabled = true) { } $sql = 'SELECT count(*) as anzahl FROM turnier_kampf t where art != \'gross\' and (win = ' . $charid . ' or lose = ' . $charid . ') and dauer > now()'; - $row = mysql_fetch_assoc(mysql_query($sql)); + $row = mysqli_fetch_assoc(db_query($sql)); if ($row['anzahl'] > 0) { $GLOBALS['char_buffered_statuses'][$charid] = 'Turnier'; return 'Turnier'; } $sql = 'SELECT count(*) as anzahl from quests where charid = ' . $charid; - $row = mysql_fetch_assoc(mysql_query($sql)); + $row = mysqli_fetch_assoc(db_query($sql)); if ($row['anzahl'] > 0) { $GLOBALS['char_buffered_statuses'][$charid] = 'Schatz Suche'; return 'Schatz Suche'; } $sql = 'SELECT count(*) as anzahl from kampf where db_satz = ' . $charid; - $row = mysql_fetch_assoc(mysql_query($sql)); + $row = mysqli_fetch_assoc(db_query($sql)); if ($row['anzahl'] > 0) { $GLOBALS['char_buffered_statuses'][$charid] = 'Kampf'; return 'Kampf'; } $sql = 'SELECT count(*) as anzahl FROM kampf_list where charakter = ' . $charid; - $row = mysql_fetch_assoc(mysql_query($sql)); + $row = mysqli_fetch_assoc(db_query($sql)); if ($row['anzahl'] > 0) { $GLOBALS['char_buffered_statuses'][$charid] = 'Kampf erstellt'; return 'Kampf erstellt'; } $sql = 'SELECT count(*) as anzahl FROM turnier1 where charakter = ' . $charid; - $row = mysql_fetch_assoc(mysql_query($sql)); + $row = mysqli_fetch_assoc(db_query($sql)); if ($row['anzahl'] > 0) { $GLOBALS['char_buffered_statuses'][$charid] = 'Angemeldet'; return 'Angemeldet'; @@ -114,7 +114,7 @@ function getChar2($charid) { if(!is_numeric($charid)){ return null; } else { - $char = mysql_fetch_assoc(mysql_query('Select * from chars where id = '.$charid)); + $char = mysqli_fetch_assoc(db_query('Select * from chars where id = '.$charid)); if(!$char){return null;} // Speichere in $char['stauts'] den aktuellen Status des Chars (buffer-Strategie ist hierbei die selbe) $char['status'] = getStatus($char['id'],$buffer_enabled); @@ -171,7 +171,7 @@ function getCharWithBuffs($charid, $buffer_enabled = true){ function getCharBuffs($items) { if($items != NULL && $items != ',,,,'){ - $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 ('.$items.')')); + $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 ('.$items.')')); } return $char_buffs; } @@ -206,8 +206,8 @@ function getCharsOfUser($userid, $buffer_enabled = true) { if ($GLOBALS['chars_read_out_user'][$userid] == null || !$buffer_enabled) { $GLOBALS['chars_read_out_user'][$userid] = array(); - $qry = mysql_query('Select id from chars where besitzer = '.$userid.' order by id'); - while($char = mysql_fetch_assoc($qry)){ + $qry = db_query('Select id from chars where besitzer = '.$userid.' order by id'); + while($char = mysqli_fetch_assoc($qry)){ $GLOBALS['chars_read_out_user'][$userid][] = &getChar($char['id'], $buffer_enabled); } } @@ -221,8 +221,8 @@ function deleteChar($userid, $charid){ } else if($char['status'] != 'Frei'){ return 'Char ist nicht Frei!'; } - mysql_query('Delete from lernen where besitzer = '.$charid); - mysql_query('Delete from chars where id = '.$charid); + db_query('Delete from lernen where besitzer = '.$charid); + db_query('Delete from chars where id = '.$charid); return true; } @@ -263,7 +263,7 @@ function getPowerLevelWithBuffs($charid, $buffer_enabled = true){ return null; } if($char['kampf_item'] != NULL && $char['kampf_item'] != ',,,,'){ - $char_buffs = mysql_fetch_assoc(mysql_query('SELECT sum(i.hp) as hp, sum(i.mp) as mp, sum(i.starke) as starke, sum(i.verteidigung) as verteidigung, sum(i.speed) as speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id IN (' . $char['kampf_item'] . ')')); + $char_buffs = mysqli_fetch_assoc(db_query('SELECT sum(i.hp) as hp, sum(i.mp) as mp, sum(i.starke) as starke, sum(i.verteidigung) as verteidigung, sum(i.speed) as speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id IN (' . $char['kampf_item'] . ')')); } // Uncomment for hp/mp in PL 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']; @@ -274,8 +274,8 @@ function getPowerLevelWithBuffs($charid, $buffer_enabled = true){ */ function getCharAttacks($charid){ $attacks = array(); - $qry = mysql_query("SELECT name, id, at_id FROM lernen WHERE besitzer='$charid' AND aktiv > '0' order by id"); - while($row = mysql_fetch_array($qry)) { + $qry = db_query("SELECT name, id, at_id FROM lernen WHERE besitzer='$charid' AND aktiv > '0' order by id"); + while($row = mysqli_fetch_array($qry)) { $attacks[] = array('name'=>$row['name'], 'id'=>$row['id'], 'at_id'=>$row['at_id']); } return $attacks; @@ -325,7 +325,7 @@ function getAttacksforChar($charid, $mode = 0) { // make a union out of both (TODO: maybe an outer join would result into the same result) $sql = '('.$sql.') union distinct ('.$sql2.') order by level'; - $qry = mysql_query($sql); + $qry = db_query($sql); if($qry === FALSE) // print sql on error echo '
'.$sql.'
'; @@ -343,7 +343,7 @@ function getAttacksforChar($charid, $mode = 0) { $attacke = array(); $requires = array(); - while($row = mysql_fetch_assoc($qry)) { + while($row = mysqli_fetch_assoc($qry)) { $attacke[$row['id']] = $row; if($row['unknown'] == 0 && $mode == 1) { diff --git a/ag/include/char_profil.inc.php b/ag/include/char_profil.inc.php index 535673c..367f5d5 100644 --- a/ag/include/char_profil.inc.php +++ b/ag/include/char_profil.inc.php @@ -12,11 +12,11 @@ defineIfNotDefined('STATUS_FREI', 'Frei'); //Dadurch kriege ich detailierte infos, sollte ein mysql query mal inkorrekt sein! function safe_query($query="") { if(empty($query)) return false; - if(DEBUG == "OFF") $result = mysql_query($query) or die('Query failed!'); + if(DEBUG == "OFF") $result = db_query($query) or die('Query failed!'); else { - $result = mysql_query($query) or die('Query failed: ' - .'
  • errorno='.mysql_errno() - .'
  • error='.mysql_error() + $result = db_query($query) or die('Query failed: ' + .'
  • errorno='.mysqli_errno($GLOBALS['main_db']) + .'
  • error='.mysqli_error($GLOBALS['main_db']) .'
  • query='.$query); } return $result; @@ -30,7 +30,7 @@ function chardaten($char_id,$name,&$char_1,&$hp1,&$mp1,&$exp,&$fehler) { $hp1 = explode(',', $char_1['hp']); $mp1 = explode(',', $char_1['mp']); $exp = explode(',', $char_1['exp']); - $user = mysql_Fetch_array(mysql_query("SELECT id FROM user WHERE nickname='$name' LIMIT 1")); + $user = mysqli_fetch_array(db_query("SELECT id FROM user WHERE nickname='$name' LIMIT 1")); if($char_1['besitzer'] != $user[0]) { $fehler= 'Dieser Char gehört nicht dir!'; } diff --git a/ag/include/cheater.inc.php b/ag/include/cheater.inc.php index 164a544..af7d6b7 100644 --- a/ag/include/cheater.inc.php +++ b/ag/include/cheater.inc.php @@ -16,9 +16,9 @@ function checkCookies($nickname, $yps) { if (isset ($nick_name2) && strtolower($nick_name2) != strtolower($nickname)) { // Ha!!! Da ist doch was faul!! // sortiere die namen - $m_user_qry = mysql_query('SELECT * FROM user where nickname IN (\'' . $nickname . '\',\'' . $nick_name2 . '\') order by id'); + $m_user_qry = db_query('SELECT * FROM user where nickname IN (\'' . $nickname . '\',\'' . $nick_name2 . '\') order by id'); $muser = array (); - while ($row = mysql_fetch_assoc($m_user_qry)) { + while ($row = mysqli_fetch_assoc($m_user_qry)) { $muser[] = $row; } if (count($muser) != 2) { @@ -26,17 +26,17 @@ function checkCookies($nickname, $yps) { } // Neue Tabelle $sql = 'INSERT INTO multiuser(user1, user2, occured, type) values(\'' . $muser[0]['id'] . '\', \'' . $muser[1]['id'] . '\',CURRENT_TIMESTAMP, \'Cookie\')'; - mysql_query($sql); + db_query($sql); } } function detectNonCodeEnterers(){ - $qry = mysql_query('Select * from bot_images WHERE TIMESTAMPDIFF(MINUTE, created, now()) > 10'); - mysql_query('DELETE from bot_images WHERE TIMESTAMPDIFF(MINUTE, created, now()) > 10 '); - while($row = mysql_fetch_assoc($qry)){ + $qry = db_query('Select * from bot_images WHERE TIMESTAMPDIFF(MINUTE, created, now()) > 10'); + db_query('DELETE from bot_images WHERE TIMESTAMPDIFF(MINUTE, created, now()) > 10 '); + while($row = mysqli_fetch_assoc($qry)){ $sql = 'Insert into bot_image_failures(userid, inserted, valid, used) values('.$row['userid'].', \'!NOTHING!\', \''.$row['compressed_phrase'].'\', \''.$row['created'].'\')'; // echo $sql.'
    '; - mysql_query($sql); + db_query($sql); } } diff --git a/ag/include/clan.inc.php b/ag/include/clan.inc.php index 5ae925c..0b174a0 100644 --- a/ag/include/clan.inc.php +++ b/ag/include/clan.inc.php @@ -26,7 +26,7 @@ function getClan($clanid, $buffer = TRUE) { return $GLOBALS['clan_buffered_instances'][$clanid]; // okay, we already buffered the clan :) } - $clan = mysql_fetch_assoc(mysql_query('SELECT * FROM clan WHERE id = '. $clanid)); + $clan = mysqli_fetch_assoc(db_query('SELECT * FROM clan WHERE id = '. $clanid)); // now calculate the member, max_exp fields :D @@ -41,7 +41,7 @@ function getClan($clanid, $buffer = TRUE) { function getClanMembersCount($clanid) { if(!is_numeric($clanid)) { return NULL; } - $row = mysql_fetch_assoc(mysql_query('SELECT count(id) as amount FROM user WHERE clan = '. $clanid)); + $row = mysqli_fetch_assoc(db_query('SELECT count(id) as amount FROM user WHERE clan = '. $clanid)); return $row['amount']; } @@ -120,8 +120,8 @@ function revokeInvitation($user, $userid, $clan = NULL){ } if($clan === NULL) { - $qry = mysql_query('Select * from clan where id = ' . $user['clan']); - $clan = mysql_fetch_assoc($qry); + $qry = db_query('Select * from clan where id = ' . $user['clan']); + $clan = mysqli_fetch_assoc($qry); } if($clan['leader'] != $user['id'] && $clan['co_leader'] != $user['id']){ @@ -130,8 +130,8 @@ function revokeInvitation($user, $userid, $clan = NULL){ $sql = 'DELETE FROM user_clan_invitations WHERE clanid = '.$clan['id'].' AND userid = '.$userid; // echo $sql . '
    '; - mysql_query($sql); - if(mysql_affected_rows() > 0){ + db_query($sql); + if(db_affected_rows() > 0){ return NULL; } else{ return 'Einladung konnte nicht zurückgezogen werden!'; @@ -151,15 +151,15 @@ function inviteUser(array $user, $userid, array $clan = NULL){ } if($clan === NULL) { - $qry = mysql_query('Select * from clan where id = ' . $user['clan']); - $clan = mysql_fetch_assoc($qry); + $qry = db_query('Select * from clan where id = ' . $user['clan']); + $clan = mysqli_fetch_assoc($qry); } if($clan['leader'] != $user['id'] && $clan['co_leader'] != $user['id']){ return 'Nur der Leader, bzw. der Co-Leader kann neue Member einladen!'; } - $row = mysql_fetch_assoc(mysql_query('SELECT * FROM user where id = \''. $userid.'\'')); + $row = mysqli_fetch_assoc(db_query('SELECT * FROM user where id = \''. $userid.'\'')); if(!row) { return 'Fehler! Nutzer exisitiert nicht!!'; } @@ -169,12 +169,12 @@ function inviteUser(array $user, $userid, array $clan = NULL){ $sql = 'INSERT INTO user_clan_invitations(userid, clanid, valid) values('.$userid.','.$user['clan'].',TIMESTAMPADD(DAY, 5, now()))'; // echo $sql.'
    '; - mysql_query($sql); - if(mysql_affected_rows() <= 0){ // Fehler? + db_query($sql); + if(db_affected_rows() <= 0){ // Fehler? $sql = 'UPDATE user_clan_invitations SET valid = TIMESTAMPADD(DAY, 5, now()) where userid = '.$userid.' and clanid = '.$user['clan']; // echo $sql.'
    '; - mysql_query($sql); - if(mysql_affected_rows() <= 0){ // Fehler? + db_query($sql); + if(db_affected_rows() <= 0){ // Fehler? return 'Fehler! Konnte Nutzer nicht einladen!'; } else{ sendMessage($user['nickname'], $userid, 'Einladung in Clan', 'Die Einladung des Clans '.$clan['clanname'].' wurde aufgefrischt! Klicke auf "Clan beitreten" um die Einladung anzunehmen!'); @@ -191,19 +191,19 @@ function fireMember($user, $member){ if($member != $clan['leader'] && $member != $clan['co_leader'] && ($user['id'] == $clan['leader'] || $user['id'] == $clan['co_leader'] || $member == $user['id'])){ $sql = 'Update user set clan = NULL where id = '.$member.' AND clan = '.$user['clan']; // echo $sql.'
    '; - mysql_query($sql); - if(mysql_affected_rows() > 0){ // Soll nur ausgeführt werden, wenn member wirklich gekickt wurde!! + db_query($sql); + if(db_affected_rows() > 0){ // Soll nur ausgeführt werden, wenn member wirklich gekickt wurde!! $sql = 'Update chars set clan_train = NULL where besitzer = '.$member; - mysql_query($sql); + db_query($sql); if($user['id'] != $member) { sendMessage($user['nickname'], $member, 'Clan rauswurf!', 'Du wurdest von '.$user['nickname'].' aus deinem Clan geworfen. Du wirst dir wohl einen neuen suchen müssen!'); } else if($clan['exp'] == 0 && $clan['level'] == 1 && getClanMembersCount($user['clan']) == 0) { - mysql_query('DELETE FROM clan WHERE id =' .$user['clan']); + db_query('DELETE FROM clan WHERE id =' .$user['clan']); } // delete the participation in open clan fights! Thats tricky because the user itself is not stored in the database!! - mysql_query('DELETE FROM clan_challenge_whitelist WHERE clan_id = ' .$clan['id'] . ' AND user_id = ' .$user['id']); - mysql_query('DELETE FROM clan_challenge_participants WHERE clan_challenge_id in (SELECT clan_challenge_id FROM clan_challenge where calculated = FALSE) and char_id IN (Select id FROM chars where besitzer = '.$user['id'].')'); + db_query('DELETE FROM clan_challenge_whitelist WHERE clan_id = ' .$clan['id'] . ' AND user_id = ' .$user['id']); + db_query('DELETE FROM clan_challenge_participants WHERE clan_challenge_id in (SELECT clan_challenge_id FROM clan_challenge where calculated = FALSE) and char_id IN (Select id FROM chars where besitzer = '.$user['id'].')'); } } else{ echo displayErrorMessage(NULL, 'Du kannst den Member nicht feuern!', displayHistoryBackLink()); @@ -216,8 +216,8 @@ function fireMember($user, $member){ * */ function getAllClans() { - $qry = mysql_query('SELECT id,clanname FROM clan;'); - while ($result = mysql_fetch_assoc($qry)) { + $qry = db_query('SELECT id,clanname FROM clan;'); + while ($result = mysqli_fetch_assoc($qry)) { $clans[] = $result; } return $clans; @@ -228,7 +228,7 @@ function joinClan($user, $clanid, $check_invitation = true){ isClanLocked($clanid); // we only require the calculation not the result! $sql = 'SELECT * FROM user_clan_invitations WHERE userid = '.$user['id'].' and clanid = '.$clanid.' and valid > now();'; - $clan_user = mysql_fetch_assoc(mysql_query($sql)); + $clan_user = mysqli_fetch_assoc(db_query($sql)); if($clan_user || !$check_invitation){ $clan = getClan($clanid); @@ -241,13 +241,13 @@ function joinClan($user, $clanid, $check_invitation = true){ } else{ $sql = 'UPDATE user SET clan = '.$clanid.' WHERE id = '.$user['id']; // echo $sql.'
    '; - mysql_query($sql); + db_query($sql); // unset the leader if the user is moving from one clan to another - mysql_query('UPDATE clan SET leader = NULL WHERE leader = ' .$user['id'] . ' and id != ' .$clanid); - mysql_query('UPDATE clan SET co_leader = NULL WHERE co_leader = ' .$user['id'] . ' and id != ' .$clanid); - mysql_query('DELETE FROM clan_challenge_whitelist WHERE clan_id = ' .$clanid . ' AND user_id = ' .$user['id']); - mysql_query('DELETE FROM clan_challenge_participants where char_id IN (SELECT id from chars where besitzer = '.$user['id'].') and clan_challenge_id IN (SELECT clan_challenge_id from clan_challenges WHERE calculated = 0)'); + db_query('UPDATE clan SET leader = NULL WHERE leader = ' .$user['id'] . ' and id != ' .$clanid); + db_query('UPDATE clan SET co_leader = NULL WHERE co_leader = ' .$user['id'] . ' and id != ' .$clanid); + db_query('DELETE FROM clan_challenge_whitelist WHERE clan_id = ' .$clanid . ' AND user_id = ' .$user['id']); + db_query('DELETE FROM clan_challenge_participants where char_id IN (SELECT id from chars where besitzer = '.$user['id'].') and clan_challenge_id IN (SELECT clan_challenge_id from clan_challenges WHERE calculated = 0)'); if($check_invitation) { displayErrorMessage('Aufgenommen','Du wurdest erfolgreich in den Clan aufgenommen!','weiter'); @@ -257,12 +257,12 @@ function joinClan($user, $clanid, $check_invitation = true){ displayErrorMessage(NULL,'Konnte die Einladung des Clans nicht annehmen!',displayHistoryBackLink()); return; } - mysql_query('DELETE FROM user_clan_invitations WHERE userid = '.$user['id'].' and clanid = '.$clanid); + db_query('DELETE FROM user_clan_invitations WHERE userid = '.$user['id'].' and clanid = '.$clanid); } function denyClan($user, $clanid){ - mysql_query('DELETE FROM user_clan_invitations WHERE userid = '.$user['id'].' and clanid = '.$clanid); - if(mysql_affected_rows() > 0){ + db_query('DELETE FROM user_clan_invitations WHERE userid = '.$user['id'].' and clanid = '.$clanid); + if(db_affected_rows() > 0){ displayErrorMessage('Abgelehnt','Du hast die Einladung erfolgreich abgelehnt!','weiter'); } else{ displayErrorMessage(NULL,'Einladung des Clans konnte nicht abgelehnt werden!',displayHistoryBackLink()); @@ -280,15 +280,15 @@ function deleteClan($userid) { // Okay notify the members :) - $qry = mysql_query('SELECT id FROM user WHERE clan = '.$user['clan']); - while($member = mysql_fetch_assoc($qry)) { + $qry = db_query('SELECT id FROM user WHERE clan = '.$user['clan']); + while($member = mysqli_fetch_assoc($qry)) { sendMessage($user['nickname'], $member['id'], 'Clan wurde gelöscht!', 'Dein Clan wurde von '.$user['nickname'].' gelöscht. Du wirst dir wohl einen neuen suchen müssen!'); } // Check if this clan is level 0 and has 0 exp ... if($clan['exp'] == 0 && $clan['level'] == 1) { // really do delete the clan !! - mysql_query('DELETE FROM clan where id = '.$user['clan']); + db_query('DELETE FROM clan where id = '.$user['clan']); } else { // cleanup the clan! $sql1 = 'UPDATE user SET clan = NULL WHERE clan = ' . $clanid; @@ -298,8 +298,8 @@ function deleteClan($userid) { // echo $sql1 . '
    '; // echo $sql2 . '
    '; - mysql_query($sql1); - mysql_query($sql2); + db_query($sql1); + db_query($sql2); } return NULL; @@ -308,15 +308,15 @@ function deleteClan($userid) { function conquerClan($clanid, $userid) { // It is possible to enter a clan that is empty :) $user = getUser($userid); - $result = mysql_fetch_row(mysql_query('SELECT count(*) FROM user WHERE clan = ' . $clanid)); + $result = mysqli_fetch_row(db_query('SELECT count(*) FROM user WHERE clan = ' . $clanid)); if($result[0] != 0) { return 'Der Clan ('.$clanid.') ist nicht leer!'; } $sql = 'UPDATE clan SET leader = ' . $userid . ' WHERE leader is NULL AND id = '. $clanid; - mysql_query($sql); + db_query($sql); - $done = mysql_affected_rows() > 0; + $done = db_affected_rows() > 0; if(!$done) { return 'Der Clan ist schon übernommen worden!'; } @@ -327,8 +327,8 @@ function conquerClan($clanid, $userid) { } function setMeAsLeader($user){ - mysql_query('UPDATE clan set leader = '.$user['id'].' WHERE id = '.$user['clan'].' and leader IS null AND co_leader IS null'); - return mysql_affected_rows() > 0; + db_query('UPDATE clan set leader = '.$user['id'].' WHERE id = '.$user['clan'].' and leader IS null AND co_leader IS null'); + return db_affected_rows() > 0; } @@ -354,8 +354,8 @@ function sendClanNewsletter($user, $text){ } $errors = FALSE; $sql = 'SELECT id FROM user WHERE clan='.$user['clan']; - $clans = mysql_query($sql); - while($row = mysql_fetch_assoc($clans)) { + $clans = db_query($sql); + while($row = mysqli_fetch_assoc($clans)) { $errors |= !sendMessage($user['nickname'], $row['id'], $clan['clanname'].' Nachricht', $text); } if($errors) { @@ -378,15 +378,15 @@ function addClanExp($clan_id, $exp) { $n_exp = 0; $n_level++; } - mysql_query('UPDATE clan SET exp = ' .$n_exp. ', level = ' .$n_level . ' WHERE id = ' .$clan_id . ' AND exp = ' .$clan['exp'] . ' AND level = ' .$clan['level']); - if(mysql_affected_rows() == 0) { + db_query('UPDATE clan SET exp = ' .$n_exp. ', level = ' .$n_level . ' WHERE id = ' .$clan_id . ' AND exp = ' .$clan['exp'] . ' AND level = ' .$clan['level']); + if(db_affected_rows() == 0) { echo 'Fehler beim zuweisen der Clanexp, dadurch sind dem Clan mit der ID ' . $clan['level'] . ' ' .$exp . ' exp fl&omul;ten gegangen!! Neue exp wären ' . $n_exp . ' bei level ' .$n_level; } else { $money = getMoneyBonusByLevel($n_level); if($money > 0) { // nice we can give the clan some money :D insertClanTickerMessage($clan_id, 'Durch Erreichen von Level ' .$n_level . ' habt ihr ' . displayMoney($money) . ' bekommen!!'); - mysql_query('UPDATE clan SET geld = geld + ' . $money . ' WHERE id = ' .$clan_id ); + db_query('UPDATE clan SET geld = geld + ' . $money . ' WHERE id = ' .$clan_id ); } } } diff --git a/ag/include/clan_chat.inc.php b/ag/include/clan_chat.inc.php index a48b5d9..c64f578 100644 --- a/ag/include/clan_chat.inc.php +++ b/ag/include/clan_chat.inc.php @@ -21,7 +21,7 @@ include_once(ROOT_PATH.'/include/messagefunctions.inc.php'); */ function createChatRoom(array $clan_ids, $foreign_identifier) { db_query('INSERT INTO clan_chatrooms(foreign_id) values(\''.$foreign_identifier.'\')'); - if(mysql_affected_rows() == 0) { + if(db_affected_rows() == 0) { return 'Konnte den Clanchatroom nicht erstellen, da er schon exisitert!'; } $chat_id = getClanChatId($foreign_identifier); @@ -36,7 +36,7 @@ function createChatRoom(array $clan_ids, $foreign_identifier) { * @param string $foreign_identifier */ function getClanChatId($foreign_identifier) { - $row = mysql_fetch_row(db_query('SELECT clan_chat_id FROM clan_chatrooms WHERE foreign_id = \''.$foreign_identifier.'\'')); + $row = mysqli_fetch_row(db_query('SELECT clan_chat_id FROM clan_chatrooms WHERE foreign_id = \''.$foreign_identifier.'\'')); return $row[0]; } @@ -48,7 +48,7 @@ function checkAccessRights($user_id, $clan_chat_id) { if(!$qry) { return false; } - return mysql_num_rows($qry); + return mysqli_stmt_num_rows($qry); } function sendClanChatMessage($user_id, $clan_chat_id, $message) { @@ -60,9 +60,9 @@ function sendClanChatMessage($user_id, $clan_chat_id, $message) { if(!qry) { return 'COULD NOT EXECUTE A QUERY!!!'; } - $row = mysql_fetch_row($qry); + $row = mysqli_fetch_row($qry); $res = db_query('INSERT INTO clan_chatroom_messages(clan_chat_id, user_id, message, msg_id) values('.$clan_chat_id.', '.$user_id.', \''.$message.'\', '. $row[0] .')'); - if(mysql_affected_rows() > 0) { + if(db_affected_rows() > 0) { break; } } @@ -82,12 +82,12 @@ function getClanChatMessages($requester, $clan_chat_id, $count, $asc, $msg_id = if(is_numeric($msg_id)) { $sql .= ' AND msg_id > ' .$msg_id; } else { - $max_id_row = mysql_fetch_row(mysql_query('Select max(msg_id) from clan_chatroom_messages WHERE clan_chat_id = ' . $clan_chat_id)); + $max_id_row = mysqli_fetch_row(db_query('Select max(msg_id) from clan_chatroom_messages WHERE clan_chat_id = ' . $clan_chat_id)); $sql .= ' AND msg_id > ' . ($max_id_row[0] - $count); } $sql .= ' ORDER BY msg_id ASC LIMIT ' .$count; $qry = db_query($sql); - while($row = mysql_fetch_assoc($qry)) { + while($row = mysqli_fetch_assoc($qry)) { $result['max_id'] = max($result['max_id'], $row['msg_id']); $message = stripslashes(encodeNoHTMLWithBB(stripslashes($row['message']))); $result['chat_rows'][] = formatTimestampShortYear($row['zeit']) . ' ' . generateUserNameByID($row['user_id']) . ': ' . $message; diff --git a/ag/include/clan_fights.inc.php b/ag/include/clan_fights.inc.php index e543d00..a08c7af 100644 --- a/ag/include/clan_fights.inc.php +++ b/ag/include/clan_fights.inc.php @@ -111,9 +111,9 @@ function challengeClan(array $user, $clanid, $anzahl = 5, $type = DAVY_BACK_FIGH // check if both clans have already been challengeing each other since 24h? $sql = 'SELECT count(*) as anzahl FROM clan_challenge_requests WHERE clan_requester IN ('.$user['clan'].', '.$clanid.') AND clan_challenged IN ('.$user['clan'].', '.$clanid.') AND challenged_time > TIMESTAMPADD(hour, -'.CLANFIGHTS_RECHALLENGE_DELAY.', now())'; - $qry = mysql_query($sql); + $qry = db_query($sql); - $row = mysql_fetch_assoc($qry); + $row = mysqli_fetch_assoc($qry); if($row['anzahl'] > 0) { semaphoreDown($ressource_clan1); // free the previously reserved semaphore! semaphoreDown($ressource_clan2); // free the previously reserved semaphore! @@ -123,7 +123,7 @@ function challengeClan(array $user, $clanid, $anzahl = 5, $type = DAVY_BACK_FIGH // it should not be possible to challenge a clan that already has an open match that is not yet calculated! ( not completely possible in sql) $sql = 'select count(k.anzahl) as anzahl from (SELECT count(*) as anzahl FROM clan_challenges c inner join clan_challenge_clans ccc on c.clan_challenge_id = ccc.clan_challenge_id where (calculated = 1 or enddate > now()) and clan_id IN ('.$user['clan'].', '.$clanid.') group by c.clan_challenge_id) k where k.anzahl = 0'; //echo $sql .'
    '; - $row = mysql_fetch_assoc(mysql_query($sql)); + $row = mysqli_fetch_assoc(db_query($sql)); if($row['anzahl'] > 0) { semaphoreDown($ressource_clan1); // free the previously reserved semaphore! semaphoreDown($ressource_clan2); // free the previously reserved semaphore! @@ -133,7 +133,7 @@ function challengeClan(array $user, $clanid, $anzahl = 5, $type = DAVY_BACK_FIGH // now calculate how many open fights we currently had or have! $sql = 'select count(*) as anzahl from (SELECT count(*) as anz FROM clan_challenges c inner join clan_challenge_clans ccc on c.clan_challenge_id = ccc.clan_challenge_id where calculated = 0 or TIMESTAMPADD(day, -1, now()) < enddate and clan_id IN ('.$user['clan'].', '.$clanid.') group by clan_id) k where k.anz >= ' . CLANFIGHTS_MAX_FIGHTS_PER_24H; //echo $sql .'
    '; - $row = mysql_fetch_assoc(mysql_query($sql)); + $row = mysqli_fetch_assoc(db_query($sql)); if($row['anzahl'] > 0) { semaphoreDown($ressource_clan1); // free the previously reserved semaphore! @@ -143,9 +143,9 @@ function challengeClan(array $user, $clanid, $anzahl = 5, $type = DAVY_BACK_FIGH // Fordere heraus! - mysql_query('INSERT INTO clan_challenge_requests(clan_requester, clan_challenged, type, challenged_time, clan_challenge_creator, anzahl_chars, active) VALUES('.$user['clan'].', '.$clanid.','.$type.' , TIMESTAMPADD(HOUR, CURRENT_TIMESTAMP, 4), '.$user['id'].', '.$anzahl.', true)'); + db_query('INSERT INTO clan_challenge_requests(clan_requester, clan_challenged, type, challenged_time, clan_challenge_creator, anzahl_chars, active) VALUES('.$user['clan'].', '.$clanid.','.$type.' , TIMESTAMPADD(HOUR, CURRENT_TIMESTAMP, 4), '.$user['id'].', '.$anzahl.', true)'); - if(mysql_affected_rows() > 0) { + if(db_affected_rows() > 0) { if(is_numeric($oclan['leader'])) { sendMessage($user['nickname'], $oclan['leader'], 'Clan-Fight Herausforderung', 'Der Clan '.$clan['clanname'].' hat euch zu einem Clan-Fight herausgefordert! Über "Mein Clan" könnt ihr die Herausforderung annehmen!'); } @@ -180,7 +180,7 @@ function acceptChallengeRequest($challenged_clan, array $user) { } $sql = 'SELECT * FROM clan_challenge_requests WHERE clan_challenged = ' .$user['clan'] . ' AND clan_requester = ' .$challenged_clan . ' AND active = TRUE AND challenged_time > TIMESTAMPADD(day, -1, now())'; - $clan_challenge = mysql_fetch_assoc(mysql_query($sql)); + $clan_challenge = mysqli_fetch_assoc(db_query($sql)); if(!$clan_challenge) { return 'Konnte die Herausforderung nicht annehmen, da diese Herausforderung nicht exisitiert!'; @@ -194,14 +194,14 @@ function acceptChallengeRequest($challenged_clan, array $user) { if(isClanLocked($clan_challenge['clan_challenged']) || isClanLocked($clan_challenge['clan_requester'])) { // okay we cannot accept the challenge so make it inactive! - mysql_query('UPDATE clan_challenge_requests SET active = FALSE WHERE clan_challenge_id = ' .$clan_challenge_id); + db_query('UPDATE clan_challenge_requests SET active = FALSE WHERE clan_challenge_id = ' .$clan_challenge_id); return 'Einer der Clans erfüllt die Anforderungen an Clanfights nichtmehr (wahrscheinlich zu wenig Members)!'; } // now calculate how many open fights we currently had or have! // FIXME: Good idea to pach this in a semaphore? $sql = 'select count(*) as anzahl from (SELECT count(*) as anz FROM clan_challenges c inner join clan_challenge_clans ccc on c.clan_challenge_id = ccc.clan_challenge_id where calculated = 0 or TIMESTAMPADD(day, -1, now()) < enddate and clan_id IN ('.$clan_challenge['clan_challenged'].', '.$clan_challenge['clan_requester'].') group by clan_id) k where k.anz >= ' . CLANFIGHTS_MAX_FIGHTS_PER_24H; // echo $sql . '
    '; - $row = mysql_fetch_assoc(mysql_query($sql)); + $row = mysqli_fetch_assoc(db_query($sql)); if($row['anzahl'] > 0) { return 'Einer der beiden Clans hat das Limit von ' . CLANFIGHTS_MAX_FIGHTS_PER_24H . ' offenen und abgeschlossenen Clanfights innerhalb von 24 erreicht. Daher kann die Herausforderung nicht angenommen werden!'; @@ -209,11 +209,11 @@ function acceptChallengeRequest($challenged_clan, array $user) { $oclan = getClan($clan_challenge['clan_requester']); - mysql_query('UPDATE clan_challenge_requests SET active = false WHERE clan_challenged = ' .$user['clan'] . ' AND clan_requester = ' .$challenged_clan . ' AND active = TRUE AND challenged_time > TIMESTAMPADD(day, -1, now())'); + db_query('UPDATE clan_challenge_requests SET active = false WHERE clan_challenged = ' .$user['clan'] . ' AND clan_requester = ' .$challenged_clan . ' AND active = TRUE AND challenged_time > TIMESTAMPADD(day, -1, now())'); - if(mysql_affected_rows() > 0) { + if(db_affected_rows() > 0) { // okay and for failsaveness just deactivate old requests - mysql_query('UPDATE clan_challenge_requests SET active = false WHERE clan_challenged = ' .$user['clan'] . ' AND clan_requester = ' .$challenged_clan. ' AND active = TRUE'); + db_query('UPDATE clan_challenge_requests SET active = false WHERE clan_challenged = ' .$user['clan'] . ' AND clan_requester = ' .$challenged_clan. ' AND active = TRUE'); if(is_numeric($oclan['leader'])) { sendMessage($user['nickname'], $oclan['leader'], 'Clan-Fight', 'Der Clan '.$clan['clanname'].' hat eure Herausforderungen zu einem Clan-Fight angenommen! Über "Mein Clan" könnt ihr nun Chars anmelden!'); @@ -231,17 +231,17 @@ function acceptChallengeRequest($challenged_clan, array $user) { $id = -1; // get id while(!$finished) { - $row = mysql_fetch_row(mysql_query('select IFNULL(max(clan_challenge_id),0) + 1 from clan_challenges')); - mysql_query('INSERT INTO clan_challenges(clan_challenge_id, type, anzahl_chars) values('.$row[0].', '.$clan_challenge['type'].', '.$clan_challenge['anzahl_chars'].')'); - $finished = mysql_affected_rows() > 0; + $row = mysqli_fetch_row(db_query('select IFNULL(max(clan_challenge_id),0) + 1 from clan_challenges')); + db_query('INSERT INTO clan_challenges(clan_challenge_id, type, anzahl_chars) values('.$row[0].', '.$clan_challenge['type'].', '.$clan_challenge['anzahl_chars'].')'); + $finished = db_affected_rows() > 0; $id = $row[0]; } // insert the participants :) $sql = 'INSERT INTO clan_challenge_clans(clan_challenge_id, id, clan_id, clan_coordinator, elo) values('.$id.', 0, '.$clan['id'].', '.$user['id'].', ' .$clan['elo'].')'; - mysql_query($sql); + db_query($sql); $sql = 'INSERT INTO clan_challenge_clans(clan_challenge_id, id, clan_id, clan_coordinator, elo) values('.$id.', 1, '.$oclan['id'].', ' .$clan_challenge['clan_challenge_creator'].', ' .$clan['elo'].')'; - mysql_query($sql); + db_query($sql); // we have everything we need for this challenge to be opened :) @@ -266,7 +266,7 @@ function cancelChallengeRequest($challenged_clan, array $user) { $sql = 'SELECT * FROM clan_challenge_requests WHERE clan_challenged = ' .$challenged_clan . ' AND clan_requester = ' .$user['clan'] . ' AND active = TRUE AND challenged_time > TIMESTAMPADD(day, -1, now())'; // echo $sql .'
    '; - $clan_challenge = mysql_fetch_assoc(mysql_query($sql)); + $clan_challenge = mysqli_fetch_assoc(db_query($sql)); if(!$clan_challenge) { return 'Konnte die Herausforderung nicht zurückziehen, da diese Herausforderung nicht exisitiert!'; @@ -280,7 +280,7 @@ function cancelChallengeRequest($challenged_clan, array $user) { } // okay seems to be okay - mysql_query('UPDATE clan_challenge_requests SET active = false WHERE clan_challenged = ' .$challenged_clan . ' AND clan_requester = ' .$user['clan'] . ' AND active = TRUE'); + db_query('UPDATE clan_challenge_requests SET active = false WHERE clan_challenged = ' .$challenged_clan . ' AND clan_requester = ' .$user['clan'] . ' AND active = TRUE'); if(is_numeric($oclan['leader'])) { sendMessage($user['nickname'], $oclan['leader'], 'Clan-Fight', 'Der Clan '.$clan['clanname'].' hat die Herausforderungen zu einem Clan-Fight zurückgezogen! Über "Mein Clan" kann eine neue Herausforderungen erstellt werden!'); @@ -311,7 +311,7 @@ function denyChallengeRequest($challenge_requester, array $user) { $sql = 'SELECT * FROM clan_challenge_requests WHERE clan_challenged = ' .$user['clan'] . ' AND clan_requester = ' .$challenge_requester . ' AND active = TRUE AND challenged_time > TIMESTAMPADD(day, -1, now())'; // echo $sql . '
    '; - $clan_challenge = mysql_fetch_assoc(mysql_query($sql)); + $clan_challenge = mysqli_fetch_assoc(db_query($sql)); if(!$clan_challenge) { return 'Konnte die Herausforderung nicht ablehnen, da diese Herausforderung nicht exisitiert!'; @@ -325,7 +325,7 @@ function denyChallengeRequest($challenge_requester, array $user) { } // okay seems to be okay - mysql_query('UPDATE clan_challenge_requests SET active = false WHERE clan_challenged = ' .$user['clan'] . ' AND clan_requester = ' .$challenge_requester. ' AND active = TRUE'); + db_query('UPDATE clan_challenge_requests SET active = false WHERE clan_challenged = ' .$user['clan'] . ' AND clan_requester = ' .$challenge_requester. ' AND active = TRUE'); if(is_numeric($oclan['leader'])) { sendMessage($user['nickname'], $oclan['leader'], 'Clan-Fight', 'Der Clan '.$clan['clanname'].' hat eure Herausforderungen zu einem Clan-Fight abgelehnt! Über "Mein Clan" könnt neue Herausforderungen erstellen!'); @@ -353,8 +353,8 @@ function getChallenge($challenge_id, $buffer = TRUE) { return $GLOBALS['clan_challenge_buffered_instances'][$challenge_id]; // okay, we already buffered the clan :) } - $qry = mysql_query('SELECT * from clan_challenges WHERE clan_challenge_id = ' .$challenge_id); - $GLOBALS['clan_challenge_buffered_instances'][$challenge_id] = mysql_fetch_assoc($qry); + $qry = db_query('SELECT * from clan_challenges WHERE clan_challenge_id = ' .$challenge_id); + $GLOBALS['clan_challenge_buffered_instances'][$challenge_id] = mysqli_fetch_assoc($qry); return $GLOBALS['clan_challenge_buffered_instances'][$challenge_id]; // okay, we already buffered the clan :) } @@ -371,8 +371,8 @@ function getOpenChallengeRequests($clanid) { $sql = 'SELECT * from clan_challenge_requests WHERE challenged_time > TIMESTAMPADD(day, -1, now()) and active = TRUE AND (clan_requester = '.$clanid.' OR clan_challenged = '.$clanid.')'; // echo $sql . '
    '; - $qry = mysql_query($sql); - while($row = mysql_fetch_assoc($qry)) { + $qry = db_query($sql); + while($row = mysqli_fetch_assoc($qry)) { $array[] = $row; } return $array; @@ -384,7 +384,7 @@ function getOpenChallengeRequestCount($clanid) { } $sql = 'SELECT count(*) from clan_challenge_requests where challenged_time > TIMESTAMPADD(day, -1, now()) and active = TRUE AND (clan_requester = '.$clanid.' OR clan_challenged = '.$clanid.')'; // echo $sql . '
    '; - $row = mysql_fetch_row(mysql_query($sql)); + $row = mysqli_fetch_row(db_query($sql)); return $row[0]; } @@ -397,8 +397,8 @@ function getOpenChallengeIDs($clanid) { } $sql = 'SELECT cc.clan_challenge_id FROM clan_challenges AS cc inner join clan_challenge_clans AS ccp ON cc.clan_challenge_id = ccp.clan_challenge_id WHERE clan_id = ' . $clanid . ' AND calculated = FALSE'; - $qry = mysql_query($sql); - while($row = mysql_fetch_row($qry)) { + $qry = db_query($sql); + while($row = mysqli_fetch_row($qry)) { $array[] = $row[0]; } // return the ids @@ -413,8 +413,8 @@ function getActiveChallengeIDs($clanid) { } $sql = 'SELECT cc.clan_challenge_id FROM clan_challenges AS cc inner join clan_challenge_clans AS ccp ON cc.clan_challenge_id = ccp.clan_challenge_id WHERE clan_id = ' . $clanid . ' AND calculated = TRUE AND enddate > now() ORDER BY cc.date DESC ' . $addition; - $qry = mysql_query($sql); - while($row = mysql_fetch_row($qry)) { + $qry = db_query($sql); + while($row = mysqli_fetch_row($qry)) { $array[] = $row[0]; } // return the ids @@ -431,8 +431,8 @@ function getAwatingChallengeIDs() { $array = array(); $sql = 'SELECT distinct(cc.clan_challenge_id) FROM clan_challenges AS cc inner join clan_challenge_clans AS ccp ON cc.clan_challenge_id = ccp.clan_challenge_id WHERE elo_change is null AND calculated = TRUE AND enddate < now()'; // echo $sql . '
    '; - $qry = mysql_query($sql); - while($row = mysql_fetch_row($qry)) { + $qry = db_query($sql); + while($row = mysqli_fetch_row($qry)) { $array[] = $row[0]; } // return the ids @@ -447,8 +447,8 @@ function getHistoricalChallengeIDs($clanid, $limit = NULL) { $addition = ' LIMIT ' .$limit; } $sql = 'SELECT cc.clan_challenge_id FROM clan_challenges AS cc inner join clan_challenge_clans AS ccp ON cc.clan_challenge_id = ccp.clan_challenge_id WHERE clan_id = ' . $clanid . ' AND calculated = TRUE AND enddate < now() ORDER BY cc.date DESC ' . $addition; - $qry = mysql_query($sql); - while($row = mysql_fetch_row($qry)) { + $qry = db_query($sql); + while($row = mysqli_fetch_row($qry)) { $array[] = $row[0]; } // return the ids @@ -458,8 +458,8 @@ function getHistoricalChallengeIDs($clanid, $limit = NULL) { function getParticipatingClanIDs($clan_challenge_id) { $array = array(); $sql = 'SELECT clan_id FROM clan_challenge_clans AS ccp WHERE clan_challenge_id = ' . $clan_challenge_id . ' ORDER BY id'; - $qry = mysql_query($sql); - while($row = mysql_fetch_row($qry)) { + $qry = db_query($sql); + while($row = mysqli_fetch_row($qry)) { $array[] = $row[0]; } // return the ids @@ -468,24 +468,24 @@ function getParticipatingClanIDs($clan_challenge_id) { function getParticipatingClanData($clan_challenge_id, $clan_id) { $sql = 'SELECT * FROM clan_challenge_clans AS ccp WHERE clan_challenge_id = ' . $clan_challenge_id . ' AND clan_id = ' .$clan_id; - $qry = mysql_query($sql); + $qry = db_query($sql); if(!$qry) { echo $sql .'
    '; } - return mysql_fetch_assoc($qry); + return mysqli_fetch_assoc($qry); } function isCharBusyWithClanfighting($char_id) { $sql = 'SELECT count(*) as anzahl FROM clan_challenge_participants ccp INNER JOIN clan_challenges cc on ccp.clan_challenge_id = cc.clan_challenge_id WHERE cc.calculated = FALSE AND char_id = ' .$char_id; - $row = mysql_fetch_row(mysql_query($sql)); + $row = mysqli_fetch_row(db_query($sql)); return $row[0] > 0; } function getParticipatingCharIDs($clan_challenge_id, $clan_id) { $array = array(); $sql = 'SELECT char_id, slot FROM clan_challenge_participants WHERE clan_challenge_id = ' . $clan_challenge_id . ' AND clan_id = ' .$clan_id; - $qry = mysql_query($sql); - while($row = mysql_fetch_assoc($qry)) { + $qry = db_query($sql); + while($row = mysqli_fetch_assoc($qry)) { $array[$row['slot']] = $row['char_id']; } // return the ids @@ -494,7 +494,7 @@ function getParticipatingCharIDs($clan_challenge_id, $clan_id) { function getParticipatingChar($clan_challenge_id, $clan_id, $char_id) { $qry = db_query('SELECT * FROM clan_challenge_participants WHERE clan_challenge_id = ' . $clan_challenge_id . ' AND clan_id = ' .$clan_id . ' AND char_id = ' . $char_id); - $row = mysql_fetch_assoc($qry); + $row = mysqli_fetch_assoc($qry); return $row; } @@ -504,7 +504,7 @@ function getClanLockedTime($clan_id) { return 0; } $sql = 'SELECT TIMESTAMPDIFF(SECOND, NOW(), locked_until) FROM clan_locked WHERE clanid = ' . $clan_id; - $row = mysql_fetch_row(mysql_query($sql)); + $row = mysqli_fetch_row(db_query($sql)); if($row) return $row[0]; return 0; @@ -518,7 +518,7 @@ function isClanLocked($clanid) { // we really want to know if we are locked at the moment. So readout everything at once ;), right join so we always have a row :D $sql = 'SELECT *, locked_until > now() as `lock`, (Select count(id) from user where clan = c2.id) as members FROM clan_locked right join clan c2 on c2.id = clan_locked.clanid where c2.id = ' . $clanid; // echo $sql.'
    '; - $lock = mysql_fetch_assoc(mysql_query($sql)); + $lock = mysqli_fetch_assoc(db_query($sql)); if($lock['lock'] == 0) { // don't matter if it is 0 or NULL // we do not have data in the clan locked table so we are not locked :D @@ -529,7 +529,7 @@ function isClanLocked($clanid) { if($lock['members'] >= MIN_MEMBERS) { if($lock['lock'] === 0) { // If data is available in 'clan_locked' remove it $sql = 'DELETE FROM clan_locked WHERE clanid = ' .$clanid .' AND locked_until < now()'; - mysql_query($sql); + db_query($sql); } // key so every thing seems to be fine :) @@ -538,23 +538,23 @@ function isClanLocked($clanid) { // INSERT $sql = 'INSERT INTO clan_locked(clanid, locked_until) values('.$clanid.', TIMESTAMPADD(HOUR, 24, CURRENT_TIMESTAMP))'; // echo $sql.'
    '; - $res = mysql_query($sql); + $res = db_query($sql); if(!$res) echo $sql . '
    '; - mysql_query('UPDATE clan_challenge_requests SET active = FALSE WHERE (clan_challenged = '.$clanid.' OR clan_requester = '.$clanid); - mysql_query('DELETE FROM clan_challenges WHERE calculated = FALSE AND clan_challenge_id IN (SELECT clan_challenge_id from clan_challenge_clans WHERE clan_id = '.$clanid.')'); + db_query('UPDATE clan_challenge_requests SET active = FALSE WHERE (clan_challenged = '.$clanid.' OR clan_requester = '.$clanid); + db_query('DELETE FROM clan_challenges WHERE calculated = FALSE AND clan_challenge_id IN (SELECT clan_challenge_id from clan_challenge_clans WHERE clan_id = '.$clanid.')'); } else if($lock['members'] < MIN_MEMBERS){ // we have to update the actual row // UPDATE $sql = 'UPDATE clan_locked set locked_until = TIMESTAMPADD(HOUR, 24, CURRENT_TIMESTAMP) WHERE clanid = ' .$clanid; // echo $sql.'
    '; - $res = mysql_query($sql); + $res = db_query($sql); if(!$res) echo $sql . '
    '; } } else if($lock['members'] < MIN_MEMBERS) { $sql = 'UPDATE clan_locked set locked_until = TIMESTAMPADD(HOUR, 24, CURRENT_TIMESTAMP) WHERE clanid = ' .$clanid; // echo $sql.'
    '; - $res = mysql_query($sql); + $res = db_query($sql); if(!$res) echo $sql . '
    '; } @@ -598,7 +598,7 @@ function joinChallenge($clan_challenge_id, array $user, $charid, $slot ) { if($forced && ($char['status'] == 'Kampf' || $char['status'] == 'Schatz Suche' || $char['status'] == 'Clanfight')) { // foreign assignment may also possible if the status is in "fetching" state // okay now check if the fetch-time is reached!! if($char['status'] == 'Schatz Suche') { - $row = mysql_fetch_row(db_query('SELECT Timestampdiff(Second,now(),dauer) as dauer from quests where charid = '.$charid)); + $row = mysqli_fetch_row(db_query('SELECT Timestampdiff(Second,now(),dauer) as dauer from quests where charid = '.$charid)); } else if($char['status'] == 'Clanfight') { if(isCharBusyWithClanfighting($charid)) { $row[0] = '???'; // we do not know when the fight is starting! @@ -608,7 +608,7 @@ function joinChallenge($clan_challenge_id, array $user, $charid, $slot ) { $row[0] = getEventStatusBlocked($char_id); } } else { - $row = mysql_fetch_row(db_query('SELECT dauer - ' . time() . ' FROM kampf WHERE db_satz='.$charid )); + $row = mysqli_fetch_row(db_query('SELECT dauer - ' . time() . ' FROM kampf WHERE db_satz='.$charid )); } if(!is_numeric($row[0]) || $row[0] > 0) { return 'Du kannst den Char \''.$char['name'].'\' nicht an dem Kampf teilnehmen lassen, da er im Moment noch für ' . $row[0] . ' Sekunden mit ' . $char['status']. ' beschäftigt ist!'; @@ -651,8 +651,8 @@ function joinChallenge($clan_challenge_id, array $user, $charid, $slot ) { } // okay does this user already has a char in the fight?? - $qry = mysql_query('SELECT count(*) as anzahl FROM clan_challenge_participants ccp inner join chars c on ccp.char_id = c.id WHERE besitzer = ' .$user['id'] . ' AND clan_challenge_id = ' . $clan_challenge_id); - $row = mysql_fetch_assoc($qry); + $qry = db_query('SELECT count(*) as anzahl FROM clan_challenge_participants ccp inner join chars c on ccp.char_id = c.id WHERE besitzer = ' .$user['id'] . ' AND clan_challenge_id = ' . $clan_challenge_id); + $row = mysqli_fetch_assoc($qry); if($row['anzahl'] != 0) { semaphoreDown($ressource); @@ -677,17 +677,17 @@ function joinChallenge($clan_challenge_id, array $user, $charid, $slot ) { return 'Du kannst den Char nicht zuweisen, da die maximale Anzahl der erlaubten Zuweisungen ('.MAX_LEADER_ASSIGNED_CHARS.') schon erreicht ist!'; } $sql = 'INSERT INTO clan_challenge_participants(clan_challenge_id, clan_id, char_id, slot, forced) values('.$clan_challenge_id.', '.$user['clan'].', '.$charid.', '.$slot.', ' .($forced?'TRUE':'FALSE') .')'; - $res = mysql_query($sql); + $res = db_query($sql); if(!$res) { echo $sql .'
    '; } - if(mysql_affected_rows() == 0) { + if(db_affected_rows() == 0) { if(!$forced) { // maybe the leader has already assigned the char and we now give the official okay for that! - mysql_query('UPDATE clan_challenge_participants SET forced = FALSE, slot = '.$slot.' WHERE clan_challenge_id = '.$clan_challenge_id.' AND clan_id = '.$user['clan'].' AND char_id = '.$charid); + db_query('UPDATE clan_challenge_participants SET forced = FALSE, slot = '.$slot.' WHERE clan_challenge_id = '.$clan_challenge_id.' AND clan_id = '.$user['clan'].' AND char_id = '.$charid); } - if(mysql_affected_rows() == 0) { + if(db_affected_rows() == 0) { semaphoreDown($ressource); if($forced) { semaphoreDown($ressource2); @@ -706,8 +706,8 @@ function joinChallenge($clan_challenge_id, array $user, $charid, $slot ) { 'WHERE ccp.clan_challenge_id = cc.clan_challenge_id AND clan_id = '.$clan_ids[1]. ') = ' . $clan_challenge['anzahl_chars']; - mysql_query($sql); - $rows = mysql_affected_rows(); + db_query($sql); + $rows = db_affected_rows(); semaphoreDown($ressource); if($forced) { semaphoreDown($ressource2); @@ -753,9 +753,9 @@ function leaveChallenge($clan_challenge_id, array $user, $charid) { // Okay, the rest we can check with the delete statement much easier! // basically the check consists of a) is the challenge not yet calculated b) is char active in the challenge? $sql = 'DELETE FROM clan_challenge_participants WHERE (SELECT calculated FROM clan_challenges AS cc WHERE cc.clan_challenge_id = clan_challenge_participants.clan_challenge_id) = FALSE AND char_id = ' . $charid; - mysql_query($sql); + db_query($sql); - if(mysql_affected_rows() == 0) { + if(db_affected_rows() == 0) { return 'Der Char kann nicht aus dem Kampf zurückgezogen werden.'; } @@ -803,7 +803,7 @@ function cancelChallenge($clan_challenge_id, array $user) { // kay, finish him !!! $sql = 'DELETE FROM clan_challenges WHERE clan_challenge_id = ' .$clan_challenge_id . ' AND calculated = FALSE'; // echo $sql . '
    '; - $res = mysql_query($sql); + $res = db_query($sql); if(!$res) return 'Beim zurückziehen des Clan-Fights ist ein technischer Fehler aufgetreten!'; @@ -835,7 +835,7 @@ function calculateChallenge($clan_challenge_id) { $clan_char_ids = getParticipatingCharIDs($clan_challenge_id, $clan_id); $sql = 'update clan_challenge_clans ccc inner join clan c on c.id = clan_id SET ccc.elo = c.elo WHERE clan_id IN (' . implode(', ', $clan_ids) .')'; - $res = mysql_query($sql); + $res = db_query($sql); if(!$res) echo 'Could not execute QUERY : ' .$sql .'
    '; @@ -864,7 +864,7 @@ function calculateChallenge($clan_challenge_id) { } $sql = 'UPDATE clan_challenges set event_id = '.$event_id.', enddate = \''.date("Y-m-d H:i:s",$result).'\' WHERE clan_challenge_id = ' .$clan_challenge_id; - $res = mysql_query($sql); + $res = db_query($sql); if(!$res) { echo $sql.'
    '; return 'Konnte Datenbank-Anfrage nicht durchführen ... breche Skript ab!'; @@ -895,11 +895,11 @@ function calculateDavyBackClanFight($clan_challenge_id, $event_id, array $clan_i if($winner['id'] == $char_clan_1['id']){ $sql = 'UPDATE clan_challenge_clans SET points = points + 1 WHERE clan_challenge_id = ' . $clan_challenge_id . ' AND clan_id = ' .$clan_ids[0]; // echo $sql . '
    '; - mysql_query($sql); + db_query($sql); } else { $sql = 'UPDATE clan_challenge_clans SET points = points + 1 WHERE clan_challenge_id = ' . $clan_challenge_id . ' AND clan_id = ' .$clan_ids[1]; // echo $sql . '
    '; - mysql_query($sql); + db_query($sql); } } return $start_time + ($runde-1) * $duration; @@ -930,12 +930,12 @@ function calculateSurvivalClanFight($clan_challenge_id, $event_id, array $clan_i // the loser is of clan 1 $char_clan_1 = $clan_char_array[$clan_ids[0]][++$counter_clan_1]; $char_clan_2 = $sieger; // the new array contains the adjusted health parameter - mysql_query('UPDATE clan_challenge_clans SET points = points + 1 WHERE clan_challenge_id = ' . $clan_challenge_id . ' AND clan_id = ' .$clan_ids[0]); + db_query('UPDATE clan_challenge_clans SET points = points + 1 WHERE clan_challenge_id = ' . $clan_challenge_id . ' AND clan_id = ' .$clan_ids[0]); } else { // the loser is of clan 2 $char_clan_2 = $clan_char_array[$clan_ids[1]][++$counter_clan_2]; $char_clan_1 = $sieger; // the new array contains the adjusted health parameter - mysql_query('UPDATE clan_challenge_clans SET points = points + 1 WHERE clan_challenge_id = ' . $clan_challenge_id . ' AND clan_id = ' .$clan_ids[1]); + db_query('UPDATE clan_challenge_clans SET points = points + 1 WHERE clan_challenge_id = ' . $clan_challenge_id . ' AND clan_id = ' .$clan_ids[1]); } } @@ -1015,20 +1015,20 @@ function updateAuthorizedClanfightCoordinators($clan_id, array $user_ids) { $sql = 'DELETE FROM `clan_challenge_whitelist` WHERE `user_id` IN (' . implode(',', $remove) .') AND `clan_id` = ' . $clan_id; // echo $sql . '
    '; - mysql_query($sql); + db_query($sql); foreach($add as $user_id) { $sql = 'INSERT INTO `clan_challenge_whitelist`(`user_id`, `clan_id`) values('.$user_id.', '.$clan_id.')'; // echo $sql . '
    '; - mysql_query($sql); + db_query($sql); } } function getAuthorizedClanfightCoordinatorIDs($clan_id) { $sql = 'SELECT user_id as id FROM `clan_challenge_whitelist` WHERE `clan_id` = '.$clan_id; - $qry = mysql_query($sql); + $qry = db_query($sql); $return = array(); - while($row = mysql_fetch_assoc($qry)) { + while($row = mysqli_fetch_assoc($qry)) { $return[] = $row['id']; } return $return; @@ -1046,7 +1046,7 @@ function isAuthorizedClanfightCoordinator($clan_id, $user_id, $clan_fight_id = N if($clan_fight_id !== NULL) { $sql = 'SELECT COUNT(*) FROM `clan_challenge_clans` WHERE `clan_coordinator` = ' .$user_id. ' AND `clan_id` = '.$clan_id . ' AND `clan_challenge_id` = ' .$clan_fight_id; // echo $sql . '
    '; - $row = mysql_fetch_row(mysql_query($sql)); + $row = mysqli_fetch_row(db_query($sql)); if($row[0] <= 0) { // okay, maybe its a leader ;) $clan = getClan($clan_id); @@ -1063,7 +1063,7 @@ function isAuthorizedClanfightCoordinator($clan_id, $user_id, $clan_fight_id = N } else { // it is a more general thing ;) $sql = 'SELECT COUNT(*) FROM `clan_challenge_whitelist` WHERE `user_id` = ' .$user_id. ' AND `clan_id` = '.$clan_id; - $row = mysql_fetch_row(mysql_query($sql)); + $row = mysqli_fetch_row(db_query($sql)); if($row[0] <= 0) { // okay, maybe its a leader ;) $clan = getClan($clan_id); @@ -1103,7 +1103,7 @@ function calculateClanExperience(array $clan1, array $clan2, $winner) { */ function getCountLeaderAssignedChars($clan_id, $clan_fight_id) { $qry = db_query('SELECT COUNT(*) FROM `clan_challenge_participants` WHERE `clan_challenge_id` = ' .$clan_fight_id . ' AND `clan_id` = '.$clan_id .' AND `forced` = TRUE'); - $row = mysql_fetch_row($qry); + $row = mysqli_fetch_row($qry); return $row[0]; } diff --git a/ag/include/config.inc.php b/ag/include/config.inc.php index c97e5dd..7018786 100644 --- a/ag/include/config.inc.php +++ b/ag/include/config.inc.php @@ -34,9 +34,9 @@ include_once (ROOT_PATH . '/include/usergroup.inc.php'); // } //} // -//mysql_query('Update referer set anzahl = anzahl + 1 where url = \''.$referer.'\' and datum = CURRENT_DATE'); -//if(mysql_affected_rows() == 0){ -// mysql_query('Insert into referer(url, anzahl, datum) values(\''.$referer.'\', 1, CURRENT_DATE)'); +//db_query('Update referer set anzahl = anzahl + 1 where url = \''.$referer.'\' and datum = CURRENT_DATE'); +//if(db_affected_rows() == 0){ +// db_query('Insert into referer(url, anzahl, datum) values(\''.$referer.'\', 1, CURRENT_DATE)'); //} $name = validateName($_COOKIE['name']); @@ -51,14 +51,14 @@ if(!checkCookiePassword($name, $passwort)){ $POLOE = 1; $user_ida = array(); } else { - $user_ida = mysql_fetch_assoc(mysql_query("SELECT * FROM user WHERE nickname='$name' LIMIT 1")); - mysql_query('UPDATE user SET ip=\'' . $_SERVER['REMOTE_ADDR'] . '\', online_zeit=now() WHERE id='.$user_ida['id']); + $user_ida = mysqli_fetch_assoc(db_query("SELECT * FROM user WHERE nickname='$name' LIMIT 1")); + db_query('UPDATE user SET ip=\'' . $_SERVER['REMOTE_ADDR'] . '\', online_zeit=now() WHERE id='.$user_ida['id']); if ($online_rekord_1_0['anzahl'] < $online_r) { - mysql_query('UPDATE online SET anzahl='.$online_r.', datum=now() WHERE id=1'); + db_query('UPDATE online SET anzahl='.$online_r.', datum=now() WHERE id=1'); } } -$banned_accs = mysql_num_rows(mysql_query("SELECT id FROM user WHERE ip!='' AND ip='$user_ida[ip]' AND id!='$user_ida[id]' LIMIT 2")); +$banned_accs = mysqli_stmt_num_rows(db_query("SELECT id FROM user WHERE ip!='' AND ip='$user_ida[ip]' AND id!='$user_ida[id]' LIMIT 2")); if ($user_ida['id'] != null) { $as = 'profil'; diff --git a/ag/include/defines.inc.php b/ag/include/defines.inc.php index 0b62469..9a0e44c 100644 --- a/ag/include/defines.inc.php +++ b/ag/include/defines.inc.php @@ -15,8 +15,8 @@ $GLOBALS['definesEditable'] = array(); function initializeDefines() { $sql = 'SELECT * from defines'; - $qry = mysql_query($sql); - while($row = mysql_fetch_assoc($qry)) { + $qry = db_query($sql); + while($row = mysqli_fetch_assoc($qry)) { if(!defined($row['key'])) { define($row['key'], $row['value']); $GLOBALS['definesEditable'][$row['key']] = $row['editable']; @@ -34,13 +34,13 @@ function defineIfNotDefined($key, $value, $editable = TRUE) { if(!defined($key)) { // we seem that we need to insert this key - value pair! $sql = 'INSERT INTO defines(`key`, `value`, `editable`) values(\''.$key.'\', \''.$value.'\', \''.$editable.'\')'; - mysql_query($sql); + db_query($sql); define($key, $value); } else if($GLOBALS['definesEditable'][$key] != $editable){ // if the editableness of this value has been changed, adjust the database ;) $sql = 'UPDATE defines SET editable = ' . ($editable?'1':'0') . ' WHERE `key` = \'' .$key.'\''; // echo $sql.'
    '; - mysql_query($sql); + db_query($sql); } } @@ -66,7 +66,7 @@ function getDefines($prefix = NULL) { } $result = array(); - while($row = mysql_fetch_assoc($qry)) { + while($row = mysqli_fetch_assoc($qry)) { $result[] = $row; } @@ -80,7 +80,7 @@ function setDefine($key, $value) { // set where editable true $sql = 'UPDATE defines SET `value` = \''.$value.'\' WHERE `key` = \''.$key.'\' AND editable = TRUE'; $qry = db_query($sql); - if(!$qry || mysql_affected_rows() == 0) { + if(!$qry || db_affected_rows() == 0) { return 'Konnte den define ' . $key . ' nicht auf ' . $value . ' setzen'; } return NULL; diff --git a/ag/include/designfunctions.inc.php b/ag/include/designfunctions.inc.php index c43a16f..681a050 100644 --- a/ag/include/designfunctions.inc.php +++ b/ag/include/designfunctions.inc.php @@ -43,7 +43,7 @@ function generateUserNameByID($userid, $showClanTags = TRUE){ $groups = getUserGroups($userid); $sql = 'select nickname, user.id as userid, clan.clanz_pre, clan.clanz_suff from user left join clan on user.clan = clan.id where user.id = '.$userid; - $user_info = mysql_fetch_assoc(mysql_query($sql)); + $user_info = mysqli_fetch_assoc(db_query($sql)); if(isUserInGroup($groups, WERBUNG_AN)){ if(isUserInGroup($groups, ADMIN)){ $color = 'style="color:'.GROUP_COLOR_GAMEMASTER.'"'; @@ -98,12 +98,12 @@ function generateAttackNameByID($attackid, $withColor = TRUE) { } $sql = 'SELECT * from attacken WHERE id = ' .$attackid; - $qry = mysql_query($sql); - $row = mysql_fetch_assoc($qry); + $qry = db_query($sql); + $row = mysqli_fetch_assoc($qry); $qry = db_query('SELECT farbe FROM `attackentyp` where name = \'' . $row['type'].'\''); - $row_color = mysql_fetch_row($qry); + $row_color = mysqli_fetch_row($qry); $color = 'style="color:'.$row_color[0].'"'; if($withColor) { @@ -115,8 +115,8 @@ function generateAttackNameByID($attackid, $withColor = TRUE) { function displayClanLink($clanid, $clanname = NULL){ if($clanname === NULL) { - $qry = mysql_query('SELECT clanname FROM clan WHERE id = ' . $clanid); - $row = mysql_fetch_assoc($qry); + $qry = db_query('SELECT clanname FROM clan WHERE id = ' . $clanid); + $row = mysqli_fetch_assoc($qry); $clanname = $row['clanname']; } return ''.$clanname.''; @@ -137,7 +137,7 @@ function generateCharLinkByID($charid, $showAvatar = FALSE, $showClanTags = FALS $suffix = null; if($showClanTags) { $qry = db_query('select clan.clanz_pre, clan.clanz_suff from user left join clan on user.clan = clan.id where user.id = '.$userid); - $row = mysql_fetch_assoc($qry); + $row = mysqli_fetch_assoc($qry); $clan_pre = $row['clanz_pre']; $clan_su = $row['clanz_suff']; } diff --git a/ag/include/donate.inc.php b/ag/include/donate.inc.php index 3556435..f46c470 100644 --- a/ag/include/donate.inc.php +++ b/ag/include/donate.inc.php @@ -15,8 +15,8 @@ function getSpendebarometer($databasename){ // 7-12 Monate = Gruen // ++ = Violett - $qry = mysql_query('select sum(betrag)+sum(malus) as saldo from '.$databasename.'.umsatz'); - $row = mysql_fetch_assoc($qry); + $qry = db_query('select sum(betrag)+sum(malus) as saldo from '.$databasename.'.umsatz'); + $row = mysqli_fetch_assoc($qry); $monate = $row['saldo'] / $kosten; $color = 'violet'; @@ -43,8 +43,8 @@ function getSpendebarometer($databasename){ function getSpenden($databasename){ $spendeline = '
  • Halle der Helden aus Runde '.($maxpages - echo '
    '.$row['art'].'
    '; - $qry = mysql_query('Select * from '.$databasename.'.umsatz where kommentar like \'%Spende%\' order by datum desc'); - while($row = mysql_fetch_assoc($qry)){ + $qry = db_query('Select * from '.$databasename.'.umsatz where kommentar like \'%Spende%\' order by datum desc'); + while($row = mysqli_fetch_assoc($qry)){ $spendeline .= ''; } $spendeline .= '
    '. $row['instanz'] . ''.$row['kommentar'].''.$row['betrag'].' '.$row['waehrung'].''.$row['datum'].'
    '; diff --git a/ag/include/erstellfunctions.inc.php b/ag/include/erstellfunctions.inc.php index b9959ed..c592bda 100644 --- a/ag/include/erstellfunctions.inc.php +++ b/ag/include/erstellfunctions.inc.php @@ -109,7 +109,7 @@ function erstelleChar($user, $rassen_id, $newname = '', $picture = '', $lvl = 1, //echo $sql.'
    '; $identifier = db_query($sql); if($identifier == FALSE){ - if(mysql_fetch_assoc(mysql_query('Select id from chars where name = \''.$newname.'\''))){ + if(mysqli_fetch_assoc(db_query('Select id from chars where name = \''.$newname.'\''))){ displayErrorMessage(NULL,'Name schon vorhanden!!',displayHistoryBackLink()); } else{ displayErrorMessage(NULL,'Erstellen fehlgeschlagen!!',displayHistoryBackLink()); @@ -118,11 +118,11 @@ function erstelleChar($user, $rassen_id, $newname = '', $picture = '', $lvl = 1, } if($race['name'] != 'NPC') { - $charsw_id = mysql_fetch_assoc(mysql_query('SELECT id FROM chars WHERE name=\''.$newname.'\'')); + $charsw_id = mysqli_fetch_assoc(db_query('SELECT id FROM chars WHERE name=\''.$newname.'\'')); - mysql_query('INSERT lernen SET at_id=1, aktiv=1, besitzer='.$charsw_id['id'].', name=\'Schlag\', dauer=0'); - mysql_query('INSERT lernen SET at_id=2, aktiv=1, besitzer='.$charsw_id['id'].', name=\'Kick\', dauer=0'); - mysql_query('INSERT lernen SET at_id=3, aktiv=1, besitzer='.$charsw_id['id'].', name=\'Block\', dauer=0'); + db_query('INSERT lernen SET at_id=1, aktiv=1, besitzer='.$charsw_id['id'].', name=\'Schlag\', dauer=0'); + db_query('INSERT lernen SET at_id=2, aktiv=1, besitzer='.$charsw_id['id'].', name=\'Kick\', dauer=0'); + db_query('INSERT lernen SET at_id=3, aktiv=1, besitzer='.$charsw_id['id'].', name=\'Block\', dauer=0'); } return true; // Hat geklappt } diff --git a/ag/include/event.inc.php b/ag/include/event.inc.php index 3a7b619..cfb32b7 100644 --- a/ag/include/event.inc.php +++ b/ag/include/event.inc.php @@ -37,9 +37,9 @@ defineIfNotDefined('KEY_ITM_CHAR1', 'ITM_CHAR1'); function createEvent($type) { while(!$finished) { $sql = 'SELECT IFNULL(max(event_id),0) + 1 FROM events'; - $row = mysql_fetch_row(mysql_query($sql)); - mysql_query('INSERT INTO events(event_id, event_type) values('.$row[0].', \''.$type.'\')'); - $finished = mysql_affected_rows() > 0; + $row = mysqli_fetch_row(db_query($sql)); + db_query('INSERT INTO events(event_id, event_type) values('.$row[0].', \''.$type.'\')'); + $finished = db_affected_rows() > 0; $id = $row[0]; } @@ -62,8 +62,8 @@ function addParticipant($event_id, array $char) { // echo $sql . '
    '; - mysql_query($sql); - if(mysql_affected_rows() == 0) + db_query($sql); + if(db_affected_rows() == 0) return NULL; return $char['id']; } @@ -90,13 +90,13 @@ function persistFight($event_id, array $combinedArray, $startTimestamp, $endTime $finished = FALSE; while(!$finished) { $sql = 'SELECT IFNULL(max(event_fight_id),0) + 1 FROM event_fights WHERE event_id = ' .$event_id; - $row = mysql_fetch_row(mysql_query($sql)); + $row = mysqli_fetch_row(db_query($sql)); $sql = 'INSERT INTO event_fights(event_id, event_fight_id, host, winner, `starting`, visible) values('.$event_id.', \''.$row[0].'\', '. $hostId . ', ' . $winnerId .', \''.date("Y-m-d H:i:s",$startTimestamp).'\', \''.date("Y-m-d H:i:s",$endTimestamp).'\')'; - if(mysql_query($sql) === FALSE) { + if(db_query($sql) === FALSE) { echo $sql . '
    '; break; } - $finished = mysql_affected_rows() > 0; + $finished = db_affected_rows() > 0; $event_fight_id = $row[0]; } @@ -114,7 +114,7 @@ function persistFight($event_id, array $combinedArray, $startTimestamp, $endTime $sql .= ' values('.$event_id.','.$event_fight_id.','.$round.',' .$chara_1['id'].',\''. $chara_1['hp'].'\', \''. $chara_1['mp'].'\', '. $chara_1['starke'].', '. $chara_1['speed'].', '. $chara_1['verteidigung'].', '. $chara_1['glueck'].', '. $chara_1['ausdauer'].', '. ($roundsArray[$round]['atk_char1']===NULL?'NULL': '\''.$roundsArray[$round]['atk_char1'].'\'' ).', '. ($roundsArray[$round]['dmg_char1']===NULL?'NULL': '\''.$roundsArray[$round]['dmg_char1'].'\'' ).', \''.date("Y-m-d H:i:s",$endTimestamp).'\')'; - $res = mysql_query($sql); + $res = db_query($sql); if(!$res) echo $sql .'
    '; // now persist char2 @@ -123,7 +123,7 @@ function persistFight($event_id, array $combinedArray, $startTimestamp, $endTime $sql = 'INSERT INTO event_fight_rounds(event_id, event_fight_id, round, event_char_id, hp, mp, strength, speed, defense, luck, stamina, attack, damage, visible)'; $sql .= ' values('.$event_id.','.$event_fight_id.','.$round.',' .$chara_2['id'].',\''. $chara_2['hp'].'\', \''. $chara_2['mp'].'\', '. $chara_2['starke'].', '. $chara_2['speed'].', '. $chara_2['verteidigung'].', '. $chara_2['glueck'].', '. $chara_2['ausdauer'].', '. ($roundsArray[$round]['atk_char2']===NULL?'NULL': '\''.$roundsArray[$round]['atk_char2'].'\'' ).', '. ($roundsArray[$round]['dmg_char2']===NULL?'NULL': '\''.$roundsArray[$round]['dmg_char2'].'\'' ).', \''.date("Y-m-d H:i:s",$endTimestamp).'\')'; - $res = mysql_query($sql); + $res = db_query($sql); if(!$res) echo $sql .'
    '; } @@ -132,10 +132,10 @@ function persistFight($event_id, array $combinedArray, $startTimestamp, $endTime foreach ($data as $key => $value) { $sql = 'INSERT INTO event_fight_metadata(event_id, event_fight_id, `key`, `value`) values('.$event_id.','.$event_fight_id.',\''.$key.'\',\''.$value.'\')'; // echo $sql . '
    '; - mysql_query($sql); + db_query($sql); } - mysql_query('UPDATE event_chars SET block_begin = \''.date("Y-m-d H:i:s",$startTimestamp).'\', block_end = \''.date("Y-m-d H:i:s",$endTimestamp).'\' WHERE event_id = ' . $event_id); + db_query('UPDATE event_chars SET block_begin = \''.date("Y-m-d H:i:s",$startTimestamp).'\', block_end = \''.date("Y-m-d H:i:s",$endTimestamp).'\' WHERE event_id = ' . $event_id); } @@ -143,8 +143,8 @@ function persistFight($event_id, array $combinedArray, $startTimestamp, $endTime function getEventStatus($charid) { $sql = 'SELECT event_type FROM event_chars ec inner join events e on ec.event_id = e.event_id where (block_end > now() or abgeholt = FALSE) and char_id = ' . $charid; // echo $sql . '
    '; - $qry = mysql_query($sql); - $row = mysql_fetch_assoc($qry); + $qry = db_query($sql); + $row = mysqli_fetch_assoc($qry); switch ($row['event_type']) { case EVENT_TEST: return 'Test'; @@ -166,7 +166,7 @@ function getEventStatus($charid) { function getOngoingEventCount($charid) { $sql = 'SELECT count(*) FROM event_chars e WHERE abgeholt = FALSE AND char_id = ' .$charid; - $row = mysql_fetch_row(mysql_query($sql)); + $row = mysqli_fetch_row(db_query($sql)); return $row[0]; } @@ -174,24 +174,24 @@ function getOngoingEventCount($charid) { function getEventStatusBlocked($charid) { $sql = 'SELECT Timestampdiff(Second,now(),MAX(block_end)) FROM event_chars WHERE abgeholt = FALSE AND char_id = ' . $charid; // echo $sql . '
    '; - $row = mysql_fetch_row(mysql_query($sql)); + $row = mysqli_fetch_row(db_query($sql)); return $row[0]; } function isEventToFetchAwaiting($charid) { $sql = 'SELECT count(*) FROM event_chars e WHERE abgeholt = FALSE AND char_id = ' .$charid; - $row = mysql_fetch_row(mysql_query($sql)); + $row = mysqli_fetch_row(db_query($sql)); return $row[0] > 0; } function getEventIdsToFetch($char_id) { $sql = 'SELECT event_id FROM event_chars e WHERE block_end < now() and abgeholt = FALSE AND char_id = ' .$char_id . ' ORDER BY event_id ASC'; - $qry = mysql_query($sql); + $qry = db_query($sql); if(!$qry) echo $sql . '
    '; $result = array(); - while ($row = mysql_fetch_row($qry)) { + while ($row = mysqli_fetch_row($qry)) { $result[] = $row[0]; } return $result; @@ -255,19 +255,19 @@ function abholenChar(array $user, $event_id, $char_id) { // Okay and now we want to learn the attacks :) $sql = 'SELECT attack, count(attack) as anzahl FROM event_fight_rounds e where event_id = ' . $event_id . ' AND event_char_id = ' . $char_id . ' group by attack'; - $qry = mysql_query($sql); + $qry = db_query($sql); if(!$qry) echo $sql .'
    '; $attacken_usage = array(); - while($row = mysql_fetch_assoc($qry)) { + while($row = mysqli_fetch_assoc($qry)) { $attacken_usage[] = array('id' => $row['attack'], 'anzahl' => $row['anzahl']); } addAttackUsageToChar($char_id, $attacken_usage); $sql = 'UPDATE event_chars SET abgeholt = TRUE WHERE char_id = ' . $char_id . ' AND event_id = ' . $event_id; - $qry = mysql_query($sql); + $qry = db_query($sql); if(!$qry) echo $sql .'
    '; @@ -277,14 +277,14 @@ function abholenChar(array $user, $event_id, $char_id) { function getEvent($event_id) { - $result = mysql_fetch_assoc(mysql_query('SELECT * FROM events WHERE event_id = ' . $event_id)); + $result = mysqli_fetch_assoc(db_query('SELECT * FROM events WHERE event_id = ' . $event_id)); if($result) return $result; return NULL; } function getEventChar($event_id, $event_char_id) { - $result = mysql_fetch_assoc(mysql_query('SELECT * FROM event_chars WHERE event_id = ' . $event_id . ' AND event_char_id = ' . $event_char_id)); + $result = mysqli_fetch_assoc(db_query('SELECT * FROM event_chars WHERE event_id = ' . $event_id . ' AND event_char_id = ' . $event_char_id)); if($result) return $result; return NULL; @@ -292,24 +292,24 @@ function getEventChar($event_id, $event_char_id) { } function getEventFight($event_id, $event_fight_id) { - $result = mysql_fetch_assoc(mysql_query('SELECT * FROM event_fights WHERE event_id = ' . $event_id. ' AND event_fight_id = ' .$event_fight_id )); + $result = mysqli_fetch_assoc(db_query('SELECT * FROM event_fights WHERE event_id = ' . $event_id. ' AND event_fight_id = ' .$event_fight_id )); if($result) return $result; return NULL; } function getEventFightMetaData($event_id, $event_fight_id) { - $qry = mysql_query('SELECT * FROM event_fight_metadata WHERE event_id = ' . $event_id. ' AND event_fight_id = ' .$event_fight_id); - while($row = mysql_fetch_assoc($qry)) { + $qry = db_query('SELECT * FROM event_fight_metadata WHERE event_id = ' . $event_id. ' AND event_fight_id = ' .$event_fight_id); + while($row = mysqli_fetch_assoc($qry)) { $result[$row['key']]= $row['value']; } return $result; } function getEventFightIds($event_id) { - $qry = mysql_query('SELECT event_fight_id FROM event_fights WHERE event_id = ' . $event_id . ' ORDER by event_fight_id ASC'); + $qry = db_query('SELECT event_fight_id FROM event_fights WHERE event_id = ' . $event_id . ' ORDER by event_fight_id ASC'); $result = array(); - while($row = mysql_fetch_assoc($qry)) { + while($row = mysqli_fetch_assoc($qry)) { $result[]= $row['event_fight_id']; } return $result; @@ -318,10 +318,10 @@ function getEventFightIds($event_id) { // this is more tricky XD function getEventFightIdsByChar($event_id, $event_char_id) { $sql = 'SELECT event_fight_id FROM event_fight_rounds where event_id = ' . $event_id . ' AND event_char_id = ' . $event_char_id . ' AND `round` = 0 ORDER BY event_fight_id ASC'; - $qry = mysql_query($sql); + $qry = db_query($sql); if(!$qry) echo $sql . '
    '; - while($row = mysql_fetch_assoc($qry)) { + while($row = mysqli_fetch_assoc($qry)) { $result[]= $row['event_fight_id']; } return $result; @@ -330,12 +330,12 @@ function getEventFightIdsByChar($event_id, $event_char_id) { function getEventFightRoundData($event_id, $event_fight_id, $round) { $sql = 'SELECT * FROM event_fight_rounds WHERE event_id = ' . $event_id . ' AND event_fight_id = ' . $event_fight_id . ' AND `round` = ' .$round; - $qry = mysql_query($sql); + $qry = db_query($sql); if(!$qry) { echo $sql . '
    '; return; } - while($row = mysql_fetch_assoc($qry)) { + while($row = mysqli_fetch_assoc($qry)) { $result[$row['event_char_id']] = $row; } return $result; diff --git a/ag/include/exp.inc.php b/ag/include/exp.inc.php index d65561f..f956328 100644 --- a/ag/include/exp.inc.php +++ b/ag/include/exp.inc.php @@ -67,15 +67,15 @@ function addAttackUsageToChar($char_id, $attacken){ $sql = 'Update lernen set benutzt = benutzt + '.$attacken[$i]['anzahl'].' where at_id = \''.$attacken[$i]['id'].'\' and besitzer = '.$char_id; } // echo $sql.'
    '; - mysql_query($sql); + db_query($sql); } // Sooo und nun gehts darum ob wir neue Attacken lernen können // Ersma die ganzen Infos laden $sql = 'SELECT * FROM lernen where besitzer = '.$char_id; - $qry = mysql_query($sql); - while($row = mysql_fetch_assoc($qry)){ + $qry = db_query($sql); + while($row = mysqli_fetch_assoc($qry)){ $lern[$row['at_id']] = $row; // Zum späteren Check ob die Reqs erfüllt sind $atkid[] = $row['at_id']; // Zum ausschliessen der Attacken } @@ -94,7 +94,7 @@ function addAttackUsageToChar($char_id, $attacken){ // echo $sql.'
    '; - $qry = mysql_query($sql); + $qry = db_query($sql); // Das geht leider nicht mit dieser Datenstruktur direkt auszuwählen $raceid[] = getCharRaceId($char_id); @@ -103,7 +103,7 @@ function addAttackUsageToChar($char_id, $attacken){ } // So und nun arbeite jede Attacke durch die nur im geringsten Lernbar sein könnte ... - while($row = mysql_fetch_assoc($qry)) { + while($row = mysqli_fetch_assoc($qry)) { // Erstmal checken ob es eine Fruchtattacke ist (durch die SQL-Anweisung werden alle nicht zutreffenden Früchte ausgeblockt) $learnable = false; if(!is_null($row['Frucht'])){ @@ -138,7 +138,7 @@ function addAttackUsageToChar($char_id, $attacken){ } if($learnable){ - mysql_query('INSERT lernen SET name=\''.$row['name'].'\', at_id=\''.$row['id'].'\', besitzer=\''.$char_id.'\', aktiv=\'1\''); + db_query('INSERT lernen SET name=\''.$row['name'].'\', at_id=\''.$row['id'].'\', besitzer=\''.$char_id.'\', aktiv=\'1\''); echo ''; } } @@ -169,12 +169,12 @@ function addExpToChar($char_id, $n_exp){ $sql = 'Update chars set exp = \''.$char_exp[0].','.$char_exp[1].'\' where id = '.$char_id; } // echo $sql.'
    '; - mysql_query($sql); + db_query($sql); $char = getChar($char_id, false); // We really want the actual char!! if($char['level'] > 25) { // remove this char out of the registration of the beginners tournament - mysql_query('Delete from turnier1 where art = \'klein\' and charakter = \''.$char_id.'\''); + db_query('Delete from turnier1 where art = \'klein\' and charakter = \''.$char_id.'\''); } } @@ -193,9 +193,9 @@ function addExpToArena($user_id, $n_exp){ } if($lvls > 0){ echo ''; - mysql_query('Update arena set exp=\''.$arena_exp[0].','.$arena_exp[1].'\', level='.$arena['level'].', skill=skill+'.$lvls.' WHERE besitzer='.$user_id); + db_query('Update arena set exp=\''.$arena_exp[0].','.$arena_exp[1].'\', level='.$arena['level'].', skill=skill+'.$lvls.' WHERE besitzer='.$user_id); } else{ - mysql_query('Update arena set exp=\''.$arena_exp[0].','.$arena_exp[1].'\' WHERE besitzer='.$user_id); + db_query('Update arena set exp=\''.$arena_exp[0].','.$arena_exp[1].'\' WHERE besitzer='.$user_id); } } diff --git a/ag/include/faq.inc.php b/ag/include/faq.inc.php index 373f68f..ea01223 100644 --- a/ag/include/faq.inc.php +++ b/ag/include/faq.inc.php @@ -18,15 +18,15 @@ include_once(ROOT_PATH.'/include/config/db.inc.php'); include_once(ROOT_PATH.'/include/parse.inc.php'); function insertFaqEntry($parent, $header, $body){ - mysql_query('INSERT INTO `faq_entries` ( `id` , `parent` , `header` , `body` ) VALUES (NULL , \''.$parent.'\', \''.encodeNoHTMLWithBB($header).'\', \''.encodeNoHTMLWithBB($body).'\')'); + db_query('INSERT INTO `faq_entries` ( `id` , `parent` , `header` , `body` ) VALUES (NULL , \''.$parent.'\', \''.encodeNoHTMLWithBB($header).'\', \''.encodeNoHTMLWithBB($body).'\')'); } function getAllFaqEntries(){ $sql = 'Select * from faq_entries order by parent'; - $qry = mysql_query($sql); + $qry = db_query($sql); $returnArray = array(); $tempArray[0] = & $returnArray; - while($result = mysql_fetch_assoc($qry)){ + while($result = mysqli_fetch_assoc($qry)){ $tempArray[$result['parent']][$result['id']]['node'] = $result; $tempArray[$result['id']] = & $tempArray[$result['parent']][$result['id']]; } @@ -84,60 +84,60 @@ function getContext($pre1, $pre2, $app1, $app2){ function getEntry($faqentry){ $sql = 'Select * from faq_entries WHERE id = '.$faqentry; - $qry = mysql_query($sql); - return mysql_fetch_assoc($qry); + $qry = db_query($sql); + return mysqli_fetch_assoc($qry); } function updateEntry($faqentry, $parent,$header,$body){ $parentpart = $parent!=null?'parent = '.$parent.',':''; $sql = 'UPDATE faq_entries SET '.$parentpart.' header = \''.encodeNoHTMLWithBB($header).'\', body = \''.encodeNoHTMLWithBB($body).'\' WHERE id = '.$faqentry; - mysql_query($sql); + db_query($sql); } function moveUp($faqentry){ $entry = getEntry($faqentry); $sql = 'Select * from faq_entries WHERE parent = '.$entry['parent'].' AND id < '.$entry['id'].' order by id desc LIMIT 1'; - $qry = mysql_query($sql); - $entry2 = mysql_fetch_assoc($qry); + $qry = db_query($sql); + $entry2 = mysqli_fetch_assoc($qry); if(!$entry2){ // Er ist schon der höchste return; } $sql2 = 'Select * from faq_entries WHERE parent = '.$faqentry; - $qry2 = mysql_query($sql2); - while($row = mysql_fetch_assoc($qry2)){ + $qry2 = db_query($sql2); + while($row = mysqli_fetch_assoc($qry2)){ $ids[] = $row['id']; } - mysql_query('UPDATE faq_entries SET header = \''.$entry2['header'].'\', body = \''.$entry2['body'].'\' where id = '.$entry['id']); - mysql_query('UPDATE faq_entries SET header = \''.$entry['header'].'\', body = \''.$entry['body'].'\' where id = '.$entry2['id']); + db_query('UPDATE faq_entries SET header = \''.$entry2['header'].'\', body = \''.$entry2['body'].'\' where id = '.$entry['id']); + db_query('UPDATE faq_entries SET header = \''.$entry['header'].'\', body = \''.$entry['body'].'\' where id = '.$entry2['id']); - mysql_query('Update faq_entries SET parent = '.$entry['id'].' where parent = '.$entry2['id']); - mysql_query('Update faq_entries SET parent = '.$entry2['id'].' where id IN ('.join($ids, ',').')'); + db_query('Update faq_entries SET parent = '.$entry['id'].' where parent = '.$entry2['id']); + db_query('Update faq_entries SET parent = '.$entry2['id'].' where id IN ('.join($ids, ',').')'); } function moveDown($faqentry){ $entry = getEntry($faqentry); $sql = 'Select * from faq_entries WHERE parent = '.$entry['parent'].' AND id > '.$entry['id'].' order by id asc LIMIT 1'; - $qry = mysql_query($sql); - $entry2 = mysql_fetch_assoc($qry); + $qry = db_query($sql); + $entry2 = mysqli_fetch_assoc($qry); if(!$entry2){ // Er ist schon der höchste return; } $sql2 = 'Select * from faq_entries WHERE parent = '.$faqentry; - $qry2 = mysql_query($sql2); - while($row = mysql_fetch_assoc($qry2)){ + $qry2 = db_query($sql2); + while($row = mysqli_fetch_assoc($qry2)){ $ids[] = $row['id']; } - mysql_query('UPDATE faq_entries SET header = \''.$entry2['header'].'\', body = \''.$entry2['body'].'\' where id = '.$entry['id']); - mysql_query('UPDATE faq_entries SET header = \''.$entry['header'].'\', body = \''.$entry['body'].'\' where id = '.$entry2['id']); + db_query('UPDATE faq_entries SET header = \''.$entry2['header'].'\', body = \''.$entry2['body'].'\' where id = '.$entry['id']); + db_query('UPDATE faq_entries SET header = \''.$entry['header'].'\', body = \''.$entry['body'].'\' where id = '.$entry2['id']); - mysql_query('Update faq_entries SET parent = '.$entry['id'].' where parent = '.$entry2['id']); - mysql_query('Update faq_entries SET parent = '.$entry2['id'].' where id IN ('.join($ids, ',').')'); + db_query('Update faq_entries SET parent = '.$entry['id'].' where parent = '.$entry2['id']); + db_query('Update faq_entries SET parent = '.$entry2['id'].' where id IN ('.join($ids, ',').')'); } function getChildren($faqentry){ $sql = 'Select * from faq_entries where parent = '.$faqentry.' order by id asc'; - $qry = mysql_query($sql); - while($row = mysql_fetch_assoc($qry)){ + $qry = db_query($sql); + while($row = mysqli_fetch_assoc($qry)){ $ret[] = $row; } return $ret; diff --git a/ag/include/halloffame.inc.php b/ag/include/halloffame.inc.php index 54e7268..1a38dc6 100644 --- a/ag/include/halloffame.inc.php +++ b/ag/include/halloffame.inc.php @@ -16,9 +16,9 @@ include_once(ROOT_PATH.'/include/char.inc.php'); * @return boolean if the insert was successful */ function insertIntoHallOfFame($title, $charid, $userid){ - $row = mysql_fetch_assoc(mysql_query('Select max(id) as round from online')); + $row = mysqli_fetch_assoc(db_query('Select max(id) as round from online')); $char = getChar($charid); - $user = mysql_fetch_assoc(mysql_query('Select * from user where id = '.$userid)); + $user = mysqli_fetch_assoc(db_query('Select * from user where id = '.$userid)); if(!$row || is_null($char) || is_null($user)){ return false; @@ -57,12 +57,12 @@ function insertIntoHallOfFameFull($round = '', $title = '', $charid = '', $charn } $sql = 'INSERT INTO highscore('.$columns.') values('.$values.')'; // echo $sql.'
    '; - $qry = mysql_query($sql); - return mysql_affected_rows() > 0; + $qry = db_query($sql); + return db_affected_rows() > 0; } function getHallOfFameEntryCount($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 getHallOfFameEntryCountFull($row['round'],$title, $userid); } @@ -72,7 +72,7 @@ function getHallOfFameEntryCountFull($round = '', $title = '', $userid = '') { } $sql = 'SELECT COUNT(*) FROM highscore WHERE art=\''.$title.'\' AND runde='.$round.' AND userid='.$userid; // echo $sql .'
    '; - $row = mysql_fetch_row(mysql_query($sql)); + $row = mysqli_fetch_row(db_query($sql)); return $row[0]; } diff --git a/ag/include/img.inc.php b/ag/include/img.inc.php index a750723..27f2b31 100644 --- a/ag/include/img.inc.php +++ b/ag/include/img.inc.php @@ -17,23 +17,23 @@ function hasToAuthenticate($user){ } function hasNotDoneAction($user, $count = 1){ - mysql_query('Update user set code = code + '.$count.' WHERE id = '.$user['id']); + db_query('Update user set code = code + '.$count.' WHERE id = '.$user['id']); } function hasDoneAction($user, $count = 1){ - mysql_query('Update user set code = code - '.$count.' WHERE id = '.$user['id']); + db_query('Update user set code = code - '.$count.' WHERE id = '.$user['id']); } function resetUserCounter($user){ $char_count = count(getCharsOfUser($user['id'])); // pro Char werden dem User 6-8 Aktionen zugestanden - mysql_query('Update user set code = '.($char_count*mt_random_wrapper(6,8)).' where id = '.$user['id']); + db_query('Update user set code = '.($char_count*mt_random_wrapper(6,8)).' where id = '.$user['id']); } function checkImageCode($id, $compr_phrase, $user){ $sql = 'SELECT *, TIMESTAMPDIFF(MINUTE, created, now()) as delay from bot_images WHERE id = \'' . $id . '\''; // echo $sql.'
    '; - $row = mysql_fetch_assoc(mysql_query($sql)); + $row = mysqli_fetch_assoc(db_query($sql)); // ID not valid if($row){ // TIMEOUT! @@ -41,12 +41,12 @@ function checkImageCode($id, $compr_phrase, $user){ if($row['delay'] > 5 || strtolower($row['compressed_phrase']) != strtolower($compr_phrase)){ $sql = 'Insert into bot_image_failures(userid, inserted, valid, used) values('.$user['id'].', \''.$compr_phrase.'\', \''.$row['compressed_phrase'].'\', CURRENT_TIMESTAMP)'; // echo $sql.'
    '; - mysql_query($sql); + db_query($sql); $success = false; } else{ $success = true; } - mysql_query('DELETE from bot_images WHERE id = \'' . $id . '\''); + db_query('DELETE from bot_images WHERE id = \'' . $id . '\''); } else{ $success = false; } @@ -65,8 +65,8 @@ function createImage($id, $user) { for (; $i < 6; $i++) { $string .= ' '; } - mysql_query('DELETE from bot_images WHERE id = \'' . $id . '\''); - mysql_query('INSERT INTO bot_images(id, phrase, compressed_phrase, created, userid) values(\'' . $id . '\', \'' . $string . '\', \'' . $comp_str . '\', now(), '.$user['id'].')'); + db_query('DELETE from bot_images WHERE id = \'' . $id . '\''); + db_query('INSERT INTO bot_images(id, phrase, compressed_phrase, created, userid) values(\'' . $id . '\', \'' . $string . '\', \'' . $comp_str . '\', now(), '.$user['id'].')'); // Aufräumen (Code wurde ignoriert) detectNonCodeEnterers(); @@ -81,7 +81,7 @@ function displayImage($id, $user) { createImage($id,$user); $sql = 'SELECT * FROM bot_images WHERE id = \'' . $id . '\''; // echo $sql.'
    '; - $row = mysql_fetch_assoc(mysql_query($sql)); + $row = mysqli_fetch_assoc(db_query($sql)); if($row){ $string = $row['phrase']; $variance = true; diff --git a/ag/include/kampf/andere_technik.php b/ag/include/kampf/andere_technik.php index 32bf6ed..06b3148 100644 --- a/ag/include/kampf/andere_technik.php +++ b/ag/include/kampf/andere_technik.php @@ -40,9 +40,9 @@ if($k_attacke1_2[$x]) { } if($new_tech1 == 1) { -$technick1 = mysql_fetch_array(mysql_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke1_2[$x]' LIMIT 10")); +$technick1 = mysqli_fetch_array(db_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke1_2[$x]' LIMIT 10")); $prozent_technik1 = (20*$technick1['aktiv'])-20; -$technick1 = mysql_fetch_array(mysql_query("SELECT * FROM attacken WHERE id='$technick1[at_id]' LIMIT 10")); +$technick1 = mysqli_fetch_array(db_query("SELECT * FROM attacken WHERE id='$technick1[at_id]' LIMIT 10")); } } @@ -80,9 +80,9 @@ if($k_attacke2_2[$x]) { } if($new_tech2 == 1) { -$technick2 = mysql_fetch_array(mysql_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke2_2[$x]' LIMIT 10")); +$technick2 = mysqli_fetch_array(db_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke2_2[$x]' LIMIT 10")); $prozent_technik2 = (20*$technick2['aktiv'])-20; -$technick2 = mysql_fetch_array(mysql_query("SELECT * FROM attacken WHERE id='$technick2[at_id]' LIMIT 10")); +$technick2 = mysqli_fetch_array(db_query("SELECT * FROM attacken WHERE id='$technick2[at_id]' LIMIT 10")); } } diff --git a/ag/include/kampf/fightclasses.inc.php b/ag/include/kampf/fightclasses.inc.php index e440666..164013e 100644 --- a/ag/include/kampf/fightclasses.inc.php +++ b/ag/include/kampf/fightclasses.inc.php @@ -29,7 +29,7 @@ class Kaempfer{ */ function __construct($char, $alternative = true, $buffs = true){ if(is_numeric($char)){ // ID, wenn keine Abfrage vorhanden - $char = mysql_fetch_assoc(mysql_query('SELECT * FROM chars WHERE id='.$char)); + $char = mysqli_fetch_assoc(db_query('SELECT * FROM chars WHERE id='.$char)); } else if(!is_array($char)){ // Wenn es weder ID noch Array ist return; // breche ab, dann kann nichts mit angefangen werden } @@ -43,7 +43,7 @@ class Kaempfer{ $this->charid = $char['id']; if($buffs == true){ // Ruestungen erlaubt??? - $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'].')')); $this->starke += $char_buffs['starke']; $k_speed[0] = $char['speed'] + $char_buffs['speed']; $this->verteidigung += $char_buffs['verteidigung']; @@ -61,8 +61,8 @@ class Monster extends Kaempfer{ function __construct($monster){ if(is_numeric($monster)){ - $qry = mysql_query('SELECT * FROM quest_monster WHERE id = '.$monster); - $monster = mysql_fetch_assoc($qry); + $qry = db_query('SELECT * FROM quest_monster WHERE id = '.$monster); + $monster = mysqli_fetch_assoc($qry); } else if(!is_array($monster)){ // Fehler return; @@ -75,7 +75,7 @@ class Monster extends Kaempfer{ class Attacke{ function __construct($attacke){ if(is_numeric($attacke)){ - $qry = mysql_query('SELECT * FROM attacken WHERE id = '.$attacke); + $qry = db_query('SELECT * FROM attacken WHERE id = '.$attacke); } else if(!is_array($attacke)){ // Fehler!! return; @@ -90,7 +90,7 @@ class Attackenauswahl{ private $attacke2; function __construct($char){ if(is_numeric($char)){ // ID, wenn keine Abfrage vorhanden - $char = mysql_fetch_assoc(mysql_query('Select attacken, attacken2, auswahl1, auswahl2, auswahl3 from chars where id = '.$char)); + $char = mysqli_fetch_assoc(db_query('Select attacken, attacken2, auswahl1, auswahl2, auswahl3 from chars where id = '.$char)); } else if(!is_array($char)){ // Wenn es weder ID noch Array ist return; // breche ab, dann kann nichts mit angefangen werden } @@ -102,8 +102,8 @@ class Attackenauswahl{ // Zwischenschritt ANFANG // Nun ein Zwischenschritt weil in den Feldern attacken und attacken2 - $qry = mysql_query('Select at_id, id from lernen where id IN ('.$char['attacken'].','.$char['attacken2'].')'); - while($row = mysql_fetch_assoc($qry)){ + $qry = db_query('Select at_id, id from lernen where id IN ('.$char['attacken'].','.$char['attacken2'].')'); + while($row = mysqli_fetch_assoc($qry)){ $transition[$row['id']] = $row['at_id']; } for($i=0;$iattacke1);$i++){ @@ -114,8 +114,8 @@ class Attackenauswahl{ // Zwischenschritt ENDE!!! // Lade die Attacken aus der DB und schreibe sie direkt in den Array - $qry = mysql_query('Select * from attacken where id IN ('.join(',',$this->attacke1).','.join(',',$this->attacke2).')'); - while($row = mysql_fetch_assoc($qry)){ + $qry = db_query('Select * from attacken where id IN ('.join(',',$this->attacke1).','.join(',',$this->attacke2).')'); + while($row = mysqli_fetch_assoc($qry)){ $temp_att[$row['id']] = $row; } for($i=0;$iattacke1);$i++){ diff --git a/ag/include/kampf/frucht.php b/ag/include/kampf/frucht.php index f26aa17..b72d81c 100644 --- a/ag/include/kampf/frucht.php +++ b/ag/include/kampf/frucht.php @@ -9,7 +9,7 @@ ####################KAIOKEN SPIELER 1 if($technick1['type'] == 'frucht') { - $frucht_stats1 = mysql_fetch_array(mysql_query("SELECT starke, ver, speed, ausdauer, glueck FROM wochen_markt WHERE item='$chara_1[frucht]' LIMIT 1")); + $frucht_stats1 = mysqli_fetch_array(db_query("SELECT starke, ver, speed, ausdauer, glueck FROM wochen_markt WHERE item='$chara_1[frucht]' LIMIT 1")); $k_mp[0] = $k_mp[0] - $technick1['mp']; $k_hp[0] = $k_hp[0] - $technick1['hp']; if($k_mp[0] < 0) { @@ -29,7 +29,7 @@ if($technick1['type'] == 'frucht') { ####################KAIOKEN SPIELER 2 if($technick2['type'] == 'frucht') { - $frucht_stats2 = mysql_fetch_array(mysql_query("SELECT starke, ver, speed, ausdauer, glueck FROM wochen_markt WHERE item='$chara_2[frucht]' LIMIT 1")); + $frucht_stats2 = mysqli_fetch_array(db_query("SELECT starke, ver, speed, ausdauer, glueck FROM wochen_markt WHERE item='$chara_2[frucht]' LIMIT 1")); $k_mp[1] = $k_mp[1] - $technick2['mp']; $k_hp[1] = $k_hp[1] - $technick2['hp']; if($k_mp[1] < 0) { diff --git a/ag/include/kampf/gift.php b/ag/include/kampf/gift.php index 3c69365..8b55e96 100644 --- a/ag/include/kampf/gift.php +++ b/ag/include/kampf/gift.php @@ -11,7 +11,7 @@ if($runden_gif1) { if($runden_gif1 > $x) { - $technick1_old = mysql_fetch_array(mysql_query("SELECT * FROM attacken WHERE id='$attacken_old_id1' LIMIT 1")); + $technick1_old = mysqli_fetch_array(db_query("SELECT * FROM attacken WHERE id='$attacken_old_id1' LIMIT 1")); $k_starke[1] = $k_starke[1] - $technick1_old['starke']; $k_speed[1] = $k_speed[1] - $technick1_old['speed']; @@ -55,7 +55,7 @@ $aktion_AV1[$x] = 'nein'; if($runden_gif2) { if($runden_gif2 > $x) { - $technick2_old = mysql_fetch_array(mysql_query("SELECT * FROM attacken WHERE id='$attacken_old_id2' LIMIT 1")); + $technick2_old = mysqli_fetch_array(db_query("SELECT * FROM attacken WHERE id='$attacken_old_id2' LIMIT 1")); $k_starke[0] = $k_starke[0] - $technick2_old['starke']; $k_speed[0] = $k_speed[0] - $technick2_old['speed']; diff --git a/ag/include/kampf/tausch2.php b/ag/include/kampf/tausch2.php index d84c3a3..a6324ab 100644 --- a/ag/include/kampf/tausch2.php +++ b/ag/include/kampf/tausch2.php @@ -21,7 +21,7 @@ if ($technick1['type'] == 'tausch2') { $k_ver[0] = round($k_ver[0] * 1.1); $aktion_AV1[$x] = 'nein'; } else { - $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['verteidigung'] = $technick1['verteidigung'] + (($technick1['verteidigung'] / 100) * $prozent_technik1); $technick1['starke'] = $technick1['starke'] + (($technick1['starke'] / 100) * $prozent_technik1); @@ -55,7 +55,7 @@ if ($technick2['type'] == 'tausch2') { $k_ver[1] = round($k_ver[1] * 1.1); $aktion_AV2[$x] = 'nein'; } else { - $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['verteidigung'] = $technick2['verteidigung'] + (($technick2['verteidigung'] / 100) * $prozent_technik2); diff --git a/ag/include/kampf_anzeige.inc.php b/ag/include/kampf_anzeige.inc.php index 3a07ded..b176154 100644 --- a/ag/include/kampf_anzeige.inc.php +++ b/ag/include/kampf_anzeige.inc.php @@ -220,7 +220,7 @@ function displaySchatzSuche($char){ include_once(ROOT_PATH.'/include/schatz.inc.php'); // Erstmal die Schatzsuche-stammdaten laden! $sql = 'Select * from quests where charid ='.$char['id'].' and dauer < now()'; - $quest = mysql_fetch_assoc(mysql_query($sql)); + $quest = mysqli_fetch_assoc(db_query($sql)); // echo $sql.'
    '; if(!$quest){ return 'Schatzsuche noch nicht beendet!!'; @@ -240,24 +240,24 @@ function displaySchatzSuche($char){ // Erstmal die Seite starten echo ''; // Einfach mal ne dicke Ueberschrift - $ort = mysql_fetch_assoc(mysql_query('select * from quest_ort where id = '.$quest['ortid'])); + $ort = mysqli_fetch_assoc(db_query('select * from quest_ort where id = '.$quest['ortid'])); echo ''; // Hole die Ergebnisse die auch in die Datenbank eingetragen werden muessen! - $row = mysql_fetch_assoc(mysql_query('Select sum(exp) as exp, sum(geld) as geld, count(*) as anzahl from quest_fights where charid = '.$char['id'])); + $row = mysqli_fetch_assoc(db_query('Select sum(exp) as exp, sum(geld) as geld, count(*) as anzahl from quest_fights where charid = '.$char['id'])); // Ermittle den Endzustand des Chars - $end_qf = mysql_fetch_assoc(mysql_query('select max(fightnr) as mf from quest_fights where charid = '.$char['id'])); - $end_qr = mysql_fetch_assoc(mysql_query('select max(roundnr) as mr from quest_rounds where fightnr = '.$end_qf['mf'].' and charid = '.$char['id'])); - $last_round = mysql_fetch_assoc(mysql_query('Select * from quest_rounds where roundnr = '.$end_qr['mr'].' and fightnr = '.$end_qf['mf'].' and charid = '.$char['id'])); - $last_fight = mysql_fetch_assoc(mysql_query('Select * from quest_fights where fightnr = '.$end_qf['mf'].' and charid = '.$char['id'])); + $end_qf = mysqli_fetch_assoc(db_query('select max(fightnr) as mf from quest_fights where charid = '.$char['id'])); + $end_qr = mysqli_fetch_assoc(db_query('select max(roundnr) as mr from quest_rounds where fightnr = '.$end_qf['mf'].' and charid = '.$char['id'])); + $last_round = mysqli_fetch_assoc(db_query('Select * from quest_rounds where roundnr = '.$end_qr['mr'].' and fightnr = '.$end_qf['mf'].' and charid = '.$char['id'])); + $last_fight = mysqli_fetch_assoc(db_query('Select * from quest_fights where fightnr = '.$end_qf['mf'].' and charid = '.$char['id'])); // Ermittle die Reqs des Chars! $sql = 'SELECT c_attack as a_name, count(*) as anzahl FROM quest_rounds q where roundnr > 0 and charid = '.$char['id'].' group by c_attack'; // echo $sql.'
    '; - $reqs = mysql_query($sql); + $reqs = db_query($sql); - while($row_r = mysql_fetch_assoc($reqs)){ + while($row_r = mysqli_fetch_assoc($reqs)){ $c_attacken[] = $row_r; // print_r($c_attacken); // echo '
    '; @@ -269,10 +269,10 @@ function displaySchatzSuche($char){ $items = getSchatzItems($row['anzahl']); for($i=0;$items[$i];$i++){ - $res = mysql_query('Update quest_item_stats set anzahl = anzahl + 1 WHERE monster = '.$row['anzahl'].' and id = '.$items[$i]['id']); - if(mysql_affected_rows() == 0){ + $res = db_query('Update quest_item_stats set anzahl = anzahl + 1 WHERE monster = '.$row['anzahl'].' and id = '.$items[$i]['id']); + if(db_affected_rows() == 0){ // entry not yet present - mysql_query('INSERT INTO quest_item_stats (monster, id, anzahl) values('.$row['anzahl'].', '.$items[$i]['id'].', 1)'); + db_query('INSERT INTO quest_item_stats (monster, id, anzahl) values('.$row['anzahl'].', '.$items[$i]['id'].', 1)'); } } } else{ @@ -285,9 +285,9 @@ function displaySchatzSuche($char){ } } - $res = mysql_query('Update quest_stats set anzahl = anzahl + 1 WHERE zeit = '.$std.' AND monster = '.$row['anzahl'].' AND status = '.($final_result=='won'?1:0)); - if(mysql_affected_rows() == 0){ - mysql_query('INSERT INTO quest_stats (monster, zeit, anzahl, status) values('.$row['anzahl'].', '.$std.', 1, '.($final_result=='won'?1:0).')'); + $res = db_query('Update quest_stats set anzahl = anzahl + 1 WHERE zeit = '.$std.' AND monster = '.$row['anzahl'].' AND status = '.($final_result=='won'?1:0)); + if(db_affected_rows() == 0){ + db_query('INSERT INTO quest_stats (monster, zeit, anzahl, status) values('.$row['anzahl'].', '.$std.', 1, '.($final_result=='won'?1:0).')'); } // Zeige als erstes die Zusammenfassung an! @@ -296,8 +296,8 @@ function displaySchatzSuche($char){ // Lade nun die Fights runter $sql = 'Select * from quest_fights where charid = '.$char['id'].' ORDER BY fightnr ASC'; - $qry = mysql_query($sql); - while($fight = mysql_fetch_assoc($qry)){ + $qry = db_query($sql); + while($fight = mysqli_fetch_assoc($qry)){ displaySchatzSucheFight($quest, $char, $fight); } @@ -309,7 +309,7 @@ function displaySchatzSuche($char){ function displaySchatzSucheFight($quest, $char, $fight){ // Lade das Monster aus der Datenbank $sql = 'select * from quest_monster where id = '.$fight['monsterid']; - $monster = mysql_fetch_assoc(mysql_query($sql)); + $monster = mysqli_fetch_assoc(db_query($sql)); if($monster['bild'] == null || $monster['bild'] == ''){ $monster['bild'] = 'design/bilder/avatare/noavart.gif'; @@ -319,8 +319,8 @@ function displaySchatzSucheFight($quest, $char, $fight){ echo ''; $sql = 'Select * from quest_rounds where charid = '.$char['id']. ' and fightnr = '.$fight['fightnr']; // echo $sql.'
    '; - $qry = mysql_query($sql); - while($round = mysql_fetch_assoc($qry)){ + $qry = db_query($sql); + while($round = mysqli_fetch_assoc($qry)){ displaySchatzSucheFightRound($char, $monster, $fight, $round); } displaySummary($char['name'], $monster['name'], $fight['sieger']==$char['id']?$char['name']:$monster['name'], $fight['exp'], 0, $fight['geld'], 0); @@ -363,7 +363,7 @@ function displayEventFight($event_id, $event_fight_id) { // first readout the required event data $sql = 'SELECT *, visible <= now() as passed FROM event_fights WHERE event_id = ' . $event_id . ' AND event_fight_id = ' . $event_fight_id . ' AND `starting` <= now()'; //echo $sql . '
    '; - $event_fight_data = mysql_fetch_assoc(mysql_query($sql)); + $event_fight_data = mysqli_fetch_assoc(db_query($sql)); if(!$event_fight_data){ displayFightNotAvailable(); echo '
    Schatzsuche in '.$ort['stadt'].'
    '.$char['name'].' Vs '.$monster['name'].'
    '; @@ -372,8 +372,8 @@ function displayEventFight($event_id, $event_fight_id) { // Okay and now get the data of the chars ;) $sql = 'SELECT * FROM event_chars e where event_id = '.$event_id.' and event_char_id IN (SELECT event_char_id from event_fight_rounds where event_id = '.$event_id.' and event_fight_id = '.$event_fight_id.' and `round` = 0)'; // echo $sql . '
    '; - $qry = mysql_query($sql); - while($row = mysql_fetch_assoc($qry)) { + $qry = db_query($sql); + while($row = mysqli_fetch_assoc($qry)) { if($row['char_bild'] == null || $row['char_bild'] == ''){ $row['char_bild'] = 'design/bilder/avatare/noavart.gif'; } @@ -389,8 +389,8 @@ function displayEventFight($event_id, $event_fight_id) { echo '
    '.$char1['char_name'].' Vs '.$char2['char_name'].'
    diff --git a/ag/info/attacken.php b/ag/info/attacken.php index 803d370..87dc626 100644 --- a/ag/info/attacken.php +++ b/ag/info/attacken.php @@ -15,11 +15,11 @@ include_once(ROOT_PATH.'/include/parse.inc.php'); // TODO: Muss noch angepasst werden! function showAttDetails($at_id) { - $at_info = mysql_Fetch_array(mysql_query("SELECT * FROM attacken WHERE id='".$at_id."' LIMIT 1")); + $at_info = mysqli_fetch_array(db_query("SELECT * FROM attacken WHERE id='".$at_id."' LIMIT 1")); $req_atk = explode(",", $at_info['req_atk']); $req_lvl = explode(",", $at_info['req_lvl']); - $req_attack = mysql_fetch_array(mysql_query("SELECT f.name AS f_name, b.name AS b_name, c.name AS c_name, d.name AS d_name, e.name AS e_name FROM attacken a LEFT JOIN attacken b ON(b.id='".$req_atk[0]."') LEFT JOIN attacken c ON(c.id='".$req_atk[1]."') LEFT JOIN attacken d ON(d.id='".$req_atk[2]."') LEFT JOIN attacken e ON(e.id='".$req_atk[3]."') LEFT JOIN attacken f ON(f.id='".$req_atk[4]."') WHERE a.id='".$at_id."'")); + $req_attack = mysqli_fetch_array(db_query("SELECT f.name AS f_name, b.name AS b_name, c.name AS c_name, d.name AS d_name, e.name AS e_name FROM attacken a LEFT JOIN attacken b ON(b.id='".$req_atk[0]."') LEFT JOIN attacken c ON(c.id='".$req_atk[1]."') LEFT JOIN attacken d ON(d.id='".$req_atk[2]."') LEFT JOIN attacken e ON(e.id='".$req_atk[3]."') LEFT JOIN attacken f ON(f.id='".$req_atk[4]."') WHERE a.id='".$at_id."'")); ?>
    @@ -204,7 +204,7 @@ function showAtks($linkz,$tf='',$rassen='',$order='',$type='',$pagenum='',$fruch $sql .= ' '.$order.' LIMIT '.($pagenum * 20).', 20 '; $attacken = db_query($sql); - while ($row = mysql_fetch_array($attacken)) { + while ($row = mysqli_fetch_array($attacken)) { ?>
    @@ -117,8 +117,8 @@ exit; if($pagenum == "" or $pagenum == 1) { $pagenum = 0; } if($pagenum != "" and $pagenum != 1) { $pagenum = ($pagenum - 1) * 10; } -$item = mysql_query("SELECT name, id FROM item LIMIT $pagenum, 10"); -while($row = mysql_Fetch_array($item)) { +$item = db_query("SELECT name, id FROM item LIMIT $pagenum, 10"); +while($row = mysqli_fetch_array($item)) { ?>
    @@ -130,7 +130,7 @@ while($row = mysql_Fetch_array($item)) { } - $Total = mysql_num_rows(mysql_query("SELECT id FROM item")); + $Total = mysqli_stmt_num_rows(db_query("SELECT id FROM item")); $pages = ceil($Total/10); $z = 1; diff --git a/ag/info/lern.php b/ag/info/lern.php index dec5c39..e565a8e 100644 --- a/ag/info/lern.php +++ b/ag/info/lern.php @@ -25,7 +25,7 @@ if ($char_id == null) { if ($attack_id != null) { $test = 'INSERT INTO lernen(name, at_id,besitzer,aktiv) VALUES'. '((SELECT name FROM attacken WHERE id ='.$attack_id.'), '.$attack_id.', '.$char_id.', 1);'; - $qry = mysql_query($test); + $qry = db_query($test); } $attacks_learned = getAttacksforChar($char_id, 0); $attacks_unlearned = getAttacksforChar($char_id, 1); diff --git a/ag/item.php b/ag/item.php index 6cfe104..7adf5b1 100644 --- a/ag/item.php +++ b/ag/item.php @@ -49,7 +49,7 @@ function getTradeItems($userid){ $result = NULL; $index = 0; - $arenalvl = mysql_fetch_array(mysql_query("SELECT level FROM arena WHERE besitzer = ".$userid.";")); + $arenalvl = mysqli_fetch_array(db_query("SELECT level FROM arena WHERE besitzer = ".$userid.";")); // Die etwas abgewandelten SQL-Querys aus dem auktion_functions.php $query = 'SELECT i.id, i.name, count(i.id) AS anzahl, tausch_anzahl, tausch_lvl, \'ware\' as tablename FROM ware w INNER JOIN item i ON(i.id=w.item_id) WHERE w.user = '.$userid.' AND s_type = \'Trank\' AND tausch_lvl <= '.$arenalvl['level'].' GROUP BY i.id union @@ -57,9 +57,9 @@ function getTradeItems($userid){ union SELECT i.id, i.item AS name, count(i.id) AS anzahl, tausch_anzahl, tausch_lvl, \'wochen_ware\' as tablename FROM wochen_ware w INNER JOIN wochen_markt i ON(i.id=w.item) WHERE w.user = '.$userid.' AND tausch_lvl <= '.$arenalvl['level'].' GROUP BY (i.id)'; - $qry = mysql_query($query); + $qry = db_query($query); // Damit waeren alle noetigen Datenbankaufrufe erledigt! - while($row = mysql_fetch_assoc($qry)){ + while($row = mysqli_fetch_assoc($qry)){ $result[$index++] = ''; } return $result; @@ -69,20 +69,20 @@ function getTradeConditions($table, $item_id) { $row = null; switch ($table) { case 'ware': - $row = mysql_fetch_array(mysql_query("SELECT tausch_lvl, tausch_anzahl, name FROM item WHERE id = $item_id;")); + $row = mysqli_fetch_array(db_query("SELECT tausch_lvl, tausch_anzahl, name FROM item WHERE id = $item_id;")); break; case 'wochen_ware': - $row = mysql_fetch_array(mysql_query("SELECT tausch_lvl, tausch_anzahl, item FROM wochen_markt WHERE id = $item_id;")); + $row = mysqli_fetch_array(db_query("SELECT tausch_lvl, tausch_anzahl, item FROM wochen_markt WHERE id = $item_id;")); break; case 'sp_ware': - $row = mysql_fetch_array(mysql_query("SELECT tausch_lvl, tausch_anzahl, name FROM sp_item WHERE id = $item_id;")); + $row = mysqli_fetch_array(db_query("SELECT tausch_lvl, tausch_anzahl, name FROM sp_item WHERE id = $item_id;")); break; } return $row; } function getUserTransaction($user_id) { - $row = mysql_fetch_array(mysql_query('SELECT zeit, NOW() as zeit2 FROM transaktionen WHERE verkaeufer = '.$user_id.' ORDER BY zeit DESC LIMIT 1;')); + $row = mysqli_fetch_array(db_query('SELECT zeit, NOW() as zeit2 FROM transaktionen WHERE verkaeufer = '.$user_id.' ORDER BY zeit DESC LIMIT 1;')); $day_old = $row['zeit']; if($day_old != null) { $day_old = substr($day_old, 8, 2); @@ -105,14 +105,14 @@ function getUserTransaction($user_id) { function setUserTransaction($user_id, $trade_user_id, $item, $anzahl=1, $betrag=0) { $qry = 'INSERT INTO transaktionen(kaeufer, verkaeufer, item, anzahl, betrag, zeit) VALUES ('.$trade_user_id.','.$user_id.',\''.$item.'\','.$anzahl.','.$betrag.',NOW())'; - mysql_query($qry); + db_query($qry); } $user = $user_ida; if ($charm == 1) { - $item_info1 = mysql_fetch_array(mysql_query("SELECT item_id, id, user FROM ware WHERE id='$item_id1' LIMIT 1")); - $item_info3 = mysql_fetch_array(mysql_query("SELECT preis, anzahl, hp, mp, starke, verteidigung, speed, s_type, type FROM item WHERE id='$item_info1[item_id]' LIMIT 1")); + $item_info1 = mysqli_fetch_array(db_query("SELECT item_id, id, user FROM ware WHERE id='$item_id1' LIMIT 1")); + $item_info3 = mysqli_fetch_array(db_query("SELECT preis, anzahl, hp, mp, starke, verteidigung, speed, s_type, type FROM item WHERE id='$item_info1[item_id]' LIMIT 1")); $char_id1 = getChar($char_id2); if ($item_info1['user'] != $user['id']) { @@ -158,8 +158,8 @@ if ($charm == 1) { $new_mp = $mp1[1]; } - mysql_Query("UPDATE chars SET starke='$new_starke', verteidigung='$new_ver', speed='$new_speed', hp='$new_hp,$new_hp2', mp='$new_mp,$new_mp2' WHERE id='$char_id2' LIMIT 1"); - mysql_query("DELETE FROM ware WHERE id='$item_info1[id]' LIMIT 1"); + db_query("UPDATE chars SET starke='$new_starke', verteidigung='$new_ver', speed='$new_speed', hp='$new_hp,$new_hp2', mp='$new_mp,$new_mp2' WHERE id='$char_id2' LIMIT 1"); + db_query("DELETE FROM ware WHERE id='$item_info1[id]' LIMIT 1"); displayErrorMessage(NULL,'Trank erfolgreich Benutzt', 'weiter...'); exit; @@ -171,8 +171,8 @@ if ($charm == 2) { exit; } - $item_info = mysql_fetch_array(mysql_query("SELECT item_id, id, user, ru_mal FROM ware WHERE id='$item_id' LIMIT 1")); - $item_info2 = mysql_fetch_array(mysql_query("SELECT preis, anzahl FROM item WHERE id='$item_info[item_id]' LIMIT 1")); + $item_info = mysqli_fetch_array(db_query("SELECT item_id, id, user, ru_mal FROM ware WHERE id='$item_id' LIMIT 1")); + $item_info2 = mysqli_fetch_array(db_query("SELECT preis, anzahl FROM item WHERE id='$item_info[item_id]' LIMIT 1")); if ($item_info['user'] != $user_ida['id']) { displayErrorMessage(NULL,'Dieses Item gehört nicht dir', displayHistoryBackLink()); @@ -187,9 +187,9 @@ if ($charm == 2) { $sql = "UPDATE user SET geld='$new_geld' WHERE id='$user[id]'"; // echo $sql.'
    '; - mysql_query($sql); - mysql_query("UPDATE item SET anzahl='$new_zahl' WHERE id='$item_info[item_id]'"); - mysql_Query("DELETE FROM ware WHERE id='$item_info[id]'"); + db_query($sql); + db_query("UPDATE item SET anzahl='$new_zahl' WHERE id='$item_info[item_id]'"); + db_query("DELETE FROM ware WHERE id='$item_info[id]'"); displayErrorMessage(NULL,'Item erfolgreich verkauft', 'weiter...'); exit; } @@ -200,7 +200,7 @@ if($charm == 3) { displayErrorMessage(NULL,'Kein Namen für den User angegeben!', displayHistoryBackLink()); exit; } else { - $row = mysql_fetch_array(mysql_query("SELECT id FROM user WHERE nickname='$tausch_user' LIMIT 1")); + $row = mysqli_fetch_array(db_query("SELECT id FROM user WHERE nickname='$tausch_user' LIMIT 1")); $tausch_user_id = $row['id']; if($tausch_user_id == null) { displayErrorMessage(NULL,'Unbekannter User!', displayHistoryBackLink()); @@ -215,16 +215,16 @@ if($charm == 3) { $tausch_item = explode(",", $tausch_item); if($tausch_geld != null xor $tausch_item[0] >= 0) { if($tausch_geld != null) { - $row = mysql_fetch_array(mysql_query("SELECT level FROM arena WHERE besitzer = ".$user['id'].";")); + $row = mysqli_fetch_array(db_query("SELECT level FROM arena WHERE besitzer = ".$user['id'].";")); $arenalvl = $row['level']; $tausch_geld = round($tausch_geld); if($tausch_geld <= ($arenalvl * 10000) && $tausch_geld > 0) { if($tausch_geld <= getRelevantMoney($user['id'])) { $qry = 'UPDATE user SET geld = geld - '.$tausch_geld.' WHERE id = '.$user['id'].';'; - mysql_query($qry); + db_query($qry); $qry = 'UPDATE user SET geld = geld + '.$tausch_geld.' WHERE id = '.$tausch_user_id.';'; - mysql_query($qry); + db_query($qry); sendMessage($user['nickname'], $tausch_user_id, 'Geschenk', 'Der Spieler '.$user['nickname'].' hat dir '.$tausch_geld.' geschenkt!'); setUserTransaction($user['id'], $tausch_user_id, 'Geld', 0, $tausch_geld); @@ -247,10 +247,10 @@ if($charm == 3) { if($tausch_anzahl <= $row['tausch_anzahl'] && $tausch_anzahl > 0) { if($tausch_item[1] == 'ware') { $qry = 'UPDATE ware SET user = '.$tausch_user_id.' WHERE item_id = '.$tausch_item[0].' AND user = '.$user['id'].' LIMIT '.$tausch_anzahl.';'; - mysql_query($qry); + db_query($qry); } else { $qry = 'UPDATE '.$tausch_item[1].' SET user = '.$tausch_user_id.' WHERE item = '.$tausch_item[0].' AND user = '.$user['id'].' LIMIT '.$tausch_anzahl.';'; - mysql_query($qry); + db_query($qry); } sendMessage($user['nickname'], $tausch_user_id, 'Geschenk', 'Der Spieler '.$user['nickname'].' hat dir das Item '.$row['name'].$row['item'].' geschenkt!'); setUserTransaction($user['id'], $tausch_user_id, $row['item'].$row['name'], $tausch_anzahl); @@ -278,7 +278,7 @@ if($charm == 3) { } if ($charm == 6) { - $item_info = mysql_fetch_array(mysql_query("SELECT w.user, i.item, i.starke, i.ver, i.speed, i.ausdauer, i.hp, i.mp, i.glueck FROM wochen_ware w LEFT JOIN wochen_markt i ON(i.id=w.item) WHERE w.id='$sp_item' LIMIT 1")); + $item_info = mysqli_fetch_array(db_query("SELECT w.user, i.item, i.starke, i.ver, i.speed, i.ausdauer, i.hp, i.mp, i.glueck FROM wochen_ware w LEFT JOIN wochen_markt i ON(i.id=w.item) WHERE w.id='$sp_item' LIMIT 1")); $char_id1 = getChar($char_id2); if ($item_info['user'] != $user['id']) { @@ -318,8 +318,8 @@ if ($charm == 6) { $new_ausdauer = $item_info['ausdauer'] + $char_id1['ausdauer']; $new_glueck = $item_info['glueck'] + $char_id1['glueck']; - mysql_Query("UPDATE chars SET frucht='$item_info[item]', ausdauer='$new_ausdauer', glueck='$new_glueck', starke='$new_starke', verteidigung='$new_ver', speed='$new_speed', hp='$hp1[0],$new_hp2', mp='$mp1[0],$new_mp2' WHERE id='$char_id2' LIMIT 1"); - mysql_query("DELETE FROM wochen_ware WHERE id='$sp_item' LIMIT 1"); + db_query("UPDATE chars SET frucht='$item_info[item]', ausdauer='$new_ausdauer', glueck='$new_glueck', starke='$new_starke', verteidigung='$new_ver', speed='$new_speed', hp='$hp1[0],$new_hp2', mp='$mp1[0],$new_mp2' WHERE id='$char_id2' LIMIT 1"); + db_query("DELETE FROM wochen_ware WHERE id='$sp_item' LIMIT 1"); displayErrorMessage(NULL,$item_info['item'].' erfolgreich benutzt', 'weiter...'); exit; @@ -328,8 +328,8 @@ if ($charm == 6) { $chars = getCharsOfUser($user_ida['id']); $sql = "SELECT item_id, count(item_id) as anzahl, user, id, ru_mal FROM ware WHERE user='$user[id]' group by item_id"; //echo $sql; -$item2 = mysql_query($sql); -$item1 = mysql_query("SELECT item_id, id, ru_mal FROM ware WHERE user='$user[id]' group by item_id"); +$item2 = db_query($sql); +$item1 = db_query("SELECT item_id, id, ru_mal FROM ware WHERE user='$user[id]' group by item_id"); ?>
    @@ -356,8 +356,8 @@ $item1 = mysql_query("SELECT item_id, id, ru_mal FROM ware WHERE user='$user[id] ?>



    '.$item_name['name'].' (Typ: '.$item_name['s_type'].', Level: '.$item_name['level'].')'; } else{ diff --git a/ag/kampf2.php b/ag/kampf2.php index 7f3de40..b847158 100644 --- a/ag/kampf2.php +++ b/ag/kampf2.php @@ -22,11 +22,11 @@ if (!$chara_1['id'] OR !$chara_2['id']) { } ################## Kaempfer 1 $char1_quis_item = explode(",", $chara_1['kampf_item']); -$char1_item_helm = mysql_Fetch_Array(mysql_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char1_quis_item[0]' LIMIT 1")); -$char1_item_rustung = mysql_Fetch_Array(mysql_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char1_quis_item[1]' LIMIT 1")); -$char1_item_schild = mysql_Fetch_Array(mysql_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char1_quis_item[2]' LIMIT 1")); -$char1_item_schwert = mysql_Fetch_Array(mysql_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char1_quis_item[3]' LIMIT 1")); -$char1_item_schuhe = mysql_Fetch_Array(mysql_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char1_quis_item[4]' LIMIT 1")); +$char1_item_helm = mysqli_fetch_array(db_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char1_quis_item[0]' LIMIT 1")); +$char1_item_rustung = mysqli_fetch_array(db_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char1_quis_item[1]' LIMIT 1")); +$char1_item_schild = mysqli_fetch_array(db_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char1_quis_item[2]' LIMIT 1")); +$char1_item_schwert = mysqli_fetch_array(db_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char1_quis_item[3]' LIMIT 1")); +$char1_item_schuhe = mysqli_fetch_array(db_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char1_quis_item[4]' LIMIT 1")); $k_hp1 = explode(",", $chara_1['hp']); $k_mp1 = explode(",", $chara_1['mp']); @@ -56,11 +56,11 @@ $k_aufgabe[0] = $k_aufgabe_a_1 * $chara_1['aufgeben']; ################## Kaempfer 2 $char2_quis_item = explode(",", $chara_2['kampf_item']); -$char2_item_helm = mysql_Fetch_Array(mysql_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char2_quis_item[0]' LIMIT 1")); -$char2_item_rustung = mysql_Fetch_Array(mysql_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char2_quis_item[1]' LIMIT 1")); -$char2_item_schild = mysql_Fetch_Array(mysql_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char2_quis_item[2]' LIMIT 1")); -$char2_item_schwert = mysql_Fetch_Array(mysql_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char2_quis_item[3]' LIMIT 1")); -$char2_item_schuhe = mysql_Fetch_Array(mysql_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char2_quis_item[4]' LIMIT 1")); +$char2_item_helm = mysqli_fetch_array(db_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char2_quis_item[0]' LIMIT 1")); +$char2_item_rustung = mysqli_fetch_array(db_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char2_quis_item[1]' LIMIT 1")); +$char2_item_schild = mysqli_fetch_array(db_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char2_quis_item[2]' LIMIT 1")); +$char2_item_schwert = mysqli_fetch_array(db_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char2_quis_item[3]' LIMIT 1")); +$char2_item_schuhe = mysqli_fetch_array(db_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char2_quis_item[4]' LIMIT 1")); $k_hp2 = explode(",", $chara_2['hp']); $k_mp2 = explode(",", $chara_2['mp']); @@ -101,9 +101,9 @@ $runden_gif_technik2 = ""; if ($k_hp[0] > $k_aufgabe[0] AND $k_hp[1] > $k_aufgabe[1] AND $x < 10) { $sql = "INSERT 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]'"; - mysql_query($sql); + db_query($sql); // echo $sql . '
    '; - if (mysql_affected_rows() == 0) { + if (db_affected_rows() == 0) { echo '"' . $sql . '" konnte nicht ausgefürt werden!
    '; } } else { @@ -131,13 +131,13 @@ $GLOBALS['kampf']['aussetzen'] = &$aussetzten_runde; 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; - $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; - $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 include (ROOT_PATH . '/include/kampf/andere_technik.php'); /////////////////// Wenn man ne andere technik sich aussuchen will... @@ -217,9 +217,9 @@ while ($k_hp[0] > $k_aufgabe[0] AND $k_hp[1] > $k_aufgabe[1] AND $x < 10) { #####################################KAMPF SYSTEM include (ROOT_PATH . '/include/kampf/kampf_rechnung.php'); - $db_query = mysql_fetch_array(mysql_query("SELECT * FROM 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 kampf WHERE (char1='$chara_1[id]' OR char1='$chara_2[id]') AND dauer='0' order by id DESC LIMIT 1")); - mysql_query("UPDATE 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 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++; } @@ -323,8 +323,8 @@ if ($sieger == $chara_1['name']) { } // Umsatzsteuer (auf alles, dafür is ja der Freibetrag höher) :) -mysql_query('Update arena set einnahmen = einnahmen + '.$k_geld[0].' WHERE besitzer = '.$chara_1['besitzer']); -mysql_query('Update arena set einnahmen = einnahmen + '.$k_geld[1].' WHERE besitzer = '.$chara_2['besitzer']); +db_query('Update arena set einnahmen = einnahmen + '.$k_geld[0].' WHERE besitzer = '.$chara_1['besitzer']); +db_query('Update arena set einnahmen = einnahmen + '.$k_geld[1].' WHERE besitzer = '.$chara_2['besitzer']); /* // Das ist der Teil, der an das Heim-Team geht und versteuert werden muss! 10% @@ -336,25 +336,25 @@ $dauer_Z = time() + ($kampf_info['zeit_rec']); $arena_exp_new = round(50 * ($chara_1['level'] + $chara_2['level']) * ($exp001 / 3)); -mysql_query("UPDATE kampf SET preis='$nw_preis', art='$kampf_info[art]', art2='$kampf_info[rasse]', exp1='$k_exp[0]', arena_name = '$arena_data[id]', win='$sieger', lose='$verlierer', exp2='$k_exp[1]', geld1='$k_geld[0]', geld2='$k_geld[1]', loge='$arena[loge]' , sitz='$arena[sitz]', steh='$arena[steh]', db_satz='$chara_1[id]', dauer='$dauer_Z', arena_exp=$arena_exp_new, loge = $arena_data[loge], sitz = $arena_data[sitz], steh = $arena_data[steh] , arena_geld = $arena_geld WHERE id='$db_query[id]'"); +db_query("UPDATE kampf SET preis='$nw_preis', art='$kampf_info[art]', art2='$kampf_info[rasse]', exp1='$k_exp[0]', arena_name = '$arena_data[id]', win='$sieger', lose='$verlierer', exp2='$k_exp[1]', geld1='$k_geld[0]', geld2='$k_geld[1]', loge='$arena[loge]' , sitz='$arena[sitz]', steh='$arena[steh]', db_satz='$chara_1[id]', dauer='$dauer_Z', arena_exp=$arena_exp_new, loge = $arena_data[loge], sitz = $arena_data[sitz], steh = $arena_data[steh] , arena_geld = $arena_geld WHERE id='$db_query[id]'"); -$db_query2 = mysql_fetch_array(mysql_query("SELECT * FROM kampf WHERE char1='$chara_1[id]' order by id DESC LIMIT 1")); +$db_query2 = mysqli_fetch_array(db_query("SELECT * FROM kampf WHERE char1='$chara_1[id]' order by id DESC LIMIT 1")); -mysql_query("UPDATE chars SET status='Kampf' WHERE id='$chara_1[id]'"); +db_query("UPDATE chars SET status='Kampf' WHERE id='$chara_1[id]'"); /////wenn npcs kaempfen if ($kampf_info['rasse'] != "NPC") { $sql = "INSERT kampf SET preis='$nw_preis', art='$kampf_info[art]', art2='$kampf_info[rasse]', hp1='$db_query2[hp1]', hp2='$db_query2[hp2]', mp1='$db_query2[mp1]', mp2='$db_query2[mp2]', attacke1='$db_query2[attacke1]', attacke2='$db_query2[attacke2]', schaden1='$db_query2[schaden1]', schaden2='$db_query2[schaden2]', char1='$db_query2[char1]', char2='$db_query2[char2]', starke1='$db_query2[starke1]', starke2='$db_query2[starke2]', ver1='$db_query2[ver1]', ver2='$db_query2[ver2]', speed1='$db_query2[speed1]',speed2='$db_query2[speed2]', ausdauer1='$db_query2[ausdauer1]', ausdauer2='$db_query2[ausdauer2]', glueck1='$db_query2[glueck1]', glueck2='$db_query2[glueck2]', exp1='$db_query2[exp1]', exp2='$db_query2[exp2]', geld1='$db_query2[geld1]', geld2='$db_query2[geld2]', loge='$db_query2[loge]', sitz=$db_query2[sitz], steh=$db_query2[steh], win='$db_query2[win]', lose='$db_query2[lose]', dauer='$dauer_Z', db_satz ='$chara_2[id]', arena_name='$db_query2[arena_name]', arena_exp=$arena_exp_new, arena_geld='$db_query2[arena_geld]'"; - mysql_query($sql); + db_query($sql); // echo $sql . '
    '; - if (mysql_affected_rows() == 0) { + if (db_affected_rows() == 0) { echo '"' . $sql . '" konnte nicht ausgefürt werden!
    '; } - mysql_query("UPDATE chars SET status='Kampf' WHERE id='$chara_2[id]'"); - mysql_query("DELETE FROM kampf_list WHERE id='$kampf_info[id]'"); + db_query("UPDATE chars SET status='Kampf' WHERE id='$chara_2[id]'"); + db_query("DELETE FROM kampf_list WHERE id='$kampf_info[id]'"); - mysql_query("INSERT top_kampf SET preis='$nw_preis', art='$kampf_info[art]', art2='$kampf_info[rasse]', hp1='$db_query2[hp1]', hp2='$db_query2[hp2]', mp1='$db_query2[mp1]', mp2='$db_query2[mp2]', attacke1='$db_query2[attacke1]', attacke2='$db_query2[attacke2]', schaden1='$db_query2[schaden1]', schaden2='$db_query2[schaden2]', char1='$db_query2[char1]', char2='$db_query2[char2]', starke1='$db_query2[starke1]', starke2='$db_query2[starke2]', ver1='$db_query2[ver1]', ver2='$db_query2[ver2]', speed1='$db_query2[speed1]',speed2='$db_query2[speed2]', ausdauer1='$db_query2[ausdauer1]', ausdauer2='$db_query2[ausdauer2]', glueck1='$db_query2[glueck1]', glueck2='$db_query2[glueck2]', exp1='$db_query2[exp1]', exp2='$db_query2[exp2]', geld1='$db_query2[geld1]', geld2='$db_query2[geld2]', loge='$db_query2[loge]', sitz=$db_query2[sitz], steh=$db_query2[steh], win='$db_query2[win]', lose='$db_query2[lose]', arena_name='$db_query2[arena_name]', arena_exp='$db_query2[arena_exp]', dauer='$dauer_Z', db_satz ='$chara_2[id]'"); + db_query("INSERT top_kampf SET preis='$nw_preis', art='$kampf_info[art]', art2='$kampf_info[rasse]', hp1='$db_query2[hp1]', hp2='$db_query2[hp2]', mp1='$db_query2[mp1]', mp2='$db_query2[mp2]', attacke1='$db_query2[attacke1]', attacke2='$db_query2[attacke2]', schaden1='$db_query2[schaden1]', schaden2='$db_query2[schaden2]', char1='$db_query2[char1]', char2='$db_query2[char2]', starke1='$db_query2[starke1]', starke2='$db_query2[starke2]', ver1='$db_query2[ver1]', ver2='$db_query2[ver2]', speed1='$db_query2[speed1]',speed2='$db_query2[speed2]', ausdauer1='$db_query2[ausdauer1]', ausdauer2='$db_query2[ausdauer2]', glueck1='$db_query2[glueck1]', glueck2='$db_query2[glueck2]', exp1='$db_query2[exp1]', exp2='$db_query2[exp2]', geld1='$db_query2[geld1]', geld2='$db_query2[geld2]', loge='$db_query2[loge]', sitz=$db_query2[sitz], steh=$db_query2[steh], win='$db_query2[win]', lose='$db_query2[lose]', arena_name='$db_query2[arena_name]', arena_exp='$db_query2[arena_exp]', dauer='$dauer_Z', db_satz ='$chara_2[id]'"); } ?> \ No newline at end of file diff --git a/ag/kampf4.php b/ag/kampf4.php index b215e84..7265b81 100644 --- a/ag/kampf4.php +++ b/ag/kampf4.php @@ -31,10 +31,10 @@ if (!isUserOwnerOf($user['id'], $char_id)) { exit; } -$kampf1 = mysql_Fetch_array(mysql_query("SELECT * FROM kampf WHERE db_satz='$char_id' order by id DESC LIMIT 1")); +$kampf1 = mysqli_fetch_array(db_query("SELECT * FROM kampf WHERE db_satz='$char_id' order by id DESC LIMIT 1")); $char_1 = getChar($kampf1['char1']); $char_2 = getChar($kampf1['char2']); -$arena = mysql_Fetch_array(mysql_query("SELECT * FROM arena WHERE id='$kampf1[arena_name]' LIMIT 1")); +$arena = mysqli_fetch_array(db_query("SELECT * FROM arena WHERE id='$kampf1[arena_name]' LIMIT 1")); $ressource = 'Kampf:' . $kampf1['id']; if (!semaphoreUP($ressource)) { @@ -54,8 +54,8 @@ if (!checkAbholcode($char_id, $code)) { exit; } -mysql_query('DELETE FROM kampf WHERE db_satz='.$char_id); -if (mysql_affected_rows() == 0) { +db_query('DELETE FROM kampf WHERE db_satz='.$char_id); +if (db_affected_rows() == 0) { displayErrorMessage(NULL, 'Der Kampf wurde schon abgeholt!', displayHistoryBackLink()); semaphoreDown($ressource); exit; @@ -132,7 +132,7 @@ if ($kampf1['id']) { if ($new_mp > $a_mp1[1]) { $new_mp = $a_mp1[1]; } - mysql_query("UPDATE chars SET status='Frei', mp='$new_mp,$a_mp1[1]', hp='$new_hp,$a_hp1[1]' WHERE id='$char_id' LIMIT 1"); + db_query("UPDATE chars SET status='Frei', mp='$new_mp,$a_mp1[1]', hp='$new_hp,$a_hp1[1]' WHERE id='$char_id' LIMIT 1"); } else { $new_exp = $kampf1['exp2']; $new_geld = $user['geld'] + $kampf1['geld2']; @@ -153,7 +153,7 @@ if ($kampf1['id']) { $new_mp = $a_mp2[1]; } - mysql_query("UPDATE chars SET status='Frei', mp='$new_mp,$a_mp2[1]', hp='$new_hp,$a_hp2[1]' WHERE id='$char_id' LIMIT 1"); + db_query("UPDATE chars SET status='Frei', mp='$new_mp,$a_mp2[1]', hp='$new_hp,$a_hp2[1]' WHERE id='$char_id' LIMIT 1"); } @@ -164,9 +164,9 @@ if ($kampf1['id']) { ////////NPC item verteilung if ($kampf1['art2'] == "NPC") { - $item = mysql_fetch_array(mysql_query('SELECT item, mal, datensatz, wieviel, feld FROM npc_item WHERE charakter='.$kampf1['char2'].';')); + $item = mysqli_fetch_array(db_query('SELECT item, mal, datensatz, wieviel, feld FROM npc_item WHERE charakter='.$kampf1['char2'].';')); - $schon_bekommen = mysql_fetch_assoc(mysql_query("SELECT Count(*) as anzahl FROM npc_ware WHERE charakter='$kampf1[char2]' AND user='$user_ida[id]'")); + $schon_bekommen = mysqli_fetch_assoc(db_query("SELECT Count(*) as anzahl FROM npc_ware WHERE charakter='$kampf1[char2]' AND user='$user_ida[id]'")); if ($schon_bekommen['anzahl'] >= $item['mal']) { /////item schon bekommen @@ -184,12 +184,12 @@ if ($kampf1['id']) { $chars = getCharsOfUser($user_ida['id']); foreach ($chars as $tmp_char) { $values = explode(',', $tmp_char[$item['feld']]); - mysql_query('UPDATE '.$item['datensatz'].' SET '.$item['feld'].'=\''.$values[0].','.($values[1]+$item['wieviel']).'\' WHERE besitzer='.$user_ida['id'].' AND id='.$tmp_char['id']); + db_query('UPDATE '.$item['datensatz'].' SET '.$item['feld'].'=\''.$values[0].','.($values[1]+$item['wieviel']).'\' WHERE besitzer='.$user_ida['id'].' AND id='.$tmp_char['id']); } } else { - mysql_query("UPDATE $item[datensatz] SET $item[feld]=$item[feld]+'$item[wieviel]' WHERE besitzer='$user_ida[id]' LIMIT 10"); + db_query("UPDATE $item[datensatz] SET $item[feld]=$item[feld]+'$item[wieviel]' WHERE besitzer='$user_ida[id]' LIMIT 10"); } - mysql_query("INSERT npc_ware SET user='$user_ida[id]', charakter='$kampf1[char2]'"); + db_query("INSERT npc_ware SET user='$user_ida[id]', charakter='$kampf1[char2]'"); } else { $satz = "item"; $new_item = "sp_item"; @@ -201,7 +201,7 @@ if ($kampf1['id']) { } else { $ut = 0; while ($ut < $item['wieviel']) { - mysql_query("INSERT $item[datensatz] SET $satz='$item[item]', user='$user_ida[id]'"); + db_query("INSERT $item[datensatz] SET $satz='$item[item]', user='$user_ida[id]'"); if (!$ut) { $itemname = $item['item']; @@ -211,13 +211,13 @@ if ($kampf1['id']) { $ut++; } - mysql_query("INSERT npc_ware SET user='$user_ida[id]', charakter='$kampf1[char2]'"); + db_query("INSERT npc_ware SET user='$user_ida[id]', charakter='$kampf1[char2]'"); } } } ///ENDE - mysql_query("UPDATE chars SET siege='$new_siege' WHERE id='$char_id'"); + db_query("UPDATE chars SET siege='$new_siege' WHERE id='$char_id'"); } else { ###################################################CHARAKTER LOSE @@ -238,7 +238,7 @@ if ($kampf1['id']) { //--> "; $new_preis = 0; - mysql_query("UPDATE chars SET status='Tod' WHERE id='$char_id'"); + db_query("UPDATE chars SET status='Tod' WHERE id='$char_id'"); } else { @@ -248,7 +248,7 @@ if ($kampf1['id']) { } - mysql_query("UPDATE chars SET niederlagen='$new_niederlagen', liga_niederlagen='$new_liga_niederlagen', preis='$new_preis', dead_list='$new_dead_list' WHERE id='$char_id'"); + db_query("UPDATE chars SET niederlagen='$new_niederlagen', liga_niederlagen='$new_liga_niederlagen', preis='$new_preis', dead_list='$new_dead_list' WHERE id='$char_id'"); } @@ -258,26 +258,26 @@ if ($kampf1['id']) { // Leveln der Arena :) (Um Rundungsfehler zu vermeiden diese umstaendliche Rechnung) addExpToArena($char_2['besitzer'], $kampf1['arena_exp']-round($kampf1['arena_exp']*0.25)); // Umsatz wird schon vorher ermittelt :) - // mysql_query('UPDATE arena SET einnahmen = einnahmen + '.$kampf1['arena_geld'].' WHERE besitzer='.$char_2['besitzer']); + // db_query('UPDATE arena SET einnahmen = einnahmen + '.$kampf1['arena_geld'].' WHERE besitzer='.$char_2['besitzer']); // include_once (ROOT_PATH . '/include/arena_exp.php'); } else{ addExpToArena($char_1['besitzer'], round($kampf1['arena_exp']*0.25)); } - $row = mysql_fetch_assoc(mysql_query('Select mietlasten FROM arena WHERE besitzer='.$user['id'])); + $row = mysqli_fetch_assoc(db_query('Select mietlasten FROM arena WHERE besitzer='.$user['id'])); if($row['mietlasten'] > 2){ // Steuerschulden $tilgung = ceil($new_geld_offset * 0.75); $restgeld = $new_geld_offset - $tilgung; - mysql_query('UPDATE user SET geld=geld+'.$restgeld.' WHERE id= '.$user['id']); + db_query('UPDATE user SET geld=geld+'.$restgeld.' WHERE id= '.$user['id']); echo ''; - mysql_query('UPDATE arena SET steuerlasten = steuerlasten - '.$tilgung. ' WHERE besitzer ='.$user['id']); + db_query('UPDATE arena SET steuerlasten = steuerlasten - '.$tilgung. ' WHERE besitzer ='.$user['id']); } else{ - mysql_query('UPDATE user SET geld=' . $new_geld . ' WHERE id=' . $user['id'] . ' LIMIT 1'); + db_query('UPDATE user SET geld=' . $new_geld . ' WHERE id=' . $user['id'] . ' LIMIT 1'); } - // mysql_query("DELETE FROM kampf_nachricht WHERE charakter='$char_id'"); + // db_query("DELETE FROM kampf_nachricht WHERE charakter='$char_id'"); // include_once (ROOT_PATH . '/include/exp.php'); @@ -309,10 +309,10 @@ if ($kampf1['id']) { addAttackUsageToChar($char_id, $l_attacken); if ($itemname) { - $item_names = mysql_query("SELECT name FROM $new_item WHERE id IN(" . $itemname . ")"); + $item_names = db_query("SELECT name FROM $new_item WHERE id IN(" . $itemname . ")"); $x2 = 0; - while ($new_row = @ mysql_fetch_array($item_names)) { + while ($new_row = @ mysqli_fetch_array($item_names)) { print "