try to simply replace the removed mysql calls with mysqli replacesments (functional way)

main
hecht 8 years ago
parent e2f198084f
commit 192c09e8d2

@ -36,7 +36,7 @@ if($char_1['besitzer'] != $user['id']) {
} }
// Ermittle den Abholcode (Eingefuehrt um das nutzen von Bots zu erschweren!) // 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){ if($code_row){
$abholstring = 'char_id='.$char_id.'&code='.$code_row['code']; $abholstring = 'char_id='.$char_id.'&code='.$code_row['code'];
} else{ } else{
@ -45,7 +45,7 @@ if($code_row){
#######################Kampf #######################Kampf
if($ab == "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_a1 = getChar($kampf_a['char1']);
$kampf_a2 = getChar($kampf_a['char2']); $kampf_a2 = getChar($kampf_a['char2']);
@ -143,7 +143,7 @@ $zeit_in_sek = getEventStatusBlocked($char_id);
#######################Schatz Suche Kampf #######################Schatz Suche Kampf
if($ab == "Schatz Suche") { 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']; $zeit_in_sek = $kampf_a['dauer'];
$cancel_zeit_in_sek = $kampf_a['cancel']; $cancel_zeit_in_sek = $kampf_a['cancel'];

@ -39,19 +39,19 @@ if(isset($user_ida['nickname'])){
} }
// Wechsel der IP // Wechsel der IP
if($_SESSION['anon_ip'] != $_SERVER['REMOTE_ADDR']){ 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']; $_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){ while(!$usr){
mysql_query('Insert into anon_chatter(ip, anon_id) values(\''.$_SESSION['anon_ip'].'\', '.mt_random_wrapper(90000,99999).')'); db_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'].'\'')); $usr = mysqli_fetch_assoc(db_query('Select * from anon_chatter where ip = \''.$_SESSION['anon_ip'].'\''));
} }
$user_ida['id'] = $usr['anon_id']; $user_ida['id'] = $usr['anon_id'];
$user_ida['nickname'] = 'anon_' . $usr['anon_id']; $user_ida['nickname'] = 'anon_' . $usr['anon_id'];
$anon_block = $usr['muted']==0?false:true; $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']);
} }
// //

@ -22,7 +22,7 @@ $serial = validateString($_GET['serial']);
$charm = $_GET['charm']; $charm = $_GET['charm'];
if($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']) { if(!$user_k['username']) {
displayErrorMessage(NULL,'Account konnte nicht aktiviert werden!', displayHistoryBackLink()); displayErrorMessage(NULL,'Account konnte nicht aktiviert werden!', displayHistoryBackLink());
exit; exit;
@ -30,11 +30,11 @@ if($charm) {
#########USER AKTIVIERUNG #########USER AKTIVIERUNG
mysql_query('INSERT INTO user(nickname, mail, passwort, agb) values(\''.$user_k['username'].'\',\''.$user_k['mail'].'\', \''.$user_k['passwort'].'\', \'ja\')'); db_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.'\'')); $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).'\')'; $sql = 'INSERT arena(besitzer, exp) values (\''.$user_ida_nach['id'].'\', \'0,'.calculateRequiredExpArena(1).'\')';
mysql_query($sql); db_query($sql);
mysql_query('DELETE from user_activation where username = \''.$user_k['username'].'\''); db_query('DELETE from user_activation where username = \''.$user_k['username'].'\'');
displayErrorMessage(NULL,'Account wurde aktiviert!', '<a href="index.php?as=login">weiter</a>'); displayErrorMessage(NULL,'Account wurde aktiviert!', '<a href="index.php?as=login">weiter</a>');
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'); 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; exit;

@ -66,10 +66,10 @@ if ($charm) {
$sql = 'SELECT nickname,mail FROM user WHERE nickname=\'' . $nick_name . '\' OR mail=\'' . $mail . '\''; $sql = 'SELECT nickname,mail FROM user WHERE nickname=\'' . $nick_name . '\' OR mail=\'' . $mail . '\'';
//echo $sql.'<br>'; //echo $sql.'<br>';
$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 . '\''; $sql = 'SELECT username,mail FROM user_activation WHERE username=\'' . $nick_name . '\' OR mail=\'' . $mail . '\'';
//echo $sql.'<br>'; //echo $sql.'<br>';
$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 != FALSE || $user_b != FALSE) {
if ($user_a['nickname'] == $nick_name || $user_b['username'] == $nick_name) { if ($user_a['nickname'] == $nick_name || $user_b['username'] == $nick_name) {
@ -101,7 +101,7 @@ if ($charm) {
$pw_1 = md5($pw_1); $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', '<a href="index.php?as=login">weiter</a>'); displayErrorMessage(NULL, 'Erfolgreich angemeldet | Schauen sie in ihr Postfach', '<a href="index.php?as=login">weiter</a>');
exit; exit;

@ -171,9 +171,9 @@ function displayAusbau2($user, $arena, $arena_name, $steh, $sitz, $loge, $vermoe
} else{ } else{
$sql = 'UPDATE arena set name = \''.$arena_name.'\', steh = '.$steh.', sitz = '.$sitz.', loge = '.$loge.' WHERE id = '.$arena['id']; $sql = 'UPDATE arena set name = \''.$arena_name.'\', steh = '.$steh.', sitz = '.$sitz.', loge = '.$loge.' WHERE id = '.$arena['id'];
// echo $sql; // echo $sql;
mysql_query($sql); db_query($sql);
if(mysql_affected_rows() > 0){ if(db_affected_rows() > 0){
mysql_query('UPDATE user set geld = geld - '.$gesamtkosten.' where id = '.$user['id']); db_query('UPDATE user set geld = geld - '.$gesamtkosten.' where id = '.$user['id']);
displayErrorMessage(NULL, 'Umbau durchgef&uuml;hrt!', '<a href="'.$_SERVER['PHP_SELF'].'?as=arena">weiter</a>'); displayErrorMessage(NULL, 'Umbau durchgef&uuml;hrt!', '<a href="'.$_SERVER['PHP_SELF'].'?as=arena">weiter</a>');
} else{ } else{
displayErrorMessage(NULL, 'Umbau konnte nicht durchgef&uuml;hrt werden!', displayHistoryBackLink()); displayErrorMessage(NULL, 'Umbau konnte nicht durchgef&uuml;hrt werden!', displayHistoryBackLink());
@ -248,9 +248,9 @@ if($charmax !== NULL || $hausmeister !== NULL || $luxus !== NULL){
} else{ } else{
$n_skill = $arena['skill'] - ($cm + $hm + $lu); $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']; $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){ 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!', '<a href="'.$_SERVER['PHP_SELF'].'?as=arena&skill1">weiter</a>'); displayErrorMessage(NULL, 'Die Skill-Points wurden erfolgreich verteilt!', '<a href="'.$_SERVER['PHP_SELF'].'?as=arena&skill1">weiter</a>');
} }
@ -306,8 +306,8 @@ function renovate($user, $arena, $vermoegen){
if($costs > $vermoegen){ if($costs > $vermoegen){
displayErrorMessage(NULL, 'Nicht genug Geld f&uuml;r die Renovierung!', displayHistoryBackLink()); displayErrorMessage(NULL, 'Nicht genug Geld f&uuml;r die Renovierung!', displayHistoryBackLink());
} else{ } else{
mysql_query('Update user set geld = geld - '.$costs.' WHERE id = '.$user['id']); db_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 arena set zustand = 1 WHERE id = '.$arena['id']);
displayErrorMessage(NULL, 'Renovierung durchgef&uuml;hrt!', displayHistoryBackLink()); displayErrorMessage(NULL, 'Renovierung durchgef&uuml;hrt!', displayHistoryBackLink());
} }
} }
@ -315,7 +315,7 @@ function renovate($user, $arena, $vermoegen){
$arena = getArena($user_ida['id']); $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']; $auktionensumme = $auktionensumme['summe'];
$vermoegen = $user['geld'] - $auktionensumme; $vermoegen = $user['geld'] - $auktionensumme;
$unterhalt = calculateUnterhaltsKosten($arena); $unterhalt = calculateUnterhaltsKosten($arena);
@ -325,9 +325,9 @@ if($action == 'miete'){
if($vermoegen < $unterhalt){ if($vermoegen < $unterhalt){
displayErrorMessage(NULL, 'Du hast nicht genug Geld um die Unterhaltskosten zu bezahlen!', displayHistoryBackLink()); displayErrorMessage(NULL, 'Du hast nicht genug Geld um die Unterhaltskosten zu bezahlen!', displayHistoryBackLink());
} else{ } else{
mysql_query('Update user set geld = geld - '.$unterhalt.' WHERE id = '.$user_ida['id']); db_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']); db_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'].'\'')); $arena = mysqli_fetch_assoc(db_query('SELECT * FROM arena where besitzer = \''.$user_ida['id'].'\''));
displayArena($arena); displayArena($arena);
} }
} else if($action == 'ausbau1'){ } else if($action == 'ausbau1'){

@ -19,14 +19,14 @@ $firstLetter = validateString($_GET['firstLetter']);
if($firstLetter == 'Numeric'){ if($firstLetter == 'Numeric'){
$auser = mysql_query('SELECT * FROM user where SUBSTRING(nickname,1,1) < \'a\' order by nickname ASC LIMIT '.($pagenum*50).', 50'); $auser = db_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\'')); $total = mysqli_fetch_assoc(db_query('SELECT count(id) as anzahl FROM user where SUBSTRING(nickname,1,1) < \'a\''));
} else if($firstLetter == null){ } else if($firstLetter == null){
$auser = mysql_query('SELECT * FROM user order by nickname ASC LIMIT '.($pagenum*50).', 50'); $auser = db_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')); $total = mysqli_fetch_assoc(db_query('SELECT count(id) as anzahl FROM user'));
} else{ } else{
$auser = mysql_query('SELECT * FROM user where nickname like \''.$firstLetter.'%\' order by nickname ASC LIMIT '.($pagenum*50).', 50'); $auser = db_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.'%\'')); $total = mysqli_fetch_assoc(db_query('SELECT count(id) as anzahl FROM user where nickname like \''.$firstLetter.'%\''));
} }
$total = $total['anzahl']; $total = $total['anzahl'];
@ -53,7 +53,7 @@ $total = $total['anzahl'];
<td width="157" height="30" align="center"><b>Homepage</b></td> <td width="157" height="30" align="center"><b>Homepage</b></td>
</tr> </tr>
<?php <?php
while($row = mysql_fetch_array($auser)) { while($row = mysqli_fetch_array($auser)) {
if(!$row['icq']) { $row['icq'] = 'Kein ICQ'; } if(!$row['icq']) { $row['icq'] = 'Kein ICQ'; }
if(!$row['homepage']) { $row['homepage'] = 'Keine Homepage'; } if(!$row['homepage']) { $row['homepage'] = 'Keine Homepage'; }
?> ?>

@ -370,7 +370,7 @@ function handleThirdPhaseForTester($type, $name, $char_lvl, $random, $user){
<?php <?php
} }
$user_daten= mysql_fetch_assoc(mysql_query("SELECT char_max, id FROM user WHERE nickname='".$_COOKIE['name']."' LIMIT 1")); $user_daten= mysqli_fetch_assoc(db_query("SELECT char_max, id FROM user WHERE nickname='".$_COOKIE['name']."' LIMIT 1"));
// FIXME: Check if thi works! // FIXME: Check if thi works!
$anzahl_spezialchars = 0; $anzahl_spezialchars = 0;
$all_chars = getCharsOfUser($user_daten['id']); $all_chars = getCharsOfUser($user_daten['id']);

@ -48,8 +48,8 @@ foreach($chars as $my_charz){
$mpleft[$char_zahl] = 0; $mpleft[$char_zahl] = 0;
} }
$exptemp = explode(",", $my_charz['exp']); $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']); $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=mysql_fetch_assoc($room); $clanroom=mysqli_fetch_assoc($room);
if($clanroom['name']=="") if($clanroom['name']=="")
$clanroom['name']="kein"; $clanroom['name']="kein";
@ -65,7 +65,7 @@ foreach($chars as $my_charz){
if($my_charz['kampf_item'] != NULL && $my_charz['kampf_item'] != ',,,,'){ if($my_charz['kampf_item'] != NULL && $my_charz['kampf_item'] != ',,,,'){
// echo 'Problematic Entry = '.$chara_1['kampf_item'].'<br>'; // echo 'Problematic Entry = '.$chara_1['kampf_item'].'<br>';
$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_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'].')'; $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') { } elseif($my_charz['status'] == 'Angemeldet' OR $my_charz['status'] == 'Kampf erstellt') {
$temp = 'Status: '.$my_charz['status']; $temp = 'Status: '.$my_charz['status'];
} elseif($my_charz['status'] == 'Kampf') { } 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(); $zeit_in_sek[$char_zahl] = $kampf_a['dauer'] - time();
$temp = '<a href="index.php?as=abholen&ab='.$statustemp.'&char_id='.$my_charz['id'].'" id="popup">Status: '.$my_charz['status'].'</a><br /><span id="timer_'.$char_zahl.'"></span>'; $temp = '<a href="index.php?as=abholen&ab='.$statustemp.'&char_id='.$my_charz['id'].'" id="popup">Status: '.$my_charz['status'].'</a><br /><span id="timer_'.$char_zahl.'"></span>';
} elseif($my_charz['status'] == 'Schatz Suche') { } 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']; $zeit_in_sek[$char_zahl] = $kampf_a['dauer'];
$temp = '<a href="index.php?as=abholen&ab='.$statustemp.'&char_id='.$my_charz['id'].'" id="popup">Status: '.$my_charz['status'].'</a><br /><span id="timer_'.$char_zahl.'"></span>'; $temp = '<a href="index.php?as=abholen&ab='.$statustemp.'&char_id='.$my_charz['id'].'" id="popup">Status: '.$my_charz['status'].'</a><br /><span id="timer_'.$char_zahl.'"></span>';
} else { } else {

@ -51,11 +51,11 @@ function stelledar($char_id,$user_ida,$name) {
$normfight_attset_name = getAttackNames($normfight_attset); $normfight_attset_name = getAttackNames($normfight_attset);
//Rüstung laden //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_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 = 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_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 = 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_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 = 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_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 = 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_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']); $checked = explode(',',$char_1['kampf_item']);
?> ?>
<body> <body>
@ -251,7 +251,7 @@ function stelledar($char_id,$user_ida,$name) {
<td height="25" width="392">&nbsp; <select id="input" name="helm_e"> <td height="25" width="392">&nbsp; <select id="input" name="helm_e">
<option value="0">Nix</option> <option value="0">Nix</option>
<?php <?php
while($helm_e_w = mysql_fetch_array($e_helm)) { while($helm_e_w = mysqli_fetch_array($e_helm)) {
if($checked[0] == $helm_e_w['id'] && !$checked_helm) { $checked_helm = 'selected'; } if($checked[0] == $helm_e_w['id'] && !$checked_helm) { $checked_helm = 'selected'; }
else { $checked_helm=''; } else { $checked_helm=''; }
echo '<option value="'.$helm_e_w['id'].'" '.$checked_helm.'>'.$helm_e_w['name'].' (Level: '.$helm_e_w['level'].')</option>'; echo '<option value="'.$helm_e_w['id'].'" '.$checked_helm.'>'.$helm_e_w['name'].' (Level: '.$helm_e_w['level'].')</option>';
@ -266,7 +266,7 @@ function stelledar($char_id,$user_ida,$name) {
name="rustung_e"> name="rustung_e">
<option value="0">Nix</option> <option value="0">Nix</option>
<?php <?php
while($rustung_e_w = mysql_fetch_array($e_rustung)) { while($rustung_e_w = mysqli_fetch_array($e_rustung)) {
if($checked[1] == $rustung_e_w['id'] && !$checked_rustung) { $checked_rustung = 'selected'; } if($checked[1] == $rustung_e_w['id'] && !$checked_rustung) { $checked_rustung = 'selected'; }
else { $checked_rustung=''; } else { $checked_rustung=''; }
echo '<option value="'.$rustung_e_w['id'].'" '.$checked_rustung.'>'.$rustung_e_w['name'].' (Level: '.$rustung_e_w['level'].')</option>'; echo '<option value="'.$rustung_e_w['id'].'" '.$checked_rustung.'>'.$rustung_e_w['name'].' (Level: '.$rustung_e_w['level'].')</option>';
@ -281,7 +281,7 @@ function stelledar($char_id,$user_ida,$name) {
name="schild_e"> name="schild_e">
<option value="0">Nix</option> <option value="0">Nix</option>
<?php <?php
while($schild_e_w = mysql_fetch_array($e_schild)) { while($schild_e_w = mysqli_fetch_array($e_schild)) {
if($checked[2] == $schild_e_w['id'] && !$checked_schild) { $checked_schild = 'selected'; } if($checked[2] == $schild_e_w['id'] && !$checked_schild) { $checked_schild = 'selected'; }
else { $checked_schild=''; } else { $checked_schild=''; }
echo '<option value="'.$schild_e_w['id'].'" '.$checked_schild.'>'.$schild_e_w['name'].' (Level: '.$schild_e_w['level'].')</option>'; echo '<option value="'.$schild_e_w['id'].'" '.$checked_schild.'>'.$schild_e_w['name'].' (Level: '.$schild_e_w['level'].')</option>';
@ -296,7 +296,7 @@ function stelledar($char_id,$user_ida,$name) {
name="schwert_e"> name="schwert_e">
<option value="0">Nix</option> <option value="0">Nix</option>
<?php <?php
while($schwert_e_w = mysql_fetch_array($e_schwert)) { while($schwert_e_w = mysqli_fetch_array($e_schwert)) {
if($checked[3] == $schwert_e_w['id'] && !$checked_schwert) { $checked_schwert = 'selected'; } if($checked[3] == $schwert_e_w['id'] && !$checked_schwert) { $checked_schwert = 'selected'; }
else { $checked_schwert=''; } else { $checked_schwert=''; }
echo '<option value="'.$schwert_e_w['id'].'" '.$checked_schwert.'>'.$schwert_e_w['name'].' (Level: '.$schwert_e_w['level'].')</option>'; echo '<option value="'.$schwert_e_w['id'].'" '.$checked_schwert.'>'.$schwert_e_w['name'].' (Level: '.$schwert_e_w['level'].')</option>';
@ -311,7 +311,7 @@ function stelledar($char_id,$user_ida,$name) {
name="schuhe_e"> name="schuhe_e">
<option value="0">Nix</option> <option value="0">Nix</option>
<?php <?php
while($schuhe_e_w = mysql_fetch_array($e_schuhe)) { while($schuhe_e_w = mysqli_fetch_array($e_schuhe)) {
if($checked[4] == $schuhe_e_w['id'] && !$checked_schuhe) { $checked_schuhe = 'selected'; } if($checked[4] == $schuhe_e_w['id'] && !$checked_schuhe) { $checked_schuhe = 'selected'; }
else { $checked_schuhe=''; } else { $checked_schuhe=''; }
echo '<option value="'.$schuhe_e_w['id'].'" '.$checked_schuhe.'>'.$schuhe_e_w['name'].' (Level: '.$schuhe_e_w['level'].')</option>'; echo '<option value="'.$schuhe_e_w['id'].'" '.$checked_schuhe.'>'.$schuhe_e_w['name'].' (Level: '.$schuhe_e_w['level'].')</option>';
@ -378,7 +378,7 @@ function eintragen($char_id,$name,$user_ida) {
'attacken=\''.implode(',', $attset_nf).'\', '. 'attacken=\''.implode(',', $attset_nf).'\', '.
'attacken2=\''.implode(',', $attset_nf).'\', '. 'attacken2=\''.implode(',', $attset_nf).'\', '.
'bild=\''.$bild11.'\' WHERE id='.$char['id'].' LIMIT 1'; 'bild=\''.$bild11.'\' WHERE id='.$char['id'].' LIMIT 1';
mysql_query($qry); db_query($qry);
//neues updaten von Attacken //neues updaten von Attacken
updateAttackSet($char_id, CLANKAMPF, $attset_cf); updateAttackSet($char_id, CLANKAMPF, $attset_cf);

@ -45,8 +45,8 @@ if ($action == 'accept') {
<th height="30" colspan="2" class="content">Reagieren</th> <th height="30" colspan="2" class="content">Reagieren</th>
<?php <?php
$sql = 'SELECT * FROM user_clan_invitations WHERE userid = '.$user_ida['id'].' and valid > now();'; $sql = 'SELECT * FROM user_clan_invitations WHERE userid = '.$user_ida['id'].' and valid > now();';
$qry = mysql_query($sql); $qry = db_query($sql);
while($row = mysql_fetch_assoc($qry)){ while($row = mysqli_fetch_assoc($qry)){
?> ?>
@ -108,9 +108,9 @@ if ($action == 'accept') {
</tr> </tr>
<?php <?php
$sql = 'SELECT c.clanz_pre, c.clanz_suff, c.clanname, c.geld, c.info, c.id, c.leader FROM clan c ORDER BY '.$poll1.' '.$poll2.' LIMIT '.($pagenum*20).',20'; $sql = 'SELECT c.clanz_pre, c.clanz_suff, c.clanname, c.geld, c.info, c.id, c.leader FROM clan c ORDER BY '.$poll1.' '.$poll2.' LIMIT '.($pagenum*20).',20';
$clan = mysql_query($sql); $clan = db_query($sql);
while ($row = mysql_fetch_array($clan)) { while ($row = mysqli_fetch_array($clan)) {
$mitglieder = mysql_num_rows(mysql_query('SELECT id FROM user WHERE clan='.$row['id'])); $mitglieder = mysqli_stmt_num_rows(db_query('SELECT id FROM user WHERE clan='.$row['id']));
$z_v = array($row['clan_pre'], $row['clan_suff']); $z_v = array($row['clan_pre'], $row['clan_suff']);
?> ?>
@ -133,7 +133,7 @@ if ($action == 'accept') {
<?php <?php
// TODO: Seitenzahlen aus Designfunctions benutzen!!! // TODO: Seitenzahlen aus Designfunctions benutzen!!!
} }
$Total = mysql_num_rows(mysql_query('SELECT id FROM clan')); $Total = mysqli_stmt_num_rows(db_query('SELECT id FROM clan'));
$url = '<a href="'.$_SERVER['PHP_SELF'].'?as=clan/add&pagenum=###PAGE###">###LABEL###</a>'; $url = '<a href="'.$_SERVER['PHP_SELF'].'?as=clan/add&pagenum=###PAGE###">###LABEL###</a>';
?> ?>
<tr> <tr>

@ -22,7 +22,7 @@ $charm = $_GET['charm'];
if($charm == 3) if($charm == 3)
{ {
$item_info = mysql_fetch_assoc(mysql_query("SELECT * FROM clan_item WHERE id='$item_id' LIMIT 1")); $item_info = mysqli_fetch_assoc(db_query("SELECT * FROM clan_item WHERE id='$item_id' LIMIT 1"));
$user = getClan($user_ida['clan']); $user = getClan($user_ida['clan']);
if($user['leader'] != $user_ida['id'] AND $user['co_leader'] != $user_ida['id']) { if($user['leader'] != $user_ida['id'] AND $user['co_leader'] != $user_ida['id']) {
@ -46,24 +46,24 @@ if($charm == 3)
$new_geld = $user['geld'] - $item_info['preis']; $new_geld = $user['geld'] - $item_info['preis'];
mysql_query("UPDATE clan_item SET anzahl=anzahl-1 WHERE id=".$item_info[id]." LIMIT 1"); db_query("UPDATE clan_item SET anzahl=anzahl-1 WHERE id=".$item_info[id]." LIMIT 1");
mysql_query("UPDATE clan SET geld='$new_geld' WHERE id=".$user[id]." LIMIT 1"); db_query("UPDATE clan SET geld='$new_geld' WHERE id=".$user[id]." LIMIT 1");
mysql_query("INSERT INTO clan_ware SET item_id='".$item_info[id]."', clan='".$user[id]."'"); db_query("INSERT INTO clan_ware SET item_id='".$item_info[id]."', clan='".$user[id]."'");
$fehler_m = "$item_name[name] erfolgreich gekauft<br>&nbsp;<br>Geld: $user[geld] - $item_info[preis] = $new_geld"; $fehler_m = "$item_name[name] erfolgreich gekauft<br>&nbsp;<br>Geld: $user[geld] - $item_info[preis] = $new_geld";
displayErrorMessage(NULL,$fehler_m, '<a href="'.$_SERVER['PHP_SELF'].'?as=clan/c_markt">weiter</a>'); displayErrorMessage(NULL,$fehler_m, '<a href="'.$_SERVER['PHP_SELF'].'?as=clan/c_markt">weiter</a>');
exit; exit;
} else if($charm == 5){ } else if($charm == 5){
$user = mysql_Fetch_array(mysql_query("SELECT leader, co_leader, geld, id FROM clan WHERE id='$user_ida[clan]'")); $user = mysqli_fetch_array(db_query("SELECT leader, co_leader, geld, id FROM clan WHERE id='$user_ida[clan]'"));
if($user['leader'] != $user_ida['id'] AND $user['co_leader'] != $user_ida['id']) { if($user['leader'] != $user_ida['id'] AND $user['co_leader'] != $user_ida['id']) {
displayErrorMessage(NULL,'Nur der Leader und der Co-Leader kann Clanitems abreissen!', displayHistoryBackLink()); displayErrorMessage(NULL,'Nur der Leader und der Co-Leader kann Clanitems abreissen!', displayHistoryBackLink());
exit; exit;
} }
mysql_query('Delete from clan_ware where clan = '.$user_ida['clan'].' and item_id = '.$item_id); db_query('Delete from clan_ware where clan = '.$user_ida['clan'].' and item_id = '.$item_id);
if(mysql_affected_rows() > 0){ if(db_affected_rows() > 0){
displayErrorMessage(NULL,'Abreissen erfolgreich!', '<a href="'.$_SERVER['PHP_SELF'].'?as=clan/c_markt">weiter</a>'); displayErrorMessage(NULL,'Abreissen erfolgreich!', '<a href="'.$_SERVER['PHP_SELF'].'?as=clan/c_markt">weiter</a>');
} else{ } else{
displayErrorMessage(NULL,'Abreissen ist fehlgeschlagen!', displayHistoryBackLink()); displayErrorMessage(NULL,'Abreissen ist fehlgeschlagen!', displayHistoryBackLink());
@ -98,15 +98,15 @@ if(!$charm)
<th align="center">Kaufen</th> <th align="center">Kaufen</th>
</tr> </tr>
<?php <?php
$item_name = mysql_query('SELECT * FROM clan_item order by preis'); $item_name = db_query('SELECT * FROM clan_item order by preis');
$clan_items_query = mysql_query('SELECT * FROM clan_ware where clan = '.$user_ida['clan']); $clan_items_query = db_query('SELECT * FROM clan_ware where clan = '.$user_ida['clan']);
while($row = mysql_fetch_assoc($clan_items_query)){ while($row = mysqli_fetch_assoc($clan_items_query)){
$c_item[$row['item_id']] = 1; $c_item[$row['item_id']] = 1;
} }
$clan = getClan($user_ida['clan']); $clan = getClan($user_ida['clan']);
while($row = mysql_fetch_array($item_name)) while($row = mysqli_fetch_array($item_name))
{ {
$info = ''; $info = '';
$info .= $row['staerke']!=0?' +'.$row['staerke'].' Str':''; $info .= $row['staerke']!=0?' +'.$row['staerke'].' Str':'';

@ -36,7 +36,7 @@ if ($wahl == 'geld') {
$sql = 'SELECT i.level, i.siege, i.leader, i.niederlagen, i.geld, i.clanname, i.id, u.nickname, (Select count(*) from user u1 where clan = i.id) as member, (Select 10 - count(*) from user u2 where clan = i.id and ((i.leader is null || i.leader != u2.id) and (i.co_leader is null ||i.co_leader != u2.id))) as freeslots, (select sum(spende) as summe from user_clan where clanid = i.id) as summe, elo FROM clan i LEFT JOIN user u ON(i.leader=u.id) ORDER BY i.'.$wahl.' DESC LIMIT 50'; $sql = 'SELECT i.level, i.siege, i.leader, i.niederlagen, i.geld, i.clanname, i.id, u.nickname, (Select count(*) from user u1 where clan = i.id) as member, (Select 10 - count(*) from user u2 where clan = i.id and ((i.leader is null || i.leader != u2.id) and (i.co_leader is null ||i.co_leader != u2.id))) as freeslots, (select sum(spende) as summe from user_clan where clanid = i.id) as summe, elo FROM clan i LEFT JOIN user u ON(i.leader=u.id) ORDER BY i.'.$wahl.' DESC LIMIT 50';
//echo $sql . '<br>'; //echo $sql . '<br>';
$char_s = mysql_query($sql); $char_s = db_query($sql);
?> ?>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" height="1"> <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" height="1">
@ -88,7 +88,7 @@ $char_s = mysql_query($sql);
</tr> </tr>
<?php <?php
$x=1; $x=1;
while($row = mysql_fetch_assoc($char_s)) { while($row = mysqli_fetch_assoc($char_s)) {
echo '<tr>'."\n"; echo '<tr>'."\n";
echo '<th valign="middle" height="25" bgcolor="'.$cols[$x].'" align="center">'.$x.'</th>'."\n"; echo '<th valign="middle" height="25" bgcolor="'.$cols[$x].'" align="center">'.$x.'</th>'."\n";
echo '<th valign="middle" height="25" bgcolor="'.$cols[$x].'" align="center"><a href="index.php?as=clan/clan_info&clan_id='.$row['id'].'">'.$row['clanname'].'</a></th>'."\n"; echo '<th valign="middle" height="25" bgcolor="'.$cols[$x].'" align="center"><a href="index.php?as=clan/clan_info&clan_id='.$row['id'].'">'.$row['clanname'].'</a></th>'."\n";

@ -17,8 +17,8 @@
<th align="center">Nachricht</th> <th align="center">Nachricht</th>
</tr> </tr>
<?php <?php
$ticks_qry = mysql_query('SELECT * FROM clan_ticker WHERE clanid ='.$user_ida['clan'].' ORDER BY `date` DESC LIMIT 20'); $ticks_qry = db_query('SELECT * FROM clan_ticker WHERE clanid ='.$user_ida['clan'].' ORDER BY `date` DESC LIMIT 20');
while($tick = mysql_fetch_assoc($ticks_qry)){ while($tick = mysqli_fetch_assoc($ticks_qry)){
echo '<tr><td align="center">'.$tick['date'].'</td><td>'.$tick['text'].'</td></tr>'; echo '<tr><td align="center">'.$tick['date'].'</td><td>'.$tick['text'].'</td></tr>';
} }
?> ?>

@ -29,7 +29,7 @@ if($charm == 1) {
} }
$char = getChar($char_id, false); $char = getChar($char_id, false);
$clan_items = mysql_query("SELECT ci.name, ci.type, cw.id, 1/(1+exp(3-$char[level]/12)) * nutzung as nutzkosten FROM clan_ware cw LEFT JOIN clan_item ci ON(cw.item_id=ci.id) WHERE cw.clan='$user_ida[clan]'"); $clan_items = db_query("SELECT ci.name, ci.type, cw.id, 1/(1+exp(3-$char[level]/12)) * nutzung as nutzkosten FROM clan_ware cw LEFT JOIN clan_item ci ON(cw.item_id=ci.id) WHERE cw.clan='$user_ida[clan]'");
if(!isUserOwnerOf($user_ida['id'], $char_id)){ if(!isUserOwnerOf($user_ida['id'], $char_id)){
// Legacy (Datei muss ueberarbeitet werden) // Legacy (Datei muss ueberarbeitet werden)
$char = null; $char = null;
@ -54,7 +54,7 @@ if(!isUserOwnerOf($user_ida['id'], $char_id)){
<?php <?php
$chars = getCharsOfUser($user_ida['id'], false); $chars = getCharsOfUser($user_ida['id'], false);
foreach($chars as $char) { foreach($chars as $char) {
$clan_items = mysql_query("SELECT ci.name, ci.type, cw.id, 1/(1+exp(3-$char[level]/12)) * nutzung as nutzkosten FROM clan_ware cw LEFT JOIN clan_item ci ON(cw.item_id=ci.id) WHERE cw.clan='$user_ida[clan]'"); $clan_items = db_query("SELECT ci.name, ci.type, cw.id, 1/(1+exp(3-$char[level]/12)) * nutzung as nutzkosten FROM clan_ware cw LEFT JOIN clan_item ci ON(cw.item_id=ci.id) WHERE cw.clan='$user_ida[clan]'");
?> ?>
<tr> <tr>
@ -65,7 +65,7 @@ if(!isUserOwnerOf($user_ida['id'], $char_id)){
<select id="input" name="c_ware_<?php echo $char['id']; ?>"> <select id="input" name="c_ware_<?php echo $char['id']; ?>">
<option value="0">W&auml;hle Kampf Raum</option> <option value="0">W&auml;hle Kampf Raum</option>
<?php <?php
while($row = mysql_Fetch_array($clan_items)) { while($row = mysqli_fetch_array($clan_items)) {
$save=""; $save="";
if($row['id'] == $char['clan_train']) { if($row['id'] == $char['clan_train']) {
$save = 'Selected'; $save = 'Selected';

@ -71,10 +71,10 @@ if((isset($_GET['value1']) || isset($_GET['value2']) || isset($_GET['edited']))
} }
function displayClanProfileReadOnly($clan, $ownclan, $userid){ function displayClanProfileReadOnly($clan, $ownclan, $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']);
$count = mysql_num_rows($member_qry); $count = mysqli_stmt_num_rows($member_qry);
$member = array(); $member = array();
while($row = mysql_fetch_assoc($member_qry)){ while($row = mysqli_fetch_assoc($member_qry)){
$tmp = generateUserLinkByID($row['id']); $tmp = generateUserLinkByID($row['id']);
if($row['id'] == $userid){ if($row['id'] == $userid){
$member[] = $tmp.' (<a href="index.php?as=clan/clan_info&action=fire&member='.$row['id'].'">verlassen</a>)'; $member[] = $tmp.' (<a href="index.php?as=clan/clan_info&action=fire&member='.$row['id'].'">verlassen</a>)';
@ -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(); $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)'; $invited[] = generateUserLinkByID($row['userid']) . ' (noch ' . $row['till'] . 'h gültig)';
} }
@ -256,10 +256,10 @@ function displayClanProfileReadOnly($clan, $ownclan, $userid){
} }
function displayClanProfileEditable($clan, $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(); $member = array();
$count = mysql_num_rows($member_qry); $count = mysqli_stmt_num_rows($member_qry);
while($row = mysql_fetch_assoc($member_qry)){ while($row = mysqli_fetch_assoc($member_qry)){
$tmp = generateUserLinkByID($row['id']); $tmp = generateUserLinkByID($row['id']);
$kickable = true; $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(); $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, <a href="index.php?as=clan/clan_info&action=reject&member='.$row['userid'].'">zurückziehen</a>)'; $invited[] = generateUserLinkByID($row['userid']) . ' (noch ' . $row['till'] . 'h gültig, <a href="index.php?as=clan/clan_info&action=reject&member='.$row['userid'].'">zurückziehen</a>)';
} }
@ -498,23 +498,23 @@ function setProfile($user, $what, $value1, $value2, $clanid, $rootlvl){
} }
switch($what){ switch($what){
case 'Homepage': case 'Homepage':
mysql_query('UPDATE clan SET homepage = \''.$value1.'\' where id = '.$clanid); db_query('UPDATE clan SET homepage = \''.$value1.'\' where id = '.$clanid);
return NULL; return NULL;
case 'Clanzeichen': case 'Clanzeichen':
if(strlen($value1.$value2) > MAX_CHARS_CLANSIGN) { 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!'; 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; return NULL;
case 'Banner': case 'Banner':
mysql_query('UPDATE clan SET banner = \''.$value1.'\' where id = '.$clanid); db_query('UPDATE clan SET banner = \''.$value1.'\' where id = '.$clanid);
return NULL; return NULL;
case 'Info': case 'Info':
mysql_query('UPDATE clan SET Info = \''.$value1.'\' where id = '.$clanid); db_query('UPDATE clan SET Info = \''.$value1.'\' where id = '.$clanid);
return NULL; return NULL;
case 'Background': 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; return NULL;
case 'Leadership': case 'Leadership':
$clan = getClan($clanid); $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 if($rootlvl == 1){ // the co leader may only set the co leader XD
$sql = 'UPDATE clan SET co_leader = '.$value2.' where id = '.$clanid; $sql = 'UPDATE clan SET co_leader = '.$value2.' where id = '.$clanid;
//echo $sql.'<br>'; //echo $sql.'<br>';
mysql_query($sql); db_query($sql);
} else if($rootlvl == 2) { // the leader may set the leader and the co leader } 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; $sql = 'UPDATE clan SET leader = '.$value1.', co_leader = '.$value2.' where id = '.$clanid;
// echo $sql.'<br>'; // echo $sql.'<br>';
mysql_query($sql); db_query($sql);
} }
return NULL; return NULL;
case 'Member': case 'Member':
@ -588,10 +588,10 @@ function displayEdit($what, $clanid, $rootlvl){
$content = '<tr><td colspan="2"><input class="input" name="value1" value="'.$clan['banner'].'"/></td></tr>'; $content = '<tr><td colspan="2"><input class="input" name="value1" value="'.$clan['banner'].'"/></td></tr>';
break; break;
case 'Leadership': 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[] = '<option value="0" selected>Niemand</option>'; $member[] = '<option value="0" selected>Niemand</option>';
$member2[] = '<option value="0" selected>Niemand</option>'; $member2[] = '<option value="0" selected>Niemand</option>';
while($row = mysql_fetch_assoc($member_qry)){ while($row = mysqli_fetch_assoc($member_qry)){
if($row['id'] == $clan['leader']) { if($row['id'] == $clan['leader']) {
$member[] = '<option value="'.$row['id'].'" selected="selected">'.$row['nickname'].'</option>'; $member[] = '<option value="'.$row['id'].'" selected="selected">'.$row['nickname'].'</option>';
} else { } else {
@ -618,11 +618,11 @@ function displayEdit($what, $clanid, $rootlvl){
$content .= '<table width="100%">'.PHP_EOL; $content .= '<table width="100%">'.PHP_EOL;
$content .= '<tr><th align="center">Member</th><th align="center" width="75px">Kick</th><th align="center" width="75px">CF Rechte</th></tr>'.PHP_EOL; $content .= '<tr><th align="center">Member</th><th align="center" width="75px">Kick</th><th align="center" width="75px">CF Rechte</th></tr>'.PHP_EOL;
$content .= '<tr><td align="center" colspan="3"><hr /><input type="hidden" name="edited" value="1"></td></tr>'.PHP_EOL; $content .= '<tr><td align="center" colspan="3"><hr /><input type="hidden" name="edited" value="1"></td></tr>'.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); $authorized = getAuthorizedClanfightCoordinatorIDs($clanid);
$leader = NULL; $leader = NULL;
$coleader = NULL; $coleader = NULL;
while($row = mysql_fetch_assoc($member_qry)){ while($row = mysqli_fetch_assoc($member_qry)){
$row['nickname'] = generateUserLinkByID($row['id'], false); $row['nickname'] = generateUserLinkByID($row['id'], false);
if($row['id'] == $clan['leader']){ if($row['id'] == $clan['leader']){
$leader = $row; $leader = $row;
@ -704,7 +704,7 @@ if($action !== NULL) { // this is done to not require to reprogramm the whole st
switch ($action) { switch ($action) {
case 'edit': case 'edit':
$errorMsg = NULL; $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']){ if($row['leader'] != $user_ida['id'] && $row['co_leader'] != $user_ida['id']){
displayErrorMessage(NULL, 'Du bist weder Leader noch Co-Leader des Clans!', displayHistoryBackLink()); displayErrorMessage(NULL, 'Du bist weder Leader noch Co-Leader des Clans!', displayHistoryBackLink());
$displayMore = false; $displayMore = false;

@ -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 $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 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;'; 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(); $chars = array();
while($row = mysql_fetch_array($qry)) { while($row = mysqli_fetch_array($qry)) {
$chars[] = $row; $chars[] = $row;
} }
return $chars; return $chars;
@ -41,9 +41,9 @@ function getEventChars($challenge_id, $event_id) {
function getChallengeClans($challenge_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.';'; $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(); $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']); $clans[$row['id']] = array('name' => $row['clanname'], 'id' => $row['clan_id'], 'elo' => $row['elo_change'], 'xp' => $row['exp_change'], 'points' => $row['points']);
} }
return $clans; return $clans;

@ -231,7 +231,7 @@ function displayShowChallenge($clan_challenge_id, $user) {
<?php if($authorized) { <?php if($authorized) {
$qry = db_query('SELECT user.id AS user_id, chars.id AS char_id, user.nickname AS user_name, chars.name AS char_name FROM user inner join chars on user.id = chars.besitzer where clan = '.$user['clan'].' and user.id NOT IN (Select besitzer from chars inner join clan_challenge_participants on chars.id = clan_challenge_participants.char_id WHERE clan_challenge_id = '.$clan_challenge_id.' and clan_id = '.$user['clan'].')'); $qry = db_query('SELECT user.id AS user_id, chars.id AS char_id, user.nickname AS user_name, chars.name AS char_name FROM user inner join chars on user.id = chars.besitzer where clan = '.$user['clan'].' and user.id NOT IN (Select besitzer from chars inner join clan_challenge_participants on chars.id = clan_challenge_participants.char_id WHERE clan_challenge_id = '.$clan_challenge_id.' and clan_id = '.$user['clan'].')');
$users = array(); $users = array();
while($row = mysql_fetch_assoc($qry)) { while($row = mysqli_fetch_assoc($qry)) {
if(!isset($users[$row['user_id']])){ if(!isset($users[$row['user_id']])){
$users[$row['user_id']] = array('user_name' => $row['user_name']); $users[$row['user_id']] = array('user_name' => $row['user_name']);
} }

@ -52,7 +52,7 @@ if ($charm == 1) {
$sql = 'SELECT id, clanname FROM clan WHERE clanname = \'' .$clan_name. '\''; $sql = 'SELECT id, clanname FROM clan WHERE clanname = \'' .$clan_name. '\'';
// echo $sql.'<br>'; // echo $sql.'<br>';
$dup = mysql_fetch_assoc(mysql_query($sql)); $dup = mysqli_fetch_assoc(db_query($sql));
if($dup) { if($dup) {
// we have a clan that has the same name!! // we have a clan that has the same name!!
@ -62,14 +62,14 @@ if ($charm == 1) {
if($error == null) { 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'].')'; $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.'<br>'; // echo $sql.'<br>';
mysql_query($sql); db_query($sql);
if(mysql_affected_rows() > 0){ // Erstellen des Clans geglueckt if(db_affected_rows() > 0){ // Erstellen des Clans geglueckt
$c_id = mysql_fetch_assoc(mysql_query('Select * from clan where clanname = \''.$clan_name.'\'')); $c_id = mysqli_fetch_assoc(db_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('UPDATE user SET clan='.$c_id['id'].', geld = geld - '.CLAN_CREATION_FEE.' WHERE id='.$user_ida['id']);
displayErrorMessage(NULL, 'Clan erfolgreich Erstellt.', '<a href="index.php?as=clan/clan_info">weiter...</a>'); displayErrorMessage(NULL, 'Clan erfolgreich Erstellt.', '<a href="index.php?as=clan/clan_info">weiter...</a>');
} else{ } else{
$sql = 'Select * from clan where clanname = \''.$clan_name.'\''; $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){ if($c_id){
$error = 'Clanname besteht schon!'; $error = 'Clanname besteht schon!';
} else{ } else{

@ -29,7 +29,7 @@ function handleInvitation($user, $username, $clan){
displayErrorMessage(NULL, 'Fehler! Nutzer existiert nicht!'); displayErrorMessage(NULL, 'Fehler! Nutzer existiert nicht!');
return false; 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']; $userid = $row['id'];
if($row['clan'] == $user['clan']){ if($row['clan'] == $user['clan']){
displayErrorMessage(NULL, 'Fehler! Nutzer ist schon in deinem Clan!', displayHistoryBackLink()); displayErrorMessage(NULL, 'Fehler! Nutzer ist schon in deinem Clan!', displayHistoryBackLink());
@ -39,12 +39,12 @@ function handleInvitation($user, $username, $clan){
if($row){ if($row){
$sql = 'INSERT INTO user_clan_invitations(userid, clanid, valid) values('.$userid.','.$user['clan'].',TIMESTAMPADD(DAY, 5, now()))'; $sql = 'INSERT INTO user_clan_invitations(userid, clanid, valid) values('.$userid.','.$user['clan'].',TIMESTAMPADD(DAY, 5, now()))';
// echo $sql.'<br>'; // echo $sql.'<br>';
mysql_query($sql); db_query($sql);
if(mysql_affected_rows() <= 0){ // Fehler? if(db_affected_rows() <= 0){ // Fehler?
$sql = 'UPDATE user_clan_invitations SET valid = TIMESTAMPADD(DAY, 5, now()) where userid = '.$userid.' and clanid = '.$user['clan']; $sql = 'UPDATE user_clan_invitations SET valid = TIMESTAMPADD(DAY, 5, now()) where userid = '.$userid.' and clanid = '.$user['clan'];
// echo $sql.'<br>'; // echo $sql.'<br>';
mysql_query($sql); db_query($sql);
if(mysql_affected_rows() <= 0){ // Fehler? if(db_affected_rows() <= 0){ // Fehler?
displayErrorMessage(NULL, 'Fehler! Konnte Nutzer nicht einladen!', displayHistoryBackLink()); displayErrorMessage(NULL, 'Fehler! Konnte Nutzer nicht einladen!', displayHistoryBackLink());
return false; return false;
} else{ } else{
@ -64,8 +64,8 @@ function sendClanNewsletter($user, $clan, $text){
return; return;
} }
$sql = 'SELECT id FROM user WHERE clan='.$clan['id']; $sql = 'SELECT id FROM user WHERE clan='.$clan['id'];
$clans = mysql_query($sql); $clans = db_query($sql);
while($row = mysql_fetch_assoc($clans)) { while($row = mysqli_fetch_assoc($clans)) {
sendMessage($user['id'], $row['id'], $clan['clanname'].' Nachricht', $text); sendMessage($user['id'], $row['id'], $clan['clanname'].' Nachricht', $text);
} }
displayErrorMessage(NULL,'Nachricht erfolgreich verschickt', '<a href="index.php?as=clan/post">weiter...</a>'); displayErrorMessage(NULL,'Nachricht erfolgreich verschickt', '<a href="index.php?as=clan/post">weiter...</a>');
@ -76,8 +76,8 @@ function revertInvitation($user, $clan, $userid){
displayErrorMessage(NULL, 'Nur der Leader, bzw. der Co-Leader kann Einladungen zur&uuml;ckziehen!!', displayHistoryBackLink()); displayErrorMessage(NULL, 'Nur der Leader, bzw. der Co-Leader kann Einladungen zur&uuml;ckziehen!!', displayHistoryBackLink());
return false; return false;
} }
mysql_query('DELETE FROM user_clan_invitations WHERE clan = '.$clan['id'].' AND userid = '.$userid); db_query('DELETE FROM user_clan_invitations WHERE clan = '.$clan['id'].' AND userid = '.$userid);
if(mysql_affected_rows() > 0){ if(db_affected_rows() > 0){
displayErrorMessage('Zur&uuml;ckgezogen','Du hast die Einladung erfolgreich zur&uuml;ckgezogen!','<a href="index.php?as=clan/post">weiter</a>'); displayErrorMessage('Zur&uuml;ckgezogen','Du hast die Einladung erfolgreich zur&uuml;ckgezogen!','<a href="index.php?as=clan/post">weiter</a>');
} else{ } else{
displayErrorMessage(NULL,'Einladung konnte nicht zur&uuml;ckgezogen werden!',displayHistoryBackLink()); displayErrorMessage(NULL,'Einladung konnte nicht zur&uuml;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') { if($action == 'newsletter') {
sendClanNewsletter($user_ida, $clan, $text); sendClanNewsletter($user_ida, $clan, $text);
@ -126,8 +126,8 @@ if($action == 'newsletter') {
<th height="30" colspan="2" class="content">Aktion</th> <th height="30" colspan="2" class="content">Aktion</th>
<?php <?php
$sql = 'SELECT * FROM user_clan_invitations WHERE clanid = '.$user_ida['clan'].' and valid > now();'; $sql = 'SELECT * FROM user_clan_invitations WHERE clanid = '.$user_ida['clan'].' and valid > now();';
$qry = mysql_query($sql); $qry = db_query($sql);
while($row = mysql_fetch_assoc($qry)){ while($row = mysqli_fetch_assoc($qry)){
?> ?>
<tr> <tr>
<td height="30" align="center" class="content"><?php echo displayUserLinkById($row['userid']); ?></td> <td height="30" align="center" class="content"><?php echo displayUserLinkById($row['userid']); ?></td>

@ -18,12 +18,12 @@ $charm=$_GET['charm'];
$mindestchar = 12; $mindestchar = 12;
$clan = mysql_fetch_array(mysql_query("SELECT geld FROM clan WHERE id='$user_ida[clan]' LIMIT 1")); $clan = mysqli_fetch_array(db_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")); $user = mysqli_fetch_array(db_query("SELECT nickname, geld FROM user WHERE id='$user_ida[id]' LIMIT 1"));
if ($charm == 1) { if ($charm == 1) {
if($clan_geld <= 0) { 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!', '<a href="index.php?as=clan/spende">weiter...</a>'); displayErrorMessage(NULL,'Geld darf nicht unter 0 sein!', '<a href="index.php?as=clan/spende">weiter...</a>');
exit; 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! // 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) { 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!', '<a href="index.php?as=clan/spende">weiter...</a>'); displayErrorMessage(NULL,'Es kann nicht mehr als 99.999.999 aufeinmal gespendet werden!', '<a href="index.php?as=clan/spende">weiter...</a>');
exit; exit;
} }
if($clan_geld <= 0) { 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!', '<a href="index.php?as=clan/spende">weiter...</a>'); displayErrorMessage(NULL,'Geld darf nicht unter 0 sein!', '<a href="index.php?as=clan/spende">weiter...</a>');
exit; exit;
} }
// Damit das minus nicht ausgenutzt wird!! // 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']; $auktionensumme = $auktionensumme['summe'];
@ -54,12 +54,12 @@ if($clan_geld+$auktionensumme>$user['geld']) {
exit; exit;
} }
mysql_query("UPDATE clan SET geld=geld+'$clan_geld' WHERE id='$user_ida[clan]'"); db_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']); db_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 user_clan SET spende = spende + '.$clan_geld.' WHERE clanid = '.$user_ida['clan'].' and userid = '.$user_ida['id']);
if(mysql_affected_rows() == 0){ if(db_affected_rows() == 0){
mysql_query('INSERT INTO user_clan(spende,clanid,userid) values('.$clan_geld.','.$user_ida['clan'].','.$user_ida['id'].')'); db_query('INSERT INTO user_clan(spende,clanid,userid) values('.$clan_geld.','.$user_ida['clan'].','.$user_ida['id'].')');
} }
displayErrorMessage(NULL,'An Clan Erfolgreich Gespendet', '<a href="index.php?as=clan/spende">weiter...</a>'); displayErrorMessage(NULL,'An Clan Erfolgreich Gespendet', '<a href="index.php?as=clan/spende">weiter...</a>');
@ -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 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'; $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.'<br>'; //echo $sql.'<br>';
$qry = mysql_query($sql); $qry = db_query($sql);
$clanraum = array(); $clanraum = array();
$clanraum_a = array(); $clanraum_a = array();
while($row = mysql_fetch_assoc($qry)){ while($row = mysqli_fetch_assoc($qry)){
$clanraum[$row['id']] = $row; $clanraum[$row['id']] = $row;
// print_r($row); // print_r($row);
$clanraum_a[] = $row; $clanraum_a[] = $row;
@ -137,10 +137,10 @@ $raumanzahl = count($clanraum_a);
//echo 'Raumanzahl = '.$raumanzahl.'<br>'; //echo 'Raumanzahl = '.$raumanzahl.'<br>';
$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'; $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.'<br>'; //echo $sql.'<br>';
$qry = mysql_query($sql); $qry = db_query($sql);
$clanrauminfo = array(); $clanrauminfo = array();
while($row = mysql_fetch_assoc($qry)){ while($row = mysqli_fetch_assoc($qry)){
$clanrauminfo[$row['clan_train']] = $row; $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'; $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.'<br>'; //echo $sql.'<br>';
$qry = mysql_query($sql); $qry = db_query($sql);
$user_raum = array(); $user_raum = array();
// Anzahl der Chars pro Raum pro User // 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; $user_raum[$row['userid']][$row['clan_warenid']] = $row;
} }
//print_r($user_raum); //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'); $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 = mysql_num_rows($clans_spend); $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'; $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.'<br>'; //echo $sql.'<br>';
$qry = mysql_query($sql); $qry = db_query($sql);
$user_nutz = array(); $user_nutz = array();
while($row = mysql_fetch_assoc($qry)){ while($row = mysqli_fetch_assoc($qry)){
$user_nutz[$row['besitzer']] = $row; $user_nutz[$row['besitzer']] = $row;
} }
@ -208,7 +208,7 @@ $cols = 4;
</tr> </tr>
<?php <?php
$summe = 0; $summe = 0;
while($row = mysql_fetch_assoc($clans_spend)) { while($row = mysqli_fetch_assoc($clans_spend)) {
?> ?>
<tr> <tr>
<th align="center"><?php echo $row['nickname']; ?></th> <th align="center"><?php echo $row['nickname']; ?></th>
@ -240,8 +240,8 @@ while($row = mysql_fetch_assoc($clans_spend)) {
<th><?php echo $member; ?> Member</th> <th><?php echo $member; ?> Member</th>
<th><?php <th><?php
$sql = 'SELECT sum(spende) as summe FROM user_clan WHERE clanid ='.$user_ida['clan']; $sql = 'SELECT sum(spende) as summe FROM user_clan WHERE clanid ='.$user_ida['clan'];
$qry = mysql_query($sql); $qry = db_query($sql);
$row_s = mysql_fetch_assoc($qry); $row_s = mysqli_fetch_assoc($qry);
echo displayMoney($row_s['summe']); echo displayMoney($row_s['summe']);
?></th> ?></th>
<?php <?php

@ -25,43 +25,43 @@ $h_name = validateName($_GET['h_name']);
// Nicht viel aber eine große Auswirkung // Nicht viel aber eine große Auswirkung
function wuenscheGeld($user){ function wuenscheGeld($user){
mysql_query('UPDATE user SET geld=geld+10000000 WHERE id='.$user['id']); db_query('UPDATE user SET geld=geld+10000000 WHERE id='.$user['id']);
return true; return true;
} }
function wuenschePotaras($user){ function wuenschePotaras($user){
mysql_query('INSERT sp_ware SET item=1, user='.$user['id']); db_query('INSERT sp_ware SET item=1, user='.$user['id']);
mysql_query('INSERT sp_ware SET item=1, user='.$user['id']); db_query('INSERT sp_ware SET item=1, user='.$user['id']);
return true; return true;
} }
function wuenscheTeufelsfrucht($user){ function wuenscheTeufelsfrucht($user){
$teufelsseele = mysql_fetch_assoc(mysql_query('SELECT count(id) as anzahl FROM sp_ware WHERE item=33 AND user='.$user['id'])); $teufelsseele = mysqli_fetch_assoc(db_query('SELECT count(id) as anzahl FROM sp_ware WHERE item=33 AND user='.$user['id']));
if($teufelsseele['anzahl'] <= 0) { if($teufelsseele['anzahl'] <= 0) {
displayErrorMessage(NULL,'Du besitzt das benötigte Item nicht!!',displayHistoryBackLink()); displayErrorMessage(NULL,'Du besitzt das benötigte Item nicht!!',displayHistoryBackLink());
return false; return false;
} }
mysql_query('DELETE FROM sp_ware WHERE item=33 AND user='.$user['id'].' LIMIT 1'); db_query('DELETE FROM sp_ware WHERE item=33 AND user='.$user['id'].' LIMIT 1');
$sum = mysql_fetch_assoc(mysql_query('SELECT sum(verteilung) as gesamt FROM wochen_markt WHERE art=\'natur\'')); $sum = mysqli_fetch_assoc(db_query('SELECT sum(verteilung) as gesamt FROM wochen_markt WHERE art=\'natur\''));
if($sum['gesamt'] != 100){ if($sum['gesamt'] != 100){
displayErrorMessage(NULL,'Die Wahrscheinlichkeit eine Frucht zu bekommen entspricht nicht 100%, Melde dich bei einem der GM!!',displayHistoryBackLink()); displayErrorMessage(NULL,'Die Wahrscheinlichkeit eine Frucht zu bekommen entspricht nicht 100%, Melde dich bei einem der GM!!',displayHistoryBackLink());
return false; return false;
} }
$natur_frucht = mysql_query('SELECT item, id,verteilung FROM wochen_markt WHERE art=\'natur\' order by id'); ///wieviel TF gibt es?. $natur_frucht = db_query('SELECT item, id,verteilung FROM wochen_markt WHERE art=\'natur\' order by id'); ///wieviel TF gibt es?.
$value = mt_random_wrapper(1,100); $value = mt_random_wrapper(1,100);
$peak = 0; $peak = 0;
while($row = mysql_fetch_assoc($natur_frucht)){ while($row = mysqli_fetch_assoc($natur_frucht)){
$peak += $row['verteilung']; $peak += $row['verteilung'];
if($value <= $peak){ if($value <= $peak){
break; break;
} }
} }
displayErrorMessage(NULL,'Du hast eine '.$row['item'].' bekommen!!',''); displayErrorMessage(NULL,'Du hast eine '.$row['item'].' bekommen!!','');
mysql_query('INSERT wochen_ware SET item='.$row['id'].', user='.$user['id']); db_query('INSERT wochen_ware SET item='.$row['id'].', user='.$user['id']);
return true; return true;
} }
@ -81,8 +81,8 @@ function wuenscheSpecialChar($user, $specialcharname, $newname = ''){
} }
// Hat der User überhaupt das Item ??? // Hat der User überhaupt das Item ???
$qry = mysql_query('SELECT count(*) AS anzahl FROM sp_ware WHERE item='.$spitem.' AND user='.$user['id']); $qry = db_query('SELECT count(*) AS anzahl FROM sp_ware WHERE item='.$spitem.' AND user='.$user['id']);
$row = mysql_fetch_assoc($qry); $row = mysqli_fetch_assoc($qry);
if($row['anzahl'] < 1){ if($row['anzahl'] < 1){
// Er hat das Item garnicht!! // Er hat das Item garnicht!!
displayErrorMessage(NULL,'Du kannst dir einen '.$specialcharname.' nur mit dem richtigen Item wünschen!!',displayHistoryBackLink()); displayErrorMessage(NULL,'Du kannst dir einen '.$specialcharname.' nur mit dem richtigen Item wünschen!!',displayHistoryBackLink());
@ -105,7 +105,7 @@ function wuenscheSpecialChar($user, $specialcharname, $newname = ''){
} }
// Slotüberprüfung beendet! // Slotüberprüfung beendet!
mysql_query('DELETE FROM sp_ware WHERE item='.$spitem.' AND user='.$user['id'].' LIMIT 1'); db_query('DELETE FROM sp_ware WHERE item='.$spitem.' AND user='.$user['id'].' LIMIT 1');
return true; return true;
} }
@ -116,8 +116,8 @@ function wuenscheUserRename($user, $newname){
return false; return false;
} }
$sql = 'Insert into user_rename(pre_name, post_name, datum, userid, wunsch) values(\''.$user['nickname'].'\', \''.$newname.'\', now(), '.$user['id'].', 1)'; $sql = 'Insert into user_rename(pre_name, post_name, datum, userid, wunsch) values(\''.$user['nickname'].'\', \''.$newname.'\', now(), '.$user['id'].', 1)';
mysql_query($sql); db_query($sql);
mysql_query('Update user set nickname = \''.$newname.'\' WHERE id = '.$user['id']); db_query('Update user set nickname = \''.$newname.'\' WHERE id = '.$user['id']);
return true; return true;
} }
@ -129,7 +129,7 @@ function worker($charm,$wunsch,$user,$newname){
return; return;
} }
$dragonballs = mysql_fetch_assoc(mysql_query('SELECT count(id) as anzahl FROM sp_ware WHERE user='.$user['id'].' AND item=11')); $dragonballs = mysqli_fetch_assoc(db_query('SELECT count(id) as anzahl FROM sp_ware WHERE user='.$user['id'].' AND item=11'));
if($dragonballs['anzahl'] < 7) { if($dragonballs['anzahl'] < 7) {
displayErrorMessage(NULL,'Du hast keine 7 Dragonballs!!',displayHistoryBackLink()); displayErrorMessage(NULL,'Du hast keine 7 Dragonballs!!',displayHistoryBackLink());
semaphoreDown($ressource); semaphoreDown($ressource);
@ -137,7 +137,7 @@ function worker($charm,$wunsch,$user,$newname){
} }
$sql = 'DELETE FROM sp_ware WHERE item=11 AND user='.$user['id'].' LIMIT 7'; $sql = 'DELETE FROM sp_ware WHERE item=11 AND user='.$user['id'].' LIMIT 7';
mysql_query($sql); db_query($sql);
$result = true; $result = true;
if($charm == 1) { if($charm == 1) {
@ -158,13 +158,13 @@ function worker($charm,$wunsch,$user,$newname){
if($result){ if($result){
displayErrorMessage('&Auml;nderungen &uuml;bernommen!','Dragonballs erfolgreich eingesetzt!!','<a href="index.php?as=dragonballs">weiter</a>'); displayErrorMessage('&Auml;nderungen &uuml;bernommen!','Dragonballs erfolgreich eingesetzt!!','<a href="index.php?as=dragonballs">weiter</a>');
} else{ } else{
mysql_query('INSERT sp_ware SET item=11, user='.$user['id']); // 1 db_query('INSERT sp_ware SET item=11, user='.$user['id']); // 1
mysql_query('INSERT sp_ware SET item=11, user='.$user['id']); // 2 db_query('INSERT sp_ware SET item=11, user='.$user['id']); // 2
mysql_query('INSERT sp_ware SET item=11, user='.$user['id']); // 3 db_query('INSERT sp_ware SET item=11, user='.$user['id']); // 3
mysql_query('INSERT sp_ware SET item=11, user='.$user['id']); // 4 db_query('INSERT sp_ware SET item=11, user='.$user['id']); // 4
mysql_query('INSERT sp_ware SET item=11, user='.$user['id']); // 5 db_query('INSERT sp_ware SET item=11, user='.$user['id']); // 5
mysql_query('INSERT sp_ware SET item=11, user='.$user['id']); // 6 db_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']); // 7
} }
semaphoreDown($ressource); semaphoreDown($ressource);
return; return;
@ -172,7 +172,7 @@ function worker($charm,$wunsch,$user,$newname){
function displayWuensche($user){ 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
<option value="6">Nutzernamen &auml;ndern</option> <option value="6">Nutzernamen &auml;ndern</option>
<?php <?php
while($row = mysql_fetch_assoc($items)) { while($row = mysqli_fetch_assoc($items)) {
if($row['id'] == 3) { ?> if($row['id'] == 3) { ?>
<option value="3">Kaioshin befreien</option> <option value="3">Kaioshin befreien</option>
<?php <?php

@ -46,13 +46,13 @@ include_once(ROOT_PATH.'/gm/include/tournament.inc.php');
function logaction($message){ function logaction($message){
$sql = 'Insert into gm_actions(userid, time, message, ip) values('.$_SESSION['user'].', now(), \''.$message.'\', \''.$_SERVER['REMOTE_ADDR'].'\')'; $sql = 'Insert into gm_actions(userid, time, message, ip) values('.$_SESSION['user'].', now(), \''.$message.'\', \''.$_SERVER['REMOTE_ADDR'].'\')';
// echo $sql.'<br>'; // echo $sql.'<br>';
mysql_query($sql); db_query($sql);
} }
function showActionLog(){ 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'); $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 = mysql_fetch_assoc($qry)){ while($row = mysqli_fetch_assoc($qry)){
echo $row['time'].' '.$row['nickname'].' ('.$row['ip'].'): '.$row['message'].'<br>'."\n"; echo $row['time'].' '.$row['nickname'].' ('.$row['ip'].'): '.$row['message'].'<br>'."\n";
} }
echo '<a href="'.$_SERVER['PHP_SELF'].'">Zum Hauptmenu</a>'; echo '<a href="'.$_SERVER['PHP_SELF'].'">Zum Hauptmenu</a>';
@ -71,8 +71,8 @@ function checkLoginData($userid, $password){
function loginUser($user,$pass){ function loginUser($user,$pass){
if(checkLoginPassword($user,$pass)){ if(checkLoginPassword($user,$pass)){
$test = 'SELECT * from user where nickname = \''.$user.'\''; $test = 'SELECT * from user where nickname = \''.$user.'\'';
$qry = mysql_query($test); $qry = db_query($test);
$result = mysql_fetch_assoc($qry); $result = mysqli_fetch_assoc($qry);
$usergroups = getUserGroups($user); $usergroups = getUserGroups($user);
if(isUserInGroup($usergroups, ADMIN)) { if(isUserInGroup($usergroups, ADMIN)) {

@ -101,7 +101,7 @@ function searchfirstAttack($action) {
} }
function searchsecondAttack($action, $attackname) { 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.'%\'');
?> ?>
<form action="" method="POST"> <form action="" method="POST">
<input name="choose" value="attacken" type="hidden"></input> <input <input name="choose" value="attacken" type="hidden"></input> <input
@ -114,7 +114,7 @@ function searchsecondAttack($action, $attackname) {
<tr> <tr>
<td><select name="attackid"> <td><select name="attackid">
<?php <?php
while($row = mysql_fetch_assoc($qry)){ while($row = mysqli_fetch_assoc($qry)){
echo '<option value="'.$row['id'].'">'.$row['name'].'</option>\n'; echo '<option value="'.$row['id'].'">'.$row['name'].'</option>\n';
} }
?> ?>
@ -134,12 +134,12 @@ function searchsecondAttack($action, $attackname) {
function createOrEditAttack($action, $attackid) { function createOrEditAttack($action, $attackid) {
if($action == 'edit'){ if($action == 'edit'){
$row = mysql_fetch_assoc(mysql_query('Select * from attacken where id ='.$attackid)); $row = mysqli_fetch_assoc(db_query('Select * from attacken where id ='.$attackid));
} }
//Alle attacken auslesen //Alle attacken auslesen
$att_qry = mysql_query('SELECT id,name FROM attacken WHERE info not like \'%NPC%\' ORDER BY name'); $att_qry = db_query('SELECT id,name FROM attacken WHERE info not like \'%NPC%\' ORDER BY name');
$available_attacks = array(); $available_attacks = array();
while($attacks = mysql_fetch_assoc($att_qry)) { while($attacks = mysqli_fetch_assoc($att_qry)) {
$available_attacks[] = array($attacks['id'], $attacks['name']); $available_attacks[] = array($attacks['id'], $attacks['name']);
} }
$used_attacks = explode(',', $row['req_atk']); $used_attacks = explode(',', $row['req_atk']);
@ -217,8 +217,8 @@ function createOrEditAttack($action, $attackid) {
<td>Type:</td> <td>Type:</td>
<td><select name="type"> <td><select name="type">
<?php <?php
$qry = mysql_query('Select name FROM attackentyp;'); $qry = db_query('Select name FROM attackentyp;');
while ($result = mysql_fetch_assoc($qry)) { while ($result = mysqli_fetch_assoc($qry)) {
if($row['type'] == $result['name']){ if($row['type'] == $result['name']){
echo '<option value="'.$result['name'].'" selected="selected">'.$result['name'].'</option>'; echo '<option value="'.$result['name'].'" selected="selected">'.$result['name'].'</option>';
} else{ } else{
@ -315,14 +315,14 @@ function createOrEditAttack($action, $attackid) {
<?php <?php
// Fuers dropdown // Fuers dropdown
$f_sql = 'SELECT id, item FROM wochen_markt WHERE type = \'Teufels Frucht\' order by item'; $f_sql = 'SELECT id, item FROM wochen_markt WHERE type = \'Teufels Frucht\' order by item';
$f_qry = mysql_query($f_sql); $f_qry = db_query($f_sql);
if($row['Frucht'] === NULL || $row['Frucht'] == 0){ if($row['Frucht'] === NULL || $row['Frucht'] == 0){
echo '<option value="0" selected="selected">-Keine-</option>'; echo '<option value="0" selected="selected">-Keine-</option>';
} else { } else {
echo '<option value="0">-Keine-</option>'; echo '<option value="0">-Keine-</option>';
} }
while($f_row = mysql_fetch_assoc($f_qry)){ while($f_row = mysqli_fetch_assoc($f_qry)){
if($f_row['id'] == $row['Frucht']){ if($f_row['id'] == $row['Frucht']){
echo '<option value="'.$f_row['id'].'" selected="selected">'.$f_row['item'].'</option>'; echo '<option value="'.$f_row['id'].'" selected="selected">'.$f_row['item'].'</option>';
} else{ } else{
@ -374,7 +374,7 @@ function createAttack($attackname, $Frucht, $starke, $verteidigung, $speed, $hp,
$sql = 'INSERT into attacken set name = \''.$attackname.'\', starke = '.$starke.', verteidigung = '.$verteidigung.', speed = '.$speed.', hp = '.$hp.', mp = '.$mp.', rassen = \''.$rassen.'\', level = '.$level.', geld = '.$geld.', type = \''.$type.'\', info = \''.$info.'\', req_atk = \''.$req_atk.'\', req_lvl = \''.$req_lvl.'\', runden = '.$runden.', maxlvl = '.$maxlvl.', options = \''.addslashes($options).'\''; $sql = 'INSERT into attacken set name = \''.$attackname.'\', starke = '.$starke.', verteidigung = '.$verteidigung.', speed = '.$speed.', hp = '.$hp.', mp = '.$mp.', rassen = \''.$rassen.'\', level = '.$level.', geld = '.$geld.', type = \''.$type.'\', info = \''.$info.'\', req_atk = \''.$req_atk.'\', req_lvl = \''.$req_lvl.'\', runden = '.$runden.', maxlvl = '.$maxlvl.', options = \''.addslashes($options).'\'';
} }
//echo $sql.'<br>'; //echo $sql.'<br>';
if(!mysql_query($sql)){ if(!db_query($sql)){
echo "Fehler beim Erstellen der Attacke: &Uuml;berpr&uuml;fe deine Eingabe und melde erst DANACH dieses Statement einem Entwickler => $sql"; echo "Fehler beim Erstellen der Attacke: &Uuml;berpr&uuml;fe deine Eingabe und melde erst DANACH dieses Statement einem Entwickler => $sql";
return; return;
} }
@ -392,8 +392,8 @@ function deleteAttack($attackid, $depth) {
if($depth == 4){ if($depth == 4){
$sql = 'Delete from attacken where id = '.$attackid; $sql = 'Delete from attacken where id = '.$attackid;
// echo 'Debugnachricht: '.$sql.'<br>'; // echo 'Debugnachricht: '.$sql.'<br>';
mysql_query($sql); db_query($sql);
mysql_query('Delete from lernen where at_id = '.$attackid); db_query('Delete from lernen where at_id = '.$attackid);
logaction('Attacke mit id = '.$attackid.' wurde geloescht!'); logaction('Attacke mit id = '.$attackid.' wurde geloescht!');
} else{ } else{
@ -416,7 +416,7 @@ sicher??
} }
function editAttack($attackname, $attackid, $Frucht, $starke, $verteidigung, $speed, $hp, $mp, $rassen, $level, $geld, $options, $type, $info, $req_atk, $req_lvl, $runden, $maxlvl) { function editAttack($attackname, $attackid, $Frucht, $starke, $verteidigung, $speed, $hp, $mp, $rassen, $level, $geld, $options, $type, $info, $req_atk, $req_lvl, $runden, $maxlvl) {
$row = mysql_fetch_assoc(mysql_query('Select * from attacken where id ='.$attackid)); $row = mysqli_fetch_assoc(db_query('Select * from attacken where id ='.$attackid));
$req_atk = implode(',', $req_atk); $req_atk = implode(',', $req_atk);
json_decode($options, true); json_decode($options, true);
@ -435,10 +435,10 @@ function editAttack($attackname, $attackid, $Frucht, $starke, $verteidigung, $sp
$sql = 'UPDATE attacken set name = \''.htmlspecialchars(urldecode($attackname)).'\', starke = '.$starke.', verteidigung = '.$verteidigung.', speed = '.$speed.', hp = '.$hp.', mp = '.$mp.', rassen = \''.$rassen.'\', level = '.$level.', geld = '.$geld.', type = \''.$type.'\', info = \''.$info.'\', req_atk = \''.$req_atk.'\', req_lvl = \''.$req_lvl.'\', Frucht = NULL, runden = '.$runden.', maxlvl = '.$maxlvl.', options = \''.$options.'\' where id = '.$attackid; $sql = 'UPDATE attacken set name = \''.htmlspecialchars(urldecode($attackname)).'\', starke = '.$starke.', verteidigung = '.$verteidigung.', speed = '.$speed.', hp = '.$hp.', mp = '.$mp.', rassen = \''.$rassen.'\', level = '.$level.', geld = '.$geld.', type = \''.$type.'\', info = \''.$info.'\', req_atk = \''.$req_atk.'\', req_lvl = \''.$req_lvl.'\', Frucht = NULL, runden = '.$runden.', maxlvl = '.$maxlvl.', options = \''.$options.'\' where id = '.$attackid;
} }
if($row['name'] != $attackname){ if($row['name'] != $attackname){
mysql_query('Update lernen set name = \''.$attackname.'\' WHERE at_id ='.$attackid); db_query('Update lernen set name = \''.$attackname.'\' WHERE at_id ='.$attackid);
} }
//echo 'Debugnachricht: '.$sql.'<br>'; //echo 'Debugnachricht: '.$sql.'<br>';
if(!mysql_query($sql)){ if(!db_query($sql)){
echo "Fehler beim Editieren der Attacke: &Uuml;berpr&uuml;fe deine Eingabe und melde erst DANACH dieses Statement einem Entwickler => $sql"; echo "Fehler beim Editieren der Attacke: &Uuml;berpr&uuml;fe deine Eingabe und melde erst DANACH dieses Statement einem Entwickler => $sql";
return; return;
} }
@ -508,7 +508,7 @@ function displayAttackenTypenOverview($page) {
echo "\t".'<tr><td colspan="'.$colspan.'"><hr></td></tr>'."\n"; echo "\t".'<tr><td colspan="'.$colspan.'"><hr></td></tr>'."\n";
while($row = mysql_fetch_assoc($qry)){ while($row = mysqli_fetch_assoc($qry)){
echo "\t".'<tr>'."\n"; echo "\t".'<tr>'."\n";
for($i=0;$i<count($d_array);$i++){ for($i=0;$i<count($d_array);$i++){
echo "\t\t".'<td>'.$row[$d_array[$i]].'</td>'."\n"; echo "\t\t".'<td>'.$row[$d_array[$i]].'</td>'."\n";
@ -524,7 +524,7 @@ function displayAttackenTypenOverview($page) {
echo "\t".'</tr>'."\n"; echo "\t".'</tr>'."\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 = '<a href="'.$_SERVER['PHP_SELF'].'?choose=npc&page=###PAGE###">###LABEL###</a>'; $url = '<a href="'.$_SERVER['PHP_SELF'].'?choose=npc&page=###PAGE###">###LABEL###</a>';
echo "\t".'<tr><td colspan="'.$colspan.'"><hr></td></tr>'."\n"; echo "\t".'<tr><td colspan="'.$colspan.'"><hr></td></tr>'."\n";
echo "\t".'<tr><td colspan="'.$colspan.'">'.displayPagelinksNew(20, $total, $page, $url).'</td></tr>'."\n"; echo "\t".'<tr><td colspan="'.$colspan.'">'.displayPagelinksNew(20, $total, $page, $url).'</td></tr>'."\n";
@ -544,7 +544,7 @@ function displayAttackenTypenInfo($action, $task, $attid) {
if($task == TASK_EDIT) { if($task == TASK_EDIT) {
$sql = 'SELECT * FROM attackentyp WHERE id = '.$attid.';'; $sql = 'SELECT * FROM attackentyp WHERE id = '.$attid.';';
$qry = db_query($sql); $qry = db_query($sql);
$row = mysql_fetch_assoc($qry); $row = mysqli_fetch_assoc($qry);
} }
$colspan = 2; $colspan = 2;
@ -584,7 +584,7 @@ function editAttackentyp($attid, $data) {
$u = db_query($sql); $u = db_query($sql);
$log = 0; $log = 0;
if(mysql_affected_rows() == 0 || $u === FALSE) { if(db_affected_rows() == 0 || $u === FALSE) {
echo "\t\t\t".'<tr><td colspan="2" style="color:red">Fehler aufgetreten!</td></tr>'; echo "\t\t\t".'<tr><td colspan="2" style="color:red">Fehler aufgetreten!</td></tr>';
} else{ } else{
echo "\t\t\t".'<tr><td colspan="2">Änderungen wurden übernommen!</td></tr>'; echo "\t\t\t".'<tr><td colspan="2">Änderungen wurden übernommen!</td></tr>';
@ -614,7 +614,7 @@ function createAttackentyp($data) {
$sql .= '\''.$data['kategorie'].'\''; $sql .= '\''.$data['kategorie'].'\'';
} }
$sql .= ');'; $sql .= ');';
$identifier = mysql_query($sql); $identifier = db_query($sql);
if($identifier == FALSE){ if($identifier == FALSE){
echo "\t".'<tr><td colspan="2" style="text-align:center">Es gab Probleme beim erstellen des Attacktyps!</td></tr>'."\n"; echo "\t".'<tr><td colspan="2" style="text-align:center">Es gab Probleme beim erstellen des Attacktyps!</td></tr>'."\n";
} else { } else {
@ -628,7 +628,7 @@ function deleteAttackentyp($attid) {
$colspan = 1; $colspan = 1;
$sql = 'DELETE FROM attackentyp WHERE id = '.$attid.';'; $sql = 'DELETE FROM attackentyp WHERE id = '.$attid.';';
$qry = db_query($sql); $qry = db_query($sql);
if($qry === FALSE || mysql_affected_rows() <= 0){ if($qry === FALSE || db_affected_rows() <= 0){
echo "\t".'<tr><td colspan="'.$colspan.'" style="text-align:center;color:red">Der Attackentyp '.$row['name'].' konnte nicht gelöscht werden!</td></tr>'."\n";; echo "\t".'<tr><td colspan="'.$colspan.'" style="text-align:center;color:red">Der Attackentyp '.$row['name'].' konnte nicht gelöscht werden!</td></tr>'."\n";;
} else { } else {
echo "\t".'<tr><td colspan="'.$colspan.'" style="text-align:center">Der Attackentyp '.$row['name'].' wurde gelöscht!</td></tr>'."\n";; echo "\t".'<tr><td colspan="'.$colspan.'" style="text-align:center">Der Attackentyp '.$row['name'].' wurde gelöscht!</td></tr>'."\n";;
@ -641,7 +641,7 @@ function displayDeleteAttackentyp($attid) {
$sql = 'SELECT * FROM attackentyp WHERE id = '.$attid; $sql = 'SELECT * FROM attackentyp WHERE id = '.$attid;
$qry = db_query($sql); $qry = db_query($sql);
$row = mysql_fetch_assoc($qry); $row = mysqli_fetch_assoc($qry);
echo "\t".'<tr><td colspan="'.$colspan.'"><h1 style="text-align:center">Attackentyp löschen</h1></td></tr>'."\n"; echo "\t".'<tr><td colspan="'.$colspan.'"><h1 style="text-align:center">Attackentyp löschen</h1></td></tr>'."\n";
echo "\t".'<tr><td colspan="'.$colspan.'" style="text-align:center">Soll der Attackentyp '.$row['name'].' wirklich gelöscht werden?</td></tr>'."\n"; echo "\t".'<tr><td colspan="'.$colspan.'" style="text-align:center">Soll der Attackentyp '.$row['name'].' wirklich gelöscht werden?</td></tr>'."\n";

@ -38,10 +38,10 @@ function zeigeBilder($begin, $bildurl, $sure, $view, $letter, $date_from, $date_
echo '<tr><form action="'.$_SERVER['PHP_SELF'].'" method="GET"><input type="hidden" name="choose" value="bilder" /><input type="hidden" name="view" value="ByDate" /><td>Von:<input name="date_from"></td><td>Bis: <input name="date_until"></td><td><input type="submit" name="aktualisieren"></td></form></tr>'; echo '<tr><form action="'.$_SERVER['PHP_SELF'].'" method="GET"><input type="hidden" name="choose" value="bilder" /><input type="hidden" name="view" value="ByDate" /><td>Von:<input name="date_from"></td><td>Bis: <input name="date_until"></td><td><input type="submit" name="aktualisieren"></td></form></tr>';
$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'; $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.'<br>'; // echo $test.'<br>';
$qry = mysql_query($test); $qry = db_query($test);
$actual = ''; $actual = '';
$i = 0; $i = 0;
while($result = mysql_fetch_assoc($qry)){ while($result = mysqli_fetch_assoc($qry)){
if($actual == '' || $result['nickname'] != $actual){ if($actual == '' || $result['nickname'] != $actual){
// Fuelle die Leeren Felder aus // Fuelle die Leeren Felder aus
for(;$i<8;$i++){ for(;$i<8;$i++){
@ -59,12 +59,12 @@ function zeigeBilder($begin, $bildurl, $sure, $view, $letter, $date_from, $date_
} else if($view == 'Random'){ } else if($view == 'Random'){
$colspan = ' colspan=5'; $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'; $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 '<tr><th'.$colspan.'>Avatar Zufall</th></tr>'; echo '<tr><th'.$colspan.'>Avatar Zufall</th></tr>';
for($i=0;$i<4;$i++){ for($i=0;$i<4;$i++){
echo '<tr>'; echo '<tr>';
for($t=0;$t<5;$t++){ for($t=0;$t<5;$t++){
$tmp = mysql_fetch_assoc($qry); $tmp = mysqli_fetch_assoc($qry);
if($tmp){ if($tmp){
echo '<td><a href="gm_seite.php?choose=bilder&view=SinglePic&bildurl='.urlencode($tmp['bild']).'">'.$tmp['name'].'<br><img src="'.$tmp['bild'].'" width="75" height="75"></a></td>'; echo '<td><a href="gm_seite.php?choose=bilder&view=SinglePic&bildurl='.urlencode($tmp['bild']).'">'.$tmp['name'].'<br><img src="'.$tmp['bild'].'" width="75" height="75"></a></td>';
} else { } else {
@ -94,28 +94,28 @@ function zeigeBilder($begin, $bildurl, $sure, $view, $letter, $date_from, $date_
echo '</tr></table></td></tr>'; echo '</tr></table></td></tr>';
if($letter == 'Numeric'){ 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'); $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 = 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 != \'\'')); $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){ } 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'); $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 = 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 != \'\'')); $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{ } 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'); $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 = 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 != \'\'')); $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']; $total = $total['anzahl'];
$users = array(); $users = array();
while($row = mysql_fetch_assoc($auser)){ while($row = mysqli_fetch_assoc($auser)){
// echo 'User: '.$row['id'].'<br>'; // echo 'User: '.$row['id'].'<br>';
$users[] = $row['id']; $users[] = $row['id'];
} }
echo '<td'.$colspan.'><table>'.displayPagelinksNew(10, $total, $begin, '<a href="'.$_SERVER['PHP_SELF'].'?choose=bilder&view=ByUser&letter='.$letter.'&begin=###PAGE###">###LABEL###</a>').'</td>'; echo '<td'.$colspan.'><table>'.displayPagelinksNew(10, $total, $begin, '<a href="'.$_SERVER['PHP_SELF'].'?choose=bilder&view=ByUser&letter='.$letter.'&begin=###PAGE###">###LABEL###</a>').'</td>';
$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'; $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 = ''; $actual = '';
$i = 0; $i = 0;
while($result = mysql_fetch_assoc($qry)){ while($result = mysqli_fetch_assoc($qry)){
if($actual == '' || $result['nickname'] != $actual){ if($actual == '' || $result['nickname'] != $actual){
// Fuelle die Leeren Felder aus // Fuelle die Leeren Felder aus
for(;$i<8;$i++){ for(;$i<8;$i++){
@ -134,14 +134,14 @@ function zeigeBilder($begin, $bildurl, $sure, $view, $letter, $date_from, $date_
if($bildurl !== NULL && $sure == 'yes'){ if($bildurl !== NULL && $sure == 'yes'){
echo '<tr><td>Bild wurde zur&uuml;ckgesetzt</td>'; echo '<tr><td>Bild wurde zur&uuml;ckgesetzt</td>';
echo '<td><a href="javascript:history.go(-2);">Zur&uuml;ck</a></td></tr>'; echo '<td><a href="javascript:history.go(-2);">Zur&uuml;ck</a></td></tr>';
mysql_query('Update chars SET bild=\'\' where bild = \''.urldecode($bildurl).'\' '); db_query('Update chars SET bild=\'\' where bild = \''.urldecode($bildurl).'\' ');
} else if($bildurl !== NULL){ } else if($bildurl !== NULL){
$colspan = ' colspan=2'; $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 '<tr><td'.$colspan.' align="center">Wollen sie dieses Bild wirklich l&ouml;schen?</td></tr>'; echo '<tr><td'.$colspan.' align="center">Wollen sie dieses Bild wirklich l&ouml;schen?</td></tr>';
echo '<tr><td'.$colspan.' align="center"><img src="'.$bildurl.'" width="75" height="75"></td></tr>'; echo '<tr><td'.$colspan.' align="center"><img src="'.$bildurl.'" width="75" height="75"></td></tr>';
echo '<tr><td>Betroffener User</td><td>Betroffener Char</td></tr>'; echo '<tr><td>Betroffener User</td><td>Betroffener Char</td></tr>';
while($row = mysql_fetch_assoc($qry)) { while($row = mysqli_fetch_assoc($qry)) {
echo '<tr><td>'.$row['nickname'].'</td><td>'.$row['name'].'</td></tr>'; echo '<tr><td>'.$row['nickname'].'</td><td>'.$row['name'].'</td></tr>';
} }
echo '<tr><td><a href="gm_seite.php?choose=bilder&view=SinglePic&bildurl='.urlencode($bildurl).'&sure=yes">ja</a></td><td><a href="javascript:history.back();">nein</a></td></tr>'; echo '<tr><td><a href="gm_seite.php?choose=bilder&view=SinglePic&bildurl='.urlencode($bildurl).'&sure=yes">ja</a></td><td><a href="javascript:history.back();">nein</a></td></tr>';

@ -12,7 +12,7 @@
defineIfNotDefined("CLAN_CREATION_FEE", 20000); defineIfNotDefined("CLAN_CREATION_FEE", 20000);
function displayClanItems() { function displayClanItems() {
$raume_qry = mysql_query('SELECT * FROM clan_item order by tp'); $raume_qry = db_query('SELECT * FROM clan_item order by tp');
?> ?>
<table> <table>
<tr> <tr>
@ -36,7 +36,7 @@ function displayClanItems() {
<td colspan=12><hr></td> <td colspan=12><hr></td>
</tr> </tr>
<?php <?php
while($res = mysql_fetch_assoc($raume_qry)){ while($res = mysqli_fetch_assoc($raume_qry)){
echo '<tr><td>'.$res['name'].'</td><td>'.$res['staerke'].'</td><td>'.$res['verteidigung'].'</td><td>'.$res['glueck'].'</td><td>'.$res['ausdauer'].'</td><td>'.$res['geschwindigkeit'].'</td><td>'.$res['preis'].'</td><td>'.$res['miete'].'</td><td>'.$res['nutzung'].'</td><td>'.$res['tp'].'</td><td>'.$res['req_level'].'</td><td><a href="'.$_SERVER['PHP_SELF'].'?choose=clan&action=editrooms&raumid='.$res['id'].'">edit</a> | <a href="'.$_SERVER['PHP_SELF'].'?choose=clan&action=deleterooms&raumid='.$res['id'].'">delete</a></td></tr>'; echo '<tr><td>'.$res['name'].'</td><td>'.$res['staerke'].'</td><td>'.$res['verteidigung'].'</td><td>'.$res['glueck'].'</td><td>'.$res['ausdauer'].'</td><td>'.$res['geschwindigkeit'].'</td><td>'.$res['preis'].'</td><td>'.$res['miete'].'</td><td>'.$res['nutzung'].'</td><td>'.$res['tp'].'</td><td>'.$res['req_level'].'</td><td><a href="'.$_SERVER['PHP_SELF'].'?choose=clan&action=editrooms&raumid='.$res['id'].'">edit</a> | <a href="'.$_SERVER['PHP_SELF'].'?choose=clan&action=deleterooms&raumid='.$res['id'].'">delete</a></td></tr>';
} }
?> ?>
@ -91,19 +91,19 @@ function displayEditOrCreateClanRoom($action, $raumid, $raumname, $staerke, $ver
if($action == 'editrooms'){ if($action == 'editrooms'){
logaction('Der Raum '.$raumname.' wurde editiert!'); 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.''; $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) if(!$res)
echo $sql . '<br>'; echo $sql . '<br>';
} else if($action == 'createrooms'){ } else if($action == 'createrooms'){
logaction('Der Raum '.$raumname.' wurde erstellt!'); 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.')'; $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) if(!$res)
echo $sql . '<br>'; echo $sql . '<br>';
} }
} }
if($action == 'editrooms'){ 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'; $aLabel = 'editieren';
} else{ } else{
$aLabel = 'erstellen'; $aLabel = 'erstellen';
@ -200,8 +200,8 @@ function displayDeleteClanRoom($raumname, $raumid) {
<table> <table>
<?php <?php
if($raumname !== NULL){ if($raumname !== NULL){
mysql_query('DELETE FROM clan_item WHERE id = '.$raumid); db_query('DELETE FROM clan_item WHERE id = '.$raumid);
mysql_query('DELETE FROM clan_ware where item_id ='.$raumid); db_query('DELETE FROM clan_ware where item_id ='.$raumid);
?> ?>
<tr> <tr>
<td align="center" colspan="2">Der Raum "<?php echo $raumname; ?>" <td align="center" colspan="2">Der Raum "<?php echo $raumname; ?>"
@ -209,7 +209,7 @@ if($raumname !== NULL){
</tr> </tr>
<?php <?php
} else{ } else{
$res = mysql_fetch_assoc(mysql_query('SELECT * FROM clan_item WHERE id = '.$raumid)); $res = mysqli_fetch_assoc(db_query('SELECT * FROM clan_item WHERE id = '.$raumid));
?> ?>
<tr> <tr>
<td align="center" colspan="2">Den Raum "<?php echo $res['name']; ?>" <td align="center" colspan="2">Den Raum "<?php echo $res['name']; ?>"

@ -188,9 +188,9 @@ function displayNews($action, $username, $newsid, $header, $value){
$header = addslashes($header); $header = addslashes($header);
$value = urldecode($value); $value = urldecode($value);
$value = encodeNoHTMLWithBB($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)'); ' values(\''.$username.'\',\''.$header.'\',\''.$value.'\',CURRENT_TIME, CURRENT_DATE)');
if(mysql_affected_rows() > 0){ if(db_affected_rows() > 0){
logaction('News '.$header.' wurde erstellt!'); logaction('News '.$header.' wurde erstellt!');
echo 'news erfolgreich erstellt!<br>'; echo 'news erfolgreich erstellt!<br>';
} else { } else {
@ -203,8 +203,8 @@ function displayNews($action, $username, $newsid, $header, $value){
$value = encodeNoHTMLWithBB($value); $value = encodeNoHTMLWithBB($value);
$sql = 'UPDATE ff11_news set betreff = \''.$header.'\', text = \''.$value.'\' where id ='.$newsid; $sql = 'UPDATE ff11_news set betreff = \''.$header.'\', text = \''.$value.'\' where id ='.$newsid;
echo $sql.'<br>'; echo $sql.'<br>';
mysql_query($sql); db_query($sql);
if(mysql_affected_rows() > 0){ if(db_affected_rows() > 0){
logaction('News '.$header.' wurde editiert!'); logaction('News '.$header.' wurde editiert!');
echo 'news erfolgreich editiert!<br>'; echo 'news erfolgreich editiert!<br>';
} else { } else {
@ -217,7 +217,7 @@ function displayNews($action, $username, $newsid, $header, $value){
$buttonval = 'erstellen'; $buttonval = 'erstellen';
} else{ } else{
$topic = 'Newseintrag editieren'; $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']); $header = debbcode($row['betreff']);
$value = debbcode($row['text']); $value = debbcode($row['text']);
$buttonval = 'editieren'; $buttonval = 'editieren';
@ -265,14 +265,14 @@ function displayNews($action, $username, $newsid, $header, $value){
</form> </form>
<?php <?php
} else if($action == 'edit'){ } else if($action == 'edit'){
$qry = mysql_query('Select * from ff11_news order by id desc'); $qry = db_query('Select * from ff11_news order by id desc');
?> ?>
<table> <table>
<tr> <tr>
<th>News bearbeiten (Auswahl)</th> <th>News bearbeiten (Auswahl)</th>
</tr> </tr>
<?php <?php
while($row = mysql_fetch_assoc($qry)){ while($row = mysqli_fetch_assoc($qry)){
?> ?>
<tr> <tr>
<td> <td>
@ -335,8 +335,8 @@ function displayPolls($action,$openumfrage,$closeumfrage,$thema,$optionen,$text,
<select name="openumfrage"> <select name="openumfrage">
<option value="-1">---Bitte Ausw&auml;hlen---</option> <option value="-1">---Bitte Ausw&auml;hlen---</option>
<?php <?php
$qry = mysql_query('SELECT * from poll WHERE TIMESTAMPDIFF(Minute, close, now()) <= 0 || close is null'); $qry = db_query('SELECT * from poll WHERE TIMESTAMPDIFF(Minute, close, now()) <= 0 || close is null');
while($result = mysql_fetch_assoc($qry)){ while($result = mysqli_fetch_assoc($qry)){
echo '<option value="'.$result['pollid'].'">'.$result['thema'].'</option>'; echo '<option value="'.$result['pollid'].'">'.$result['thema'].'</option>';
} }
?> ?>
@ -351,8 +351,8 @@ function displayPolls($action,$openumfrage,$closeumfrage,$thema,$optionen,$text,
<select name="closeumfrage"> <select name="closeumfrage">
<option value="-1">---Bitte Ausw&auml;hlen---</option> <option value="-1">---Bitte Ausw&auml;hlen---</option>
<?php <?php
$qry = mysql_query('SELECT * from poll WHERE TIMESTAMPDIFF(Minute, close, now()) > 0'); $qry = db_query('SELECT * from poll WHERE TIMESTAMPDIFF(Minute, close, now()) > 0');
while($result = mysql_fetch_assoc($qry)){ while($result = mysqli_fetch_assoc($qry)){
echo '<option value="'.$result['pollid'].'">'.$result['thema'].'</option>'; echo '<option value="'.$result['pollid'].'">'.$result['thema'].'</option>';
} }
?> ?>
@ -385,9 +385,9 @@ function displayPolls($action,$openumfrage,$closeumfrage,$thema,$optionen,$text,
$pollid = $closeumfrage; $pollid = $closeumfrage;
} }
if(is_numeric($pollid) && $pollid >= 0){ if(is_numeric($pollid) && $pollid >= 0){
$result = mysql_fetch_assoc(mysql_query('SELECT * FROM poll WHERE pollid='.$pollid)); $result = mysqli_fetch_assoc(db_query('SELECT * FROM poll WHERE pollid='.$pollid));
$qry = mysql_query('SELECT * FROM poll_options WHERE pollid='.$pollid); $qry = db_query('SELECT * FROM poll_options WHERE pollid='.$pollid);
while($opts = mysql_fetch_assoc($qry)){ while($opts = mysqli_fetch_assoc($qry)){
$options[$opts['polloptionid']] = $opts['text']; $options[$opts['polloptionid']] = $opts['text'];
} }
?> ?>
@ -470,20 +470,20 @@ function displayPolls($action,$openumfrage,$closeumfrage,$thema,$optionen,$text,
</form> </form>
<?php <?php
} else if($action == 'save'){ } else if($action == 'save'){
mysql_query('INSERT INTO poll(ersteller, thema, open, close, text) values('.$_SESSION['user'].',\''.$thema.'\',now(),NULL,\''.$text.'\')'); db_query('INSERT INTO poll(ersteller, thema, open, close, text) values('.$_SESSION['user'].',\''.$thema.'\',now(),NULL,\''.$text.'\')');
$pollid = mysql_fetch_assoc(mysql_query('SELECT pollid FROM poll WHERE text=\''.$text.'\'')); $pollid = mysqli_fetch_assoc(db_query('SELECT pollid FROM poll WHERE text=\''.$text.'\''));
for($i=0;$i<5;$i++){ for($i=0;$i<5;$i++){
if($optionen[$i] != null){ if($optionen[$i] != null){
mysql_query('INSERT INTO poll_options(pollid, polloptionid, text) values('.$pollid['pollid'].','.$i.',\''.$optionen[$i].'\')'); db_query('INSERT INTO poll_options(pollid, polloptionid, text) values('.$pollid['pollid'].','.$i.',\''.$optionen[$i].'\')');
} }
} }
displayPolls('display',NULL, NULL,NULL,NULL,NULL,$pollid['pollid']); displayPolls('display',NULL, NULL,NULL,NULL,NULL,$pollid['pollid']);
} else if($action == 'update'){ } else if($action == 'update'){
mysql_query('UPDATE poll set thema =\''.$thema.'\', text =\''.$text.'\' WHERE pollid ='.$pollid); db_query('UPDATE poll set thema =\''.$thema.'\', text =\''.$text.'\' WHERE pollid ='.$pollid);
for($i=0;$i<5;$i++){ for($i=0;$i<5;$i++){
if($optionen[$i] != null){ if($optionen[$i] != null){
$sql = 'UPDATE poll_options SET text =\''.$optionen[$i].'\' WHERE pollid='.$pollid.' AND polloptionid ='.$i; $sql = 'UPDATE poll_options SET text =\''.$optionen[$i].'\' WHERE pollid='.$pollid.' AND polloptionid ='.$i;
mysql_query($sql); db_query($sql);
echo $sql.'<br>'; echo $sql.'<br>';
} }
} }

@ -37,9 +37,9 @@ function displayItems($action, $task, $itemid, $itemtable, $searchstring, $s_ite
. ' union' . ' union'
. ' SELECT i.id, i.item AS name, \'wochen_markt\' as tablename FROM wochen_markt i'; . ' 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'; // 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; $colspan = 3;
echo "\t\t\t".'<tr><td colspan="'.$colspan.'"><h1 style="text-align:center">Bearbeiten</h1></td></tr>'."\n";; echo "\t\t\t".'<tr><td colspan="'.$colspan.'"><h1 style="text-align:center">Bearbeiten</h1></td></tr>'."\n";;
$o_array = array('-Alle-', 'Markt Items', 'Schatzsuche Items', 'Auktionsitems'); $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".'<tr><td colspan="'.$colspan.'"><hr></td></tr>'."\n"; echo "\t\t\t".'<tr><td colspan="'.$colspan.'"><hr></td></tr>'."\n";
while($row = mysql_fetch_assoc($qry)){ while($row = mysqli_fetch_assoc($qry)){
echo "\t\t\t".'<tr><td>'.$row['name'].'</td><td width="10"><a href="'.$_SERVER['PHP_SELF'].'?choose=items&action=edit&task=change&itemid='.$row['id'].'&itemtable='.$row['tablename'].'&searchstring='.$searchstring.'&s_itemtable='.$s_itemtable.'&page='.$page.'">Edit</a></td>'; echo "\t\t\t".'<tr><td>'.$row['name'].'</td><td width="10"><a href="'.$_SERVER['PHP_SELF'].'?choose=items&action=edit&task=change&itemid='.$row['id'].'&itemtable='.$row['tablename'].'&searchstring='.$searchstring.'&s_itemtable='.$s_itemtable.'&page='.$page.'">Edit</a></td>';
echo '<td width="10"><a href="'.$_SERVER['PHP_SELF'].'?choose=items&action=edit&task=delete&itemid='.$row['id'].'&itemtable='.$row['tablename'].'&searchstring='.$searchstring.'&s_itemtable='.$s_itemtable.'&page='.$page.'">Delete</a></td></tr>'."\n"; echo '<td width="10"><a href="'.$_SERVER['PHP_SELF'].'?choose=items&action=edit&task=delete&itemid='.$row['id'].'&itemtable='.$row['tablename'].'&searchstring='.$searchstring.'&s_itemtable='.$s_itemtable.'&page='.$page.'">Delete</a></td></tr>'."\n";
} }
@ -87,8 +87,8 @@ function displayItems($action, $task, $itemid, $itemtable, $searchstring, $s_ite
} }
if(!$error){ if(!$error){
$sql = 'SELECT '.join(',', $d_array).' FROM '.$itemtable.' where id = '.$itemid; $sql = 'SELECT '.join(',', $d_array).' FROM '.$itemtable.' where id = '.$itemid;
$qry = mysql_query($sql); $qry = db_query($sql);
$row = mysql_fetch_assoc($qry); $row = mysqli_fetch_assoc($qry);
echo "\t\t".'<tr><td>'.$desc_array[0].'</td><td style="text-align:center">'.$row[$d_array[0]].'</td></tr>'."\n"; echo "\t\t".'<tr><td>'.$desc_array[0].'</td><td style="text-align:center">'.$row[$d_array[0]].'</td></tr>'."\n";
for($i = 1;$i<count($d_array)-1;$i++){ for($i = 1;$i<count($d_array)-1;$i++){
echo "\t\t".'<tr><td>'.$desc_array[$i].'</td><td style="text-align:center"><input name="data['.$d_array[$i].']" value="'.debbcode($row[$d_array[$i]]).'"></input></td></tr>'."\n"; echo "\t\t".'<tr><td>'.$desc_array[$i].'</td><td style="text-align:center"><input name="data['.$d_array[$i].']" value="'.debbcode($row[$d_array[$i]]).'"></input></td></tr>'."\n";
@ -120,7 +120,7 @@ function displayItems($action, $task, $itemid, $itemtable, $searchstring, $s_ite
if(!$error){ if(!$error){
$row = mysql_fetch_assoc(mysql_query($sql)); $row = mysqli_fetch_assoc(db_query($sql));
echo "\t\t\t".'<tr><td colspan="'.$colspan.'" style="text-align:center">Soll Item "'.$row['name'].'" wirklich gelöscht werden?</td></tr>'."\n"; echo "\t\t\t".'<tr><td colspan="'.$colspan.'" style="text-align:center">Soll Item "'.$row['name'].'" wirklich gelöscht werden?</td></tr>'."\n";
echo "\t\t\t".'<tr><td style="text-align:center"><a href="'.$_SERVER['PHP_SELF'].'?choose=items&action=edit&task=dodelete&itemid='.$itemid.'&itemtable='.$itemtable.'&s_itemtable='.$s_itemtable.'&searchstring='.$searchstring.'&page='.$page.'">ja</a>, <a href="'.$_SERVER['PHP_SELF'].'?choose=items&action=edit&s_itemtable='.$s_itemtable.'&searchstring='.$searchstring.'&page='.$page.'">nein</a>, <a href="'.$_SERVER['PHP_SELF'].'?choose=items&action=edit&task=delete&itemid='.$itemid.'&itemtable='.$itemtable.'&s_itemtable='.$s_itemtable.'&searchstring='.$searchstring.'&page='.$page.'">vielleicht</a></td></tr>'."\n"; echo "\t\t\t".'<tr><td style="text-align:center"><a href="'.$_SERVER['PHP_SELF'].'?choose=items&action=edit&task=dodelete&itemid='.$itemid.'&itemtable='.$itemtable.'&s_itemtable='.$s_itemtable.'&searchstring='.$searchstring.'&page='.$page.'">ja</a>, <a href="'.$_SERVER['PHP_SELF'].'?choose=items&action=edit&s_itemtable='.$s_itemtable.'&searchstring='.$searchstring.'&page='.$page.'">nein</a>, <a href="'.$_SERVER['PHP_SELF'].'?choose=items&action=edit&task=delete&itemid='.$itemid.'&itemtable='.$itemtable.'&s_itemtable='.$s_itemtable.'&searchstring='.$searchstring.'&page='.$page.'">vielleicht</a></td></tr>'."\n";
} }
@ -139,7 +139,7 @@ function displayItems($action, $task, $itemid, $itemtable, $searchstring, $s_ite
if(!$error){ if(!$error){
$sql = 'UPDATE '.$itemtable.' SET '; $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]]).'\''; $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.'\''; $sql .= ' WHERE id=\''.$itemid.'\'';
// echo $sql.'<br>'; // echo $sql.'<br>';
$u = mysql_query($sql); $u = db_query($sql);
if(mysql_affected_rows() == 0 || $u === FALSE){ if(db_affected_rows() == 0 || $u === FALSE){
echo "\t\t\t".'<tr><td colspan="2" style="color:red">Fehler! Änderungen konnten nicht übernommen werden!</td></tr>'; echo "\t\t\t".'<tr><td colspan="2" style="color:red">Fehler! Änderungen konnten nicht übernommen werden!</td></tr>';
} else{ } else{
logaction('Ein Item wurde geändert (@'.$itemtable.', id = '.$itemid.','.encodeNoHTMLWithBB(join($data,',')).')'); logaction('Ein Item wurde geändert (@'.$itemtable.', id = '.$itemid.','.encodeNoHTMLWithBB(join($data,',')).')');
echo "\t\t\t".'<tr><td colspan="2">Änderungen wurden übernommen!</td></tr>'; echo "\t\t\t".'<tr><td colspan="2">Änderungen wurden übernommen!</td></tr>';
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'){ if($itemtable == 'wochen_markt'){
$sql = 'Update sp_item set name = \''.encodeNoHTMLWithBB($data[$d_array[0]]).'\' where name = \''.$row[$d_array[0]].'\''; $sql = 'Update sp_item set name = \''.encodeNoHTMLWithBB($data[$d_array[0]]).'\' where name = \''.$row[$d_array[0]].'\'';
echo $sql.'<br>'; echo $sql.'<br>';
mysql_query($sql); db_query($sql);
} else if($itemtable == 'sp_item'){ } else if($itemtable == 'sp_item'){
$sql = 'Update wochen_markt set item = \''.encodeNoHTMLWithBB($data[$d_array[0]]).'\' where item = \''.$row[$d_array[0]].'\''; $sql = 'Update wochen_markt set item = \''.encodeNoHTMLWithBB($data[$d_array[0]]).'\' where item = \''.$row[$d_array[0]].'\'';
echo $sql.'<br>'; echo $sql.'<br>';
mysql_query($sql); db_query($sql);
} }
} }
} }
@ -188,11 +188,11 @@ function displayItems($action, $task, $itemid, $itemtable, $searchstring, $s_ite
$error = true; $error = true;
} }
if(!$error){ 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".'<tr><td colspan="2">Item "'.$row['name'].'" konnte nicht gelöscht werden!</td></tr>'; echo "\t\t\t".'<tr><td colspan="2">Item "'.$row['name'].'" konnte nicht gelöscht werden!</td></tr>';
} 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'].')'); logaction('Ein Item wurde gelöscht (@'.$itemtable.', id = '.$itemid.','.$row['name'].')');
echo "\t\t\t".'<tr><td colspan="2">Item "'.$row['name'].'" wurde zwar gelöscht, bei der Warentabelle ist jedoch ein Fehler aufgetreten!</td></tr>'; echo "\t\t\t".'<tr><td colspan="2">Item "'.$row['name'].'" wurde zwar gelöscht, bei der Warentabelle ist jedoch ein Fehler aufgetreten!</td></tr>';
} else{ } else{
@ -225,8 +225,8 @@ function displayItems($action, $task, $itemid, $itemtable, $searchstring, $s_ite
if(!$error){ if(!$error){
// We create an itemtable-wide unique id!! // 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 = 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 = mysql_fetch_assoc(mysql_query('SELECT max(id) +1 as id FROM '.$itemtable)); // $row = mysqli_fetch_assoc(db_query('SELECT max(id) +1 as id FROM '.$itemtable));
$itemid = $row['id']; $itemid = $row['id'];
$sql = 'INSERT INTO '.$itemtable.' (id, '.join($d_array,', ').') values('.$itemid; $sql = 'INSERT INTO '.$itemtable.' (id, '.join($d_array,', ').') values('.$itemid;
@ -238,8 +238,8 @@ function displayItems($action, $task, $itemid, $itemtable, $searchstring, $s_ite
$sql .= ')'; $sql .= ')';
// echo $sql.'<br>'; // echo $sql.'<br>';
$u = mysql_query($sql); $u = db_query($sql);
if(mysql_affected_rows() == 0 || $u === FALSE){ if(db_affected_rows() == 0 || $u === FALSE){
echo "\t\t\t".'<tr><td colspan="2" style="color:red">Fehler! Konnte Item nicht erstellen!</td></tr>'; echo "\t\t\t".'<tr><td colspan="2" style="color:red">Fehler! Konnte Item nicht erstellen!</td></tr>';
displayItems($action, null, null, $itemtable, $searchstring, $s_itemtable,$page, $data); displayItems($action, null, null, $itemtable, $searchstring, $s_itemtable,$page, $data);
} else{ } else{
@ -335,8 +335,8 @@ function displayItems($action, $task, $itemid, $itemtable, $searchstring, $s_ite
$sql = 'SELECT '.join($d_array,',').' FROM '.$itemtable; $sql = 'SELECT '.join($d_array,',').' FROM '.$itemtable;
$qry = mysql_query($sql); $qry = db_query($sql);
while($row = mysql_fetch_assoc($qry)){ while($row = mysqli_fetch_assoc($qry)){
echo "\t\t\t".'<tr>'; echo "\t\t\t".'<tr>';
for($i=1;$i<count($d_array)-1;$i++){ for($i=1;$i<count($d_array)-1;$i++){
echo '<td>'.$row[$d_array[$i]].'</td>'; echo '<td>'.$row[$d_array[$i]].'</td>';

@ -12,7 +12,7 @@
function displayQuestNPC($action, $name, $starke, $speed, $verteidigung, $ausdauer, $hp, $mp, $level, $orte,$id, $anzahl, $confirm, $glueck){ function displayQuestNPC($action, $name, $starke, $speed, $verteidigung, $ausdauer, $hp, $mp, $level, $orte,$id, $anzahl, $confirm, $glueck){
if($action != 'delete' && $action != 'change' && $action != 'create'){ if($action != 'delete' && $action != 'change' && $action != 'create'){
$sql = 'SELECT id , name FROM `quest_monster` order by name asc'; $sql = 'SELECT id , name FROM `quest_monster` order by name asc';
$result = mysql_query($sql); $result = db_query($sql);
?> ?>
<table> <table>
<tr> <tr>
@ -25,7 +25,7 @@ function displayQuestNPC($action, $name, $starke, $speed, $verteidigung, $ausdau
<th align="center" colspan="2">Aktion</th> <th align="center" colspan="2">Aktion</th>
</tr> </tr>
<?php <?php
while($res = mysql_fetch_assoc($result)){ while($res = mysqli_fetch_assoc($result)){
?> ?>
<tr> <tr>
<td><?php echo $res['name']; ?></td> <td><?php echo $res['name']; ?></td>
@ -48,7 +48,7 @@ function displayQuestNPC($action, $name, $starke, $speed, $verteidigung, $ausdau
echo '<a href="'.$_SERVER['PHP_SELF'].'?choose=qnpc&action=delete&id='.$id.'&confirm=yes">L&ouml;schen!!</a><br>'; echo '<a href="'.$_SERVER['PHP_SELF'].'?choose=qnpc&action=delete&id='.$id.'&confirm=yes">L&ouml;schen!!</a><br>';
} else{ } else{
$sql = 'DELETE FROM `quest_monster` where id = '.$id; $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!!'); logaction('Das Monster mit der ID '.$id.' wurde geloescht!!');
echo 'Das Monster mit der ID '.$id.' wurde gel&ouml;scht<br>'; echo 'Das Monster mit der ID '.$id.' wurde gel&ouml;scht<br>';
} }
@ -61,32 +61,32 @@ function displayQuestNPC($action, $name, $starke, $speed, $verteidigung, $ausdau
if($name != null){ 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; $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<count($orte);$i++){ for($i=0;$i<count($orte);$i++){
mysql_query('Insert into quest_monster_orte(ortid, monsterid) values('.$orte[$i].', '.$id.')'); db_query('Insert into quest_monster_orte(ortid, monsterid) values('.$orte[$i].', '.$id.')');
} }
logaction('Das Monster mit dem Namen '.$name.' wurde angepasst!!'); logaction('Das Monster mit dem Namen '.$name.' wurde angepasst!!');
$query = mysql_query($sql); $query = db_query($sql);
} }
// Erstmal die Orte aufzaehlen, in der das Monster zu finden ist // Erstmal die Orte aufzaehlen, in der das Monster zu finden ist
$sql = 'Select ortid from quest_monster_orte where monsterid = '.$id; $sql = 'Select ortid from quest_monster_orte where monsterid = '.$id;
$qry = mysql_query($sql); $qry = db_query($sql);
while($row = mysql_fetch_assoc($qry)){ while($row = mysqli_fetch_assoc($qry)){
$monster_orte[$row['ortid']] = $row; $monster_orte[$row['ortid']] = $row;
} }
// Jetzt die Orte auslesen die zu Bereisen sind // Jetzt die Orte auslesen die zu Bereisen sind
$sql = 'Select * from quest_ort order by stadt'; $sql = 'Select * from quest_ort order by stadt';
$qry = mysql_query($sql); $qry = db_query($sql);
while($row = mysql_fetch_assoc($qry)){ while($row = mysqli_fetch_assoc($qry)){
$orte_array[] = $row; $orte_array[] = $row;
} }
$sql = 'SELECT * FROM `quest_monster` where id = '.$id; $sql = 'SELECT * FROM `quest_monster` where id = '.$id;
$result = mysql_query($sql); $result = db_query($sql);
$res = mysql_fetch_assoc($result); $res = mysqli_fetch_assoc($result);
?> ?>
<form action="" method="POST"> <form action="" method="POST">
<input name="choose" value="qnpc" type="hidden"></input> <input name="choose" value="qnpc" type="hidden"></input>
@ -173,11 +173,11 @@ function displayQuestNPC($action, $name, $starke, $speed, $verteidigung, $ausdau
} else if($action == 'create'){ } else if($action == 'create'){
if($name != null){ 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.')'; $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); $query = db_query($sql);
$id = mysql_fetch_assoc(mysql_query('Select id from quest_monster where name = \''.$name.'\'')); $id = mysqli_fetch_assoc(db_query('Select id from quest_monster where name = \''.$name.'\''));
$monsterid = $id['id']; $monsterid = $id['id'];
for($i=0;$i<count($orte);$i++){ for($i=0;$i<count($orte);$i++){
mysql_query('Insert into quest_monster_orte(ortid, monsterid) values('.$orte[$i].', '.$monsterid.')'); db_query('Insert into quest_monster_orte(ortid, monsterid) values('.$orte[$i].', '.$monsterid.')');
} }
logaction('Das Monster mit dem Namen '.$name.' wurde erstellt!!'); logaction('Das Monster mit dem Namen '.$name.' wurde erstellt!!');
echo "Monster erstellt<br>"; echo "Monster erstellt<br>";
@ -189,8 +189,8 @@ function displayQuestNPC($action, $name, $starke, $speed, $verteidigung, $ausdau
} }
// Jetzt die Orte auslesen die zu Bereisen sind // Jetzt die Orte auslesen die zu Bereisen sind
$sql = 'Select * from quest_ort order by stadt'; $sql = 'Select * from quest_ort order by stadt';
$qry = mysql_query($sql); $qry = db_query($sql);
while($row = mysql_fetch_assoc($qry)){ while($row = mysqli_fetch_assoc($qry)){
$orte_array[] = $row; $orte_array[] = $row;
} }

@ -34,7 +34,7 @@ function getDropItemsAsOptions(){
$qry = db_query($query); $qry = db_query($query);
// Damit waeren alle noetigen Datenbankaufrufe erledigt! // Damit waeren alle noetigen Datenbankaufrufe erledigt!
while($row = mysql_fetch_assoc($qry)){ while($row = mysqli_fetch_assoc($qry)){
$result[$index++] = '<option value=\''.$row['id'].','.$row['tablename'].'\'>'.$row['name'].'</option>'; $result[$index++] = '<option value=\''.$row['id'].','.$row['tablename'].'\'>'.$row['name'].'</option>';
} }
@ -59,14 +59,14 @@ function istrinstr($source, $insert, $search) {
function getNPCUser() { function getNPCUser() {
$qry = db_query('SELECT * FROM user WHERE nickname = "'.NPC_USER_NAME.'";'); $qry = db_query('SELECT * FROM user WHERE nickname = "'.NPC_USER_NAME.'";');
return mysql_fetch_assoc($qry); return mysqli_fetch_assoc($qry);
} }
function getNPCAttacks() { function getNPCAttacks() {
$qry = db_query('SELECT name,id FROM attacken a WHERE info like "%NPC%";'); $qry = db_query('SELECT name,id FROM attacken a WHERE info like "%NPC%";');
$set = array(); $set = array();
while ($result = mysql_fetch_assoc($qry)) { while ($result = mysqli_fetch_assoc($qry)) {
$set[$result['id']] = $result['name']; $set[$result['id']] = $result['name'];
} }
@ -79,7 +79,7 @@ function learnNewAttacks($charid, $att_ids) {
$qry = db_query($sql); $qry = db_query($sql);
$learned_atts = array(); $learned_atts = array();
while($result = mysql_fetch_assoc($qry)) { while($result = mysqli_fetch_assoc($qry)) {
$learned_atts[$result['at_id']] = $result['id']; $learned_atts[$result['at_id']] = $result['id'];
} }
@ -88,7 +88,7 @@ function learnNewAttacks($charid, $att_ids) {
$qry = db_query($sql); $qry = db_query($sql);
$att_names = array(); $att_names = array();
while($result = mysql_fetch_assoc($qry)) { while($result = mysqli_fetch_assoc($qry)) {
$att_names[$result['id']] = $result['name']; $att_names[$result['id']] = $result['name'];
} }
@ -110,7 +110,7 @@ function getNPCAttackSet($charid, $att_ids) {
$qry = db_query($sql); $qry = db_query($sql);
$learned_atts = array(); $learned_atts = array();
while($result = mysql_fetch_assoc($qry)) { while($result = mysqli_fetch_assoc($qry)) {
$learned_atts[$result['at_id']] = $result['id']; $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; //$sql = 'SELECT * FROM chars c inner join kampf_list kl on c.id = kl.charakter WHERE c.id ='.$charid;
//echo $sql."<br>"; //echo $sql."<br>";
$qry = db_query($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! // Fetch the char array by getChar method (for backwards compat) with no caching enabled!
$char_data = getChar($charid, false); $char_data = getChar($charid, false);
foreach( $char_data as $key => $value ) { foreach( $char_data as $key => $value ) {
@ -276,7 +276,7 @@ function editNPC($charid, $data, $att_ids) {
$u = db_query($sql); $u = db_query($sql);
$log = 0; $log = 0;
if(mysql_affected_rows() == 0 || $u === FALSE) { if(db_affected_rows() == 0 || $u === FALSE) {
echo "\t\t\t".'<tr><td colspan="2" style="color:red">Stats wurden nicht geändert oder es gab Fehler!</td></tr>'; echo "\t\t\t".'<tr><td colspan="2" style="color:red">Stats wurden nicht geändert oder es gab Fehler!</td></tr>';
} else{ } else{
echo "\t\t\t".'<tr><td colspan="2">Änderungen wurden übernommen!</td></tr>'; echo "\t\t\t".'<tr><td colspan="2">Änderungen wurden übernommen!</td></tr>';
@ -316,7 +316,7 @@ function createNPC($data, $att_ids) {
if($success) { if($success) {
//Char ID holen //Char ID holen
$qry = db_query('SELECT id FROM chars c WHERE name = "'.$data['name'].'";'); $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']; $char_id = $result['id'];
//zur Kampfliste hinzufügen :) //zur Kampfliste hinzufügen :)
@ -370,7 +370,7 @@ function deleteNPC($charid) {
$colspan = 1; $colspan = 1;
$sql = 'DELETE FROM chars WHERE id = '.$charid.';'; $sql = 'DELETE FROM chars WHERE id = '.$charid.';';
$qry = db_query($sql); $qry = db_query($sql);
if($qry === FALSE || mysql_affected_rows() <= 0){ if($qry === FALSE || db_affected_rows() <= 0){
echo "\t".'<tr><td colspan="'.$colspan.'" style="text-align:center;color:red">Der NPC '.$row['name'].' konnte nicht gelöscht werden!</td></tr>'."\n";; echo "\t".'<tr><td colspan="'.$colspan.'" style="text-align:center;color:red">Der NPC '.$row['name'].' konnte nicht gelöscht werden!</td></tr>'."\n";;
} else { } else {
echo "\t".'<tr><td colspan="'.$colspan.'" style="text-align:center">Der NPC '.$row['name'].' wurde gelöscht!</td></tr>'."\n";; echo "\t".'<tr><td colspan="'.$colspan.'" style="text-align:center">Der NPC '.$row['name'].' wurde gelöscht!</td></tr>'."\n";;
@ -401,7 +401,7 @@ function displayNPCOverview($page) {
echo "\t".'<tr><td colspan="'.$colspan.'"><hr></td></tr>'."\n"; echo "\t".'<tr><td colspan="'.$colspan.'"><hr></td></tr>'."\n";
while($row = mysql_fetch_assoc($qry)){ while($row = mysqli_fetch_assoc($qry)){
echo "\t".'<tr>'."\n"; echo "\t".'<tr>'."\n";
for($i=1;$i<count($d_array);$i++){ for($i=1;$i<count($d_array);$i++){
echo "\t\t".'<td>'.$row[$d_array[$i]].'</td>'."\n"; echo "\t\t".'<td>'.$row[$d_array[$i]].'</td>'."\n";
@ -417,7 +417,7 @@ function displayNPCOverview($page) {
echo "\t".'</tr>'."\n"; echo "\t".'</tr>'."\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 = '<a href="'.$_SERVER['PHP_SELF'].'?choose=npc&page=###PAGE###">###LABEL###</a>'; $url = '<a href="'.$_SERVER['PHP_SELF'].'?choose=npc&page=###PAGE###">###LABEL###</a>';
echo "\t".'<tr><td colspan="'.$colspan.'"><hr></td></tr>'."\n"; echo "\t".'<tr><td colspan="'.$colspan.'"><hr></td></tr>'."\n";
echo "\t".'<tr><td colspan="'.$colspan.'">'.displayPagelinksNew(20, $total, $page, $url).'</td></tr>'."\n"; echo "\t".'<tr><td colspan="'.$colspan.'">'.displayPagelinksNew(20, $total, $page, $url).'</td></tr>'."\n";

@ -240,7 +240,7 @@ function displayRassen($request) {
<th align="center" colspan="2">Aktion</th> <th align="center" colspan="2">Aktion</th>
</tr> </tr>
<?php <?php
$num = mysql_num_rows(db_query('SELECT * FROM rassen_type')); $num = mysqli_stmt_num_rows(db_query('SELECT * FROM rassen_type'));
if($num == 0) { if($num == 0) {
echo '<tr><th colspan="4"><a href="?choose=rassen&setup=1">setup rassen database</a></th></tr>'; echo '<tr><th colspan="4"><a href="?choose=rassen&setup=1">setup rassen database</a></th></tr>';
} else { } else {

@ -10,19 +10,19 @@
function getItemsMap() { function getItemsMap() {
$items_map = array(); $items_map = array();
$qry = db_query('SELECT * from sp_item WHERE type != \'Teufels Frucht\''); $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'; $row['table_name'] = 'sp_item';
$items_map['sp_item'][$row['id']] = $row; $items_map['sp_item'][$row['id']] = $row;
} }
$qry = db_query('SELECT * from item'); $qry = db_query('SELECT * from item');
while( $row = mysql_fetch_assoc($qry)) { while( $row = mysqli_fetch_assoc($qry)) {
$row['table_name'] = 'item'; $row['table_name'] = 'item';
$items_map['item'][$row['id']] = $row; $items_map['item'][$row['id']] = $row;
} }
$qry = db_query('SELECT * from wochen_markt'); $qry = db_query('SELECT * from wochen_markt');
while( $row = mysql_fetch_assoc($qry) ) { while( $row = mysqli_fetch_assoc($qry) ) {
$row['name'] = $row['item']; $row['name'] = $row['item'];
$row['table_name'] = 'wochen_markt'; $row['table_name'] = 'wochen_markt';
$items_map['wochen_markt'][$row['id']] = $row; $items_map['wochen_markt'][$row['id']] = $row;
@ -43,12 +43,12 @@ function get_set_definitions() {
$qry = db_query('SELECT * from sp_sets'); $qry = db_query('SELECT * from sp_sets');
$sets = array(); $sets = array();
while( $row = mysql_fetch_assoc($qry) ) { while( $row = mysqli_fetch_assoc($qry) ) {
$set = array(); $set = array();
$set['item'] = $items_map[$row['table_name']][$row['item_id']]; $set['item'] = $items_map[$row['table_name']][$row['item_id']];
$dep_items = array(); $dep_items = array();
$qry2 = db_query('SELECT * from sp_set_ingredient WHERE set_id = '.$row['set_id']); $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']]; $dep_items[] = $items_map[$row2['table_name']][$row2['item_id']];
} }
$set['deps'] = $dep_items; $set['deps'] = $dep_items;
@ -141,11 +141,11 @@ function itemEquals($lhs, $rhs) {
function createRezeptEntry($set) { function createRezeptEntry($set) {
$qry = db_query('Select max(set_id) FROM sp_sets'); $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 { do {
$new_id++; $new_id++;
db_query('INSERT sp_sets(set_id, table_name, item_id) values('.$new_id.',\''.$set['item']['table_name'].'\','.$set['item']['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; return $new_id;
} }

@ -11,7 +11,7 @@
<?php <?php
function displayShop($action, $s_id, $info, $s_name, $s2_name, $s3_name, $s_typ, $preis, $frei, $anzahl){ function displayShop($action, $s_id, $info, $s_name, $s2_name, $s3_name, $s_typ, $preis, $frei, $anzahl){
if($action == ''){ if($action == ''){
$shop_qry = mysql_query('SELECT * FROM shop order by preis'); $shop_qry = db_query('SELECT * FROM shop order by preis');
?> ?>
<table border="1"> <table border="1">
<tr> <tr>
@ -25,7 +25,7 @@ function displayShop($action, $s_id, $info, $s_name, $s2_name, $s3_name, $s_typ
<tr><td>Name</td><td>ID</td><td>Art</td> <tr><td>Name</td><td>ID</td><td>Art</td>
<td>Preis</td><td>Freischalten</td><td>Anzahl<td>bearbeiten</td></tr> <td>Preis</td><td>Freischalten</td><td>Anzahl<td>bearbeiten</td></tr>
<?php <?php
while($res = mysql_fetch_assoc($shop_qry)){ while($res = mysqli_fetch_assoc($shop_qry)){
echo '<tr><td>'.$res['item'].'</td><td>'.$res['id'].'</td><td>'.$res['datensatz'].'</td> echo '<tr><td>'.$res['item'].'</td><td>'.$res['id'].'</td><td>'.$res['datensatz'].'</td>
<td>'.$res['preis'].'</td><td>'.$res['preis_req'].'</td><td>'.$res['mal'].' <td>'.$res['preis'].'</td><td>'.$res['preis_req'].'</td><td>'.$res['mal'].'
</td><td><a href="'.$_SERVER['PHP_SELF'].'?choose=shop&action=edit&s_id='.$res['id'].'">edit</a>|<a href="'.$_SERVER['PHP_SELF'].'?choose=shop&action=delete&s_id='.$res['id'].'">delete</a></td></tr>'; </td><td><a href="'.$_SERVER['PHP_SELF'].'?choose=shop&action=edit&s_id='.$res['id'].'">edit</a>|<a href="'.$_SERVER['PHP_SELF'].'?choose=shop&action=delete&s_id='.$res['id'].'">delete</a></td></tr>';
@ -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!'); logaction('Das Angebot für '.$s3_name.' wurde editiert!');
} }
mysql_query($sql); db_query($sql);
echo $sql; echo $sql;
} else if($action == 'erstellen'){ } 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.'\')'; $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; echo $sql;
} }
} }
if($action == 'edit'){ 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'; $aLabel = 'editieren';
} else{ } else{
$aLabel = 'erstellen'; $aLabel = 'erstellen';
@ -106,12 +106,12 @@ function displayShop($action, $s_id, $info, $s_name, $s2_name, $s3_name, $s_typ
<td>Bei SS Items</td> <td>Bei SS Items</td>
<td height="25" width="200" valign="top"> <td height="25" width="200" valign="top">
<?php <?php
$item = mysql_query('SELECT * FROM sp_item where type !=\'Teufels Frucht\' ORDER BY name '); $item = db_query('SELECT * FROM sp_item where type !=\'Teufels Frucht\' ORDER BY name ');
?> ?>
<select id="input" name="s_name"> <select id="input" name="s_name">
<option value="">SS Item wählen</option> <option value="">SS Item wählen</option>
<?php <?php
while ($row2 = mysql_fetch_array($item)) { while ($row2 = mysqli_fetch_array($item)) {
echo "<option value='$row2[name]'>$row2[name]"; echo "<option value='$row2[name]'>$row2[name]";
} }
?> ?>
@ -122,12 +122,12 @@ function displayShop($action, $s_id, $info, $s_name, $s2_name, $s3_name, $s_typ
<td>Bei Markt Items</td> <td>Bei Markt Items</td>
<td height="25" width="200" valign="top"> <td height="25" width="200" valign="top">
<?php <?php
$item = mysql_query('SELECT * FROM item ORDER BY s_type '); $item = db_query('SELECT * FROM item ORDER BY s_type ');
?> ?>
<select id="input" name="s2_name"> <select id="input" name="s2_name">
<option value="">Martk Item wählen</option> <option value="">Martk Item wählen</option>
<?php <?php
while ($row2 = mysql_fetch_array($item)) { while ($row2 = mysqli_fetch_array($item)) {
echo "<option value='$row2[name]'>$row2[name]"; echo "<option value='$row2[name]'>$row2[name]";
} }
?> ?>
@ -138,12 +138,12 @@ function displayShop($action, $s_id, $info, $s_name, $s2_name, $s3_name, $s_typ
<td>Teufelsfrüchte</td> <td>Teufelsfrüchte</td>
<td height="25" width="200" valign="top"> <td height="25" width="200" valign="top">
<?php <?php
$item = mysql_query('SELECT * FROM wochen_markt ORDER BY item '); $item = db_query('SELECT * FROM wochen_markt ORDER BY item ');
?> ?>
<select id="input" name="s3_name"> <select id="input" name="s3_name">
<option value="">Teufelsfrucht wählen</option> <option value="">Teufelsfrucht wählen</option>
<?php <?php
while ($row2 = mysql_fetch_array($item)) { while ($row2 = mysqli_fetch_array($item)) {
echo "<option value='$row2[item]'>$row2[item]"; echo "<option value='$row2[item]'>$row2[item]";
} }
?> ?>
@ -185,7 +185,7 @@ function displayShop($action, $s_id, $info, $s_name, $s2_name, $s3_name, $s_typ
<?php <?php
if($s_name !== NULL){ if($s_name !== NULL){
$sql = 'DELETE FROM shop WHERE id='.$s_id.' '; $sql = 'DELETE FROM shop WHERE id='.$s_id.' ';
mysql_query($sql); db_query($sql);
echo $sql; echo $sql;
?> ?>
<tr> <tr>
@ -195,7 +195,7 @@ function displayShop($action, $s_id, $info, $s_name, $s2_name, $s3_name, $s_typ
</tr> </tr>
<?php <?php
} else{ } else{
$res = mysql_fetch_assoc(mysql_query('SELECT * FROM shop WHERE id = '.$s_id)); $res = mysqli_fetch_assoc(db_query('SELECT * FROM shop WHERE id = '.$s_id));
?> ?>
<tr> <tr>
<td align="center" colspan="2"> <td align="center" colspan="2">

@ -12,44 +12,44 @@ include_once(ROOT_PATH.'/include/clan_fights.inc.php');
function doTheClanfightTest($acceptTestCase, $amount) { 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(); $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) { if(count($ids) < $row[0] / MIN_MEMBERS) {
//echo 'We may optimize the user('.$row[0].')/clan('.count($ids).') ratio<br>'; //echo 'We may optimize the user('.$row[0].')/clan('.count($ids).') ratio<br>';
mysql_query('UPDATE user SET clan = null'); // clean all clans db_query('UPDATE user SET clan = null'); // clean all clans
mysql_query('UPDATE clan SET leader = null, co_leader = null'); db_query('UPDATE clan SET leader = null, co_leader = null');
$sql = 'SELECT id FROM clan ORDER BY ID ASC'; $sql = 'SELECT id FROM clan ORDER BY ID ASC';
$qry = mysql_query($sql); $qry = db_query($sql);
while( $row = mysql_fetch_assoc($qry)) { 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'; $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 . '<br>'; //echo $sql . '<br>';
mysql_query($sql); db_query($sql);
if(mysql_affected_rows() == 0) { if(db_affected_rows() == 0) {
break; break;
} }
} }
$qry = mysql_query('SELECT clan, min(id) as id FROM user WHERE clan is not null GROUP BY clan'); $qry = db_query('SELECT clan, min(id) as id FROM user WHERE clan is not null GROUP BY clan');
while($row = mysql_fetch_assoc($qry)) { while($row = mysqli_fetch_assoc($qry)) {
$sql = 'UPDATE clan SET leader = '.$row['id'].' WHERE id = '.$row['clan']; $sql = 'UPDATE clan SET leader = '.$row['id'].' WHERE id = '.$row['clan'];
//echo $sql . '<br>'; //echo $sql . '<br>';
mysql_query($sql); db_query($sql);
} }
} }
mysql_query('DELETE FROM clan_challenge_requests'); db_query('DELETE FROM clan_challenge_requests');
mysql_query('DELETE FROM clan_challenges'); db_query('DELETE FROM clan_challenges');
mysql_query('DELETE FROM events'); db_query('DELETE FROM events');
mysql_query('DELETE FROM clan_locked'); db_query('DELETE FROM clan_locked');

@ -18,16 +18,16 @@ function getOtherUserGroups($user) {
if(is_numeric($user)) { if(is_numeric($user)) {
$test = 'SELECT gruppen_id, gruppen_name FROM user_gruppe WHERE gruppen_id not in $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.'\')'; (SELECT gruppen_id FROM user_gruppe_zuordnung WHERE user_id = \''.$user.'\')';
$qry = mysql_query($test); $qry = db_query($test);
} else if (validateString($user) != null) { } else if (validateString($user) != null) {
$test = 'SELECT gruppen_id, gruppen_name FROM user_gruppe WHERE gruppen_id not in $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 (SELECT ugz.gruppen_id FROM user u INNER JOIN user_gruppe_zuordnung ugz ON
u.id=ugz.user_id WHERE nickname = \''.$user.'\')'; u.id=ugz.user_id WHERE nickname = \''.$user.'\')';
$qry = mysql_query($test); $qry = db_query($test);
} }
$i = 0; $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']); $groups[$i] = array("gruppen_id" => $result['gruppen_id'], "gruppen_name" => $result['gruppen_name']);
$i++; $i++;
} }
@ -115,7 +115,7 @@ function displayUserGroups($action, $name, $ugname, $delete, $add) {
$sqlqry = 'SELECT u.nickname FROM user_gruppe_zuordnung ugz $sqlqry = 'SELECT u.nickname FROM user_gruppe_zuordnung ugz
INNER JOIN user_gruppe ug ON ug.gruppen_id=ugz.gruppen_id 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;'; 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);
?> ?>
<table width="80%"> <table width="80%">
<tr> <tr>
@ -127,7 +127,7 @@ function displayUserGroups($action, $name, $ugname, $delete, $add) {
<?php <?php
echo '<tr>'; echo '<tr>';
$x = 0; $x = 0;
while($row = mysql_fetch_assoc($usergroups_qry)){ while($row = mysqli_fetch_assoc($usergroups_qry)){
echo '<td align="center" width = "25%">'.$row['nickname'].'</td>'; echo '<td align="center" width = "25%">'.$row['nickname'].'</td>';
$x++; $x++;
if($x % 4 == 0) { if($x % 4 == 0) {
@ -174,8 +174,8 @@ function displayUserGroups($action, $name, $ugname, $delete, $add) {
<th>Usergruppe</th> <th>Usergruppe</th>
<th>Beschreibung</th> <th>Beschreibung</th>
<?php <?php
$usergroups_qry = mysql_query('SELECT gruppen_name, gruppen_beschreibung FROM user_gruppe ug;'); $usergroups_qry = db_query('SELECT gruppen_name, gruppen_beschreibung FROM user_gruppe ug;');
while($row = mysql_fetch_assoc($usergroups_qry)){ while($row = mysqli_fetch_assoc($usergroups_qry)){
echo '<tr><td align="center"><a href="' echo '<tr><td align="center"><a href="'
.$_SERVER['PHP_SELF'].'?choose=usergroups&action=show&ugname='.$row['gruppen_name'].'">' .$_SERVER['PHP_SELF'].'?choose=usergroups&action=show&ugname='.$row['gruppen_name'].'">'
.$row['gruppen_name'].'</a></td><td>'.$row['gruppen_beschreibung'].'</td></tr>'; .$row['gruppen_name'].'</a></td><td>'.$row['gruppen_beschreibung'].'</td></tr>';
@ -225,7 +225,7 @@ function displayCheater($action, $from, $until, $user1, $user2, $tradeid, $verif
</form> </form>
<?php <?php
} else if($action == 'access'){ } else if($action == 'access'){
$minmax = mysql_fetch_assoc(mysql_query('SELECT DATE(min(occured)) as min, DATE(max(occured)) as max FROM multiuser')); $minmax = mysqli_fetch_assoc(db_query('SELECT DATE(min(occured)) as min, DATE(max(occured)) as max FROM multiuser'));
$low = $from===null?$minmax['min']:$from; $low = $from===null?$minmax['min']:$from;
$high = $until===null?$minmax['max']:$until; $high = $until===null?$minmax['max']:$until;
?> ?>
@ -254,8 +254,8 @@ function displayCheater($action, $from, $until, $user1, $user2, $tradeid, $verif
<th>Anzahl</th> <th>Anzahl</th>
<th>Action</th> <th>Action</th>
<?php <?php
$cheater_qry = mysql_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'); $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 = mysql_fetch_assoc($cheater_qry)){ while($row = mysqli_fetch_assoc($cheater_qry)){
echo '<tr><td>'.$row['u1n'].'</td><td>'.$row['u2n'].'</td><td>'.$row['anzahl'].'</td><td><a href="'.$_SERVER['PHP_SELF'].'?choose=cheat&action=show&from='.$low.'&until='.$high.'&user1='.$row['u1i'].'&user2='.$row['u2i'].'">Nachweis</a> | <a href="'.$_SERVER['PHP_SELF'].'?choose=cheat&action=vwarn&user1='.$row['u1i'].'&user2='.$row['u2i'].'">Verwarnen</a> | <a href="'.$_SERVER['PHP_SELF'].'?choose=cheat&action=ban&user1='.$row['u1i'].'&user2='.$row['u2i'].'">Bannen</a></td></tr>'; echo '<tr><td>'.$row['u1n'].'</td><td>'.$row['u2n'].'</td><td>'.$row['anzahl'].'</td><td><a href="'.$_SERVER['PHP_SELF'].'?choose=cheat&action=show&from='.$low.'&until='.$high.'&user1='.$row['u1i'].'&user2='.$row['u2i'].'">Nachweis</a> | <a href="'.$_SERVER['PHP_SELF'].'?choose=cheat&action=vwarn&user1='.$row['u1i'].'&user2='.$row['u2i'].'">Verwarnen</a> | <a href="'.$_SERVER['PHP_SELF'].'?choose=cheat&action=ban&user1='.$row['u1i'].'&user2='.$row['u2i'].'">Bannen</a></td></tr>';
} }
?> ?>
@ -281,7 +281,7 @@ function displayCheater($action, $from, $until, $user1, $user2, $tradeid, $verif
} else if($action == 'trades'){ } else if($action == 'trades'){
// Hier ist wichtig, zu hohe Trades und Trades in den Clans // 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; $low = $from===null?$minmax['min']:$from;
$high = $until===null?$minmax['max']:$until; $high = $until===null?$minmax['max']:$until;
?> ?>
@ -316,8 +316,8 @@ function displayCheater($action, $from, $until, $user1, $user2, $tradeid, $verif
<th>Action</th> <th>Action</th>
<?php <?php
$sql = 'SELECT at.transaktionsid, 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 cheatingverdacht = 1 and deadline >= \''.$low.' 00:00:00\' and deadline <= \''.$high.' 23:59:59\''; $sql = 'SELECT at.transaktionsid, 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 cheatingverdacht = 1 and deadline >= \''.$low.' 00:00:00\' and deadline <= \''.$high.' 23:59:59\'';
$cheater_qry = mysql_query($sql); $cheater_qry = db_query($sql);
while($row = mysql_fetch_assoc($cheater_qry)){ 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']); $name = $row['i_name']!=null?$row['i_name']:($row['w_name']!=null?$row['w_name']:$row['s_name']);
$cheatv = $row['cheatingverdacht']==0?'OK':'WARNUNG'; $cheatv = $row['cheatingverdacht']==0?'OK':'WARNUNG';
echo '<tr><td align="center">'.$row['u1n'].'</td><td align="center">'.$row['u2n'].'</td><td align="center">'.$name.'</td><td align="center">'.$row['betrag'].'</td><td align="center">'.$row['anzahl'].'</td><td align="center">'.$row['deadline'].'</td><td align="center">'.$cheatv.'</td><td><a href="'.$_SERVER['PHP_SELF'].'?choose=cheat&action=show&from='.$low.'&until='.$high.'&user1='.$row['u1i'].'&user2='.$row['u2i'].'">Nachweis</a> | <a href="'.$_SERVER['PHP_SELF'].'?choose=cheat&action=undo&tradeid='.$row['transaktionsid'].'">R&uuml;ckg&auml;ngig</a> | <a href="'.$_SERVER['PHP_SELF'].'?choose=cheat&action=markok&tradeid='.$row['transaktionsid'].'">OK</a> | <a href="'.$_SERVER['PHP_SELF'].'?choose=cheat&action=vwarn&user1='.$row['u1i'].'&user2='.$row['u2i'].'">Verwarnen</a> | <a href="'.$_SERVER['PHP_SELF'].'?choose=cheat&action=ban&user1='.$row['u1i'].'&user2='.$row['u2i'].'">Bannen</a></td></tr>'; echo '<tr><td align="center">'.$row['u1n'].'</td><td align="center">'.$row['u2n'].'</td><td align="center">'.$name.'</td><td align="center">'.$row['betrag'].'</td><td align="center">'.$row['anzahl'].'</td><td align="center">'.$row['deadline'].'</td><td align="center">'.$cheatv.'</td><td><a href="'.$_SERVER['PHP_SELF'].'?choose=cheat&action=show&from='.$low.'&until='.$high.'&user1='.$row['u1i'].'&user2='.$row['u2i'].'">Nachweis</a> | <a href="'.$_SERVER['PHP_SELF'].'?choose=cheat&action=undo&tradeid='.$row['transaktionsid'].'">R&uuml;ckg&auml;ngig</a> | <a href="'.$_SERVER['PHP_SELF'].'?choose=cheat&action=markok&tradeid='.$row['transaktionsid'].'">OK</a> | <a href="'.$_SERVER['PHP_SELF'].'?choose=cheat&action=vwarn&user1='.$row['u1i'].'&user2='.$row['u2i'].'">Verwarnen</a> | <a href="'.$_SERVER['PHP_SELF'].'?choose=cheat&action=ban&user1='.$row['u1i'].'&user2='.$row['u2i'].'">Bannen</a></td></tr>';
@ -344,7 +344,7 @@ function displayCheater($action, $from, $until, $user1, $user2, $tradeid, $verif
<?php <?php
} else if($action == 'show'){ } else if($action == 'show'){
// Zeigt die Verbindungen zwischen 2 Usern auf // Zeigt die Verbindungen zwischen 2 Usern auf
$minmax = mysql_fetch_assoc(mysql_query('SELECT DATE(min(occured)) as min, DATE(max(occured)) as max FROM multiuser')); $minmax = mysqli_fetch_assoc(db_query('SELECT DATE(min(occured)) as min, DATE(max(occured)) as max FROM multiuser'));
$low = $from===null?$minmax['min']:$from; $low = $from===null?$minmax['min']:$from;
$high = $until===null?$minmax['max']:$until; $high = $until===null?$minmax['max']:$until;
@ -376,8 +376,8 @@ function displayCheater($action, $from, $until, $user1, $user2, $tradeid, $verif
<th>Action</th> <th>Action</th>
<?php <?php
$sql = 'Select u1.nickname as u1n, u1.id as u1i, u2.nickname u2n, u2.id u2i, occured, type from multiuser left join user as u1 on multiuser.user1 = u1.id left join user as u2 on multiuser.user2 = u2.id where user1 = '.$user1.' and user2 = '.$user2.' and occured >= \''.$$low.' 0:00:00\' and occured <= \''.$high.' 23:59:59\' order by occured desc'; $sql = 'Select u1.nickname as u1n, u1.id as u1i, u2.nickname u2n, u2.id u2i, occured, type from multiuser left join user as u1 on multiuser.user1 = u1.id left join user as u2 on multiuser.user2 = u2.id where user1 = '.$user1.' and user2 = '.$user2.' and occured >= \''.$$low.' 0:00:00\' and occured <= \''.$high.' 23:59:59\' order by occured desc';
$cheater_qry = mysql_query($sql); $cheater_qry = db_query($sql);
while($row = mysql_fetch_assoc($cheater_qry)){ while($row = mysqli_fetch_assoc($cheater_qry)){
echo '<tr><td align="center">'.$row['u1n'].'</td><td align="center">'.$row['u2n'].'</td><td align="center">'.$row['occured'].'</td><td align="center">'.$row['type'].'</td><td align="center"><a href="'.$_SERVER['PHP_SELF'].'?choose=cheat&action=vwarn&user1='.$row['u1i'].'&user2='.$row['u2i'].'">Verwarnen</a> | <a href="'.$_SERVER['PHP_SELF'].'?choose=cheat&action=ban&user1='.$row['u1i'].'&user2='.$row['u2i'].'">Bannen</a></td></tr>'; echo '<tr><td align="center">'.$row['u1n'].'</td><td align="center">'.$row['u2n'].'</td><td align="center">'.$row['occured'].'</td><td align="center">'.$row['type'].'</td><td align="center"><a href="'.$_SERVER['PHP_SELF'].'?choose=cheat&action=vwarn&user1='.$row['u1i'].'&user2='.$row['u2i'].'">Verwarnen</a> | <a href="'.$_SERVER['PHP_SELF'].'?choose=cheat&action=ban&user1='.$row['u1i'].'&user2='.$row['u2i'].'">Bannen</a></td></tr>';
} }
?> ?>
@ -403,8 +403,8 @@ function displayCheater($action, $from, $until, $user1, $user2, $tradeid, $verif
<?php <?php
$sql = '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 bieter IN ('.$user1.','.$user2.') and anbieter IN('.$user1.','.$user2.') and deadline >= \''.$low.' 00:00:00\' and deadline <= \''.$high.' 23:59:59\''; $sql = '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 bieter IN ('.$user1.','.$user2.') and anbieter IN('.$user1.','.$user2.') and deadline >= \''.$low.' 00:00:00\' and deadline <= \''.$high.' 23:59:59\'';
// echo $sql.'<br>'; // echo $sql.'<br>';
$cheater_qry = mysql_query($sql); $cheater_qry = db_query($sql);
while($row = mysql_fetch_assoc($cheater_qry)){ 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']); $name = $row['i_name']!=null?$row['i_name']:($row['w_name']!=null?$row['w_name']:$row['s_name']);
$cheatv = $row['cheatingverdacht']==0?'OK':'WARNUNG'; $cheatv = $row['cheatingverdacht']==0?'OK':'WARNUNG';
echo '<tr><td align="center">'.$row['u1n'].'</td><td align="center">'.$row['u2n'].'</td><td align="center">'.$name.'</td><td align="center">'.$row['betrag'].'</td><td align="center">'.$row['anzahl'].'</td><td align="center">'.$row['deadline'].'</td><td align="center">'.$cheatv.'</td><td></td></tr>'; echo '<tr><td align="center">'.$row['u1n'].'</td><td align="center">'.$row['u2n'].'</td><td align="center">'.$name.'</td><td align="center">'.$row['betrag'].'</td><td align="center">'.$row['anzahl'].'</td><td align="center">'.$row['deadline'].'</td><td align="center">'.$cheatv.'</td><td></td></tr>';
@ -435,17 +435,17 @@ function displayCheater($action, $from, $until, $user1, $user2, $tradeid, $verif
} else if($action == 'vwarn'){ } else if($action == 'vwarn'){
// Spricht eine Verwarnung zwischen 2 Usern aus // Spricht eine Verwarnung zwischen 2 Usern aus
if($verify == 1){ if($verify == 1){
$qry = mysql_query('select id, nickname from user where id in ('.$user1.', '.$user2.')'); $qry = db_query('select id, nickname from user where id in ('.$user1.', '.$user2.')');
while($row = mysql_fetch_assoc($qry)){ while($row = mysqli_fetch_assoc($qry)){
$users[] = $row['nickname']; $users[] = $row['nickname'];
} }
displayErrorMessage('Verwarnung ausgesprochen', 'Die User '.join(' und ',$users).' sind nun verwarnt!', '<a href="'.$_SERVER['PHP_SELF'].'?choose=cheat">weiter</a>'); displayErrorMessage('Verwarnung ausgesprochen', 'Die User '.join(' und ',$users).' sind nun verwarnt!', '<a href="'.$_SERVER['PHP_SELF'].'?choose=cheat">weiter</a>');
mysql_query('INSERT INTO nachricht(betreff, von, datum, text, besitzer) values(\'Verwarnung\', \'AG-Team\', now(), \'Es kam zwischen den Accounts '.join(' und ',$users).' zu &Uuml;berschneidungen, wir bitten euch dies zu unterlassen, da wir uns sonst gezwungen sehen diese Aktivit&auml;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 &Uuml;berschneidungen, wir bitten euch dies zu unterlassen, da wir uns sonst gezwungen sehen diese Aktivit&auml;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 &Uuml;berschneidungen, wir bitten euch dies zu unterlassen, da wir uns sonst gezwungen sehen diese Aktivit&auml;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 &Uuml;berschneidungen, wir bitten euch dies zu unterlassen, da wir uns sonst gezwungen sehen diese Aktivit&auml;ten zu bestrafen!\', '.$user2.')');
logaction('Die User '.join(' und ',$users).' wurden verwarnt!'); logaction('Die User '.join(' und ',$users).' wurden verwarnt!');
} else{ } else{
$qry = mysql_query('select id, nickname from user where id in ('.$user1.', '.$user2.')'); $qry = db_query('select id, nickname from user where id in ('.$user1.', '.$user2.')');
while($row = mysql_fetch_assoc($qry)){ while($row = mysqli_fetch_assoc($qry)){
$users[] = $row['nickname']; $users[] = $row['nickname'];
} }
displayErrorMessage('Verwarnen', 'Sollen die User '.join(' und ',$users).' wirklich verwarnt werden?', '<a href="'.$_SERVER['PHP_SELF'].'?choose=cheat&action=vwarn&user1='.$user1.'&user2='.$user2.'&verify=1">weiter</a> | '.displayHistoryBackLink()); displayErrorMessage('Verwarnen', 'Sollen die User '.join(' und ',$users).' wirklich verwarnt werden?', '<a href="'.$_SERVER['PHP_SELF'].'?choose=cheat&action=vwarn&user1='.$user1.'&user2='.$user2.'&verify=1">weiter</a> | '.displayHistoryBackLink());
@ -453,18 +453,18 @@ function displayCheater($action, $from, $until, $user1, $user2, $tradeid, $verif
} else if($action == 'ban'){ } else if($action == 'ban'){
// Bannt zwei Accounts // Bannt zwei Accounts
if($verify == 1){ if($verify == 1){
$qry = mysql_query('select id, nickname from user where id in ('.$user1.', '.$user2.')'); $qry = db_query('select id, nickname from user where id in ('.$user1.', '.$user2.')');
while($row = mysql_fetch_assoc($qry)){ while($row = mysqli_fetch_assoc($qry)){
$users[] = $row['nickname']; $users[] = $row['nickname'];
} }
displayErrorMessage('Bann vollzogen!', 'Die User '.join(' und ',$users).' sind nun verwarnt!', '<a href="'.$_SERVER['PHP_SELF'].'?choose=cheat">weiter</a>'); displayErrorMessage('Bann vollzogen!', 'Die User '.join(' und ',$users).' sind nun verwarnt!', '<a href="'.$_SERVER['PHP_SELF'].'?choose=cheat">weiter</a>');
mysql_query('INSERT INTO nachricht(betreff, von, datum, text, besitzer) values(\'Bann\', \'AG-Team\', now(), \'Es kam zwischen den Accounts '.join(' und ',$users).' zu &Uuml;berschneidungen. Deswegen sahen wir uns gezwungen diese Aktivit&auml;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 &Uuml;berschneidungen. Deswegen sahen wir uns gezwungen diese Aktivit&auml;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 &Uuml;berschneidungen. Deswegen sahen wir uns gezwungen diese Aktivit&auml;ten zu bestrafen!\', '.$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 &Uuml;berschneidungen. Deswegen sahen wir uns gezwungen diese Aktivit&auml;ten zu bestrafen!\', '.$user2.')');
mysql_query('Update user set bann = \'ja\' where id IN('.$user1.', '.$user2.')'); db_query('Update user set bann = \'ja\' where id IN('.$user1.', '.$user2.')');
logaction('Die User '.join(' und ',$users).' wurden gebannt!'); logaction('Die User '.join(' und ',$users).' wurden gebannt!');
} else{ } else{
$qry = mysql_query('select id, nickname from user where id in ('.$user1.', '.$user2.')'); $qry = db_query('select id, nickname from user where id in ('.$user1.', '.$user2.')');
while($row = mysql_fetch_assoc($qry)){ while($row = mysqli_fetch_assoc($qry)){
$users[] = $row['nickname']; $users[] = $row['nickname'];
} }
displayErrorMessage('Bannen', 'Sollen die User '.join(' und ',$users).' wirklich gebannt werden?', '<a href="'.$_SERVER['PHP_SELF'].'?choose=cheat&action=ban&user1='.$user1.'&user2='.$user2.'&verify=1">weiter</a> | '.displayHistoryBackLink()); displayErrorMessage('Bannen', 'Sollen die User '.join(' und ',$users).' wirklich gebannt werden?', '<a href="'.$_SERVER['PHP_SELF'].'?choose=cheat&action=ban&user1='.$user1.'&user2='.$user2.'&verify=1">weiter</a> | '.displayHistoryBackLink());
@ -474,12 +474,12 @@ function displayCheater($action, $from, $until, $user1, $user2, $tradeid, $verif
displayErrorMessage(NULL, 'not yet implemented', displayHistoryBackLink()); displayErrorMessage(NULL, 'not yet implemented', displayHistoryBackLink());
} else if($action == 'markok'){ } else if($action == 'markok'){
if($verify == 1){ 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!', '<a href="'.$_SERVER['PHP_SELF'].'?choose=cheat">weiter</a>'); displayErrorMessage('Trade validiert!', 'Der Handel zwischen '.$trade['u1n'].' und '.$trade['u2n'].' ist nun als \'Ok\' markiert!', '<a href="'.$_SERVER['PHP_SELF'].'?choose=cheat">weiter</a>');
logaction('Der Handel zwischen '.$trade['u1n'].' und '.$trade['u2n'].' wurde als \'Ok\' markiert (Tradeid = '.$tradeid.')!'); 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{ } 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?', '<a href="'.$_SERVER['PHP_SELF'].'?choose=cheat&action=markok&tradeid='.$tradeid.'&verify=1">weiter</a> | '.displayHistoryBackLink()); displayErrorMessage('Trade validieren!', 'Sollen der Handel zwischen '.$trade['u1n'].' und '.$trade['u2n'].' als \'Ok\' markiert werden?', '<a href="'.$_SERVER['PHP_SELF'].'?choose=cheat&action=markok&tradeid='.$tradeid.'&verify=1">weiter</a> | '.displayHistoryBackLink());
} }
} }
@ -523,7 +523,7 @@ function displayBannOptions($action, $username,$opfer,$gamebann,$shoutbann,$fore
</form> </form>
<?php <?php
} else if(is_numeric($anonid)){ } else if(is_numeric($anonid)){
mysql_query('UPDATE anon_chatter set muted = 1 where anon_id = '.$anonid); db_query('UPDATE anon_chatter set muted = 1 where anon_id = '.$anonid);
?> ?>
<table> <table>
<tr> <tr>
@ -539,7 +539,7 @@ function displayBannOptions($action, $username,$opfer,$gamebann,$shoutbann,$fore
<?php <?php
} else if($action == "search"){ } else if($action == "search"){
// Auslagern ;D // Auslagern ;D
$qry = mysql_query('Select nickname, id from user where nickname like \''.$username.'%\''); $qry = db_query('Select nickname, id from user where nickname like \''.$username.'%\'');
?> ?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST"> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
<input type="hidden" name="choose" value="bann"></input> <input <input type="hidden" name="choose" value="bann"></input> <input
@ -552,7 +552,7 @@ function displayBannOptions($action, $username,$opfer,$gamebann,$shoutbann,$fore
<td>Username</td> <td>Username</td>
<td><select name="opfer"> <td><select name="opfer">
<?php <?php
while($result = mysql_fetch_assoc($qry)){ while($result = mysqli_fetch_assoc($qry)){
echo '<option value="'.$result['id'].'">'.$result['nickname'].'</option>'; echo '<option value="'.$result['id'].'">'.$result['nickname'].'</option>';
} }
?> ?>

@ -19,10 +19,10 @@ include_once('../path.inc.php'); // get the path ;)
include_once(ROOT_PATH.'/include/config/db.inc.php'); include_once(ROOT_PATH.'/include/config/db.inc.php');
function getChatMessages(){ function getChatMessages(){
$result = mysql_query('SELECT *, Minute(zeit) as m, Hour(zeit) as h, DAY(zeit) as d , MONTH(zeit) as mon FROM ag_chat ORDER BY ID desc'); $result = db_query('SELECT *, Minute(zeit) as m, Hour(zeit) as h, DAY(zeit) as d , MONTH(zeit) as mon FROM ag_chat ORDER BY ID desc');
$resultstring = ''; $resultstring = '';
while ($row = mysql_fetch_array($result)) { while ($row = mysqli_fetch_array($result)) {
$h = $row['h']; $h = $row['h'];
if($h < 10){ $h = "0".$h;} if($h < 10){ $h = "0".$h;}
$m = $row['m']; $m = $row['m'];

@ -13,9 +13,9 @@ include_once(ROOT_PATH.'/include/parse.inc.php');
$page = validateUnsignedInteger($_GET['page'], null); $page = validateUnsignedInteger($_GET['page'], null);
$online_h = mysql_fetch_array(mysql_query('SELECT * FROM online WHERE id='.($page+1))); $online_h = mysqli_fetch_array(db_query('SELECT * FROM online WHERE id='.($page+1)));
$row = mysql_fetch_assoc(mysql_query('Select max(id) as maximum from online')); $row = mysqli_fetch_assoc(db_query('Select max(id) as maximum from online'));
$maxpages = $row['maximum']; $maxpages = $row['maximum'];
$url = '<a href="index.php?as=h_turnier&page=###PAGE###">###LABEL###</a>'; $url = '<a href="index.php?as=h_turnier&page=###PAGE###">###LABEL###</a>';

@ -12,7 +12,7 @@ include_once(ROOT_PATH.'/include/designfunctions.inc.php');
$page = validateUnsignedInteger($_GET['page'], null); $page = validateUnsignedInteger($_GET['page'], null);
$row = mysql_fetch_assoc(mysql_query('Select max(runde) as maximum from highscore')); $row = mysqli_fetch_assoc(db_query('Select max(runde) as maximum from highscore'));
$maxpages = $row['maximum']; $maxpages = $row['maximum'];
$url = '<a href="index.php?as=halloffame&page=###PAGE###">###LABEL###</a>'; $url = '<a href="index.php?as=halloffame&page=###PAGE###">###LABEL###</a>';
@ -25,12 +25,12 @@ if(!is_numeric($page) || $page < 1){
// Determine the importance of the Highscores (the less occurece, the more important) // Determine the importance of the Highscores (the less occurece, the more important)
$qry = mysql_query('Select count(*) as anzahl, art from highscore where runde = '.($maxpages-$page).' group by art order by anzahl,art asc'); $qry = db_query('Select count(*) as anzahl, art from highscore where runde = '.($maxpages-$page).' group by art order by anzahl,art asc');
while($row = mysql_fetch_assoc($qry)){ while($row = mysqli_fetch_assoc($qry)){
$events[] = $row; $events[] = $row;
} }
$qry = mysql_query('Select * from highscore where runde = '.($maxpages-$page).' order by art, datum'); $qry = db_query('Select * from highscore where runde = '.($maxpages-$page).' order by art, datum');
echo '<table cellpadding="0" cellspacing="0" width="100%" height="69">'."\n"; echo '<table cellpadding="0" cellspacing="0" width="100%" height="69">'."\n";
@ -39,7 +39,7 @@ echo ' <th class="content" colspan="3">Halle der Helden aus Runde '.($maxpages -
echo '</tr>'."\n"; echo '</tr>'."\n";
// Now generate the strings // Now generate the strings
while($row = mysql_fetch_assoc($qry)){ while($row = mysqli_fetch_assoc($qry)){
if($old != $row['art']){ if($old != $row['art']){
$eventhighscore[$row['art']] .= '<tr>'."\n"; $eventhighscore[$row['art']] .= '<tr>'."\n";
$eventhighscore[$row['art']] .= ' <th class="content" height="39" colspan="3">'.$row['art'].'</th>'."\n"; $eventhighscore[$row['art']] .= ' <th class="content" height="39" colspan="3">'.$row['art'].'</th>'."\n";

@ -28,8 +28,8 @@
$mptemp = explode(",", $my_charz['mp']); $mptemp = explode(",", $my_charz['mp']);
$mpleft[$char_zahl] = $mptemp['0'] / $mptemp['1'] * 100; $mpleft[$char_zahl] = $mptemp['0'] / $mptemp['1'] * 100;
$exptemp = explode(",", $my_charz['exp']); $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']); $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=mysql_fetch_assoc($room); $clanroom=mysqli_fetch_assoc($room);
if($clanroom['name']=="") if($clanroom['name']=="")
$clanroom['name']="kein"; $clanroom['name']="kein";
@ -45,7 +45,7 @@
if($my_charz['kampf_item'] != NULL && $my_charz['kampf_item'] != ',,,,'){ if($my_charz['kampf_item'] != NULL && $my_charz['kampf_item'] != ',,,,'){
// echo 'Problematic Entry = '.$chara_1['kampf_item'].'<br>'; // echo 'Problematic Entry = '.$chara_1['kampf_item'].'<br>';
$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_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'].')'; $c_verteidigung = $char1_buffs['verteidigung']==0?$my_charz['verteidigung']:($my_charz['verteidigung']).' (+'.$char1_buffs['verteidigung'].')';

@ -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.inc.php');
include_once (ROOT_PATH . '/include/clan_chat.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]'")); $itemsx1 = mysqli_stmt_num_rows(db_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")); $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]'")); $itemsx2 = mysqli_stmt_num_rows(db_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")); $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")); $anmeldungen = mysqli_stmt_num_rows(db_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'")); $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; //echo $nnn_nn;
$zeit = date("H:i:s"); $zeit = date("H:i:s");
$date = date("d.m.y"); $date = date("d.m.y");
@ -89,7 +89,7 @@ if ($name AND $passwort) {
// $clan_009 .= "<a href=index.php?as=clan/c_kampf&id=fights>Clan K&auml;mpfe Anzeige</a><br>"; // $clan_009 .= "<a href=index.php?as=clan/c_kampf&id=fights>Clan K&auml;mpfe Anzeige</a><br>";
// Ist user der leader? // 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']){ // if($chiefs['co_leader'] == $user_ida['id'] || $chiefs['leader'] == $user_ida['id']){
// $clan_009 .= '<a href=index.php?as=clan/c_kampf>Clan K&auml;mpfe</a><br>'; // $clan_009 .= '<a href=index.php?as=clan/c_kampf>Clan K&auml;mpfe</a><br>';
// } // }
@ -105,7 +105,7 @@ if ($name AND $passwort) {
<a href=index.php?as=halloffame>Halle der Helden</a><br> <a href=index.php?as=halloffame>Halle der Helden</a><br>
<a href=index.php?as=last_fight>Letzten 20 K&auml;mpfe</a><br>"; <a href=index.php?as=last_fight>Letzten 20 K&auml;mpfe</a><br>";
$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']; $auktionensumme = $auktionensumme['summe'];
if ($auktionensumme == 0) { if ($auktionensumme == 0) {
@ -138,7 +138,7 @@ if ($name AND $passwort) {
<a href=index.php?as=pw>Passwort Vergessen?</a><br> <a href=index.php?as=pw>Passwort Vergessen?</a><br>
"; ";
} }
$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']); $o_datum = preg_split('# #',$online_rekord_1_0['datum']);
$info_019 = " $info_019 = "

@ -11,12 +11,12 @@ include_once(ROOT_PATH.'/include/random.inc.php');
function createAbholcode($charid){ function createAbholcode($charid){
$code = mt_random_wrapper(0, 44*$charid); $code = mt_random_wrapper(0, 44*$charid);
$code = md5($code.time()); $code = md5($code.time());
mysql_query('DELETE from char_abholcodes where charid = '.$charid); db_query('DELETE from char_abholcodes where charid = '.$charid);
mysql_query('INSERT INTO char_abholcodes(charid, code) values('.$charid.', \''.$code.'\')'); db_query('INSERT INTO char_abholcodes(charid, code) values('.$charid.', \''.$code.'\')');
} }
function checkAbholcode($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){ if($code_row){
return $code == $code_row['code']; return $code == $code_row['code'];
} }

@ -23,7 +23,7 @@ function calculateArenaData($owner_id, $char_1, $char_2, $factor){
$arena['loge'] = 1000000; $arena['loge'] = 1000000;
$arena['zustand'] = 1; $arena['zustand'] = 1;
} else { } 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']); $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) { function getArena($user_id) {
$sql_select = 'SELECT * FROM arena where besitzer = \''.$user_id.'\''; $sql_select = 'SELECT * FROM arena where besitzer = \''.$user_id.'\'';
$qry = mysql_query($sql_select); $qry = db_query($sql_select);
if(mysql_num_rows($qry) == 0) { if(mysqli_stmt_num_rows($qry) == 0) {
$sql = 'INSERT arena(besitzer, exp) values (\''.$user_id.'\', \'0,'.calculateRequiredExpArena(1).'\')'; $sql = 'INSERT arena(besitzer, exp) values (\''.$user_id.'\', \'0,'.calculateRequiredExpArena(1).'\')';
mysql_query($sql); db_query($sql);
$qry = mysql_query($sql_select); $qry = db_query($sql_select);
} }
$arena = mysql_fetch_assoc($qry); $arena = mysqli_fetch_assoc($qry);
return $arena; return $arena;
} }

@ -15,7 +15,7 @@ function getAttack($attack_id, $buffer = TRUE) {
} }
if(!isset($GLOBALS['attack_buffered'][$attack_id])) { 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]; return $GLOBALS['attack_buffered'][$attack_id];
} }

@ -30,7 +30,7 @@ function createAttackSet($char_id, $type) {
} }
$qry = 'INSERT INTO attackenset VALUES '.$values.';'; $qry = 'INSERT INTO attackenset VALUES '.$values.';';
return mysql_query($qry); return db_query($qry);
} }
function deleteAttackSet($char_id, $type) { 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.';'; $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) { 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); $qry = db_query('SELECT attack_id, round FROM attackenset WHERE char_id = '.$char_id.' AND type = '.$type);
$set = array(); $set = array();
while ($result = mysql_fetch_assoc($qry)) { while ($result = mysqli_fetch_assoc($qry)) {
$set[$result['round']] = $result['attack_id']; $set[$result['round']] = $result['attack_id'];
} }
return $set; return $set;
@ -64,7 +64,7 @@ function updateAttackSet($char_id, $type, $newSet) {
for ($i = 1; $i < KAMPF_RUNDEN + 1; $i++) { for ($i = 1; $i < KAMPF_RUNDEN + 1; $i++) {
if($oldset[$i] != $newSet[$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.';'; $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; return true;
@ -75,9 +75,9 @@ function getAttackNames($attackSet) {
return array(); 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']; $set[$result['id']] = $result['name'];
} }
@ -89,8 +89,8 @@ function getAttackTypes($attackSet) {
return array(); 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).');'); $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 = mysql_fetch_assoc($qry)) { while ($result = mysqli_fetch_assoc($qry)) {
if($result['type'] == 'generic') { if($result['type'] == 'generic') {
$options = json_decode($result['options'], true); $options = json_decode($result['options'], true);
$set[$result['id']] = $options['type']; $set[$result['id']] = $options['type'];
@ -116,9 +116,9 @@ function validateAttackSet($attackSet) {
} }
//Alle Attackentypen auslesen //Alle Attackentypen auslesen
$qry = mysql_query('SELECT name, anzahl, kategorie FROM attackentyp;'); $qry = db_query('SELECT name, anzahl, kategorie FROM attackentyp;');
$types = array(); $types = array();
while ($row = mysql_fetch_assoc($qry)) { while ($row = mysqli_fetch_assoc($qry)) {
$types[$row['name']] = array('anzahl' => $row['anzahl'], 'kategorie' => $row['kategorie']); $types[$row['name']] = array('anzahl' => $row['anzahl'], 'kategorie' => $row['kategorie']);
} }

@ -27,11 +27,11 @@ include_once(ROOT_PATH.'/include/semaphore.inc.php');
// Returns Mindestgebot // Returns Mindestgebot
// @Return Integer // @Return Integer
function aktuellesMindestgebot($auktionsid){ function aktuellesMindestgebot($auktionsid){
$qry = mysql_query('SELECT aktuellesgebot, startgebot FROM auktion WHERE auktionsid = '.$auktionsid); $qry = db_query('SELECT aktuellesgebot, startgebot FROM auktion WHERE auktionsid = '.$auktionsid);
if(mysql_num_rows($qry) != 1){ // Auktion nicht vorhanden?? if(mysqli_stmt_num_rows($qry) != 1){ // Auktion nicht vorhanden??
return -1; 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?? // Aktuelles Gebot vorhanden??
if($result['aktuellesgebot']!=NULL){ if($result['aktuellesgebot']!=NULL){
$minBetrag = $result['aktuellesgebot']*1.02; // Mindestens 2% mehr muss geboten werden $minBetrag = $result['aktuellesgebot']*1.02; // Mindestens 2% mehr muss geboten werden
@ -49,9 +49,9 @@ function aktuellesMindestgebot($auktionsid){
*/ */
function getUserAvailableMoney($userid) { 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 //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']; $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']; $auktionensumme = $auktionensumme['summe'];
return $usermoney - $auktionensumme; 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 //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']; $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']; $auktionensumme = $auktionensumme['summe'];
if($usermoney < $auktionensumme + $gebot){ 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 //Wenn 10 minuten vor Deadline-ende geboten wird wird die deadline um 10 Minuten verschoben
if($zeitdifferenz < 10){ 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 // 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']; $deadline = $res_deadline['deadline'];
} else{ } else{
// Ansonsten nur die Grundwerte // 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 // Nun noch den aktuellen bieter eine Nachricht senden
sendMessage('Auktionsmarkt', $bieter, '&Uuml;berboten worden', 'Sie sind von '.$user_a['nickname'].' &uuml;berboten worden, er bietet '.$gebot.' f&uuml;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]'); sendMessage('Auktionsmarkt', $bieter, '&Uuml;berboten worden', 'Sie sind von '.$user_a['nickname'].' &uuml;berboten worden, er bietet '.$gebot.' f&uuml;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 '<br><br>'.$new_query.'<br><br>'; // echo '<br><br>'.$new_query.'<br><br>';
return ''; // Leerer String, also kein Fehler! return ''; // Leerer String, also kein Fehler!
} }
@ -139,9 +139,9 @@ function getItemOptions($userid,$preselected){
union 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)'; 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! // Damit waeren alle noetigen Datenbankaufrufe erledigt!
while($row = mysql_fetch_assoc($qry)){ while($row = mysqli_fetch_assoc($qry)){
if($row['id'] == $preselected){ if($row['id'] == $preselected){
$result[$index++] = '<option value=\''.$row['id'].','.$row['tablename'].'\' selected>'.$row['name'].' | Anzahl:'.$row['anzahl'].'</option>'; $result[$index++] = '<option value=\''.$row['id'].','.$row['tablename'].'\' selected>'.$row['name'].' | Anzahl:'.$row['anzahl'].'</option>';
} }
@ -189,23 +189,23 @@ function insertItem($userid,$id_db_mix, $anzahl, $startgebot){
// Nun die Anzahl vergleichen // 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; $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; // echo $test;
if($result['anzahl'] < $anzahl){ if($result['anzahl'] < $anzahl){
return 'Nicht genug Items (Vorhanden:'.$result['anzahl'].', Eingetragen:'.$anzahl.')'; return 'Nicht genug Items (Vorhanden:'.$result['anzahl'].', Eingetragen:'.$anzahl.')';
} }
$test = 'SELECT '.$db[3].' AS name FROM '.$db[1].' WHERE id ='.$id; $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; // echo $test;
// Nun werden dem User die Items abgezogen und in die auktionstabelle eingefuegt. // 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); $qry = db_query('DELETE FROM '.$db[0].' WHERE '.$db[2].'='.$id.' AND user='.$userid.' LIMIT '.$anzahl);
$anzahl2 = mysql_affected_rows(); $anzahl2 = db_affected_rows();
if($anzahl2 == 0){ if($anzahl2 == 0){
return 'Cheater!!'; return 'Cheater!!';
} else if($anzahl != $anzahl2){ } 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{ } 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 ''; return '';
} }
@ -214,8 +214,8 @@ function insertItem($userid,$id_db_mix, $anzahl, $startgebot){
// Diese Funktion erstellt die Auktionstabelle und die Transaktionentabelle // Diese Funktion erstellt die Auktionstabelle und die Transaktionentabelle
function createTables(){ function createTables(){
// Erstellen der Auktionstabelle // Erstellen der Auktionstabelle
mysql_query('DROP TABLE auktion'); db_query('DROP TABLE auktion');
mysql_query(' db_query('
CREATE TABLE `auktion` ( CREATE TABLE `auktion` (
`auktionsid` int(10) unsigned NOT NULL auto_increment, `auktionsid` int(10) unsigned NOT NULL auto_increment,
`anbieter` int(10) unsigned NOT NULL, `anbieter` int(10) unsigned NOT NULL,
@ -233,8 +233,8 @@ function createTables(){
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=0 ; ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=0 ;
'); ');
mysql_query('DROP TABLE auktion_transaktionen'); db_query('DROP TABLE auktion_transaktionen');
mysql_query(' db_query('
CREATE TABLE `auktion_transaktionen` ( CREATE TABLE `auktion_transaktionen` (
`transaktionsid` int(10) unsigned NOT NULL auto_increment, `transaktionsid` int(10) unsigned NOT NULL auto_increment,
`anbieter` int(10) unsigned NOT NULL, `anbieter` int(10) unsigned NOT NULL,
@ -267,11 +267,11 @@ function getAuktionTotalCount($kategorie,$itemnamepart,$maxPrice){
$stringDelimiter = ' AND itemname LIKE \'%'.$itemnamepart.'%\' '; $stringDelimiter = ' AND itemname LIKE \'%'.$itemnamepart.'%\' ';
} }
$test = 'SELECT count(auktionsid) as anzahl FROM auktion WHERE 1 '.$kategorieDelimitier.$stringDelimiter.$priceDelimiter.' AND TIMESTAMPDIFF(Minute,now(),deadline) >= 0'; $test = 'SELECT count(auktionsid) as anzahl FROM auktion WHERE 1 '.$kategorieDelimitier.$stringDelimiter.$priceDelimiter.' AND TIMESTAMPDIFF(Minute,now(),deadline) >= 0';
$qry = mysql_query($test); $qry = db_query($test);
if(mysql_num_rows($qry) == 0){ if(mysqli_stmt_num_rows($qry) == 0){
return 0; return 0;
} }
$result = mysql_fetch_assoc($qry); $result = mysqli_fetch_assoc($qry);
return $result['anzahl']; return $result['anzahl'];
} }
@ -294,9 +294,9 @@ function getAuktionEntries($kategorie,$itemnamepart,$entriesPerSite,$pageNumber,
} }
$index = 0; $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; $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 '<br>'.$test.'<br>'; //echo '<br>'.$test.'<br>';
while($result = mysql_fetch_assoc($qry)){ while($result = mysqli_fetch_assoc($qry)){
$returnArray[$index++] = $result; $returnArray[$index++] = $result;
} }
return $returnArray; return $returnArray;
@ -304,9 +304,9 @@ function getAuktionEntries($kategorie,$itemnamepart,$entriesPerSite,$pageNumber,
function getEntryInformation($auktionsid){ function getEntryInformation($auktionsid){
if(!is_numeric($auktionsid)){return;} 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); $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(mysql_num_rows($qry) == 0){ return NULL; } if(mysqli_stmt_num_rows($qry) == 0){ return NULL; }
return mysql_fetch_assoc($qry); return mysqli_fetch_assoc($qry);
} }
function getKategorieOptions($preselect){ function getKategorieOptions($preselect){
@ -318,8 +318,8 @@ function getKategorieOptions($preselect){
$total = 0; $total = 0;
$select = false; $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'); $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 = mysql_fetch_assoc($qry)){ while($row = mysqli_fetch_assoc($qry)){
if($preselect == $row['tablename']){ if($preselect == $row['tablename']){
$result[$index++] = '<option value=\''.$row['tablename'].'\' selected>'.$converter[$row['tablename']].' | Anzahl:'.$row['anzahl'].'</option>'; $result[$index++] = '<option value=\''.$row['tablename'].'\' selected>'.$converter[$row['tablename']].' | Anzahl:'.$row['anzahl'].'</option>';
$select = true; $select = true;
@ -349,10 +349,10 @@ function zurueckziehen($userid, $auktionsid, $pay){
return 'Es wurde zwischenzeitlich geboten! Zur&uuml;ckziehen nur mit Geb&uuml;hr m&ouml;glich!'; return 'Es wurde zwischenzeitlich geboten! Zur&uuml;ckziehen nur mit Geb&uuml;hr m&ouml;glich!';
} }
$gebuehr = floor($auktionsdaten['aktuellesgebot'] * 0.1); $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); db_query('DELETE FROM auktion WHERE auktionsid='.$auktionsid);
$anzahl2 = mysql_affected_rows(); $anzahl2 = db_affected_rows();
if($anzahl2 == 0){ if($anzahl2 == 0){
return 'CHEATER!!'; return 'CHEATER!!';
} }
@ -361,23 +361,23 @@ function zurueckziehen($userid, $auktionsid, $pay){
if($auktionsdaten['tablename'] == 'ware'){$item_row_name = 'item_id';} if($auktionsdaten['tablename'] == 'ware'){$item_row_name = 'item_id';}
while($anzahl-- > 0){ while($anzahl-- > 0){
$sql = 'INSERT INTO '.$auktionsdaten['tablename'].' ('.$item_row_name.', user) VALUES('.$auktionsdaten['itemid'].','.$userid.')'; $sql = 'INSERT INTO '.$auktionsdaten['tablename'].' ('.$item_row_name.', user) VALUES('.$auktionsdaten['itemid'].','.$userid.')';
mysql_query($sql); db_query($sql);
// echo '<br>'.$sql.'<br>'; // echo '<br>'.$sql.'<br>';
} }
$sql = 'INSERT INTO nachricht(von, besitzer, betreff, text) VALUES (\'Auktionsmarkt\', '.$auktionsdaten['anbieter'].', \'Item zur&uuml;ckgezogen!\', \' Sie haben das Item '.$auktionsdaten['itemname'].' f&uuml;r eine Geb&uuml;hr von '.$gebuehr.' zur&uuml;ckgezogen!\')'; $sql = 'INSERT INTO nachricht(von, besitzer, betreff, text) VALUES (\'Auktionsmarkt\', '.$auktionsdaten['anbieter'].', \'Item zur&uuml;ckgezogen!\', \' Sie haben das Item '.$auktionsdaten['itemname'].' f&uuml;r eine Geb&uuml;hr von '.$gebuehr.' zur&uuml;ckgezogen!\')';
mysql_query($sql); db_query($sql);
// echo '<br>'.$sql.'<br>'; // echo '<br>'.$sql.'<br>';
if($auktionsdaten['bieter'] != NULL){ if($auktionsdaten['bieter'] != NULL){
$sql = 'INSERT INTO nachricht(von, besitzer, betreff, text) VALUES (\'Auktionsmarkt\', '.$auktionsdaten['bieter'].', \'Item zur&uuml;ckgezogen!\', \' Das Item '.$auktionsdaten['itemname'].' wurde von '.$auktionsdaten['anbietername'].' zur&uuml;ckgezogen!\')'; $sql = 'INSERT INTO nachricht(von, besitzer, betreff, text) VALUES (\'Auktionsmarkt\', '.$auktionsdaten['bieter'].', \'Item zur&uuml;ckgezogen!\', \' Das Item '.$auktionsdaten['itemname'].' wurde von '.$auktionsdaten['anbietername'].' zur&uuml;ckgezogen!\')';
mysql_query($sql); db_query($sql);
// echo '<br>'.$sql.'<br>'; // echo '<br>'.$sql.'<br>';
} }
} }
function getAveragePrice($itemid, $tablename, $anzahl){ function getAveragePrice($itemid, $tablename, $anzahl){
$sql = 'SELECT avg(betrag) / avg(anzahl) AS average FROM auktion_transaktionen WHERE anbieter != 1 and itemid = '.$itemid.' and tablename = \''.$tablename.'\' and cheatingverdacht = 0 and TIMESTAMPADD(DAY,30,deadline) > CURRENT_TIMESTAMP'; $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); $qry = db_query($sql);
$row = mysql_fetch_assoc($qry); $row = mysqli_fetch_assoc($qry);
return round($row['average']*$anzahl); return round($row['average']*$anzahl);
} }

@ -6,7 +6,7 @@
* *
*/ */
function isSpammer($id){ 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){ if($result['anzahl'] < 0){
return true; return true;
} else{ } else{
@ -17,11 +17,11 @@ function isSpammer($id){
function becomeSpammer($id,$nick,$text){ function becomeSpammer($id,$nick,$text){
// Es gibt 2 indikatoren ein Spammer zu sein // Es gibt 2 indikatoren ein Spammer zu sein
// Man schreibt min 10 posts innerhalb von 20 Sekunden // 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 // 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!! // 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 // Und nun noch ein paar Aergernisse
@ -40,21 +40,21 @@ function becomeSpammer($id,$nick,$text){
} }
function setSpamblock($id){ 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)); $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){ 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){ 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){ function unbannAccount($id){
mysql_query('UPDATE user SET bann = \'nein\' WHERE id='.$id); db_query('UPDATE user SET bann = \'nein\' WHERE id='.$id);
} }
?> ?>

@ -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()'; $sql = 'SELECT count(*) as anzahl FROM turnier_kampf t where art != \'gross\' and (win = ' . $charid . ' or lose = ' . $charid . ') and dauer > now()';
$row = mysql_fetch_assoc(mysql_query($sql)); $row = mysqli_fetch_assoc(db_query($sql));
if ($row['anzahl'] > 0) { if ($row['anzahl'] > 0) {
$GLOBALS['char_buffered_statuses'][$charid] = 'Turnier'; $GLOBALS['char_buffered_statuses'][$charid] = 'Turnier';
return 'Turnier'; return 'Turnier';
} }
$sql = 'SELECT count(*) as anzahl from quests where charid = ' . $charid; $sql = 'SELECT count(*) as anzahl from quests where charid = ' . $charid;
$row = mysql_fetch_assoc(mysql_query($sql)); $row = mysqli_fetch_assoc(db_query($sql));
if ($row['anzahl'] > 0) { if ($row['anzahl'] > 0) {
$GLOBALS['char_buffered_statuses'][$charid] = 'Schatz Suche'; $GLOBALS['char_buffered_statuses'][$charid] = 'Schatz Suche';
return 'Schatz Suche'; return 'Schatz Suche';
} }
$sql = 'SELECT count(*) as anzahl from kampf where db_satz = ' . $charid; $sql = 'SELECT count(*) as anzahl from kampf where db_satz = ' . $charid;
$row = mysql_fetch_assoc(mysql_query($sql)); $row = mysqli_fetch_assoc(db_query($sql));
if ($row['anzahl'] > 0) { if ($row['anzahl'] > 0) {
$GLOBALS['char_buffered_statuses'][$charid] = 'Kampf'; $GLOBALS['char_buffered_statuses'][$charid] = 'Kampf';
return 'Kampf'; return 'Kampf';
} }
$sql = 'SELECT count(*) as anzahl FROM kampf_list where charakter = ' . $charid; $sql = 'SELECT count(*) as anzahl FROM kampf_list where charakter = ' . $charid;
$row = mysql_fetch_assoc(mysql_query($sql)); $row = mysqli_fetch_assoc(db_query($sql));
if ($row['anzahl'] > 0) { if ($row['anzahl'] > 0) {
$GLOBALS['char_buffered_statuses'][$charid] = 'Kampf erstellt'; $GLOBALS['char_buffered_statuses'][$charid] = 'Kampf erstellt';
return 'Kampf erstellt'; return 'Kampf erstellt';
} }
$sql = 'SELECT count(*) as anzahl FROM turnier1 where charakter = ' . $charid; $sql = 'SELECT count(*) as anzahl FROM turnier1 where charakter = ' . $charid;
$row = mysql_fetch_assoc(mysql_query($sql)); $row = mysqli_fetch_assoc(db_query($sql));
if ($row['anzahl'] > 0) { if ($row['anzahl'] > 0) {
$GLOBALS['char_buffered_statuses'][$charid] = 'Angemeldet'; $GLOBALS['char_buffered_statuses'][$charid] = 'Angemeldet';
return 'Angemeldet'; return 'Angemeldet';
@ -114,7 +114,7 @@ function getChar2($charid) {
if(!is_numeric($charid)){ if(!is_numeric($charid)){
return null; return null;
} else { } else {
$char = mysql_fetch_assoc(mysql_query('Select * from chars where id = '.$charid)); $char = mysqli_fetch_assoc(db_query('Select * from chars where id = '.$charid));
if(!$char){return null;} if(!$char){return null;}
// Speichere in $char['stauts'] den aktuellen Status des Chars (buffer-Strategie ist hierbei die selbe) // Speichere in $char['stauts'] den aktuellen Status des Chars (buffer-Strategie ist hierbei die selbe)
$char['status'] = getStatus($char['id'],$buffer_enabled); $char['status'] = getStatus($char['id'],$buffer_enabled);
@ -171,7 +171,7 @@ function getCharWithBuffs($charid, $buffer_enabled = true){
function getCharBuffs($items) { function getCharBuffs($items) {
if($items != NULL && $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; return $char_buffs;
} }
@ -206,8 +206,8 @@ function getCharsOfUser($userid, $buffer_enabled = true) {
if ($GLOBALS['chars_read_out_user'][$userid] == null || !$buffer_enabled) { if ($GLOBALS['chars_read_out_user'][$userid] == null || !$buffer_enabled) {
$GLOBALS['chars_read_out_user'][$userid] = array(); $GLOBALS['chars_read_out_user'][$userid] = array();
$qry = mysql_query('Select id from chars where besitzer = '.$userid.' order by id'); $qry = db_query('Select id from chars where besitzer = '.$userid.' order by id');
while($char = mysql_fetch_assoc($qry)){ while($char = mysqli_fetch_assoc($qry)){
$GLOBALS['chars_read_out_user'][$userid][] = &getChar($char['id'], $buffer_enabled); $GLOBALS['chars_read_out_user'][$userid][] = &getChar($char['id'], $buffer_enabled);
} }
} }
@ -221,8 +221,8 @@ function deleteChar($userid, $charid){
} else if($char['status'] != 'Frei'){ } else if($char['status'] != 'Frei'){
return 'Char ist nicht Frei!'; return 'Char ist nicht Frei!';
} }
mysql_query('Delete from lernen where besitzer = '.$charid); db_query('Delete from lernen where besitzer = '.$charid);
mysql_query('Delete from chars where id = '.$charid); db_query('Delete from chars where id = '.$charid);
return true; return true;
} }
@ -263,7 +263,7 @@ function getPowerLevelWithBuffs($charid, $buffer_enabled = true){
return null; return null;
} }
if($char['kampf_item'] != NULL && $char['kampf_item'] != ',,,,'){ if($char['kampf_item'] != NULL && $char['kampf_item'] != ',,,,'){
$char_buffs = mysql_fetch_assoc(mysql_query('SELECT sum(i.hp) as hp, sum(i.mp) as mp, sum(i.starke) as starke, sum(i.verteidigung) as verteidigung, sum(i.speed) as speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id IN (' . $char['kampf_item'] . ')')); $char_buffs = mysqli_fetch_assoc(db_query('SELECT sum(i.hp) as hp, sum(i.mp) as mp, sum(i.starke) as starke, sum(i.verteidigung) as verteidigung, sum(i.speed) as speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id IN (' . $char['kampf_item'] . ')'));
} }
// Uncomment for hp/mp in PL // 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']; 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){ function getCharAttacks($charid){
$attacks = array(); $attacks = array();
$qry = mysql_query("SELECT name, id, at_id FROM lernen WHERE besitzer='$charid' AND aktiv > '0' order by id"); $qry = db_query("SELECT name, id, at_id FROM lernen WHERE besitzer='$charid' AND aktiv > '0' order by id");
while($row = mysql_fetch_array($qry)) { while($row = mysqli_fetch_array($qry)) {
$attacks[] = array('name'=>$row['name'], 'id'=>$row['id'], 'at_id'=>$row['at_id']); $attacks[] = array('name'=>$row['name'], 'id'=>$row['id'], 'at_id'=>$row['at_id']);
} }
return $attacks; 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) // 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'; $sql = '('.$sql.') union distinct ('.$sql2.') order by level';
$qry = mysql_query($sql); $qry = db_query($sql);
if($qry === FALSE) // print sql on error if($qry === FALSE) // print sql on error
echo '<br>'.$sql.'<br>'; echo '<br>'.$sql.'<br>';
@ -343,7 +343,7 @@ function getAttacksforChar($charid, $mode = 0) {
$attacke = array(); $attacke = array();
$requires = array(); $requires = array();
while($row = mysql_fetch_assoc($qry)) { while($row = mysqli_fetch_assoc($qry)) {
$attacke[$row['id']] = $row; $attacke[$row['id']] = $row;
if($row['unknown'] == 0 && $mode == 1) { if($row['unknown'] == 0 && $mode == 1) {

@ -12,11 +12,11 @@ defineIfNotDefined('STATUS_FREI', 'Frei');
//Dadurch kriege ich detailierte infos, sollte ein mysql query mal inkorrekt sein! //Dadurch kriege ich detailierte infos, sollte ein mysql query mal inkorrekt sein!
function safe_query($query="") { function safe_query($query="") {
if(empty($query)) return false; 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 { else {
$result = mysql_query($query) or die('Query failed: ' $result = db_query($query) or die('Query failed: '
.'<li>errorno='.mysql_errno() .'<li>errorno='.mysqli_errno($GLOBALS['main_db'])
.'<li>error='.mysql_error() .'<li>error='.mysqli_error($GLOBALS['main_db'])
.'<li>query='.$query); .'<li>query='.$query);
} }
return $result; return $result;
@ -30,7 +30,7 @@ function chardaten($char_id,$name,&$char_1,&$hp1,&$mp1,&$exp,&$fehler) {
$hp1 = explode(',', $char_1['hp']); $hp1 = explode(',', $char_1['hp']);
$mp1 = explode(',', $char_1['mp']); $mp1 = explode(',', $char_1['mp']);
$exp = explode(',', $char_1['exp']); $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]) { if($char_1['besitzer'] != $user[0]) {
$fehler= 'Dieser Char geh&ouml;rt nicht dir!'; $fehler= 'Dieser Char geh&ouml;rt nicht dir!';
} }

@ -16,9 +16,9 @@ function checkCookies($nickname, $yps) {
if (isset ($nick_name2) && strtolower($nick_name2) != strtolower($nickname)) { if (isset ($nick_name2) && strtolower($nick_name2) != strtolower($nickname)) {
// Ha!!! Da ist doch was faul!! // Ha!!! Da ist doch was faul!!
// sortiere die namen // 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 (); $muser = array ();
while ($row = mysql_fetch_assoc($m_user_qry)) { while ($row = mysqli_fetch_assoc($m_user_qry)) {
$muser[] = $row; $muser[] = $row;
} }
if (count($muser) != 2) { if (count($muser) != 2) {
@ -26,17 +26,17 @@ function checkCookies($nickname, $yps) {
} }
// Neue Tabelle // Neue Tabelle
$sql = 'INSERT INTO multiuser(user1, user2, occured, type) values(\'' . $muser[0]['id'] . '\', \'' . $muser[1]['id'] . '\',CURRENT_TIMESTAMP, \'Cookie\')'; $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(){ function detectNonCodeEnterers(){
$qry = mysql_query('Select * from bot_images WHERE TIMESTAMPDIFF(MINUTE, created, now()) > 10'); $qry = db_query('Select * from bot_images WHERE TIMESTAMPDIFF(MINUTE, created, now()) > 10');
mysql_query('DELETE from bot_images WHERE TIMESTAMPDIFF(MINUTE, created, now()) > 10 '); db_query('DELETE from bot_images WHERE TIMESTAMPDIFF(MINUTE, created, now()) > 10 ');
while($row = mysql_fetch_assoc($qry)){ 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'].'\')'; $sql = 'Insert into bot_image_failures(userid, inserted, valid, used) values('.$row['userid'].', \'!NOTHING!\', \''.$row['compressed_phrase'].'\', \''.$row['created'].'\')';
// echo $sql.'<br>'; // echo $sql.'<br>';
mysql_query($sql); db_query($sql);
} }
} }

@ -26,7 +26,7 @@ function getClan($clanid, $buffer = TRUE) {
return $GLOBALS['clan_buffered_instances'][$clanid]; // okay, we already buffered the clan :) 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 // now calculate the member, max_exp fields :D
@ -41,7 +41,7 @@ function getClan($clanid, $buffer = TRUE) {
function getClanMembersCount($clanid) { function getClanMembersCount($clanid) {
if(!is_numeric($clanid)) { return NULL; } 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']; return $row['amount'];
} }
@ -120,8 +120,8 @@ function revokeInvitation($user, $userid, $clan = NULL){
} }
if($clan === NULL) { if($clan === NULL) {
$qry = mysql_query('Select * from clan where id = ' . $user['clan']); $qry = db_query('Select * from clan where id = ' . $user['clan']);
$clan = mysql_fetch_assoc($qry); $clan = mysqli_fetch_assoc($qry);
} }
if($clan['leader'] != $user['id'] && $clan['co_leader'] != $user['id']){ 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; $sql = 'DELETE FROM user_clan_invitations WHERE clanid = '.$clan['id'].' AND userid = '.$userid;
// echo $sql . '<br>'; // echo $sql . '<br>';
mysql_query($sql); db_query($sql);
if(mysql_affected_rows() > 0){ if(db_affected_rows() > 0){
return NULL; return NULL;
} else{ } else{
return 'Einladung konnte nicht zur&uuml;ckgezogen werden!'; return 'Einladung konnte nicht zur&uuml;ckgezogen werden!';
@ -151,15 +151,15 @@ function inviteUser(array $user, $userid, array $clan = NULL){
} }
if($clan === NULL) { if($clan === NULL) {
$qry = mysql_query('Select * from clan where id = ' . $user['clan']); $qry = db_query('Select * from clan where id = ' . $user['clan']);
$clan = mysql_fetch_assoc($qry); $clan = mysqli_fetch_assoc($qry);
} }
if($clan['leader'] != $user['id'] && $clan['co_leader'] != $user['id']){ if($clan['leader'] != $user['id'] && $clan['co_leader'] != $user['id']){
return 'Nur der Leader, bzw. der Co-Leader kann neue Member einladen!'; 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) { if(!row) {
return 'Fehler! Nutzer exisitiert nicht!!'; 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()))'; $sql = 'INSERT INTO user_clan_invitations(userid, clanid, valid) values('.$userid.','.$user['clan'].',TIMESTAMPADD(DAY, 5, now()))';
// echo $sql.'<br>'; // echo $sql.'<br>';
mysql_query($sql); db_query($sql);
if(mysql_affected_rows() <= 0){ // Fehler? if(db_affected_rows() <= 0){ // Fehler?
$sql = 'UPDATE user_clan_invitations SET valid = TIMESTAMPADD(DAY, 5, now()) where userid = '.$userid.' and clanid = '.$user['clan']; $sql = 'UPDATE user_clan_invitations SET valid = TIMESTAMPADD(DAY, 5, now()) where userid = '.$userid.' and clanid = '.$user['clan'];
// echo $sql.'<br>'; // echo $sql.'<br>';
mysql_query($sql); db_query($sql);
if(mysql_affected_rows() <= 0){ // Fehler? if(db_affected_rows() <= 0){ // Fehler?
return 'Fehler! Konnte Nutzer nicht einladen!'; return 'Fehler! Konnte Nutzer nicht einladen!';
} else{ } else{
sendMessage($user['nickname'], $userid, 'Einladung in Clan', 'Die Einladung des Clans '.$clan['clanname'].' wurde aufgefrischt! Klicke auf "Clan beitreten" um die Einladung anzunehmen!'); 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'])){ 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']; $sql = 'Update user set clan = NULL where id = '.$member.' AND clan = '.$user['clan'];
// echo $sql.'<br>'; // echo $sql.'<br>';
mysql_query($sql); db_query($sql);
if(mysql_affected_rows() > 0){ // Soll nur ausgeführt werden, wenn member wirklich gekickt wurde!! 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; $sql = 'Update chars set clan_train = NULL where besitzer = '.$member;
mysql_query($sql); db_query($sql);
if($user['id'] != $member) { 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&uuml;ssen!'); sendMessage($user['nickname'], $member, 'Clan rauswurf!', 'Du wurdest von '.$user['nickname'].' aus deinem Clan geworfen. Du wirst dir wohl einen neuen suchen m&uuml;ssen!');
} else if($clan['exp'] == 0 && $clan['level'] == 1 && getClanMembersCount($user['clan']) == 0) { } 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!! // 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']); db_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_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{ } else{
echo displayErrorMessage(NULL, 'Du kannst den Member nicht feuern!', displayHistoryBackLink()); echo displayErrorMessage(NULL, 'Du kannst den Member nicht feuern!', displayHistoryBackLink());
@ -216,8 +216,8 @@ function fireMember($user, $member){
* *
*/ */
function getAllClans() { function getAllClans() {
$qry = mysql_query('SELECT id,clanname FROM clan;'); $qry = db_query('SELECT id,clanname FROM clan;');
while ($result = mysql_fetch_assoc($qry)) { while ($result = mysqli_fetch_assoc($qry)) {
$clans[] = $result; $clans[] = $result;
} }
return $clans; return $clans;
@ -228,7 +228,7 @@ function joinClan($user, $clanid, $check_invitation = true){
isClanLocked($clanid); // we only require the calculation not the result! 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();'; $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){ if($clan_user || !$check_invitation){
$clan = getClan($clanid); $clan = getClan($clanid);
@ -241,13 +241,13 @@ function joinClan($user, $clanid, $check_invitation = true){
} else{ } else{
$sql = 'UPDATE user SET clan = '.$clanid.' WHERE id = '.$user['id']; $sql = 'UPDATE user SET clan = '.$clanid.' WHERE id = '.$user['id'];
// echo $sql.'<br>'; // echo $sql.'<br>';
mysql_query($sql); db_query($sql);
// unset the leader if the user is moving from one clan to another // 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); db_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); db_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']); db_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('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) { if($check_invitation) {
displayErrorMessage('Aufgenommen','Du wurdest erfolgreich in den Clan aufgenommen!','<a href="index.php?as=clan/clan_info">weiter</a>'); displayErrorMessage('Aufgenommen','Du wurdest erfolgreich in den Clan aufgenommen!','<a href="index.php?as=clan/clan_info">weiter</a>');
@ -257,12 +257,12 @@ function joinClan($user, $clanid, $check_invitation = true){
displayErrorMessage(NULL,'Konnte die Einladung des Clans nicht annehmen!',displayHistoryBackLink()); displayErrorMessage(NULL,'Konnte die Einladung des Clans nicht annehmen!',displayHistoryBackLink());
return; 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){ function denyClan($user, $clanid){
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);
if(mysql_affected_rows() > 0){ if(db_affected_rows() > 0){
displayErrorMessage('Abgelehnt','Du hast die Einladung erfolgreich abgelehnt!','<a href="index.php?as=clan/add">weiter</a>'); displayErrorMessage('Abgelehnt','Du hast die Einladung erfolgreich abgelehnt!','<a href="index.php?as=clan/add">weiter</a>');
} else{ } else{
displayErrorMessage(NULL,'Einladung des Clans konnte nicht abgelehnt werden!',displayHistoryBackLink()); displayErrorMessage(NULL,'Einladung des Clans konnte nicht abgelehnt werden!',displayHistoryBackLink());
@ -280,15 +280,15 @@ function deleteClan($userid) {
// Okay notify the members :) // Okay notify the members :)
$qry = mysql_query('SELECT id FROM user WHERE clan = '.$user['clan']); $qry = db_query('SELECT id FROM user WHERE clan = '.$user['clan']);
while($member = mysql_fetch_assoc($qry)) { while($member = mysqli_fetch_assoc($qry)) {
sendMessage($user['nickname'], $member['id'], 'Clan wurde gelöscht!', 'Dein Clan wurde von '.$user['nickname'].' gel&ouml;scht. Du wirst dir wohl einen neuen suchen m&uuml;ssen!'); sendMessage($user['nickname'], $member['id'], 'Clan wurde gelöscht!', 'Dein Clan wurde von '.$user['nickname'].' gel&ouml;scht. Du wirst dir wohl einen neuen suchen m&uuml;ssen!');
} }
// Check if this clan is level 0 and has 0 exp ... // Check if this clan is level 0 and has 0 exp ...
if($clan['exp'] == 0 && $clan['level'] == 1) { if($clan['exp'] == 0 && $clan['level'] == 1) {
// really do delete the clan !! // really do delete the clan !!
mysql_query('DELETE FROM clan where id = '.$user['clan']); db_query('DELETE FROM clan where id = '.$user['clan']);
} else { } else {
// cleanup the clan! // cleanup the clan!
$sql1 = 'UPDATE user SET clan = NULL WHERE clan = ' . $clanid; $sql1 = 'UPDATE user SET clan = NULL WHERE clan = ' . $clanid;
@ -298,8 +298,8 @@ function deleteClan($userid) {
// echo $sql1 . '<br>'; // echo $sql1 . '<br>';
// echo $sql2 . '<br>'; // echo $sql2 . '<br>';
mysql_query($sql1); db_query($sql1);
mysql_query($sql2); db_query($sql2);
} }
return NULL; return NULL;
@ -308,15 +308,15 @@ function deleteClan($userid) {
function conquerClan($clanid, $userid) { function conquerClan($clanid, $userid) {
// It is possible to enter a clan that is empty :) // It is possible to enter a clan that is empty :)
$user = getUser($userid); $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) { if($result[0] != 0) {
return 'Der Clan ('.$clanid.') ist nicht leer!'; return 'Der Clan ('.$clanid.') ist nicht leer!';
} }
$sql = 'UPDATE clan SET leader = ' . $userid . ' WHERE leader is NULL AND id = '. $clanid; $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) { if(!$done) {
return 'Der Clan ist schon &uuml;bernommen worden!'; return 'Der Clan ist schon &uuml;bernommen worden!';
} }
@ -327,8 +327,8 @@ function conquerClan($clanid, $userid) {
} }
function setMeAsLeader($user){ function setMeAsLeader($user){
mysql_query('UPDATE clan set leader = '.$user['id'].' WHERE id = '.$user['clan'].' and leader IS null AND co_leader IS null'); db_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; return db_affected_rows() > 0;
} }
@ -354,8 +354,8 @@ function sendClanNewsletter($user, $text){
} }
$errors = FALSE; $errors = FALSE;
$sql = 'SELECT id FROM user WHERE clan='.$user['clan']; $sql = 'SELECT id FROM user WHERE clan='.$user['clan'];
$clans = mysql_query($sql); $clans = db_query($sql);
while($row = mysql_fetch_assoc($clans)) { while($row = mysqli_fetch_assoc($clans)) {
$errors |= !sendMessage($user['nickname'], $row['id'], $clan['clanname'].' Nachricht', $text); $errors |= !sendMessage($user['nickname'], $row['id'], $clan['clanname'].' Nachricht', $text);
} }
if($errors) { if($errors) {
@ -378,15 +378,15 @@ function addClanExp($clan_id, $exp) {
$n_exp = 0; $n_exp = 0;
$n_level++; $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']); db_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) { 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&auml;ren ' . $n_exp . ' bei level ' .$n_level; echo 'Fehler beim zuweisen der Clanexp, dadurch sind dem Clan mit der ID ' . $clan['level'] . ' ' .$exp . ' exp fl&omul;ten gegangen!! Neue exp w&auml;ren ' . $n_exp . ' bei level ' .$n_level;
} else { } else {
$money = getMoneyBonusByLevel($n_level); $money = getMoneyBonusByLevel($n_level);
if($money > 0) { if($money > 0) {
// nice we can give the clan some money :D // nice we can give the clan some money :D
insertClanTickerMessage($clan_id, 'Durch Erreichen von Level ' .$n_level . ' habt ihr ' . displayMoney($money) . ' bekommen!!'); 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 );
} }
} }
} }

@ -21,7 +21,7 @@ include_once(ROOT_PATH.'/include/messagefunctions.inc.php');
*/ */
function createChatRoom(array $clan_ids, $foreign_identifier) { function createChatRoom(array $clan_ids, $foreign_identifier) {
db_query('INSERT INTO clan_chatrooms(foreign_id) values(\''.$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!'; return 'Konnte den Clanchatroom nicht erstellen, da er schon exisitert!';
} }
$chat_id = getClanChatId($foreign_identifier); $chat_id = getClanChatId($foreign_identifier);
@ -36,7 +36,7 @@ function createChatRoom(array $clan_ids, $foreign_identifier) {
* @param string $foreign_identifier * @param string $foreign_identifier
*/ */
function getClanChatId($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]; return $row[0];
} }
@ -48,7 +48,7 @@ function checkAccessRights($user_id, $clan_chat_id) {
if(!$qry) { if(!$qry) {
return false; return false;
} }
return mysql_num_rows($qry); return mysqli_stmt_num_rows($qry);
} }
function sendClanChatMessage($user_id, $clan_chat_id, $message) { function sendClanChatMessage($user_id, $clan_chat_id, $message) {
@ -60,9 +60,9 @@ function sendClanChatMessage($user_id, $clan_chat_id, $message) {
if(!qry) { if(!qry) {
return 'COULD NOT EXECUTE A QUERY!!!'; 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] .')'); $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; break;
} }
} }
@ -82,12 +82,12 @@ function getClanChatMessages($requester, $clan_chat_id, $count, $asc, $msg_id =
if(is_numeric($msg_id)) { if(is_numeric($msg_id)) {
$sql .= ' AND msg_id > ' .$msg_id; $sql .= ' AND msg_id > ' .$msg_id;
} else { } 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 .= ' AND msg_id > ' . ($max_id_row[0] - $count);
} }
$sql .= ' ORDER BY msg_id ASC LIMIT ' .$count; $sql .= ' ORDER BY msg_id ASC LIMIT ' .$count;
$qry = db_query($sql); $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']); $result['max_id'] = max($result['max_id'], $row['msg_id']);
$message = stripslashes(encodeNoHTMLWithBB(stripslashes($row['message']))); $message = stripslashes(encodeNoHTMLWithBB(stripslashes($row['message'])));
$result['chat_rows'][] = formatTimestampShortYear($row['zeit']) . ' ' . generateUserNameByID($row['user_id']) . ': ' . $message; $result['chat_rows'][] = formatTimestampShortYear($row['zeit']) . ' ' . generateUserNameByID($row['user_id']) . ': ' . $message;

@ -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? // 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())'; $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) { if($row['anzahl'] > 0) {
semaphoreDown($ressource_clan1); // free the previously reserved semaphore! semaphoreDown($ressource_clan1); // free the previously reserved semaphore!
semaphoreDown($ressource_clan2); // 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) // 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'; $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 .'<br>'; //echo $sql .'<br>';
$row = mysql_fetch_assoc(mysql_query($sql)); $row = mysqli_fetch_assoc(db_query($sql));
if($row['anzahl'] > 0) { if($row['anzahl'] > 0) {
semaphoreDown($ressource_clan1); // free the previously reserved semaphore! semaphoreDown($ressource_clan1); // free the previously reserved semaphore!
semaphoreDown($ressource_clan2); // 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! // 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; $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 .'<br>'; //echo $sql .'<br>';
$row = mysql_fetch_assoc(mysql_query($sql)); $row = mysqli_fetch_assoc(db_query($sql));
if($row['anzahl'] > 0) { if($row['anzahl'] > 0) {
semaphoreDown($ressource_clan1); // free the previously reserved semaphore! 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! // 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'])) { 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!'); 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())'; $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) { if(!$clan_challenge) {
return 'Konnte die Herausforderung nicht annehmen, da diese Herausforderung nicht exisitiert!'; 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'])) { if(isClanLocked($clan_challenge['clan_challenged']) || isClanLocked($clan_challenge['clan_requester'])) {
// okay we cannot accept the challenge so make it inactive! // 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)!'; 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? // 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; $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 . '<br>'; // echo $sql . '<br>';
$row = mysql_fetch_assoc(mysql_query($sql)); $row = mysqli_fetch_assoc(db_query($sql));
if($row['anzahl'] > 0) { 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!'; 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']); $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 // 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'])) { 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!'); 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; $id = -1;
// get id // get id
while(!$finished) { while(!$finished) {
$row = mysql_fetch_row(mysql_query('select IFNULL(max(clan_challenge_id),0) + 1 from clan_challenges')); $row = mysqli_fetch_row(db_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'].')'); db_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; $finished = db_affected_rows() > 0;
$id = $row[0]; $id = $row[0];
} }
// insert the participants :) // 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'].')'; $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'].')'; $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 :) // 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())'; $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 .'<br>'; // echo $sql .'<br>';
$clan_challenge = mysql_fetch_assoc(mysql_query($sql)); $clan_challenge = mysqli_fetch_assoc(db_query($sql));
if(!$clan_challenge) { if(!$clan_challenge) {
return 'Konnte die Herausforderung nicht zur&uuml;ckziehen, da diese Herausforderung nicht exisitiert!'; return 'Konnte die Herausforderung nicht zur&uuml;ckziehen, da diese Herausforderung nicht exisitiert!';
@ -280,7 +280,7 @@ function cancelChallengeRequest($challenged_clan, array $user) {
} }
// okay seems to be okay // 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'])) { 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!'); 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())'; $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 . '<br>'; // echo $sql . '<br>';
$clan_challenge = mysql_fetch_assoc(mysql_query($sql)); $clan_challenge = mysqli_fetch_assoc(db_query($sql));
if(!$clan_challenge) { if(!$clan_challenge) {
return 'Konnte die Herausforderung nicht ablehnen, da diese Herausforderung nicht exisitiert!'; 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 // 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'])) { 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!'); 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 :) 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); $qry = db_query('SELECT * from clan_challenges WHERE clan_challenge_id = ' .$challenge_id);
$GLOBALS['clan_challenge_buffered_instances'][$challenge_id] = mysql_fetch_assoc($qry); $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 :) 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.')'; $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 . '<br>'; // echo $sql . '<br>';
$qry = mysql_query($sql); $qry = db_query($sql);
while($row = mysql_fetch_assoc($qry)) { while($row = mysqli_fetch_assoc($qry)) {
$array[] = $row; $array[] = $row;
} }
return $array; 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.')'; $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 . '<br>'; // echo $sql . '<br>';
$row = mysql_fetch_row(mysql_query($sql)); $row = mysqli_fetch_row(db_query($sql));
return $row[0]; 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'; $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); $qry = db_query($sql);
while($row = mysql_fetch_row($qry)) { while($row = mysqli_fetch_row($qry)) {
$array[] = $row[0]; $array[] = $row[0];
} }
// return the ids // 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; $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); $qry = db_query($sql);
while($row = mysql_fetch_row($qry)) { while($row = mysqli_fetch_row($qry)) {
$array[] = $row[0]; $array[] = $row[0];
} }
// return the ids // return the ids
@ -431,8 +431,8 @@ function getAwatingChallengeIDs() {
$array = array(); $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()'; $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 . '<br>'; // echo $sql . '<br>';
$qry = mysql_query($sql); $qry = db_query($sql);
while($row = mysql_fetch_row($qry)) { while($row = mysqli_fetch_row($qry)) {
$array[] = $row[0]; $array[] = $row[0];
} }
// return the ids // return the ids
@ -447,8 +447,8 @@ function getHistoricalChallengeIDs($clanid, $limit = NULL) {
$addition = ' LIMIT ' .$limit; $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; $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); $qry = db_query($sql);
while($row = mysql_fetch_row($qry)) { while($row = mysqli_fetch_row($qry)) {
$array[] = $row[0]; $array[] = $row[0];
} }
// return the ids // return the ids
@ -458,8 +458,8 @@ function getHistoricalChallengeIDs($clanid, $limit = NULL) {
function getParticipatingClanIDs($clan_challenge_id) { function getParticipatingClanIDs($clan_challenge_id) {
$array = array(); $array = array();
$sql = 'SELECT clan_id FROM clan_challenge_clans AS ccp WHERE clan_challenge_id = ' . $clan_challenge_id . ' ORDER BY id'; $sql = 'SELECT clan_id FROM clan_challenge_clans AS ccp WHERE clan_challenge_id = ' . $clan_challenge_id . ' ORDER BY id';
$qry = mysql_query($sql); $qry = db_query($sql);
while($row = mysql_fetch_row($qry)) { while($row = mysqli_fetch_row($qry)) {
$array[] = $row[0]; $array[] = $row[0];
} }
// return the ids // return the ids
@ -468,24 +468,24 @@ function getParticipatingClanIDs($clan_challenge_id) {
function getParticipatingClanData($clan_challenge_id, $clan_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; $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) { if(!$qry) {
echo $sql .'<br>'; echo $sql .'<br>';
} }
return mysql_fetch_assoc($qry); return mysqli_fetch_assoc($qry);
} }
function isCharBusyWithClanfighting($char_id) { 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; $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; return $row[0] > 0;
} }
function getParticipatingCharIDs($clan_challenge_id, $clan_id) { function getParticipatingCharIDs($clan_challenge_id, $clan_id) {
$array = array(); $array = array();
$sql = 'SELECT char_id, slot FROM clan_challenge_participants WHERE clan_challenge_id = ' . $clan_challenge_id . ' AND clan_id = ' .$clan_id; $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); $qry = db_query($sql);
while($row = mysql_fetch_assoc($qry)) { while($row = mysqli_fetch_assoc($qry)) {
$array[$row['slot']] = $row['char_id']; $array[$row['slot']] = $row['char_id'];
} }
// return the ids // return the ids
@ -494,7 +494,7 @@ function getParticipatingCharIDs($clan_challenge_id, $clan_id) {
function getParticipatingChar($clan_challenge_id, $clan_id, $char_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); $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; return $row;
} }
@ -504,7 +504,7 @@ function getClanLockedTime($clan_id) {
return 0; return 0;
} }
$sql = 'SELECT TIMESTAMPDIFF(SECOND, NOW(), locked_until) FROM clan_locked WHERE clanid = ' . $clan_id; $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) if($row)
return $row[0]; return $row[0];
return 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 // 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; $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.'<br>'; // echo $sql.'<br>';
$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 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 // 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['members'] >= MIN_MEMBERS) {
if($lock['lock'] === 0) { // If data is available in 'clan_locked' remove it 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()'; $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 :) // key so every thing seems to be fine :)
@ -538,23 +538,23 @@ function isClanLocked($clanid) {
// INSERT // INSERT
$sql = 'INSERT INTO clan_locked(clanid, locked_until) values('.$clanid.', TIMESTAMPADD(HOUR, 24, CURRENT_TIMESTAMP))'; $sql = 'INSERT INTO clan_locked(clanid, locked_until) values('.$clanid.', TIMESTAMPADD(HOUR, 24, CURRENT_TIMESTAMP))';
// echo $sql.'<br>'; // echo $sql.'<br>';
$res = mysql_query($sql); $res = db_query($sql);
if(!$res) if(!$res)
echo $sql . '<br>'; echo $sql . '<br>';
mysql_query('UPDATE clan_challenge_requests SET active = FALSE WHERE (clan_challenged = '.$clanid.' OR clan_requester = '.$clanid); db_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('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 } else if($lock['members'] < MIN_MEMBERS){ // we have to update the actual row
// UPDATE // UPDATE
$sql = 'UPDATE clan_locked set locked_until = TIMESTAMPADD(HOUR, 24, CURRENT_TIMESTAMP) WHERE clanid = ' .$clanid; $sql = 'UPDATE clan_locked set locked_until = TIMESTAMPADD(HOUR, 24, CURRENT_TIMESTAMP) WHERE clanid = ' .$clanid;
// echo $sql.'<br>'; // echo $sql.'<br>';
$res = mysql_query($sql); $res = db_query($sql);
if(!$res) if(!$res)
echo $sql . '<br>'; echo $sql . '<br>';
} }
} else if($lock['members'] < MIN_MEMBERS) { } else if($lock['members'] < MIN_MEMBERS) {
$sql = 'UPDATE clan_locked set locked_until = TIMESTAMPADD(HOUR, 24, CURRENT_TIMESTAMP) WHERE clanid = ' .$clanid; $sql = 'UPDATE clan_locked set locked_until = TIMESTAMPADD(HOUR, 24, CURRENT_TIMESTAMP) WHERE clanid = ' .$clanid;
// echo $sql.'<br>'; // echo $sql.'<br>';
$res = mysql_query($sql); $res = db_query($sql);
if(!$res) if(!$res)
echo $sql . '<br>'; echo $sql . '<br>';
} }
@ -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 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!! // okay now check if the fetch-time is reached!!
if($char['status'] == 'Schatz Suche') { 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') { } else if($char['status'] == 'Clanfight') {
if(isCharBusyWithClanfighting($charid)) { if(isCharBusyWithClanfighting($charid)) {
$row[0] = '???'; // we do not know when the fight is starting! $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); $row[0] = getEventStatusBlocked($char_id);
} }
} else { } 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) { 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&uuml;r ' . $row[0] . ' Sekunden mit ' . $char['status']. ' besch&auml;ftigt ist!'; return 'Du kannst den Char \''.$char['name'].'\' nicht an dem Kampf teilnehmen lassen, da er im Moment noch f&uuml;r ' . $row[0] . ' Sekunden mit ' . $char['status']. ' besch&auml;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?? // 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); $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 = mysql_fetch_assoc($qry); $row = mysqli_fetch_assoc($qry);
if($row['anzahl'] != 0) { if($row['anzahl'] != 0) {
semaphoreDown($ressource); 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!'; 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') .')'; $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) { if(!$res) {
echo $sql .'<br>'; echo $sql .'<br>';
} }
if(mysql_affected_rows() == 0) { if(db_affected_rows() == 0) {
if(!$forced) { if(!$forced) {
// maybe the leader has already assigned the char and we now give the official okay for that! // 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); semaphoreDown($ressource);
if($forced) { if($forced) {
semaphoreDown($ressource2); 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]. 'WHERE ccp.clan_challenge_id = cc.clan_challenge_id AND clan_id = '.$clan_ids[1].
') = ' . $clan_challenge['anzahl_chars']; ') = ' . $clan_challenge['anzahl_chars'];
mysql_query($sql); db_query($sql);
$rows = mysql_affected_rows(); $rows = db_affected_rows();
semaphoreDown($ressource); semaphoreDown($ressource);
if($forced) { if($forced) {
semaphoreDown($ressource2); 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! // 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? // 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; $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.'; 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 !!! // kay, finish him !!!
$sql = 'DELETE FROM clan_challenges WHERE clan_challenge_id = ' .$clan_challenge_id . ' AND calculated = FALSE'; $sql = 'DELETE FROM clan_challenges WHERE clan_challenge_id = ' .$clan_challenge_id . ' AND calculated = FALSE';
// echo $sql . '<br>'; // echo $sql . '<br>';
$res = mysql_query($sql); $res = db_query($sql);
if(!$res) if(!$res)
return 'Beim zur&uuml;ckziehen des Clan-Fights ist ein technischer Fehler aufgetreten!'; return 'Beim zur&uuml;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); $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) .')'; $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) if(!$res)
echo 'Could not execute QUERY : ' .$sql .'<br>'; echo 'Could not execute QUERY : ' .$sql .'<br>';
@ -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; $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) { if(!$res) {
echo $sql.'<br>'; echo $sql.'<br>';
return 'Konnte Datenbank-Anfrage nicht durchf&uuml;hren ... breche Skript ab!'; return 'Konnte Datenbank-Anfrage nicht durchf&uuml;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']){ 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]; $sql = 'UPDATE clan_challenge_clans SET points = points + 1 WHERE clan_challenge_id = ' . $clan_challenge_id . ' AND clan_id = ' .$clan_ids[0];
// echo $sql . '<br>'; // echo $sql . '<br>';
mysql_query($sql); db_query($sql);
} else { } else {
$sql = 'UPDATE clan_challenge_clans SET points = points + 1 WHERE clan_challenge_id = ' . $clan_challenge_id . ' AND clan_id = ' .$clan_ids[1]; $sql = 'UPDATE clan_challenge_clans SET points = points + 1 WHERE clan_challenge_id = ' . $clan_challenge_id . ' AND clan_id = ' .$clan_ids[1];
// echo $sql . '<br>'; // echo $sql . '<br>';
mysql_query($sql); db_query($sql);
} }
} }
return $start_time + ($runde-1) * $duration; 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 // the loser is of clan 1
$char_clan_1 = $clan_char_array[$clan_ids[0]][++$counter_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 $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 { } else {
// the loser is of clan 2 // the loser is of clan 2
$char_clan_2 = $clan_char_array[$clan_ids[1]][++$counter_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 $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; $sql = 'DELETE FROM `clan_challenge_whitelist` WHERE `user_id` IN (' . implode(',', $remove) .') AND `clan_id` = ' . $clan_id;
// echo $sql . '<br>'; // echo $sql . '<br>';
mysql_query($sql); db_query($sql);
foreach($add as $user_id) { foreach($add as $user_id) {
$sql = 'INSERT INTO `clan_challenge_whitelist`(`user_id`, `clan_id`) values('.$user_id.', '.$clan_id.')'; $sql = 'INSERT INTO `clan_challenge_whitelist`(`user_id`, `clan_id`) values('.$user_id.', '.$clan_id.')';
// echo $sql . '<br>'; // echo $sql . '<br>';
mysql_query($sql); db_query($sql);
} }
} }
function getAuthorizedClanfightCoordinatorIDs($clan_id) { function getAuthorizedClanfightCoordinatorIDs($clan_id) {
$sql = 'SELECT user_id as id FROM `clan_challenge_whitelist` WHERE `clan_id` = '.$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(); $return = array();
while($row = mysql_fetch_assoc($qry)) { while($row = mysqli_fetch_assoc($qry)) {
$return[] = $row['id']; $return[] = $row['id'];
} }
return $return; return $return;
@ -1046,7 +1046,7 @@ function isAuthorizedClanfightCoordinator($clan_id, $user_id, $clan_fight_id = N
if($clan_fight_id !== NULL) { 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; $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 . '<br>'; // echo $sql . '<br>';
$row = mysql_fetch_row(mysql_query($sql)); $row = mysqli_fetch_row(db_query($sql));
if($row[0] <= 0) { if($row[0] <= 0) {
// okay, maybe its a leader ;) // okay, maybe its a leader ;)
$clan = getClan($clan_id); $clan = getClan($clan_id);
@ -1063,7 +1063,7 @@ function isAuthorizedClanfightCoordinator($clan_id, $user_id, $clan_fight_id = N
} else { } else {
// it is a more general thing ;) // it is a more general thing ;)
$sql = 'SELECT COUNT(*) FROM `clan_challenge_whitelist` WHERE `user_id` = ' .$user_id. ' AND `clan_id` = '.$clan_id; $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) { if($row[0] <= 0) {
// okay, maybe its a leader ;) // okay, maybe its a leader ;)
$clan = getClan($clan_id); $clan = getClan($clan_id);
@ -1103,7 +1103,7 @@ function calculateClanExperience(array $clan1, array $clan2, $winner) {
*/ */
function getCountLeaderAssignedChars($clan_id, $clan_fight_id) { 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'); $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]; return $row[0];
} }

@ -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'); //db_query('Update referer set anzahl = anzahl + 1 where url = \''.$referer.'\' and datum = CURRENT_DATE');
//if(mysql_affected_rows() == 0){ //if(db_affected_rows() == 0){
// mysql_query('Insert into referer(url, anzahl, datum) values(\''.$referer.'\', 1, CURRENT_DATE)'); // db_query('Insert into referer(url, anzahl, datum) values(\''.$referer.'\', 1, CURRENT_DATE)');
//} //}
$name = validateName($_COOKIE['name']); $name = validateName($_COOKIE['name']);
@ -51,14 +51,14 @@ if(!checkCookiePassword($name, $passwort)){
$POLOE = 1; $POLOE = 1;
$user_ida = array(); $user_ida = array();
} else { } else {
$user_ida = mysql_fetch_assoc(mysql_query("SELECT * FROM user WHERE nickname='$name' LIMIT 1")); $user_ida = mysqli_fetch_assoc(db_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']); 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) { 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) { if ($user_ida['id'] != null) {
$as = 'profil'; $as = 'profil';

@ -15,8 +15,8 @@ $GLOBALS['definesEditable'] = array();
function initializeDefines() { function initializeDefines() {
$sql = 'SELECT * from defines'; $sql = 'SELECT * from defines';
$qry = mysql_query($sql); $qry = db_query($sql);
while($row = mysql_fetch_assoc($qry)) { while($row = mysqli_fetch_assoc($qry)) {
if(!defined($row['key'])) { if(!defined($row['key'])) {
define($row['key'], $row['value']); define($row['key'], $row['value']);
$GLOBALS['definesEditable'][$row['key']] = $row['editable']; $GLOBALS['definesEditable'][$row['key']] = $row['editable'];
@ -34,13 +34,13 @@ function defineIfNotDefined($key, $value, $editable = TRUE) {
if(!defined($key)) { if(!defined($key)) {
// we seem that we need to insert this key - value pair! // we seem that we need to insert this key - value pair!
$sql = 'INSERT INTO defines(`key`, `value`, `editable`) values(\''.$key.'\', \''.$value.'\', \''.$editable.'\')'; $sql = 'INSERT INTO defines(`key`, `value`, `editable`) values(\''.$key.'\', \''.$value.'\', \''.$editable.'\')';
mysql_query($sql); db_query($sql);
define($key, $value); define($key, $value);
} else if($GLOBALS['definesEditable'][$key] != $editable){ } else if($GLOBALS['definesEditable'][$key] != $editable){
// if the editableness of this value has been changed, adjust the database ;) // if the editableness of this value has been changed, adjust the database ;)
$sql = 'UPDATE defines SET editable = ' . ($editable?'1':'0') . ' WHERE `key` = \'' .$key.'\''; $sql = 'UPDATE defines SET editable = ' . ($editable?'1':'0') . ' WHERE `key` = \'' .$key.'\'';
// echo $sql.'<br>'; // echo $sql.'<br>';
mysql_query($sql); db_query($sql);
} }
} }
@ -66,7 +66,7 @@ function getDefines($prefix = NULL) {
} }
$result = array(); $result = array();
while($row = mysql_fetch_assoc($qry)) { while($row = mysqli_fetch_assoc($qry)) {
$result[] = $row; $result[] = $row;
} }
@ -80,7 +80,7 @@ function setDefine($key, $value) {
// set where editable true // set where editable true
$sql = 'UPDATE defines SET `value` = \''.$value.'\' WHERE `key` = \''.$key.'\' AND editable = TRUE'; $sql = 'UPDATE defines SET `value` = \''.$value.'\' WHERE `key` = \''.$key.'\' AND editable = TRUE';
$qry = db_query($sql); $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 'Konnte den define ' . $key . ' nicht auf ' . $value . ' setzen';
} }
return NULL; return NULL;

@ -43,7 +43,7 @@ function generateUserNameByID($userid, $showClanTags = TRUE){
$groups = getUserGroups($userid); $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; $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, WERBUNG_AN)){
if(isUserInGroup($groups, ADMIN)){ if(isUserInGroup($groups, ADMIN)){
$color = 'style="color:'.GROUP_COLOR_GAMEMASTER.'"'; $color = 'style="color:'.GROUP_COLOR_GAMEMASTER.'"';
@ -98,12 +98,12 @@ function generateAttackNameByID($attackid, $withColor = TRUE) {
} }
$sql = 'SELECT * from attacken WHERE id = ' .$attackid; $sql = 'SELECT * from attacken WHERE id = ' .$attackid;
$qry = mysql_query($sql); $qry = db_query($sql);
$row = mysql_fetch_assoc($qry); $row = mysqli_fetch_assoc($qry);
$qry = db_query('SELECT farbe FROM `attackentyp` where name = \'' . $row['type'].'\''); $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].'"'; $color = 'style="color:'.$row_color[0].'"';
if($withColor) { if($withColor) {
@ -115,8 +115,8 @@ function generateAttackNameByID($attackid, $withColor = TRUE) {
function displayClanLink($clanid, $clanname = NULL){ function displayClanLink($clanid, $clanname = NULL){
if($clanname === NULL) { if($clanname === NULL) {
$qry = mysql_query('SELECT clanname FROM clan WHERE id = ' . $clanid); $qry = db_query('SELECT clanname FROM clan WHERE id = ' . $clanid);
$row = mysql_fetch_assoc($qry); $row = mysqli_fetch_assoc($qry);
$clanname = $row['clanname']; $clanname = $row['clanname'];
} }
return '<a href="index.php?as=clan/clan_info&clan_id='.$clanid.'">'.$clanname.'</a>'; return '<a href="index.php?as=clan/clan_info&clan_id='.$clanid.'">'.$clanname.'</a>';
@ -137,7 +137,7 @@ function generateCharLinkByID($charid, $showAvatar = FALSE, $showClanTags = FALS
$suffix = null; $suffix = null;
if($showClanTags) { 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); $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_pre = $row['clanz_pre'];
$clan_su = $row['clanz_suff']; $clan_su = $row['clanz_suff'];
} }

@ -15,8 +15,8 @@ function getSpendebarometer($databasename){
// 7-12 Monate = Gruen // 7-12 Monate = Gruen
// ++ = Violett // ++ = Violett
$qry = mysql_query('select sum(betrag)+sum(malus) as saldo from '.$databasename.'.umsatz'); $qry = db_query('select sum(betrag)+sum(malus) as saldo from '.$databasename.'.umsatz');
$row = mysql_fetch_assoc($qry); $row = mysqli_fetch_assoc($qry);
$monate = $row['saldo'] / $kosten; $monate = $row['saldo'] / $kosten;
$color = 'violet'; $color = 'violet';
@ -43,8 +43,8 @@ function getSpendebarometer($databasename){
function getSpenden($databasename){ function getSpenden($databasename){
$spendeline = '<table width="100%">'; $spendeline = '<table width="100%">';
$qry = mysql_query('Select * from '.$databasename.'.umsatz where kommentar like \'%Spende%\' order by datum desc'); $qry = db_query('Select * from '.$databasename.'.umsatz where kommentar like \'%Spende%\' order by datum desc');
while($row = mysql_fetch_assoc($qry)){ while($row = mysqli_fetch_assoc($qry)){
$spendeline .= '<tr><th class="content">'. $row['instanz'] . '</th><td class="content" width="50%">'.$row['kommentar'].'</td><td class="content">'.$row['betrag'].' '.$row['waehrung'].'</td><td class="content">'.$row['datum'].'</td></tr>'; $spendeline .= '<tr><th class="content">'. $row['instanz'] . '</th><td class="content" width="50%">'.$row['kommentar'].'</td><td class="content">'.$row['betrag'].' '.$row['waehrung'].'</td><td class="content">'.$row['datum'].'</td></tr>';
} }
$spendeline .= '</table>'; $spendeline .= '</table>';

@ -109,7 +109,7 @@ function erstelleChar($user, $rassen_id, $newname = '', $picture = '', $lvl = 1,
//echo $sql.'<br>'; //echo $sql.'<br>';
$identifier = db_query($sql); $identifier = db_query($sql);
if($identifier == FALSE){ 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()); displayErrorMessage(NULL,'Name schon vorhanden!!',displayHistoryBackLink());
} else{ } else{
displayErrorMessage(NULL,'Erstellen fehlgeschlagen!!',displayHistoryBackLink()); displayErrorMessage(NULL,'Erstellen fehlgeschlagen!!',displayHistoryBackLink());
@ -118,11 +118,11 @@ function erstelleChar($user, $rassen_id, $newname = '', $picture = '', $lvl = 1,
} }
if($race['name'] != 'NPC') { 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'); db_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'); db_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=3, aktiv=1, besitzer='.$charsw_id['id'].', name=\'Block\', dauer=0');
} }
return true; // Hat geklappt return true; // Hat geklappt
} }

@ -37,9 +37,9 @@ defineIfNotDefined('KEY_ITM_CHAR1', 'ITM_CHAR1');
function createEvent($type) { function createEvent($type) {
while(!$finished) { while(!$finished) {
$sql = 'SELECT IFNULL(max(event_id),0) + 1 FROM events'; $sql = 'SELECT IFNULL(max(event_id),0) + 1 FROM events';
$row = mysql_fetch_row(mysql_query($sql)); $row = mysqli_fetch_row(db_query($sql));
mysql_query('INSERT INTO events(event_id, event_type) values('.$row[0].', \''.$type.'\')'); db_query('INSERT INTO events(event_id, event_type) values('.$row[0].', \''.$type.'\')');
$finished = mysql_affected_rows() > 0; $finished = db_affected_rows() > 0;
$id = $row[0]; $id = $row[0];
} }
@ -62,8 +62,8 @@ function addParticipant($event_id, array $char) {
// echo $sql . '<br>'; // echo $sql . '<br>';
mysql_query($sql); db_query($sql);
if(mysql_affected_rows() == 0) if(db_affected_rows() == 0)
return NULL; return NULL;
return $char['id']; return $char['id'];
} }
@ -90,13 +90,13 @@ function persistFight($event_id, array $combinedArray, $startTimestamp, $endTime
$finished = FALSE; $finished = FALSE;
while(!$finished) { while(!$finished) {
$sql = 'SELECT IFNULL(max(event_fight_id),0) + 1 FROM event_fights WHERE event_id = ' .$event_id; $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).'\')'; $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 . '<br>'; echo $sql . '<br>';
break; break;
} }
$finished = mysql_affected_rows() > 0; $finished = db_affected_rows() > 0;
$event_fight_id = $row[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).'\')'; $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) if(!$res)
echo $sql .'<br>'; echo $sql .'<br>';
// now persist char2 // 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 = '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).'\')'; $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) if(!$res)
echo $sql .'<br>'; echo $sql .'<br>';
} }
@ -132,10 +132,10 @@ function persistFight($event_id, array $combinedArray, $startTimestamp, $endTime
foreach ($data as $key => $value) { 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.'\')'; $sql = 'INSERT INTO event_fight_metadata(event_id, event_fight_id, `key`, `value`) values('.$event_id.','.$event_fight_id.',\''.$key.'\',\''.$value.'\')';
// echo $sql . ' <br>'; // echo $sql . ' <br>';
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) { 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; $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 . '<br>'; // echo $sql . '<br>';
$qry = mysql_query($sql); $qry = db_query($sql);
$row = mysql_fetch_assoc($qry); $row = mysqli_fetch_assoc($qry);
switch ($row['event_type']) { switch ($row['event_type']) {
case EVENT_TEST: case EVENT_TEST:
return 'Test'; return 'Test';
@ -166,7 +166,7 @@ function getEventStatus($charid) {
function getOngoingEventCount($charid) { function getOngoingEventCount($charid) {
$sql = 'SELECT count(*) FROM event_chars e WHERE abgeholt = FALSE AND char_id = ' .$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]; return $row[0];
} }
@ -174,24 +174,24 @@ function getOngoingEventCount($charid) {
function getEventStatusBlocked($charid) { function getEventStatusBlocked($charid) {
$sql = 'SELECT Timestampdiff(Second,now(),MAX(block_end)) FROM event_chars WHERE abgeholt = FALSE AND char_id = ' . $charid; $sql = 'SELECT Timestampdiff(Second,now(),MAX(block_end)) FROM event_chars WHERE abgeholt = FALSE AND char_id = ' . $charid;
// echo $sql . '<br>'; // echo $sql . '<br>';
$row = mysql_fetch_row(mysql_query($sql)); $row = mysqli_fetch_row(db_query($sql));
return $row[0]; return $row[0];
} }
function isEventToFetchAwaiting($charid) { function isEventToFetchAwaiting($charid) {
$sql = 'SELECT count(*) FROM event_chars e WHERE abgeholt = FALSE AND char_id = ' .$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; return $row[0] > 0;
} }
function getEventIdsToFetch($char_id) { 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'; $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) if(!$qry)
echo $sql . '<br>'; echo $sql . '<br>';
$result = array(); $result = array();
while ($row = mysql_fetch_row($qry)) { while ($row = mysqli_fetch_row($qry)) {
$result[] = $row[0]; $result[] = $row[0];
} }
return $result; return $result;
@ -255,19 +255,19 @@ function abholenChar(array $user, $event_id, $char_id) {
// Okay and now we want to learn the attacks :) // 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'; $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) if(!$qry)
echo $sql .'<br>'; echo $sql .'<br>';
$attacken_usage = array(); $attacken_usage = array();
while($row = mysql_fetch_assoc($qry)) { while($row = mysqli_fetch_assoc($qry)) {
$attacken_usage[] = array('id' => $row['attack'], 'anzahl' => $row['anzahl']); $attacken_usage[] = array('id' => $row['attack'], 'anzahl' => $row['anzahl']);
} }
addAttackUsageToChar($char_id, $attacken_usage); addAttackUsageToChar($char_id, $attacken_usage);
$sql = 'UPDATE event_chars SET abgeholt = TRUE WHERE char_id = ' . $char_id . ' AND event_id = ' . $event_id; $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) if(!$qry)
echo $sql .'<br>'; echo $sql .'<br>';
@ -277,14 +277,14 @@ function abholenChar(array $user, $event_id, $char_id) {
function getEvent($event_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) if($result)
return $result; return $result;
return NULL; return NULL;
} }
function getEventChar($event_id, $event_char_id) { 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) if($result)
return $result; return $result;
return NULL; return NULL;
@ -292,24 +292,24 @@ function getEventChar($event_id, $event_char_id) {
} }
function getEventFight($event_id, $event_fight_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) if($result)
return $result; return $result;
return NULL; return NULL;
} }
function getEventFightMetaData($event_id, $event_fight_id) { 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); $qry = db_query('SELECT * FROM event_fight_metadata WHERE event_id = ' . $event_id. ' AND event_fight_id = ' .$event_fight_id);
while($row = mysql_fetch_assoc($qry)) { while($row = mysqli_fetch_assoc($qry)) {
$result[$row['key']]= $row['value']; $result[$row['key']]= $row['value'];
} }
return $result; return $result;
} }
function getEventFightIds($event_id) { 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(); $result = array();
while($row = mysql_fetch_assoc($qry)) { while($row = mysqli_fetch_assoc($qry)) {
$result[]= $row['event_fight_id']; $result[]= $row['event_fight_id'];
} }
return $result; return $result;
@ -318,10 +318,10 @@ function getEventFightIds($event_id) {
// this is more tricky XD // this is more tricky XD
function getEventFightIdsByChar($event_id, $event_char_id) { 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'; $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) if(!$qry)
echo $sql . '<br>'; echo $sql . '<br>';
while($row = mysql_fetch_assoc($qry)) { while($row = mysqli_fetch_assoc($qry)) {
$result[]= $row['event_fight_id']; $result[]= $row['event_fight_id'];
} }
return $result; return $result;
@ -330,12 +330,12 @@ function getEventFightIdsByChar($event_id, $event_char_id) {
function getEventFightRoundData($event_id, $event_fight_id, $round) { 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; $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) { if(!$qry) {
echo $sql . '<br>'; echo $sql . '<br>';
return; return;
} }
while($row = mysql_fetch_assoc($qry)) { while($row = mysqli_fetch_assoc($qry)) {
$result[$row['event_char_id']] = $row; $result[$row['event_char_id']] = $row;
} }
return $result; return $result;

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

@ -18,15 +18,15 @@ include_once(ROOT_PATH.'/include/config/db.inc.php');
include_once(ROOT_PATH.'/include/parse.inc.php'); include_once(ROOT_PATH.'/include/parse.inc.php');
function insertFaqEntry($parent, $header, $body){ 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(){ function getAllFaqEntries(){
$sql = 'Select * from faq_entries order by parent'; $sql = 'Select * from faq_entries order by parent';
$qry = mysql_query($sql); $qry = db_query($sql);
$returnArray = array(); $returnArray = array();
$tempArray[0] = & $returnArray; $tempArray[0] = & $returnArray;
while($result = mysql_fetch_assoc($qry)){ while($result = mysqli_fetch_assoc($qry)){
$tempArray[$result['parent']][$result['id']]['node'] = $result; $tempArray[$result['parent']][$result['id']]['node'] = $result;
$tempArray[$result['id']] = & $tempArray[$result['parent']][$result['id']]; $tempArray[$result['id']] = & $tempArray[$result['parent']][$result['id']];
} }
@ -84,60 +84,60 @@ function getContext($pre1, $pre2, $app1, $app2){
function getEntry($faqentry){ function getEntry($faqentry){
$sql = 'Select * from faq_entries WHERE id = '.$faqentry; $sql = 'Select * from faq_entries WHERE id = '.$faqentry;
$qry = mysql_query($sql); $qry = db_query($sql);
return mysql_fetch_assoc($qry); return mysqli_fetch_assoc($qry);
} }
function updateEntry($faqentry, $parent,$header,$body){ function updateEntry($faqentry, $parent,$header,$body){
$parentpart = $parent!=null?'parent = '.$parent.',':''; $parentpart = $parent!=null?'parent = '.$parent.',':'';
$sql = 'UPDATE faq_entries SET '.$parentpart.' header = \''.encodeNoHTMLWithBB($header).'\', body = \''.encodeNoHTMLWithBB($body).'\' WHERE id = '.$faqentry; $sql = 'UPDATE faq_entries SET '.$parentpart.' header = \''.encodeNoHTMLWithBB($header).'\', body = \''.encodeNoHTMLWithBB($body).'\' WHERE id = '.$faqentry;
mysql_query($sql); db_query($sql);
} }
function moveUp($faqentry){ function moveUp($faqentry){
$entry = getEntry($faqentry); $entry = getEntry($faqentry);
$sql = 'Select * from faq_entries WHERE parent = '.$entry['parent'].' AND id < '.$entry['id'].' order by id desc LIMIT 1'; $sql = 'Select * from faq_entries WHERE parent = '.$entry['parent'].' AND id < '.$entry['id'].' order by id desc LIMIT 1';
$qry = mysql_query($sql); $qry = db_query($sql);
$entry2 = mysql_fetch_assoc($qry); $entry2 = mysqli_fetch_assoc($qry);
if(!$entry2){ // Er ist schon der höchste if(!$entry2){ // Er ist schon der höchste
return; return;
} }
$sql2 = 'Select * from faq_entries WHERE parent = '.$faqentry; $sql2 = 'Select * from faq_entries WHERE parent = '.$faqentry;
$qry2 = mysql_query($sql2); $qry2 = db_query($sql2);
while($row = mysql_fetch_assoc($qry2)){ while($row = mysqli_fetch_assoc($qry2)){
$ids[] = $row['id']; $ids[] = $row['id'];
} }
mysql_query('UPDATE faq_entries SET header = \''.$entry2['header'].'\', body = \''.$entry2['body'].'\' where id = '.$entry['id']); db_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 = \''.$entry['header'].'\', body = \''.$entry['body'].'\' where id = '.$entry2['id']);
mysql_query('Update faq_entries SET parent = '.$entry['id'].' where parent = '.$entry2['id']); db_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 = '.$entry2['id'].' where id IN ('.join($ids, ',').')');
} }
function moveDown($faqentry){ function moveDown($faqentry){
$entry = getEntry($faqentry); $entry = getEntry($faqentry);
$sql = 'Select * from faq_entries WHERE parent = '.$entry['parent'].' AND id > '.$entry['id'].' order by id asc LIMIT 1'; $sql = 'Select * from faq_entries WHERE parent = '.$entry['parent'].' AND id > '.$entry['id'].' order by id asc LIMIT 1';
$qry = mysql_query($sql); $qry = db_query($sql);
$entry2 = mysql_fetch_assoc($qry); $entry2 = mysqli_fetch_assoc($qry);
if(!$entry2){ // Er ist schon der höchste if(!$entry2){ // Er ist schon der höchste
return; return;
} }
$sql2 = 'Select * from faq_entries WHERE parent = '.$faqentry; $sql2 = 'Select * from faq_entries WHERE parent = '.$faqentry;
$qry2 = mysql_query($sql2); $qry2 = db_query($sql2);
while($row = mysql_fetch_assoc($qry2)){ while($row = mysqli_fetch_assoc($qry2)){
$ids[] = $row['id']; $ids[] = $row['id'];
} }
mysql_query('UPDATE faq_entries SET header = \''.$entry2['header'].'\', body = \''.$entry2['body'].'\' where id = '.$entry['id']); db_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 = \''.$entry['header'].'\', body = \''.$entry['body'].'\' where id = '.$entry2['id']);
mysql_query('Update faq_entries SET parent = '.$entry['id'].' where parent = '.$entry2['id']); db_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 = '.$entry2['id'].' where id IN ('.join($ids, ',').')');
} }
function getChildren($faqentry){ function getChildren($faqentry){
$sql = 'Select * from faq_entries where parent = '.$faqentry.' order by id asc'; $sql = 'Select * from faq_entries where parent = '.$faqentry.' order by id asc';
$qry = mysql_query($sql); $qry = db_query($sql);
while($row = mysql_fetch_assoc($qry)){ while($row = mysqli_fetch_assoc($qry)){
$ret[] = $row; $ret[] = $row;
} }
return $ret; return $ret;

@ -16,9 +16,9 @@ include_once(ROOT_PATH.'/include/char.inc.php');
* @return boolean if the insert was successful * @return boolean if the insert was successful
*/ */
function insertIntoHallOfFame($title, $charid, $userid){ 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); $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)){ if(!$row || is_null($char) || is_null($user)){
return false; return false;
@ -57,12 +57,12 @@ function insertIntoHallOfFameFull($round = '', $title = '', $charid = '', $charn
} }
$sql = 'INSERT INTO highscore('.$columns.') values('.$values.')'; $sql = 'INSERT INTO highscore('.$columns.') values('.$values.')';
// echo $sql.'<br>'; // echo $sql.'<br>';
$qry = mysql_query($sql); $qry = db_query($sql);
return mysql_affected_rows() > 0; return db_affected_rows() > 0;
} }
function getHallOfFameEntryCount($title, $userid) { 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); 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; $sql = 'SELECT COUNT(*) FROM highscore WHERE art=\''.$title.'\' AND runde='.$round.' AND userid='.$userid;
// echo $sql .'<br>'; // echo $sql .'<br>';
$row = mysql_fetch_row(mysql_query($sql)); $row = mysqli_fetch_row(db_query($sql));
return $row[0]; return $row[0];
} }

@ -17,23 +17,23 @@ function hasToAuthenticate($user){
} }
function hasNotDoneAction($user, $count = 1){ 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){ 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){ function resetUserCounter($user){
$char_count = count(getCharsOfUser($user['id'])); $char_count = count(getCharsOfUser($user['id']));
// pro Char werden dem User 6-8 Aktionen zugestanden // 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){ function checkImageCode($id, $compr_phrase, $user){
$sql = 'SELECT *, TIMESTAMPDIFF(MINUTE, created, now()) as delay from bot_images WHERE id = \'' . $id . '\''; $sql = 'SELECT *, TIMESTAMPDIFF(MINUTE, created, now()) as delay from bot_images WHERE id = \'' . $id . '\'';
// echo $sql.'<br>'; // echo $sql.'<br>';
$row = mysql_fetch_assoc(mysql_query($sql)); $row = mysqli_fetch_assoc(db_query($sql));
// ID not valid // ID not valid
if($row){ if($row){
// TIMEOUT! // TIMEOUT!
@ -41,12 +41,12 @@ function checkImageCode($id, $compr_phrase, $user){
if($row['delay'] > 5 || strtolower($row['compressed_phrase']) != strtolower($compr_phrase)){ 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)'; $sql = 'Insert into bot_image_failures(userid, inserted, valid, used) values('.$user['id'].', \''.$compr_phrase.'\', \''.$row['compressed_phrase'].'\', CURRENT_TIMESTAMP)';
// echo $sql.'<br>'; // echo $sql.'<br>';
mysql_query($sql); db_query($sql);
$success = false; $success = false;
} else{ } else{
$success = true; $success = true;
} }
mysql_query('DELETE from bot_images WHERE id = \'' . $id . '\''); db_query('DELETE from bot_images WHERE id = \'' . $id . '\'');
} else{ } else{
$success = false; $success = false;
} }
@ -65,8 +65,8 @@ function createImage($id, $user) {
for (; $i < 6; $i++) { for (; $i < 6; $i++) {
$string .= ' '; $string .= ' ';
} }
mysql_query('DELETE from bot_images WHERE id = \'' . $id . '\''); db_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('INSERT INTO bot_images(id, phrase, compressed_phrase, created, userid) values(\'' . $id . '\', \'' . $string . '\', \'' . $comp_str . '\', now(), '.$user['id'].')');
// Aufräumen (Code wurde ignoriert) // Aufräumen (Code wurde ignoriert)
detectNonCodeEnterers(); detectNonCodeEnterers();
@ -81,7 +81,7 @@ function displayImage($id, $user) {
createImage($id,$user); createImage($id,$user);
$sql = 'SELECT * FROM bot_images WHERE id = \'' . $id . '\''; $sql = 'SELECT * FROM bot_images WHERE id = \'' . $id . '\'';
// echo $sql.'<br>'; // echo $sql.'<br>';
$row = mysql_fetch_assoc(mysql_query($sql)); $row = mysqli_fetch_assoc(db_query($sql));
if($row){ if($row){
$string = $row['phrase']; $string = $row['phrase'];
$variance = true; $variance = true;

@ -40,9 +40,9 @@ if($k_attacke1_2[$x]) {
} }
if($new_tech1 == 1) { if($new_tech1 == 1) {
$technick1 = mysql_fetch_array(mysql_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke1_2[$x]' LIMIT 10")); $technick1 = mysqli_fetch_array(db_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke1_2[$x]' LIMIT 10"));
$prozent_technik1 = (20*$technick1['aktiv'])-20; $prozent_technik1 = (20*$technick1['aktiv'])-20;
$technick1 = mysql_fetch_array(mysql_query("SELECT * FROM attacken WHERE id='$technick1[at_id]' LIMIT 10")); $technick1 = mysqli_fetch_array(db_query("SELECT * FROM attacken WHERE id='$technick1[at_id]' LIMIT 10"));
} }
} }
@ -80,9 +80,9 @@ if($k_attacke2_2[$x]) {
} }
if($new_tech2 == 1) { if($new_tech2 == 1) {
$technick2 = mysql_fetch_array(mysql_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke2_2[$x]' LIMIT 10")); $technick2 = mysqli_fetch_array(db_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke2_2[$x]' LIMIT 10"));
$prozent_technik2 = (20*$technick2['aktiv'])-20; $prozent_technik2 = (20*$technick2['aktiv'])-20;
$technick2 = mysql_fetch_array(mysql_query("SELECT * FROM attacken WHERE id='$technick2[at_id]' LIMIT 10")); $technick2 = mysqli_fetch_array(db_query("SELECT * FROM attacken WHERE id='$technick2[at_id]' LIMIT 10"));
} }
} }

@ -29,7 +29,7 @@ class Kaempfer{
*/ */
function __construct($char, $alternative = true, $buffs = true){ function __construct($char, $alternative = true, $buffs = true){
if(is_numeric($char)){ // ID, wenn keine Abfrage vorhanden 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 } else if(!is_array($char)){ // Wenn es weder ID noch Array ist
return; // breche ab, dann kann nichts mit angefangen werden return; // breche ab, dann kann nichts mit angefangen werden
} }
@ -43,7 +43,7 @@ class Kaempfer{
$this->charid = $char['id']; $this->charid = $char['id'];
if($buffs == true){ // Ruestungen erlaubt??? 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']; $this->starke += $char_buffs['starke'];
$k_speed[0] = $char['speed'] + $char_buffs['speed']; $k_speed[0] = $char['speed'] + $char_buffs['speed'];
$this->verteidigung += $char_buffs['verteidigung']; $this->verteidigung += $char_buffs['verteidigung'];
@ -61,8 +61,8 @@ class Monster extends Kaempfer{
function __construct($monster){ function __construct($monster){
if(is_numeric($monster)){ if(is_numeric($monster)){
$qry = mysql_query('SELECT * FROM quest_monster WHERE id = '.$monster); $qry = db_query('SELECT * FROM quest_monster WHERE id = '.$monster);
$monster = mysql_fetch_assoc($qry); $monster = mysqli_fetch_assoc($qry);
} else if(!is_array($monster)){ } else if(!is_array($monster)){
// Fehler // Fehler
return; return;
@ -75,7 +75,7 @@ class Monster extends Kaempfer{
class Attacke{ class Attacke{
function __construct($attacke){ function __construct($attacke){
if(is_numeric($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)){ } else if(!is_array($attacke)){
// Fehler!! // Fehler!!
return; return;
@ -90,7 +90,7 @@ class Attackenauswahl{
private $attacke2; private $attacke2;
function __construct($char){ function __construct($char){
if(is_numeric($char)){ // ID, wenn keine Abfrage vorhanden 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 } else if(!is_array($char)){ // Wenn es weder ID noch Array ist
return; // breche ab, dann kann nichts mit angefangen werden return; // breche ab, dann kann nichts mit angefangen werden
} }
@ -102,8 +102,8 @@ class Attackenauswahl{
// Zwischenschritt ANFANG // Zwischenschritt ANFANG
// Nun ein Zwischenschritt weil in den Feldern attacken und attacken2 // 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'].')'); $qry = db_query('Select at_id, id from lernen where id IN ('.$char['attacken'].','.$char['attacken2'].')');
while($row = mysql_fetch_assoc($qry)){ while($row = mysqli_fetch_assoc($qry)){
$transition[$row['id']] = $row['at_id']; $transition[$row['id']] = $row['at_id'];
} }
for($i=0;$i<count($this->attacke1);$i++){ for($i=0;$i<count($this->attacke1);$i++){
@ -114,8 +114,8 @@ class Attackenauswahl{
// Zwischenschritt ENDE!!! // Zwischenschritt ENDE!!!
// Lade die Attacken aus der DB und schreibe sie direkt in den Array // 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).')'); $qry = db_query('Select * from attacken where id IN ('.join(',',$this->attacke1).','.join(',',$this->attacke2).')');
while($row = mysql_fetch_assoc($qry)){ while($row = mysqli_fetch_assoc($qry)){
$temp_att[$row['id']] = $row; $temp_att[$row['id']] = $row;
} }
for($i=0;$i<count($this->attacke1);$i++){ for($i=0;$i<count($this->attacke1);$i++){

@ -9,7 +9,7 @@
####################KAIOKEN SPIELER 1 ####################KAIOKEN SPIELER 1
if($technick1['type'] == 'frucht') { if($technick1['type'] == 'frucht') {
$frucht_stats1 = mysql_fetch_array(mysql_query("SELECT starke, ver, speed, ausdauer, glueck FROM wochen_markt WHERE item='$chara_1[frucht]' LIMIT 1")); $frucht_stats1 = mysqli_fetch_array(db_query("SELECT starke, ver, speed, ausdauer, glueck FROM wochen_markt WHERE item='$chara_1[frucht]' LIMIT 1"));
$k_mp[0] = $k_mp[0] - $technick1['mp']; $k_mp[0] = $k_mp[0] - $technick1['mp'];
$k_hp[0] = $k_hp[0] - $technick1['hp']; $k_hp[0] = $k_hp[0] - $technick1['hp'];
if($k_mp[0] < 0) { if($k_mp[0] < 0) {
@ -29,7 +29,7 @@ if($technick1['type'] == 'frucht') {
####################KAIOKEN SPIELER 2 ####################KAIOKEN SPIELER 2
if($technick2['type'] == 'frucht') { if($technick2['type'] == 'frucht') {
$frucht_stats2 = mysql_fetch_array(mysql_query("SELECT starke, ver, speed, ausdauer, glueck FROM wochen_markt WHERE item='$chara_2[frucht]' LIMIT 1")); $frucht_stats2 = mysqli_fetch_array(db_query("SELECT starke, ver, speed, ausdauer, glueck FROM wochen_markt WHERE item='$chara_2[frucht]' LIMIT 1"));
$k_mp[1] = $k_mp[1] - $technick2['mp']; $k_mp[1] = $k_mp[1] - $technick2['mp'];
$k_hp[1] = $k_hp[1] - $technick2['hp']; $k_hp[1] = $k_hp[1] - $technick2['hp'];
if($k_mp[1] < 0) { if($k_mp[1] < 0) {

@ -11,7 +11,7 @@
if($runden_gif1) { if($runden_gif1) {
if($runden_gif1 > $x) { if($runden_gif1 > $x) {
$technick1_old = mysql_fetch_array(mysql_query("SELECT * FROM attacken WHERE id='$attacken_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_starke[1] = $k_starke[1] - $technick1_old['starke'];
$k_speed[1] = $k_speed[1] - $technick1_old['speed']; $k_speed[1] = $k_speed[1] - $technick1_old['speed'];
@ -55,7 +55,7 @@ $aktion_AV1[$x] = 'nein';
if($runden_gif2) { if($runden_gif2) {
if($runden_gif2 > $x) { if($runden_gif2 > $x) {
$technick2_old = mysql_fetch_array(mysql_query("SELECT * FROM attacken WHERE id='$attacken_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_starke[0] = $k_starke[0] - $technick2_old['starke'];
$k_speed[0] = $k_speed[0] - $technick2_old['speed']; $k_speed[0] = $k_speed[0] - $technick2_old['speed'];

@ -21,7 +21,7 @@ if ($technick1['type'] == 'tausch2') {
$k_ver[0] = round($k_ver[0] * 1.1); $k_ver[0] = round($k_ver[0] * 1.1);
$aktion_AV1[$x] = 'nein'; $aktion_AV1[$x] = 'nein';
} else { } 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['speed'] = $technick1['speed'] + (($technick1['speed'] / 100) * $prozent_technik1);
$technick1['verteidigung'] = $technick1['verteidigung'] + (($technick1['verteidigung'] / 100) * $prozent_technik1); $technick1['verteidigung'] = $technick1['verteidigung'] + (($technick1['verteidigung'] / 100) * $prozent_technik1);
$technick1['starke'] = $technick1['starke'] + (($technick1['starke'] / 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); $k_ver[1] = round($k_ver[1] * 1.1);
$aktion_AV2[$x] = 'nein'; $aktion_AV2[$x] = 'nein';
} else { } 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['speed'] = $technick2['speed'] + (($technick2['speed'] / 100) * $prozent_technik2);
$technick2['verteidigung'] = $technick2['verteidigung'] + (($technick2['verteidigung'] / 100) * $prozent_technik2); $technick2['verteidigung'] = $technick2['verteidigung'] + (($technick2['verteidigung'] / 100) * $prozent_technik2);

@ -220,7 +220,7 @@ function displaySchatzSuche($char){
include_once(ROOT_PATH.'/include/schatz.inc.php'); include_once(ROOT_PATH.'/include/schatz.inc.php');
// Erstmal die Schatzsuche-stammdaten laden! // Erstmal die Schatzsuche-stammdaten laden!
$sql = 'Select * from quests where charid ='.$char['id'].' and dauer < now()'; $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.'<br>'; // echo $sql.'<br>';
if(!$quest){ if(!$quest){
return 'Schatzsuche noch nicht beendet!!'; return 'Schatzsuche noch nicht beendet!!';
@ -240,24 +240,24 @@ function displaySchatzSuche($char){
// Erstmal die Seite starten // Erstmal die Seite starten
echo '<html><head><link rel="stylesheet" type="text/css" href="design/FightStyle.css"></head><body><table width="100%">'; echo '<html><head><link rel="stylesheet" type="text/css" href="design/FightStyle.css"></head><body><table width="100%">';
// Einfach mal ne dicke Ueberschrift // 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 '<tr><th class="top" colspan="3">Schatzsuche in '.$ort['stadt'].'</th></tr>'; echo '<tr><th class="top" colspan="3">Schatzsuche in '.$ort['stadt'].'</th></tr>';
// Hole die Ergebnisse die auch in die Datenbank eingetragen werden muessen! // 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 // 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_qf = mysqli_fetch_assoc(db_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'])); $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 = mysql_fetch_assoc(mysql_query('Select * from quest_rounds where roundnr = '.$end_qr['mr'].' and 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 = mysql_fetch_assoc(mysql_query('Select * from quest_fights where 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! // 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'; $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.'<br>'; // echo $sql.'<br>';
$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; $c_attacken[] = $row_r;
// print_r($c_attacken); // print_r($c_attacken);
// echo '<br>'; // echo '<br>';
@ -269,10 +269,10 @@ function displaySchatzSuche($char){
$items = getSchatzItems($row['anzahl']); $items = getSchatzItems($row['anzahl']);
for($i=0;$items[$i];$i++){ 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']); $res = db_query('Update quest_item_stats set anzahl = anzahl + 1 WHERE monster = '.$row['anzahl'].' and id = '.$items[$i]['id']);
if(mysql_affected_rows() == 0){ if(db_affected_rows() == 0){
// entry not yet present // 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{ } 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)); $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(mysql_affected_rows() == 0){ if(db_affected_rows() == 0){
mysql_query('INSERT INTO quest_stats (monster, zeit, anzahl, status) values('.$row['anzahl'].', '.$std.', 1, '.($final_result=='won'?1: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! // Zeige als erstes die Zusammenfassung an!
@ -296,8 +296,8 @@ function displaySchatzSuche($char){
// Lade nun die Fights runter // Lade nun die Fights runter
$sql = 'Select * from quest_fights where charid = '.$char['id'].' ORDER BY fightnr ASC'; $sql = 'Select * from quest_fights where charid = '.$char['id'].' ORDER BY fightnr ASC';
$qry = mysql_query($sql); $qry = db_query($sql);
while($fight = mysql_fetch_assoc($qry)){ while($fight = mysqli_fetch_assoc($qry)){
displaySchatzSucheFight($quest, $char, $fight); displaySchatzSucheFight($quest, $char, $fight);
} }
@ -309,7 +309,7 @@ function displaySchatzSuche($char){
function displaySchatzSucheFight($quest, $char, $fight){ function displaySchatzSucheFight($quest, $char, $fight){
// Lade das Monster aus der Datenbank // Lade das Monster aus der Datenbank
$sql = 'select * from quest_monster where id = '.$fight['monsterid']; $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'] == ''){ if($monster['bild'] == null || $monster['bild'] == ''){
$monster['bild'] = 'design/bilder/avatare/noavart.gif'; $monster['bild'] = 'design/bilder/avatare/noavart.gif';
@ -319,8 +319,8 @@ function displaySchatzSucheFight($quest, $char, $fight){
echo '<tr><th class="top" colspan="3">'.$char['name'].' Vs '.$monster['name'].'</th></tr>'; echo '<tr><th class="top" colspan="3">'.$char['name'].' Vs '.$monster['name'].'</th></tr>';
$sql = 'Select * from quest_rounds where charid = '.$char['id']. ' and fightnr = '.$fight['fightnr']; $sql = 'Select * from quest_rounds where charid = '.$char['id']. ' and fightnr = '.$fight['fightnr'];
// echo $sql.'<br>'; // echo $sql.'<br>';
$qry = mysql_query($sql); $qry = db_query($sql);
while($round = mysql_fetch_assoc($qry)){ while($round = mysqli_fetch_assoc($qry)){
displaySchatzSucheFightRound($char, $monster, $fight, $round); displaySchatzSucheFightRound($char, $monster, $fight, $round);
} }
displaySummary($char['name'], $monster['name'], $fight['sieger']==$char['id']?$char['name']:$monster['name'], $fight['exp'], 0, $fight['geld'], 0); 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 // 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()'; $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 . '<br>'; //echo $sql . '<br>';
$event_fight_data = mysql_fetch_assoc(mysql_query($sql)); $event_fight_data = mysqli_fetch_assoc(db_query($sql));
if(!$event_fight_data){ if(!$event_fight_data){
displayFightNotAvailable(); displayFightNotAvailable();
echo '</table></body></html>'; echo '</table></body></html>';
@ -372,8 +372,8 @@ function displayEventFight($event_id, $event_fight_id) {
// Okay and now get the data of the chars ;) // 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)'; $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 . '<br>'; // echo $sql . '<br>';
$qry = mysql_query($sql); $qry = db_query($sql);
while($row = mysql_fetch_assoc($qry)) { while($row = mysqli_fetch_assoc($qry)) {
if($row['char_bild'] == null || $row['char_bild'] == ''){ if($row['char_bild'] == null || $row['char_bild'] == ''){
$row['char_bild'] = 'design/bilder/avatare/noavart.gif'; $row['char_bild'] = 'design/bilder/avatare/noavart.gif';
} }
@ -389,8 +389,8 @@ function displayEventFight($event_id, $event_fight_id) {
echo '<tr><th class="top" colspan="3">'.$char1['char_name'].' Vs '.$char2['char_name'].'</th></tr>'; echo '<tr><th class="top" colspan="3">'.$char1['char_name'].' Vs '.$char2['char_name'].'</th></tr>';
// now get the round data :D // 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()'; $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); $qry = db_query($sql);
while($row = mysql_fetch_assoc($qry)) { while($row = mysqli_fetch_assoc($qry)) {
if($event_fight_data['host'] == $row['event_char_id']) { if($event_fight_data['host'] == $row['event_char_id']) {
$char1_rounds[$row['round']] = $row; $char1_rounds[$row['round']] = $row;
} else { } else {
@ -404,9 +404,9 @@ function displayEventFight($event_id, $event_fight_id) {
// readout the meta-data of this fight :D // 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; $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(); $event_fight_metadata = array();
while($row = mysql_fetch_assoc($qry)) { while($row = mysqli_fetch_assoc($qry)) {
$event_fight_metadata[$row['key']] = $row['value']; $event_fight_metadata[$row['key']] = $row['value'];
} }

@ -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; $sql = 'SELECT id, at_id FROM lernen WHERE id IN ('.implode(',', $learnids).') AND besitzer = ' . $char_id;
// echo $sql .'<br>'; // echo $sql .'<br>';
$qry = mysql_query($sql); $qry = db_query($sql);
if (!$qry) { if (!$qry) {
return array(); return array();
} }
while($row = mysql_fetch_assoc($qry)) { while($row = mysqli_fetch_assoc($qry)) {
for($i=0;$i<count($learnids);$i++) { for($i=0;$i<count($learnids);$i++) {
if($learnids[$i] == $row['id']) { if($learnids[$i] == $row['id']) {
$result[$i] = $row['at_id']; $result[$i] = $row['at_id'];
@ -111,10 +111,10 @@ function calculateFight(array $char1, array $char2) {
if(count($kombined) > 0) { if(count($kombined) > 0) {
$sql = 'SELECT * FROM attacken WHERE id IN(' .implode(',', $kombined) . ')'; $sql = 'SELECT * FROM attacken WHERE id IN(' .implode(',', $kombined) . ')';
// echo $sql .'<br>'; // echo $sql .'<br>';
$qry = mysql_query($sql); $qry = db_query($sql);
$attack_data = array(); $attack_data = array();
while($row = mysql_fetch_assoc($qry)) { while($row = mysqli_fetch_assoc($qry)) {
$attack_data[$row['id']] = $row; $attack_data[$row['id']] = $row;
} }
} }

@ -32,8 +32,8 @@ function sendMessage($von, $besitzer, $betreff, $text){
$sql = 'INSERT INTO nachricht(von, besitzer, betreff, text) VALUES (\''.$von.'\', '.$besitzer.', \''.$betreff.'\', \''.$text.'\')'; $sql = 'INSERT INTO nachricht(von, besitzer, betreff, text) VALUES (\''.$von.'\', '.$besitzer.', \''.$betreff.'\', \''.$text.'\')';
// echo $sql.'<br>'; // echo $sql.'<br>';
mysql_query($sql); db_query($sql);
return mysql_affected_rows() != 0; return db_affected_rows() != 0;
} }
function colorize($text){ function colorize($text){
@ -63,7 +63,7 @@ function sendChatMessage($user,$text, $usergroups){
$nick = displayUserNameByID($user['id']); $nick = displayUserNameByID($user['id']);
} }
if($text != '' && !is_null($text)){ 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)){ if(!is_numeric($messageid)){
$messageid = 0; $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]; $maxid = $row[0];
$count = $row[1]; $count = $row[1];
if($maxid === null) { 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); $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']; $h = $row['h'];
if($h < 10){ $h = '0'.$h;} if($h < 10){ $h = '0'.$h;}
$m = $row['m']; $m = $row['m'];
@ -119,8 +119,8 @@ function insertUserTickerMessage($userid, $message, $offset = 0){
} }
for($msgid = 0; $msgid < 100000; $msgid += mt_random_wrapper(1,1000)){ for($msgid = 0; $msgid < 100000; $msgid += mt_random_wrapper(1,1000)){
$sql = 'INSERT INTO user_ticker(userid, date, msgid, text) values('.$userid.', '.$timestamp.', '.$msgid.', \''.$message.'\')'; $sql = 'INSERT INTO user_ticker(userid, date, msgid, text) values('.$userid.', '.$timestamp.', '.$msgid.', \''.$message.'\')';
mysql_query($sql); db_query($sql);
if(mysql_affected_rows() == 1){ if(db_affected_rows() == 1){
// echo 'MYSQL success: '.$sql; // echo 'MYSQL success: '.$sql;
return; return;
} }
@ -136,8 +136,8 @@ function insertClanTickerMessage($clanid, $message, $offset = 0){
} }
for($msgid = 0; $msgid < 100000; $msgid += mt_random_wrapper(1,1000)){ for($msgid = 0; $msgid < 100000; $msgid += mt_random_wrapper(1,1000)){
$sql = 'INSERT INTO clan_ticker(clanid, date, msgid, text) values('.$clanid.', now(), '.$msgid.', \''.$message.'\')'; $sql = 'INSERT INTO clan_ticker(clanid, date, msgid, text) values('.$clanid.', now(), '.$msgid.', \''.$message.'\')';
mysql_query($sql); db_query($sql);
if(mysql_affected_rows() == 1){ if(db_affected_rows() == 1){
// echo 'MYSQL success: '.$sql; // echo 'MYSQL success: '.$sql;
return; return;
} }

@ -9,12 +9,12 @@
function insertUser($user_name, $password){ function insertUser($user_name, $password){
$sql = 'SELECT * FROM user WHERE nickname like \''.$user_name.'\''; $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! // 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.'\'))'; $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! // Should do the trick!
mysql_query($sql); db_query($sql);
} }
?> ?>

@ -7,9 +7,9 @@
*/ */
// Online-Berechnungen // 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_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'));
?> ?>

@ -18,29 +18,29 @@
include_once "parse.inc.php"; include_once "parse.inc.php";
function stimme($pollid, $polloptionid, $userid, $kommentar){ 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! // NEU einfuegen!
$sql = 'INSERT INTO poll_votes(pollid, polloptionid, userid, comment) values ('.$pollid.','.$polloptionid.','.$userid.',\''.$kommentar.'\')'; $sql = 'INSERT INTO poll_votes(pollid, polloptionid, userid, comment) values ('.$pollid.','.$polloptionid.','.$userid.',\''.$kommentar.'\')';
mysql_query($sql); db_query($sql);
//echo $sql.'<br>'; //echo $sql.'<br>';
} else{ } 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) // Liefert den Datensatz der Stimme (Nr und eigener Kommentar)
function getStimme($pollid, $userid){ function getStimme($pollid, $userid){
$qry = mysql_query('SELECT * FROM poll_votes WHERE pollid = '.$pollid.' and userid = '.$userid); $qry = db_query('SELECT * FROM poll_votes WHERE pollid = '.$pollid.' and userid = '.$userid);
$result = mysql_fetch_assoc($qry); $result = mysqli_fetch_assoc($qry);
return $result; return $result;
} }
function getUmfrage($pollid){ function getUmfrage($pollid){
$umfrage = array(); $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); $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'] = mysql_fetch_assoc($qry); $umfrage['poll'] = mysqli_fetch_assoc($qry);
$qry = mysql_query('SELECT * FROM poll_options WHERE pollid ='.$pollid); $qry = db_query('SELECT * FROM poll_options WHERE pollid ='.$pollid);
while($result = mysql_fetch_assoc($qry)){ while($result = mysqli_fetch_assoc($qry)){
$umfrage['options'][$result['polloptionid']] = $result; $umfrage['options'][$result['polloptionid']] = $result;
} }
return $umfrage; return $umfrage;
@ -48,41 +48,41 @@ function getUmfrage($pollid){
function getUmfragen($entries, $page){ function getUmfragen($entries, $page){
$returnArray = array(); $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; $i=0;
while($result=mysql_fetch_assoc($qry)){ while($result=mysqli_fetch_assoc($qry)){
$returnArray[$i++] = $result; $returnArray[$i++] = $result;
} }
return $returnArray; return $returnArray;
} }
function getUmfragenCount(){ 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']; return $temp['anzahl'];
} }
function getComments($pollid, $entries, $page){ function getComments($pollid, $entries, $page){
$returnArray = array(); $returnArray = array();
$sql = 'SELECT polloptionid, comment FROM poll_votes where comment != \'\' and pollid= '.$pollid.' LIMIT '.$entries*$page.','.$entries; $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 '<br>'.$sql.'<br>'; // echo '<br>'.$sql.'<br>';
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; $returnArray[$i] = $result;
} }
return $returnArray; return $returnArray;
} }
function getCommentCount($pollid){ 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']; return $temp['anzahl'];
} }
function getPollResult($pollid){ function getPollResult($pollid){
$returnArray = array(); $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'; $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 '<br>'.$sql.'<br>'; // echo '<br>'.$sql.'<br>';
while($result = mysql_fetch_assoc($qry)){ while($result = mysqli_fetch_assoc($qry)){
$returnArray[$result['polloptionid']] = $result['anzahl']; $returnArray[$result['polloptionid']] = $result['anzahl'];
} }
return $returnArray; return $returnArray;
@ -91,8 +91,8 @@ function getPollResult($pollid){
function isOpen($pollid){ function isOpen($pollid){
$sql = 'SELECT count(*) as anzahl from poll where pollid ='.$pollid.' AND (close is null OR close > now())'; $sql = 'SELECT count(*) as anzahl from poll where pollid ='.$pollid.' AND (close is null OR close > now())';
$qry = mysql_query($sql); $qry = db_query($sql);
$row = mysql_fetch_assoc($qry); $row = mysqli_fetch_assoc($qry);
if($row['anzahl'] > 0){ if($row['anzahl'] > 0){
return true; return true;
} }

@ -25,9 +25,9 @@ function getRassen() {
*/ */
function getRaces() { function getRaces() {
if(count($GLOBALS['char_buffered_races']) == 0) { 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! // 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; $GLOBALS['char_buffered_races'][$race['id']] = $race;
} }
} }
@ -40,8 +40,8 @@ function getRassenTypeMapping() {
function getRaceTypes(){ function getRaceTypes(){
if(count($GLOBALS['char_buffered_race_types']) == 0) { if(count($GLOBALS['char_buffered_race_types']) == 0) {
$qry = mysql_query('select * from rassen_type'); $qry = db_query('select * from rassen_type');
while($racetype = mysql_fetch_assoc($qry)) { while($racetype = mysqli_fetch_assoc($qry)) {
$GLOBALS['char_buffered_race_types'][$racetype['id']] = $racetype; $GLOBALS['char_buffered_race_types'][$racetype['id']] = $racetype;
} }
} }

@ -17,14 +17,14 @@ defineIfNotDefined('ATTACK_SET_SCHATZSUCHE', 2);
function interruptSchatzSuche($charid){ function interruptSchatzSuche($charid){
mysql_query('Delete from quest_rounds where charid ='.$charid); db_query('Delete from quest_rounds where charid ='.$charid);
mysql_query('Delete from quest_fights where charid ='.$charid); db_query('Delete from quest_fights where charid ='.$charid);
mysql_query('Delete from quests where charid ='.$charid); db_query('Delete from quests where charid ='.$charid);
mysql_query('Update chars set status = \'Frei\' where id = '.$charid); db_query('Update chars set status = \'Frei\' where id = '.$charid);
} }
function getMonsterCount($ort){ 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! // 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'; $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()'; $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.'<br>'; // echo $sql.'<br>';
$qry = mysql_query($sql); // Lade alle Monster $qry = db_query($sql); // Lade alle Monster
// while($monster[] = mysql_fetch_assoc($qry)); // Lade alle monster in einen Array // while($monster[] = mysqli_fetch_assoc($qry)); // Lade alle monster in einen Array
$gesamtguete = 0; $gesamtguete = 0;
while($row = mysql_fetch_assoc($qry)){ while($row = mysqli_fetch_assoc($qry)){
if($row['guete'] == 0){ if($row['guete'] == 0){
$row['guete'] += 1; $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'] != ',,,,'){ if($chara_1['kampf_item'] != NULL && $chara_1['kampf_item'] != ',,,,'){
// echo 'Problematic Entry = '.$chara_1['kampf_item'].'<br>'; // echo 'Problematic Entry = '.$chara_1['kampf_item'].'<br>';
$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! // 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_hp_max.', '.
$in_mp_max.')'; $in_mp_max.')';
// echo 'Debug-Message: '.$sql.'<br>'; // echo 'Debug-Message: '.$sql.'<br>';
mysql_query($sql); db_query($sql);
$Dead1 = 0; $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<count($fight_monster) && $Dead1 == 0;$i++){ for($i=0;$i<count($fight_monster) && $Dead1 == 0;$i++){
$sql = 'Insert into quest_fights(charid, fightnr, monsterid)' . $sql = 'Insert into quest_fights(charid, fightnr, monsterid)' .
' values(' . ' values(' .
@ -141,7 +141,7 @@ function monsterfight_neu($chara_1, $fight_monster, $std, $ort){
$i.', ' . $i.', ' .
$fight_monster[$i]['id'].')'; $fight_monster[$i]['id'].')';
// echo $sql.'<br>'; // echo $sql.'<br>';
mysql_query($sql); db_query($sql);
// Werte uebernehmen // Werte uebernehmen
$k_starke[0] = $in_starke; $k_starke[0] = $in_starke;
$k_speed[0] = $in_speed; $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]. $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.'<br>'; // echo 'Debug Message: '.$sql.'<br>';
mysql_query($sql); db_query($sql);
$statChange_Char1 = array(); $statChange_Char1 = array();
$statChange_Char2 = array(); $statChange_Char2 = array();
@ -207,9 +207,9 @@ function monsterfight_neu($chara_1, $fight_monster, $std, $ort){
$GLOBALS['kampf']['aussetzen'] = &$aussetzten_runde; $GLOBALS['kampf']['aussetzen'] = &$aussetzten_runde;
while ($k_hp[0] > $k_aufgabe[0] AND $k_hp[1] > 0 AND $x < 10) { 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; $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'); 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]. $k_starke[1].','.$k_speed[1].','.$k_ver[1].','.$k_hp[1].','.$k_mp[1].','.$k_ausdauer[1].','.$k_glueck[1].
')'; ')';
// echo $sql.'<br>'; // echo $sql.'<br>';
mysql_query($sql); db_query($sql);
} }
###########################EXP VERTEILUNG ###########################EXP VERTEILUNG
@ -300,9 +300,9 @@ function monsterfight_neu($chara_1, $fight_monster, $std, $ort){
$geld = 0; $geld = 0;
} }
// With money on SS // 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 // 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) // 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(); $items = array();
$sql = 'SELECT * FROM sp_item where FLOOR(RAND()*wert/'.$divisor.') = 0'; $sql = 'SELECT * FROM sp_item where FLOOR(RAND()*wert/'.$divisor.') = 0';
// echo $sql.' ('.$monster_count.')<br>'; // echo $sql.' ('.$monster_count.')<br>';
$qry = mysql_query($sql); $qry = db_query($sql);
while($items[] = mysql_fetch_assoc($qry)); while($items[] = mysqli_fetch_assoc($qry));
return $items; return $items;
} }
@ -345,9 +345,9 @@ function submitCharChanges($charid, $items, $exp, $geld, $ort, $hp, $mp, $attack
$mp[0] = $mp[1]; $mp[0] = $mp[1];
} }
// Erstmal aufräumen // Erstmal aufräumen
mysql_query('Delete from quests where charid = '.$charid); db_query('Delete from quests where charid = '.$charid);
mysql_query('Delete from quest_fights where charid = '.$charid); db_query('Delete from quest_fights where charid = '.$charid);
mysql_query('Delete from quest_rounds where charid = '.$charid); db_query('Delete from quest_rounds where charid = '.$charid);
// Das leveln :) // Das leveln :)
// Erfahrung // 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 :) // 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; $sql = 'Update chars set hp=\''.$hp[0].','.$hp[1].'\', mp=\''.$mp[0].','.$mp[1].'\', ort = '.$ort.', status = \'Frei\' where id = '.$charid;
// echo $sql.'<br>'; // echo $sql.'<br>';
mysql_query($sql); db_query($sql);
// // Kohle gibts ja nichmehr :) // // Kohle gibts ja nichmehr :)
// $sql = 'Update user set geld = geld + '.$geld.' where id = '.$char['besitzer']; // $sql = 'Update user set geld = geld + '.$geld.' where id = '.$char['besitzer'];
//// echo $sql.'<br>'; //// echo $sql.'<br>';
// mysql_query($sql); // db_query($sql);
// Nun gehts zum auffinden der Items :) // Nun gehts zum auffinden der Items :)
for($i=0;$items[$i];$i++){ for($i=0;$items[$i];$i++){
// Ermittle ob es eine Teufelsfrucht ist! // Ermittle ob es eine Teufelsfrucht ist!
$sql = 'Select name, type from sp_item where id = '.$items[$i]['id']; $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'){ if($row['type'] == 'Teufels Frucht'){
$sql = 'Select id from wochen_markt where item = \''.$row['name'].'\''; $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'].')'; $sql = 'INSERT INTO wochen_ware(item, user) values('.$row2['id'].','.$char['besitzer'].')';
mysql_query($sql); db_query($sql);
} else{ } else{
$sql = 'Insert into sp_ware(item, user) values('.$items[$i]['id'].','.$char['besitzer'].')'; $sql = 'Insert into sp_ware(item, user) values('.$items[$i]['id'].','.$char['besitzer'].')';
// echo $sql.'<br>'; // echo $sql.'<br>';
mysql_query($sql); db_query($sql);
} }
} }
} }

@ -13,7 +13,7 @@ function renderSchnellleiste($user){
$Schnell_my_chars = getCharsOfUser($user['id']); $Schnell_my_chars = getCharsOfUser($user['id']);
$char_zahl = 0; $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']; $POWERLEVEL5 = $my_charz['starke']+$my_charz['verteidigung']+$my_charz['speed']+$my_charz['ausdauer']+$my_charz['glueck'];

@ -41,12 +41,12 @@ function semaphoreUP($resource){
// echo 'DEBUG: kritischer Bereich betreten<br>'; // echo 'DEBUG: kritischer Bereich betreten<br>';
} }
// Loesche alte Ressourcen // 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.'\')'; $sql = 'INSERT INTO semaphore(ressource) values(\''.$resource.'\')';
mysql_query($sql); db_query($sql);
if(mysql_affected_rows() > 0){ if(db_affected_rows() > 0){
// echo 'DEBUG: Semaphore fuer '.$ressource.' belegt!('.mysql_affected_rows().')<br>'; // echo 'DEBUG: Semaphore fuer '.$ressource.' belegt!('.db_affected_rows().')<br>';
$GLOBALS['semaphorecount']++; $GLOBALS['semaphorecount']++;
return true; return true;
} }
@ -61,8 +61,8 @@ function semaphoreUP($resource){
// @Returns TRUE if ok, FALSE on Semaphore error, NULL on MYQL Error // @Returns TRUE if ok, FALSE on Semaphore error, NULL on MYQL Error
function semaphoreDown($resource){ function semaphoreDown($resource){
$sql = 'DELETE FROM semaphore where ressource = \''.$resource.'\''; $sql = 'DELETE FROM semaphore where ressource = \''.$resource.'\'';
mysql_query($sql); db_query($sql);
if(mysql_affected_rows() == 0){ if(db_affected_rows() == 0){
// echo 'DEBUG: Semaphore '.$ressource.' war schon freigegeben<br>'; // echo 'DEBUG: Semaphore '.$ressource.' war schon freigegeben<br>';
return false; return false;
} }
@ -81,7 +81,7 @@ function semaphoreDown($resource){
* returns true, wenn Semaphore belegt ist, false wenn nicht * returns true, wenn Semaphore belegt ist, false wenn nicht
*/ */
function isSemaphoreUP($ressource){ 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(){ function installSemaphoreDatabase(){
@ -94,8 +94,8 @@ function installSemaphoreDatabase(){
')' . ')' .
'ENGINE = MYISAM ' . 'ENGINE = MYISAM ' .
'COMMENT = \'Die Tabelle, die hoffentlich alle Zugriffsprobleme loesen wird\''; 'COMMENT = \'Die Tabelle, die hoffentlich alle Zugriffsprobleme loesen wird\'';
mysql_query($sql1); db_query($sql1);
mysql_query($sql2); db_query($sql2);
} }
?> ?>

@ -7,10 +7,14 @@
*/ */
function db_query($sql) { function db_query($sql) {
$qry = mysql_query($sql); $qry = mysqli_query($GLOBALS['main_db'], $sql);
if(!$qry) { if(!$qry) {
echo $sql . '<br>'; echo $sql . '<br>';
} }
return $qry; return $qry;
} }
function db_affected_rows() {
return mysqli_affected_rows($GLOBALS['main_db']);
}

@ -79,7 +79,7 @@ function getAllTaskIds() {
if(!$qry) if(!$qry)
return array(); return array();
$result = array(); $result = array();
while($row = mysql_fetch_row($qry)) { while($row = mysqli_fetch_row($qry)) {
$result[] = $row[0]; $result[] = $row[0];
} }
return $result; return $result;
@ -96,7 +96,7 @@ function getPassedTaskIds($timestamp = NULL) {
if(!$qry) if(!$qry)
return array(); return array();
$result = array(); $result = array();
while($row = mysql_fetch_row($qry)) { while($row = mysqli_fetch_row($qry)) {
$result[] = $row[0]; $result[] = $row[0];
} }
return $result; return $result;
@ -110,7 +110,7 @@ function getTask($task_id) {
$qry = db_query('SELECT * FROM tasking WHERE task_id = ' . $task_id); $qry = db_query('SELECT * FROM tasking WHERE task_id = ' . $task_id);
if(!$qry) if(!$qry)
return null; return null;
return mysql_fetch_assoc($qry); return mysqli_fetch_assoc($qry);
} }
/** /**

@ -19,7 +19,7 @@ function getUser($userid, $buffer_enabled = true) {
} }
// Wenn Char nicht im Puffer ist, oder nicht gepuffert werden soll // Wenn Char nicht im Puffer ist, oder nicht gepuffert werden soll
if ($GLOBALS['user_buffered_instances'][$userid] == null || !$buffer_enabled) { 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; $GLOBALS['user_buffered_instances'][$userid] = $user;
} }
return $GLOBALS['user_buffered_instances'][$userid]; return $GLOBALS['user_buffered_instances'][$userid];
@ -42,12 +42,12 @@ function getOwnerOfChar($charid, $buffer_enabled = true) {
return null; 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']); return getUser($user['id']);
} }
function addMoneyToUser($userid, $amount) { 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) { function getRelevantMoney($userid) {
$user = getUser($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']; $auktionensumme = $auktionensumme['summe'];
if ($auktionensumme == 0) { if ($auktionensumme == 0) {
@ -69,7 +69,7 @@ function getRelevantMoney($userid) {
function checkSessionPasswort($userid, $password){ function checkSessionPasswort($userid, $password){
$sql = 'SELECT passwort from user where id = \''.$userid.'\''; $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){ if($row['passwort'] != null){
// echo $password.' == '.$row['passwort']; // echo $password.' == '.$row['passwort'];
return $password == $row['passwort']; return $password == $row['passwort'];
@ -81,7 +81,7 @@ function checkSessionPasswort($userid, $password){
function checkCookiePassword($username, $password){ function checkCookiePassword($username, $password){
$sql = 'SELECT passwort from user where nickname = \''.$username.'\''; $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){ if($row['passwort'] != null){
return $password == $row['passwort']; return $password == $row['passwort'];
} else{ } 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.'\''; $sql = 'SELECT SHA1(AES_ENCRYPT(\''.$password.'\',\''.$GLOBALS['PW_AES_KEY'].'\')) as encrypt_password, passwort from user where nickname = \''.$username.'\'';
// echo $sql.'<br>'; // echo $sql.'<br>';
$row = mysql_fetch_assoc(mysql_query($sql)); $row = mysqli_fetch_assoc(db_query($sql));
if($row){ if($row){
if($row['passwort'] == $pw) { if($row['passwort'] == $pw) {
return true; // already bcrypt based! return true; // already bcrypt based!
@ -120,7 +120,7 @@ function setPassword($username, $password){
$pw = encryptPassword($password); $pw = encryptPassword($password);
$sql = 'UPDATE user set passwort = \''.$pw.'\' where nickname = \''.$username.'\''; $sql = 'UPDATE user set passwort = \''.$pw.'\' where nickname = \''.$username.'\'';
// echo $sql.'<br>'; // echo $sql.'<br>';
mysql_query($sql); db_query($sql);
} }
function encryptPassword($password){ function encryptPassword($password){
@ -130,7 +130,7 @@ function encryptPassword($password){
function getUserMetaData($userid) { function getUserMetaData($userid) {
$sql = 'SELECT * FROM user_meta_data WHERE user_id = ' . $userid; $sql = 'SELECT * FROM user_meta_data WHERE user_id = ' . $userid;
$qry = mysql_query($sql); $qry = db_query($sql);
$result = array(); $result = array();
if(!$qry) if(!$qry)
@ -139,7 +139,7 @@ function getUserMetaData($userid) {
return $result; return $result;
} }
while ($row = mysql_fetch_assoc($qry)) { while ($row = mysqli_fetch_assoc($qry)) {
$result[$row['key']] = $row['value']; $result[$row['key']] = $row['value'];
} }
return $result; return $result;
@ -147,15 +147,15 @@ function getUserMetaData($userid) {
function setUserMetaDataEntry($userid, $key, $value) { function setUserMetaDataEntry($userid, $key, $value) {
$sql = 'UPDATE user_meta_data SET `value` = \''.$value.'\' WHERE user_id = \''.$userid.'\' and `key` = \''.$key.'\''; $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) if(!qry)
return; return;
if(mysql_affected_rows() > 0) if(db_affected_rows() > 0)
return; return;
$sql = 'INSERT INTO user_meta_data(user_id, `key`, `value`) values (\''.$userid.'\',\''.$key.'\',\''.$value.'\')'; $sql = 'INSERT INTO user_meta_data(user_id, `key`, `value`) values (\''.$userid.'\',\''.$key.'\',\''.$value.'\')';
$qry = mysql_query($sql); $qry = db_query($sql);
} }

@ -41,7 +41,7 @@ function getUserGroups($user) {
$i = 0; $i = 0;
if($qry) { 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']); $groups[] = array("gruppen_id" => $result['gruppen_id'], "gruppen_name" => $result['gruppen_name']);
} }
} }

@ -21,7 +21,7 @@ include_once(ROOT_PATH.'/include/messagefunctions.inc.php');
// Fuer den Transit von register_globals auf normal // Fuer den Transit von register_globals auf normal
$name = $user_ida['nickname']; $name = $user_ida['nickname'];
$passwort = $user_ida['passwort']; $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']; $as = $_REQUEST['as'];
$agb = $_REQUEST['agb']; $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($user_ida['agb'] == "nein" && $as != "info/agb") {
if($agb == 'ok'){ 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 '<form action=index.php method="get"><input type="hidden" name="as" value="'.$as.'"><input name="agb" value="ok" type="hidden">Die Regeln haben sich ver&auml;ndert. Bist du mit den neuen Regeln einverstanden? <a href="index.php?as=info/agb" target="_blank">Hier Klicken um die neuen Regeln zu lesen</a><br><input type="submit" value="Einverstanden"></form>'; echo '<form action=index.php method="get"><input type="hidden" name="as" value="'.$as.'"><input name="agb" value="ok" type="hidden">Die Regeln haben sich ver&auml;ndert. Bist du mit den neuen Regeln einverstanden? <a href="index.php?as=info/agb" target="_blank">Hier Klicken um die neuen Regeln zu lesen</a><br><input type="submit" value="Einverstanden"></form>';
exit; exit;

@ -28,7 +28,7 @@ $charm = $_GET['charm'];
function isNickChanged($user){ 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; return $row['anzahl'] != 0;
} }
@ -108,9 +108,9 @@ function display1($char_id){
function display2($user_id, $userage, $user_ida){ function display2($user_id, $userage, $user_ida){
if($userage != NULL){ 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{ } 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)) { if(!is_numeric($user_id)) {
$user_id = $user_a['id']; $user_id = $user_a['id'];
@ -134,18 +134,18 @@ function display2($user_id, $userage, $user_ida){
if($user_a['clan'] == NULL){ if($user_a['clan'] == NULL){
echo 'Keiner'; echo 'Keiner';
} else{ } 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']) ; 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! // 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']); $qry = db_query('Select id from clan where leader = ' . $user_ida['id'] . ' or co_leader = ' . $user_ida['id']);
$clan = mysql_fetch_assoc($qry); $clan = mysqli_fetch_assoc($qry);
// is there data available and if yes does the other user have the same clan? // is there data available and if yes does the other user have the same clan?
if($clan && $clan['id'] !== $user_a['clan']) { if($clan && $clan['id'] !== $user_a['clan']) {
// check if we already invited him. Then renew invitation -> // 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); $qry = db_query('Select count(*) as anzahl from user_clan_invitations where clanid = '.$clan['id'].' AND userid = ' . $user_id);
$row = mysql_fetch_assoc($qry); $row = mysqli_fetch_assoc($qry);
if ($row['anzahl'] > 0) { if ($row['anzahl'] > 0) {
$action = 'Einladung erneuern'; $action = 'Einladung erneuern';
@ -165,8 +165,8 @@ function display2($user_id, $userage, $user_ida){
<?php <?php
if(isNickChanged($user_a)){ if(isNickChanged($user_a)){
$nick_history = array(); $nick_history = array();
$nick_qry = mysql_query('Select * from user_rename where userid = '.$user_a['id'].' ORDER BY datum asc'); $nick_qry = db_query('Select * from user_rename where userid = '.$user_a['id'].' ORDER BY datum asc');
while($row = mysql_fetch_assoc($nick_qry)){ while($row = mysqli_fetch_assoc($nick_qry)){
$nick_history[] = $row['datum'].': Von "'.$row['pre_name'].'" zu "'.$row['post_name'].'"'; $nick_history[] = $row['datum'].': Von "'.$row['pre_name'].'" zu "'.$row['post_name'].'"';
} }
?> ?>
@ -212,7 +212,7 @@ function display3($tablename, $itemid){
return; 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));
?> ?>
<table cellpadding="0" cellspacing="0" width="100%" height="51"> <table cellpadding="0" cellspacing="0" width="100%" height="51">
<tr> <tr>

@ -15,11 +15,11 @@ include_once(ROOT_PATH.'/include/parse.inc.php');
// TODO: Muss noch angepasst werden! // TODO: Muss noch angepasst werden!
function showAttDetails($at_id) { 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_atk = explode(",", $at_info['req_atk']);
$req_lvl = explode(",", $at_info['req_lvl']); $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."'"));
?> ?>
<div align="center"> <div align="center">
<input type="button" value="Zur&uuml;ck" onClick="history.back()"> <input type="button" value="Zur&uuml;ck" onClick="history.back()">
@ -204,7 +204,7 @@ function showAtks($linkz,$tf='',$rassen='',$order='',$type='',$pagenum='',$fruch
$sql .= ' '.$order.' LIMIT '.($pagenum * 20).', 20 '; $sql .= ' '.$order.' LIMIT '.($pagenum * 20).', 20 ';
$attacken = db_query($sql); $attacken = db_query($sql);
while ($row = mysql_fetch_array($attacken)) { while ($row = mysqli_fetch_array($attacken)) {
?> ?>
<tr> <tr>
<td align="center" valign="top" bgcolor="#333333"><font <td align="center" valign="top" bgcolor="#333333"><font
@ -229,7 +229,7 @@ function showAtks($linkz,$tf='',$rassen='',$order='',$type='',$pagenum='',$fruch
} }
$row = mysql_fetch_row(db_query(getAttackenSQLStatement($tf, $rassen, $type, $search, 'count(attacken.id)'))); $row = mysqli_fetch_row(db_query(getAttackenSQLStatement($tf, $rassen, $type, $search, 'count(attacken.id)')));
$total = $row[0]; $total = $row[0];
$pages = ceil($total / 20); $pages = ceil($total / 20);
@ -348,7 +348,7 @@ function atksHeaderRasse($type,$link,$fruchttyp) {
$condition = getFruchtCondition($fruchttyp); $condition = getFruchtCondition($fruchttyp);
$tf_query = db_query('SELECT * FROM wochen_markt WHERE '.$condition.' 1 ORDER BY item ASC'); $tf_query = db_query('SELECT * FROM wochen_markt WHERE '.$condition.' 1 ORDER BY item ASC');
$first = true; $first = true;
while ($tf_array= mysql_fetch_assoc($tf_query)) { while ($tf_array= mysqli_fetch_assoc($tf_query)) {
if($first) { if($first) {
$first = false; $first = false;
} else { } else {
@ -451,11 +451,11 @@ if (!empty($type) AND empty($fruchttyp)) {
$link = "pagenum=$pagenum&order_art=$order_art&last_klick1=$last_klick1"; $link = "pagenum=$pagenum&order_art=$order_art&last_klick1=$last_klick1";
if ($p) { if ($p) {
if ($_GET['search']) { if ($_GET['search']) {
$anzahl_atks = mysql_num_rows(mysql_query("SELECT id FROM attacken WHERE name LIKE '%".trim($search)."%'")); $anzahl_atks = mysqli_stmt_num_rows(db_query("SELECT id FROM attacken WHERE name LIKE '%".trim($search)."%'"));
if ($anzahl_atks == 1) { if ($anzahl_atks == 1) {
$at_z = mysql_fetch_array(mysql_query("SELECT id FROM attacken WHERE name='".trim($search)."' LIMIT 1")); $at_z = mysqli_fetch_array(db_query("SELECT id FROM attacken WHERE name='".trim($search)."' LIMIT 1"));
if (empty($at_z)) { if (empty($at_z)) {
$at_z = mysql_fetch_array(mysql_query("SELECT id FROM attacken WHERE name LIKE '%".trim($search)."%' LIMIT 1")); $at_z = mysqli_fetch_array(db_query("SELECT id FROM attacken WHERE name LIKE '%".trim($search)."%' LIMIT 1"));
} }
showAttDetails($at_z['id']); showAttDetails($at_z['id']);
} else { } else {

@ -8,7 +8,7 @@
include_once(ROOT_PATH.'/include/config.inc.php'); include_once(ROOT_PATH.'/include/config.inc.php');
if($item_id) { if($item_id) {
$item_info = mysql_Fetch_array(mysql_query("SELECT * FROM item WHERE id='$item_id' LIMIT 1")); $item_info = mysqli_fetch_array(db_query("SELECT * FROM item WHERE id='$item_id' LIMIT 1"));
?> ?>
@ -117,8 +117,8 @@ exit;
if($pagenum == "" or $pagenum == 1) { $pagenum = 0; } if($pagenum == "" or $pagenum == 1) { $pagenum = 0; }
if($pagenum != "" and $pagenum != 1) { $pagenum = ($pagenum - 1) * 10; } if($pagenum != "" and $pagenum != 1) { $pagenum = ($pagenum - 1) * 10; }
$item = mysql_query("SELECT name, id FROM item LIMIT $pagenum, 10"); $item = db_query("SELECT name, id FROM item LIMIT $pagenum, 10");
while($row = mysql_Fetch_array($item)) { while($row = mysqli_fetch_array($item)) {
?> ?>
<tr> <tr>
<td width="158" height="25"> <td width="158" height="25">
@ -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); $pages = ceil($Total/10);
$z = 1; $z = 1;

@ -25,7 +25,7 @@ if ($char_id == null) {
if ($attack_id != null) { if ($attack_id != null) {
$test = 'INSERT INTO lernen(name, at_id,besitzer,aktiv) VALUES'. $test = 'INSERT INTO lernen(name, at_id,besitzer,aktiv) VALUES'.
'((SELECT name FROM attacken WHERE id ='.$attack_id.'), '.$attack_id.', '.$char_id.', 1);'; '((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_learned = getAttacksforChar($char_id, 0);
$attacks_unlearned = getAttacksforChar($char_id, 1); $attacks_unlearned = getAttacksforChar($char_id, 1);

@ -49,7 +49,7 @@ function getTradeItems($userid){
$result = NULL; $result = NULL;
$index = 0; $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 // 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 $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 union
@ -57,9 +57,9 @@ function getTradeItems($userid){
union 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)'; 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! // Damit waeren alle noetigen Datenbankaufrufe erledigt!
while($row = mysql_fetch_assoc($qry)){ while($row = mysqli_fetch_assoc($qry)){
$result[$index++] = '<option value=\''.$row['id'].','.$row['tablename'].'\'>'.$row['name'].' | Anzahl:'.$row['anzahl'].' (max: '.$row['tausch_anzahl'].')</option>'; $result[$index++] = '<option value=\''.$row['id'].','.$row['tablename'].'\'>'.$row['name'].' | Anzahl:'.$row['anzahl'].' (max: '.$row['tausch_anzahl'].')</option>';
} }
return $result; return $result;
@ -69,20 +69,20 @@ function getTradeConditions($table, $item_id) {
$row = null; $row = null;
switch ($table) { switch ($table) {
case 'ware': 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; break;
case 'wochen_ware': 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; break;
case 'sp_ware': 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; break;
} }
return $row; return $row;
} }
function getUserTransaction($user_id) { 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']; $day_old = $row['zeit'];
if($day_old != null) { if($day_old != null) {
$day_old = substr($day_old, 8, 2); $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) { 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())'; $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; $user = $user_ida;
if ($charm == 1) { if ($charm == 1) {
$item_info1 = mysql_fetch_array(mysql_query("SELECT item_id, id, user FROM ware WHERE id='$item_id1' LIMIT 1")); $item_info1 = mysqli_fetch_array(db_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_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); $char_id1 = getChar($char_id2);
if ($item_info1['user'] != $user['id']) { if ($item_info1['user'] != $user['id']) {
@ -158,8 +158,8 @@ if ($charm == 1) {
$new_mp = $mp1[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"); 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");
mysql_query("DELETE FROM ware WHERE id='$item_info1[id]' LIMIT 1"); db_query("DELETE FROM ware WHERE id='$item_info1[id]' LIMIT 1");
displayErrorMessage(NULL,'Trank erfolgreich Benutzt', '<a href="index.php?as=item">weiter...</a>'); displayErrorMessage(NULL,'Trank erfolgreich Benutzt', '<a href="index.php?as=item">weiter...</a>');
exit; exit;
@ -171,8 +171,8 @@ if ($charm == 2) {
exit; exit;
} }
$item_info = mysql_fetch_array(mysql_query("SELECT item_id, id, user, ru_mal FROM ware WHERE id='$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 = mysql_fetch_array(mysql_query("SELECT preis, anzahl FROM item WHERE id='$item_info[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']) { if ($item_info['user'] != $user_ida['id']) {
displayErrorMessage(NULL,'Dieses Item geh&ouml;rt nicht dir', displayHistoryBackLink()); displayErrorMessage(NULL,'Dieses Item geh&ouml;rt nicht dir', displayHistoryBackLink());
@ -187,9 +187,9 @@ if ($charm == 2) {
$sql = "UPDATE user SET geld='$new_geld' WHERE id='$user[id]'"; $sql = "UPDATE user SET geld='$new_geld' WHERE id='$user[id]'";
// echo $sql.'<br>'; // echo $sql.'<br>';
mysql_query($sql); db_query($sql);
mysql_query("UPDATE item SET anzahl='$new_zahl' WHERE id='$item_info[item_id]'"); db_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("DELETE FROM ware WHERE id='$item_info[id]'");
displayErrorMessage(NULL,'Item erfolgreich verkauft', '<a href="index.php?as=item">weiter...</a>'); displayErrorMessage(NULL,'Item erfolgreich verkauft', '<a href="index.php?as=item">weiter...</a>');
exit; exit;
} }
@ -200,7 +200,7 @@ if($charm == 3) {
displayErrorMessage(NULL,'Kein Namen für den User angegeben!', displayHistoryBackLink()); displayErrorMessage(NULL,'Kein Namen für den User angegeben!', displayHistoryBackLink());
exit; exit;
} else { } 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']; $tausch_user_id = $row['id'];
if($tausch_user_id == null) { if($tausch_user_id == null) {
displayErrorMessage(NULL,'Unbekannter User!', displayHistoryBackLink()); displayErrorMessage(NULL,'Unbekannter User!', displayHistoryBackLink());
@ -215,16 +215,16 @@ if($charm == 3) {
$tausch_item = explode(",", $tausch_item); $tausch_item = explode(",", $tausch_item);
if($tausch_geld != null xor $tausch_item[0] >= 0) { if($tausch_geld != null xor $tausch_item[0] >= 0) {
if($tausch_geld != null) { 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']; $arenalvl = $row['level'];
$tausch_geld = round($tausch_geld); $tausch_geld = round($tausch_geld);
if($tausch_geld <= ($arenalvl * 10000) && $tausch_geld > 0) { if($tausch_geld <= ($arenalvl * 10000) && $tausch_geld > 0) {
if($tausch_geld <= getRelevantMoney($user['id'])) { if($tausch_geld <= getRelevantMoney($user['id'])) {
$qry = 'UPDATE user SET geld = geld - '.$tausch_geld.' WHERE id = '.$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.';'; $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!'); 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); 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_anzahl <= $row['tausch_anzahl'] && $tausch_anzahl > 0) {
if($tausch_item[1] == 'ware') { 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.';'; $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 { } else {
$qry = 'UPDATE '.$tausch_item[1].' SET user = '.$tausch_user_id.' WHERE item = '.$tausch_item[0].' AND user = '.$user['id'].' LIMIT '.$tausch_anzahl.';'; $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!'); 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); setUserTransaction($user['id'], $tausch_user_id, $row['item'].$row['name'], $tausch_anzahl);
@ -278,7 +278,7 @@ if($charm == 3) {
} }
if ($charm == 6) { 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); $char_id1 = getChar($char_id2);
if ($item_info['user'] != $user['id']) { if ($item_info['user'] != $user['id']) {
@ -318,8 +318,8 @@ if ($charm == 6) {
$new_ausdauer = $item_info['ausdauer'] + $char_id1['ausdauer']; $new_ausdauer = $item_info['ausdauer'] + $char_id1['ausdauer'];
$new_glueck = $item_info['glueck'] + $char_id1['glueck']; $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"); 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");
mysql_query("DELETE FROM wochen_ware WHERE id='$sp_item' LIMIT 1"); db_query("DELETE FROM wochen_ware WHERE id='$sp_item' LIMIT 1");
displayErrorMessage(NULL,$item_info['item'].' erfolgreich benutzt', '<a href="index.php?as=item">weiter...</a>'); displayErrorMessage(NULL,$item_info['item'].' erfolgreich benutzt', '<a href="index.php?as=item">weiter...</a>');
exit; exit;
@ -328,8 +328,8 @@ if ($charm == 6) {
$chars = getCharsOfUser($user_ida['id']); $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"; $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; //echo $sql;
$item2 = mysql_query($sql); $item2 = db_query($sql);
$item1 = mysql_query("SELECT item_id, id, ru_mal FROM ware WHERE user='$user[id]' group by item_id"); $item1 = db_query("SELECT item_id, id, ru_mal FROM ware WHERE user='$user[id]' group by item_id");
?> ?>
<div align="center"> <div align="center">
@ -356,8 +356,8 @@ $item1 = mysql_query("SELECT item_id, id, ru_mal FROM ware WHERE user='$user[id]
?> ?>
</select> <br> <br> <select id="input" name="item_id1"> </select> <br> <br> <select id="input" name="item_id1">
<?php <?php
while ($row = mysql_fetch_array($item2)) { while ($row = mysqli_fetch_array($item2)) {
$item_name = mysql_fetch_assoc(mysql_query('SELECT hp, mp, name, type, s_type, id FROM item WHERE id='.$row['item_id'])); $item_name = mysqli_fetch_assoc(db_query('SELECT hp, mp, name, type, s_type, id FROM item WHERE id='.$row['item_id']));
if ($item_name['s_type'] == "Trank") { if ($item_name['s_type'] == "Trank") {
echo '<option value="'.$row['id'].'">'.$item_name['name'].' ('.$row['anzahl'].' mal)'; echo '<option value="'.$row['id'].'">'.$item_name['name'].' ('.$row['anzahl'].' mal)';
} }
@ -379,8 +379,8 @@ $item1 = mysql_query("SELECT item_id, id, ru_mal FROM ware WHERE user='$user[id]
$sp_items = array(1,2,11,404,415); $sp_items = array(1,2,11,404,415);
$sql = 'SELECT si.name, si.id, count(sw.item) as anzahl FROM sp_item si LEFT JOIN (Select item from sp_ware where user = '.$user_ida['id'].') sw ON sw.item = si.id WHERE si.id IN ('.join(',',$sp_items).') GROUP by si.id'; $sql = 'SELECT si.name, si.id, count(sw.item) as anzahl FROM sp_item si LEFT JOIN (Select item from sp_ware where user = '.$user_ida['id'].') sw ON sw.item = si.id WHERE si.id IN ('.join(',',$sp_items).') GROUP by si.id';
// echo $sql.'<br>'; // echo $sql.'<br>';
$qry = mysql_query($sql); $qry = db_query($sql);
while($row = mysql_fetch_assoc($qry)){ while($row = mysqli_fetch_assoc($qry)){
// 7 DBs, 1 Potara und 1 Bohne gibts derzeit // 7 DBs, 1 Potara und 1 Bohne gibts derzeit
if($row['id'] == 11 && $row['anzahl'] >= 7){ if($row['id'] == 11 && $row['anzahl'] >= 7){
echo '<a href="index.php?as=dragonballs">'.$row['name'].' einsetzen ('.$row['anzahl'].')</a><br>'; echo '<a href="index.php?as=dragonballs">'.$row['name'].' einsetzen ('.$row['anzahl'].')</a><br>';
@ -412,7 +412,7 @@ $item1 = mysql_query("SELECT item_id, id, ru_mal FROM ware WHERE user='$user[id]
<option value="">Charakter ausw&auml;hlen</option> <option value="">Charakter ausw&auml;hlen</option>
<?php <?php
// Speziell!! // Speziell!!
#$char4 = mysql_query('SELECT id, name FROM chars WHERE besitzer='.$user_ida['id'].' AND type=\'Onepiece\' AND frucht is NULL'); #$char4 = db_query('SELECT id, name FROM chars WHERE besitzer='.$user_ida['id'].' AND type=\'Onepiece\' AND frucht is NULL');
$all_chars = getCharsOfUser($user_ida['id']); $all_chars = getCharsOfUser($user_ida['id']);
foreach($all_chars as $row4) { foreach($all_chars as $row4) {
if($row4['type'] == 'Onepiece' && $row4['frucht'] == NULL) { if($row4['type'] == 'Onepiece' && $row4['frucht'] == NULL) {
@ -422,8 +422,8 @@ $item1 = mysql_query("SELECT item_id, id, ru_mal FROM ware WHERE user='$user[id]
?> ?>
</select> <br> <br> <select id="input" name="sp_item"> </select> <br> <br> <select id="input" name="sp_item">
<?php <?php
$sp_item = mysql_query("SELECT w.id, i.item FROM wochen_ware w LEFT JOIN wochen_markt i ON(w.item=i.id) WHERE w.user='$user_ida[id]'"); $sp_item = db_query("SELECT w.id, i.item FROM wochen_ware w LEFT JOIN wochen_markt i ON(w.item=i.id) WHERE w.user='$user_ida[id]'");
while ($row3 = mysql_fetch_array($sp_item)) { while ($row3 = mysqli_fetch_array($sp_item)) {
echo "<option value='$row3[id]'>$row3[item]"; echo "<option value='$row3[id]'>$row3[item]";
} }
?> ?>
@ -445,8 +445,8 @@ $item1 = mysql_query("SELECT item_id, id, ru_mal FROM ware WHERE user='$user[id]
name="charm" value="2"> <select id="input" name=item_id> name="charm" value="2"> <select id="input" name=item_id>
<option value="0">Verkaufen!</option> <option value="0">Verkaufen!</option>
<?php <?php
while ($row = mysql_fetch_assoc($item1)) { while ($row = mysqli_fetch_assoc($item1)) {
$item_name = mysql_fetch_assoc(mysql_query('SELECT * FROM item WHERE id='.$row['item_id'])); $item_name = mysqli_fetch_assoc(db_query('SELECT * FROM item WHERE id='.$row['item_id']));
if($item_name['s_type'] != 'Trank'){ if($item_name['s_type'] != 'Trank'){
echo '<option value="'.$row['id'].'">'.$item_name['name'].' (Typ: '.$item_name['s_type'].', Level: '.$item_name['level'].')</option>'; echo '<option value="'.$row['id'].'">'.$item_name['name'].' (Typ: '.$item_name['s_type'].', Level: '.$item_name['level'].')</option>';
} else{ } else{

@ -22,11 +22,11 @@ if (!$chara_1['id'] OR !$chara_2['id']) {
} }
################## Kaempfer 1 ################## Kaempfer 1
$char1_quis_item = explode(",", $chara_1['kampf_item']); $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_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 = 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_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 = 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_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 = 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_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 = 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_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_hp1 = explode(",", $chara_1['hp']);
$k_mp1 = explode(",", $chara_1['mp']); $k_mp1 = explode(",", $chara_1['mp']);
@ -56,11 +56,11 @@ $k_aufgabe[0] = $k_aufgabe_a_1 * $chara_1['aufgeben'];
################## Kaempfer 2 ################## Kaempfer 2
$char2_quis_item = explode(",", $chara_2['kampf_item']); $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_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 = 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_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 = 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_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 = 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_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 = 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_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_hp2 = explode(",", $chara_2['hp']);
$k_mp2 = explode(",", $chara_2['mp']); $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) { 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]'"; $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 . '<br>'; // echo $sql . '<br>';
if (mysql_affected_rows() == 0) { if (db_affected_rows() == 0) {
echo '"' . $sql . '" konnte nicht ausgef&uuml;rt werden!<br>'; echo '"' . $sql . '" konnte nicht ausgef&uuml;rt werden!<br>';
} }
} else { } 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) { while ($k_hp[0] > $k_aufgabe[0] AND $k_hp[1] > $k_aufgabe[1] AND $x < 10) {
$technick1 = mysql_fetch_array(mysql_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke1[$x]' LIMIT 10")); $technick1 = mysqli_fetch_array(db_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke1[$x]' LIMIT 10"));
$prozent_technik1 = (20 * $technick1['aktiv']) - 20; $prozent_technik1 = (20 * $technick1['aktiv']) - 20;
$technick1 = mysql_fetch_array(mysql_query("SELECT * FROM attacken WHERE id='$technick1[at_id]' LIMIT 10")); $technick1 = mysqli_fetch_array(db_query("SELECT * FROM attacken WHERE id='$technick1[at_id]' LIMIT 10"));
$technick2 = mysql_fetch_array(mysql_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke2[$x]' LIMIT 10")); $technick2 = mysqli_fetch_array(db_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke2[$x]' LIMIT 10"));
$prozent_technik2 = (20 * $technick2['aktiv']) - 20; $prozent_technik2 = (20 * $technick2['aktiv']) - 20;
$technick2 = mysql_fetch_array(mysql_query("SELECT * FROM attacken WHERE id='$technick2[at_id]' LIMIT 10")); $technick2 = mysqli_fetch_array(db_query("SELECT * FROM attacken WHERE id='$technick2[at_id]' LIMIT 10"));
///////////////////Hier laedt er den RELOAD der technik wenn die zusammen setzung nicht stimmen sollte ///////////////////Hier laedt er den RELOAD der technik wenn die zusammen setzung nicht stimmen sollte
include (ROOT_PATH . '/include/kampf/andere_technik.php'); /////////////////// Wenn man ne andere technik sich aussuchen will... 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 #####################################KAMPF SYSTEM
include (ROOT_PATH . '/include/kampf/kampf_rechnung.php'); 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++; $x++;
} }
@ -323,8 +323,8 @@ if ($sieger == $chara_1['name']) {
} }
// Umsatzsteuer (auf alles, dafür is ja der Freibetrag höher) :) // 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']); db_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[1].' WHERE besitzer = '.$chara_2['besitzer']);
/* /*
// Das ist der Teil, der an das Heim-Team geht und versteuert werden muss! 10% // 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)); $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 /////wenn npcs kaempfen
if ($kampf_info['rasse'] != "NPC") { 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]'"; $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 . '<br>'; // echo $sql . '<br>';
if (mysql_affected_rows() == 0) { if (db_affected_rows() == 0) {
echo '"' . $sql . '" konnte nicht ausgef&uuml;rt werden!<br>'; echo '"' . $sql . '" konnte nicht ausgef&uuml;rt werden!<br>';
} }
mysql_query("UPDATE chars SET status='Kampf' WHERE id='$chara_2[id]'"); db_query("UPDATE chars SET status='Kampf' WHERE id='$chara_2[id]'");
mysql_query("DELETE FROM kampf_list WHERE id='$kampf_info[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]'");
} }
?> ?>

@ -31,10 +31,10 @@ if (!isUserOwnerOf($user['id'], $char_id)) {
exit; 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_1 = getChar($kampf1['char1']);
$char_2 = getChar($kampf1['char2']); $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']; $ressource = 'Kampf:' . $kampf1['id'];
if (!semaphoreUP($ressource)) { if (!semaphoreUP($ressource)) {
@ -54,8 +54,8 @@ if (!checkAbholcode($char_id, $code)) {
exit; exit;
} }
mysql_query('DELETE FROM kampf WHERE db_satz='.$char_id); db_query('DELETE FROM kampf WHERE db_satz='.$char_id);
if (mysql_affected_rows() == 0) { if (db_affected_rows() == 0) {
displayErrorMessage(NULL, 'Der Kampf wurde schon abgeholt!', displayHistoryBackLink()); displayErrorMessage(NULL, 'Der Kampf wurde schon abgeholt!', displayHistoryBackLink());
semaphoreDown($ressource); semaphoreDown($ressource);
exit; exit;
@ -132,7 +132,7 @@ if ($kampf1['id']) {
if ($new_mp > $a_mp1[1]) { if ($new_mp > $a_mp1[1]) {
$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 { } else {
$new_exp = $kampf1['exp2']; $new_exp = $kampf1['exp2'];
$new_geld = $user['geld'] + $kampf1['geld2']; $new_geld = $user['geld'] + $kampf1['geld2'];
@ -153,7 +153,7 @@ if ($kampf1['id']) {
$new_mp = $a_mp2[1]; $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 ////////NPC item verteilung
if ($kampf1['art2'] == "NPC") { 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']) { if ($schon_bekommen['anzahl'] >= $item['mal']) {
/////item schon bekommen /////item schon bekommen
@ -184,12 +184,12 @@ if ($kampf1['id']) {
$chars = getCharsOfUser($user_ida['id']); $chars = getCharsOfUser($user_ida['id']);
foreach ($chars as $tmp_char) { foreach ($chars as $tmp_char) {
$values = explode(',', $tmp_char[$item['feld']]); $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 { } 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 { } else {
$satz = "item"; $satz = "item";
$new_item = "sp_item"; $new_item = "sp_item";
@ -201,7 +201,7 @@ if ($kampf1['id']) {
} else { } else {
$ut = 0; $ut = 0;
while ($ut < $item['wieviel']) { 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) { if (!$ut) {
$itemname = $item['item']; $itemname = $item['item'];
@ -211,13 +211,13 @@ if ($kampf1['id']) {
$ut++; $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 ///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 { } else {
###################################################CHARAKTER LOSE ###################################################CHARAKTER LOSE
@ -238,7 +238,7 @@ if ($kampf1['id']) {
//--> //-->
</script>"; </script>";
$new_preis = 0; $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 { } 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) // Leveln der Arena :) (Um Rundungsfehler zu vermeiden diese umstaendliche Rechnung)
addExpToArena($char_2['besitzer'], $kampf1['arena_exp']-round($kampf1['arena_exp']*0.25)); addExpToArena($char_2['besitzer'], $kampf1['arena_exp']-round($kampf1['arena_exp']*0.25));
// Umsatz wird schon vorher ermittelt :) // 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'); // include_once (ROOT_PATH . '/include/arena_exp.php');
} else{ } else{
addExpToArena($char_1['besitzer'], round($kampf1['arena_exp']*0.25)); 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){ if($row['mietlasten'] > 2){
// Steuerschulden // Steuerschulden
$tilgung = ceil($new_geld_offset * 0.75); $tilgung = ceil($new_geld_offset * 0.75);
$restgeld = $new_geld_offset - $tilgung; $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 '<script type="text/javascript">alert("Da du 3 Tage hintereinander nicht deine Umsatzsteuerverbindlichkeit beglichen hast wird ab jetzt automatisch von jedem Kampf ein Teil zur Tilgung verwendet. Daher fliessen '.$tilgung.' zum Gl&auml;biger");</script>'; echo '<script type="text/javascript">alert("Da du 3 Tage hintereinander nicht deine Umsatzsteuerverbindlichkeit beglichen hast wird ab jetzt automatisch von jedem Kampf ein Teil zur Tilgung verwendet. Daher fliessen '.$tilgung.' zum Gl&auml;biger");</script>';
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{ } 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'); // include_once (ROOT_PATH . '/include/exp.php');
@ -309,10 +309,10 @@ if ($kampf1['id']) {
addAttackUsageToChar($char_id, $l_attacken); addAttackUsageToChar($char_id, $l_attacken);
if ($itemname) { 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; $x2 = 0;
while ($new_row = @ mysql_fetch_array($item_names)) { while ($new_row = @ mysqli_fetch_array($item_names)) {
print " <script language='JavaScript'> print " <script language='JavaScript'>
<!-- <!--
alert('$new_row[name] $item[wieviel]x erhalten'); alert('$new_row[name] $item[wieviel]x erhalten');

@ -20,11 +20,11 @@ if (!$chara_1['id'] OR !$chara_2['id']) {
} }
################## Kaempfer 1 ################## Kaempfer 1
$char1_quis_item = explode(",", $chara_1['kampf_item']); $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_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 = 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_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 = 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_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 = 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_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 = 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_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_hp1 = explode(",", $chara_1['hp']);
$k_mp1 = explode(",", $chara_1['mp']); $k_mp1 = explode(",", $chara_1['mp']);
@ -54,11 +54,11 @@ $k_aufgabe[0] = $k_aufgabe_a_1 * $chara_1['aufgeben'];
################## Kaempfer 2 ################## Kaempfer 2
$char2_quis_item = explode(",", $chara_2['kampf_item']); $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_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 = 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_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 = 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_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 = 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_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 = 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_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_hp2 = explode(",", $chara_2['hp']);
$k_mp2 = explode(",", $chara_2['mp']); $k_mp2 = explode(",", $chara_2['mp']);
@ -117,9 +117,9 @@ $GLOBALS['kampf']['aussetzen'] = &$aussetzten_runde;
if ($k_hp[0] > $k_aufgabe[0] AND $k_hp[1] > $k_aufgabe[1] AND $x < 10) { if ($k_hp[0] > $k_aufgabe[0] AND $k_hp[1] > $k_aufgabe[1] AND $x < 10) {
$sql = "INSERT clan_fights 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]', clanfight_id='$clanfight_id', runde='$runde', kampf='$kampf'"; $sql = "INSERT clan_fights 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]', clanfight_id='$clanfight_id', runde='$runde', kampf='$kampf'";
mysql_query($sql); db_query($sql);
// echo $sql . '<br>'; // echo $sql . '<br>';
if (mysql_affected_rows() == 0) { if (db_affected_rows() == 0) {
echo '"' . $sql . '" konnte nicht ausgef&uuml;rt werden!<br>'; echo '"' . $sql . '" konnte nicht ausgef&uuml;rt werden!<br>';
} }
} else { } else {
@ -129,13 +129,13 @@ if ($k_hp[0] > $k_aufgabe[0] AND $k_hp[1] > $k_aufgabe[1] AND $x < 10) {
while ($k_hp[0] > $k_aufgabe[0] AND $k_hp[1] > $k_aufgabe[1] AND $x < 10) { while ($k_hp[0] > $k_aufgabe[0] AND $k_hp[1] > $k_aufgabe[1] AND $x < 10) {
$technick1 = mysql_fetch_array(mysql_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke1[$x]' LIMIT 10")); $technick1 = mysqli_fetch_array(db_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke1[$x]' LIMIT 10"));
$prozent_technik1 = (20 * $technick1['aktiv']) - 20; $prozent_technik1 = (20 * $technick1['aktiv']) - 20;
$technick1 = mysql_fetch_array(mysql_query("SELECT * FROM attacken WHERE id='$technick1[at_id]' LIMIT 10")); $technick1 = mysqli_fetch_array(db_query("SELECT * FROM attacken WHERE id='$technick1[at_id]' LIMIT 10"));
$technick2 = mysql_fetch_array(mysql_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke2[$x]' LIMIT 10")); $technick2 = mysqli_fetch_array(db_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke2[$x]' LIMIT 10"));
$prozent_technik2 = (20 * $technick2['aktiv']) - 20; $prozent_technik2 = (20 * $technick2['aktiv']) - 20;
$technick2 = mysql_fetch_array(mysql_query("SELECT * FROM attacken WHERE id='$technick2[at_id]' LIMIT 10")); $technick2 = mysqli_fetch_array(db_query("SELECT * FROM attacken WHERE id='$technick2[at_id]' LIMIT 10"));
///////////////////Hier laedt er den RELOAD der technik wenn die zusammen setzung nicht stimmen sollte ///////////////////Hier laedt er den RELOAD der technik wenn die zusammen setzung nicht stimmen sollte
include (ROOT_PATH . '//include/kampf/andere_technik.php'); /////////////////// Wenn man ne andere technik sich aussuchen will... include (ROOT_PATH . '//include/kampf/andere_technik.php'); /////////////////// Wenn man ne andere technik sich aussuchen will...
@ -192,9 +192,9 @@ while ($k_hp[0] > $k_aufgabe[0] AND $k_hp[1] > $k_aufgabe[1] AND $x < 10) {
#####################################KAMPF SYSTEM #####################################KAMPF SYSTEM
include (ROOT_PATH . '//include/kampf/kampf_rechnung.php'); include (ROOT_PATH . '//include/kampf/kampf_rechnung.php');
$db_query = mysql_fetch_array(mysql_query("SELECT * FROM clan_fights WHERE (char1='$chara_1[id]' OR char1='$chara_2[id]') order by id DESC LIMIT 1")); $db_query = mysqli_fetch_array(db_query("SELECT * FROM clan_fights WHERE (char1='$chara_1[id]' OR char1='$chara_2[id]') order by id DESC LIMIT 1"));
mysql_query("UPDATE clan_fights 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]' WHERE id='$db_query[id]'"); db_query("UPDATE clan_fights 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]' WHERE id='$db_query[id]'");
$x++; $x++;
} }
@ -217,6 +217,6 @@ if ($k_hp[0] < $k_aufgabe[0] OR $k_hp[0] < $k_hp[1]) {
$verlierer = $chara_1['id']; $verlierer = $chara_1['id'];
} }
mysql_query("UPDATE clan_fights SET win='$sieger', lose='$verlierer' WHERE id='$db_query[id]'"); db_query("UPDATE clan_fights SET win='$sieger', lose='$verlierer' WHERE id='$db_query[id]'");
?> ?>

@ -75,12 +75,12 @@ function starteFight($chara_1, $chara_2, $kampf_info){
function erstelleEinenFight($charid, &$user, $kampf_name, $kampf_pw, $kampf_zeit, $lvl){ function erstelleEinenFight($charid, &$user, $kampf_name, $kampf_pw, $kampf_zeit, $lvl){
// Ermittle ob der User eine Funktionierende Arena besitzt! // Ermittle ob der User eine Funktionierende Arena besitzt!
$qry = mysql_query('Select * from arena where besitzer = '.$user['id']); $qry = db_query('Select * from arena where besitzer = '.$user['id']);
if(mysql_num_rows($qry) == 0){ if(mysqli_stmt_num_rows($qry) == 0){
mysql_query('INSERT arena(besitzer, exp) values (\''.$user_ida['id'].'\', \'0,'.calculateRequiredExpArena(1).'\')'); db_query('INSERT arena(besitzer, exp) values (\''.$user_ida['id'].'\', \'0,'.calculateRequiredExpArena(1).'\')');
$arena = mysql_query('Select * from arena where besitzer = '.$user['id']); $arena = db_query('Select * from arena where besitzer = '.$user['id']);
} }
$arena = mysql_fetch_assoc($qry); $arena = mysqli_fetch_assoc($qry);
if($arena['mietlasten'] > 6){ if($arena['mietlasten'] > 6){
displayErrorMessage('Kampf erstellen nicht M&ouml;glich!', 'Ihre Arena ist geschlossen', displayHistoryBackLink()); displayErrorMessage('Kampf erstellen nicht M&ouml;glich!', 'Ihre Arena ist geschlossen', displayHistoryBackLink());
return; return;
@ -112,7 +112,7 @@ function erstelleEinenFight($charid, &$user, $kampf_name, $kampf_pw, $kampf_zeit
} }
$w_zeit = time() + 43200; $w_zeit = time() + 43200;
mysql_query('UPDATE chars SET status=\'Kampf Erstellt\' WHERE id='.$charid); db_query('UPDATE chars SET status=\'Kampf Erstellt\' WHERE id='.$charid);
if($lvl != 0){ if($lvl != 0){
$sql = 'INSERT INTO kampf_list(lvlmin, lvlmax, kampfname, charakter, passwort, besitzer, zeit, zeit_rec, ip) values ('.($char_a['level']-$lvl).', '.($char_a['level']+$lvl).', \''.$kampf_name.'\', '.$charid.', \''.$kampf_pw.'\', \''.$user['nickname'].'\', '.$w_zeit.', '.$kampf_zeit.', \''.$_SERVER['REMOTE_ADDR'].'\')'; $sql = 'INSERT INTO kampf_list(lvlmin, lvlmax, kampfname, charakter, passwort, besitzer, zeit, zeit_rec, ip) values ('.($char_a['level']-$lvl).', '.($char_a['level']+$lvl).', \''.$kampf_name.'\', '.$charid.', \''.$kampf_pw.'\', \''.$user['nickname'].'\', '.$w_zeit.', '.$kampf_zeit.', \''.$_SERVER['REMOTE_ADDR'].'\')';
} else{ } else{
@ -120,9 +120,9 @@ function erstelleEinenFight($charid, &$user, $kampf_name, $kampf_pw, $kampf_zeit
} }
// echo $sql.'<br'; // echo $sql.'<br';
mysql_query($sql); db_query($sql);
if($kampf_pw != '' && !is_null($kampf_pw)){ if($kampf_pw != '' && !is_null($kampf_pw)){
mysql_query('UPDATE user SET pw_fight=pw_fight-1 WHERE id='.$user['id']); db_query('UPDATE user SET pw_fight=pw_fight-1 WHERE id='.$user['id']);
$user['pw_fight']--; $user['pw_fight']--;
} }
@ -167,10 +167,10 @@ function nehmeKampfAn($user, $charid, $kampf_id, $kampf_pw){
} }
$sql = 'SELECT * FROM kampf_list where id = '.$kampf_id.' AND ('.$char_a['level'].' between lvlmin and lvlmax OR lvlmax = 0) AND ip != \''.$_SERVER['REMOTE_ADDR'].'\' AND (passwort = \'\' OR passwort = \''.$kampf_pw.'\')'; $sql = 'SELECT * FROM kampf_list where id = '.$kampf_id.' AND ('.$char_a['level'].' between lvlmin and lvlmax OR lvlmax = 0) AND ip != \''.$_SERVER['REMOTE_ADDR'].'\' AND (passwort = \'\' OR passwort = \''.$kampf_pw.'\')';
// echo $sql.'<br>'; // echo $sql.'<br>';
$fight_row = mysql_fetch_assoc(mysql_query($sql)); $fight_row = mysqli_fetch_assoc(db_query($sql));
if(!$fight_row){ if(!$fight_row){
$fight_row = mysql_fetch_assoc(mysql_query('SELECT * FROM kampf_list where id = '.$kampf_id)); $fight_row = mysqli_fetch_assoc(db_query('SELECT * FROM kampf_list where id = '.$kampf_id));
if(!$fight_row){ if(!$fight_row){
displayErrorMessage(NULL,'Kampf existiert nicht mehr!', displayHistoryBackLink()); displayErrorMessage(NULL,'Kampf existiert nicht mehr!', displayHistoryBackLink());
} else if($_SERVER['REMOTE_ADDR'] == $fight_row['ip']){ } else if($_SERVER['REMOTE_ADDR'] == $fight_row['ip']){
@ -242,13 +242,13 @@ function nehmeAutofightAn($user, $charid, $kampf_name, $kampf_zeit, $lvl){
// Nur mal die ID-Liste ausgeben // Nur mal die ID-Liste ausgeben
// echo $sql.'<br>'; // echo $sql.'<br>';
$qry = mysql_query($sql); $qry = db_query($sql);
$fight_row = NULL; $fight_row = NULL;
while($row = mysql_fetch_assoc($qry)){ while($row = mysqli_fetch_assoc($qry)){
$ressource = 'Kampf:'.$row['id']; $ressource = 'Kampf:'.$row['id'];
// Wichtig, die Semaphore!! // Wichtig, die Semaphore!!
if(semaphoreUP($ressource)){ // TRUE, diese Anfrage darf bearbeitet werden if(semaphoreUP($ressource)){ // TRUE, diese Anfrage darf bearbeitet werden
$fight_row = mysql_fetch_assoc(mysql_query('SELECT * FROM kampf_list where id = '.$row['id'])); $fight_row = mysqli_fetch_assoc(db_query('SELECT * FROM kampf_list where id = '.$row['id']));
if($fight_row){ if($fight_row){
break; break;
} }
@ -445,11 +445,11 @@ function displayAutoFights($user, $portal, $pagenum){
function displayKampfErstellen($user, $portal, $pagenum){ function displayKampfErstellen($user, $portal, $pagenum){
$meta_data = getUserMetaData($user['id']); $meta_data = getUserMetaData($user['id']);
// Ermittle ob der User eine Funktionierende Arena besitzt! // Ermittle ob der User eine Funktionierende Arena besitzt!
$qry = mysql_query('Select * from arena where besitzer = '.$user['id']); $qry = db_query('Select * from arena where besitzer = '.$user['id']);
$arena = mysql_fetch_assoc($qry); $arena = mysqli_fetch_assoc($qry);
if(mysql_num_rows($qry) == 0){ if(mysqli_stmt_num_rows($qry) == 0){
mysql_query('INSERT arena(besitzer, exp) values (\''.$user_ida['id'].'\', \'0,'.calculateRequiredExpArena(1).'\')'); db_query('INSERT arena(besitzer, exp) values (\''.$user_ida['id'].'\', \'0,'.calculateRequiredExpArena(1).'\')');
$arena = mysql_fetch_assoc(mysql_query('Select * from arena where besitzer = '.$user['id'])); $arena = mysqli_fetch_assoc(db_query('Select * from arena where besitzer = '.$user['id']));
} }
if($arena['mietlasten'] > 7){ if($arena['mietlasten'] > 7){
displayErrorMessage('Kampf erstellen nicht M&ouml;glich!', 'Ihre Arena ist geschlossen', displayHistoryBackLink()); displayErrorMessage('Kampf erstellen nicht M&ouml;glich!', 'Ihre Arena ist geschlossen', displayHistoryBackLink());
@ -565,23 +565,23 @@ function display($user, $portal, $pagenum){
<?php <?php
if($portal == 'NPC') { if($portal == 'NPC') {
$kampf_l = mysql_query('SELECT n.mal, k.rasse, k.id, k.passwort, k.kampfname, k.lvlmin, k.lvlmax, k.zeit_rec, k.besitzer, k.charakter ,a.name as a_name, a.level as a_level, a.luxus, a.loge, a.steh, a.sitz FROM kampf_list k LEFT JOIN chars c ON(c.id=k.charakter) LEFT JOIN npc_item n ON(n.charakter=c.id) inner join arena a ON a.besitzer = c.besitzer WHERE k.rasse=\'NPC\' ORDER BY c.level'); $kampf_l = db_query('SELECT n.mal, k.rasse, k.id, k.passwort, k.kampfname, k.lvlmin, k.lvlmax, k.zeit_rec, k.besitzer, k.charakter ,a.name as a_name, a.level as a_level, a.luxus, a.loge, a.steh, a.sitz FROM kampf_list k LEFT JOIN chars c ON(c.id=k.charakter) LEFT JOIN npc_item n ON(n.charakter=c.id) inner join arena a ON a.besitzer = c.besitzer WHERE k.rasse=\'NPC\' ORDER BY c.level');
$total = mysql_fetch_row(mysql_query('SELECT count(*) FROM kampf_list WHERE rasse=\'NPC\'')); $total = mysqli_fetch_row(db_query('SELECT count(*) FROM kampf_list WHERE rasse=\'NPC\''));
$total = $total[0]; $total = $total[0];
$entriesPerPage = $total; $entriesPerPage = $total;
} else if($portal == 'LVL'){ } else if($portal == 'LVL'){
$entriesPerPage = 10; $entriesPerPage = 10;
$kampf_l = mysql_query('SELECT k.id, k.passwort, k.kampfname, k.lvlmin, k.lvlmax, k.zeit_rec, k.besitzer, k.charakter, a.name as a_name, a.level as a_level, a.luxus, a.loge, a.steh, a.sitz FROM kampf_list k LEFT JOIN chars c ON(c.id=k.charakter) inner join arena a ON a.besitzer = c.besitzer WHERE k.rasse=\'ALL\' and k.lvlmax != 0 or passwort != \'\' ORDER BY k.id ASC LIMIT '.$pagenum*$entriesPerPage.','.$entriesPerPage); $kampf_l = db_query('SELECT k.id, k.passwort, k.kampfname, k.lvlmin, k.lvlmax, k.zeit_rec, k.besitzer, k.charakter, a.name as a_name, a.level as a_level, a.luxus, a.loge, a.steh, a.sitz FROM kampf_list k LEFT JOIN chars c ON(c.id=k.charakter) inner join arena a ON a.besitzer = c.besitzer WHERE k.rasse=\'ALL\' and k.lvlmax != 0 or passwort != \'\' ORDER BY k.id ASC LIMIT '.$pagenum*$entriesPerPage.','.$entriesPerPage);
$total = mysql_fetch_row(mysql_query('SELECT count(*) FROM kampf_list WHERE rasse=\'ALL\' and lvlmax != 0 or passwort != \'\'')); $total = mysqli_fetch_row(db_query('SELECT count(*) FROM kampf_list WHERE rasse=\'ALL\' and lvlmax != 0 or passwort != \'\''));
$total = $total[0]; $total = $total[0];
} else{ } else{
$entriesPerPage = 10; $entriesPerPage = 10;
$kampf_l = mysql_query('SELECT k.id, k.passwort, k.kampfname, k.lvlmin, k.lvlmax, k.zeit_rec, k.besitzer, k.charakter, a.name as a_name, a.level as a_level, a.luxus, a.loge, a.steh, a.sitz FROM kampf_list k LEFT JOIN chars c ON(c.id=k.charakter) inner join arena a ON a.besitzer = c.besitzer WHERE k.rasse=\'ALL\' and k.lvlmax = 0 and passwort = \'\' ORDER BY k.id ASC LIMIT '.$pagenum*$entriesPerPage.','.$entriesPerPage); $kampf_l = db_query('SELECT k.id, k.passwort, k.kampfname, k.lvlmin, k.lvlmax, k.zeit_rec, k.besitzer, k.charakter, a.name as a_name, a.level as a_level, a.luxus, a.loge, a.steh, a.sitz FROM kampf_list k LEFT JOIN chars c ON(c.id=k.charakter) inner join arena a ON a.besitzer = c.besitzer WHERE k.rasse=\'ALL\' and k.lvlmax = 0 and passwort = \'\' ORDER BY k.id ASC LIMIT '.$pagenum*$entriesPerPage.','.$entriesPerPage);
$total = mysql_fetch_row(mysql_query('SELECT count(*) FROM kampf_list WHERE rasse=\'ALL\' and lvlmax = 0 and passwort = \'\'')); $total = mysqli_fetch_row(db_query('SELECT count(*) FROM kampf_list WHERE rasse=\'ALL\' and lvlmax = 0 and passwort = \'\''));
$total = $total[0]; $total = $total[0];
} }
while($row = mysql_fetch_array($kampf_l)) { while($row = mysqli_fetch_array($kampf_l)) {
$char = getChar($row['charakter']); $char = getChar($row['charakter']);
if($row['passwort']){ if($row['passwort']){
$pw_exe = 'pass1'; $pw_exe = 'pass1';
@ -629,7 +629,7 @@ function display($user, $portal, $pagenum){
<td id="content" align="center"> <td id="content" align="center">
<?php <?php
if($row['rasse'] == 'NPC') { if($row['rasse'] == 'NPC') {
$anzahl_min = mysql_fetch_row(mysql_query('SELECT count(id) FROM npc_ware WHERE charakter=\''.$row['charakter'].'\' AND user='.$user['id'].' LIMIT 50')); $anzahl_min = mysqli_fetch_row(db_query('SELECT count(id) FROM npc_ware WHERE charakter=\''.$row['charakter'].'\' AND user='.$user['id'].' LIMIT 50'));
$anzahl_min = $anzahl_min[0]; $anzahl_min = $anzahl_min[0];
echo 'geschafft ('.$anzahl_min.'/'.$row['mal'].')<br>'; echo 'geschafft ('.$anzahl_min.'/'.$row['mal'].')<br>';
} else { } else {
@ -717,7 +717,7 @@ function zieheKampfZurueck($user, $kampf_id){
return; return;
} }
$kampf_a = mysql_fetch_assoc(mysql_query('SELECT * FROM kampf_list where id = '.$kampf_id)); $kampf_a = mysqli_fetch_assoc(db_query('SELECT * FROM kampf_list where id = '.$kampf_id));
if(!$kampf_a){ if(!$kampf_a){
displayErrorMessage(NULL,'Kampf ist nicht mehr vorhanden! ('.$kampf_a['charakter'].')', displayHistoryBackLink()); displayErrorMessage(NULL,'Kampf ist nicht mehr vorhanden! ('.$kampf_a['charakter'].')', displayHistoryBackLink());
return; return;
@ -746,10 +746,10 @@ function zieheKampfZurueck($user, $kampf_id){
return; return;
} }
mysql_query('DELETE FROM kampf_list WHERE id = '.$kampf_id); db_query('DELETE FROM kampf_list WHERE id = '.$kampf_id);
mysql_query('UPDATE chars SET status = \'Frei\' WHERE id ='.$char_id); db_query('UPDATE chars SET status = \'Frei\' WHERE id ='.$char_id);
if($kampf_a['kampf_pw'] !== '' || $kampf_a['kampf_pw'] !== NULL){ if($kampf_a['kampf_pw'] !== '' || $kampf_a['kampf_pw'] !== NULL){
mysql_query('UPDATE user SET pw_fight = pw_fight + 1 WHERE id ='.$user['id']); db_query('UPDATE user SET pw_fight = pw_fight + 1 WHERE id ='.$user['id']);
} }
semaphoreDown($ressource2); semaphoreDown($ressource2);
semaphoreDown($ressource1); semaphoreDown($ressource1);

@ -31,7 +31,7 @@ test += id;
<?php <?php
$ne = time(); $ne = time();
$last_fight = mysql_query("SELECT char1, char2, id FROM top_kampf WHERE dauer < '$ne' ORDER BY id DESC LIMIT 20"); $last_fight = db_query("SELECT char1, char2, id FROM top_kampf WHERE dauer < '$ne' ORDER BY id DESC LIMIT 20");
?> ?>
<tr> <tr>
<td width="761" height="8" colspan="3"> <td width="761" height="8" colspan="3">
@ -41,7 +41,7 @@ $last_fight = mysql_query("SELECT char1, char2, id FROM top_kampf WHERE dauer <
</tr> </tr>
<?php <?php
while ($row = mysql_fetch_array($last_fight)) { while ($row = mysqli_fetch_array($last_fight)) {
$char1 = getChar($row['char1']); $char1 = getChar($row['char1']);
$char2 = getChar($row['char2']); $char2 = getChar($row['char2']);
?> ?>

@ -24,17 +24,17 @@ $kampf_id = validateUnsignedInteger($_GET['kampf_id'], null);
if(!$spleoic) { $spleoic = "top_kampf"; if(!$spleoic) { $spleoic = "top_kampf";
} else { } else {
echo "<p align=center>$back<br>&nbsp;<br>"; echo "<p align=center>$back<br>&nbsp;<br>";
$kampf1 = mysql_Fetch_array(mysql_query("SELECT * FROM $spleoic WHERE id='$kampf_id' LIMIT 1")); $kampf1 = mysqli_fetch_array(db_query("SELECT * FROM $spleoic WHERE id='$kampf_id' LIMIT 1"));
if(($kampf_id * 300) + $kampf1['dauer'] > time()) { if(($kampf_id * 300) + $kampf1['dauer'] > time()) {
echo "Fehler Sie k&ouml;nnen diesen Kampf nicht anschauen bevor er vorbei ist"; echo "Fehler Sie k&ouml;nnen diesen Kampf nicht anschauen bevor er vorbei ist";
exit; exit;
} }
} }
$kampf1 = mysql_Fetch_array(mysql_query("SELECT * FROM $spleoic WHERE id='$kampf_id' LIMIT 1")); $kampf1 = mysqli_fetch_array(db_query("SELECT * FROM $spleoic WHERE id='$kampf_id' LIMIT 1"));
$char_1 = getChar($kampf1['char1']); $char_1 = getChar($kampf1['char1']);
$char_2 = getChar($kampf1['char2']); $char_2 = getChar($kampf1['char2']);
$arena = mysql_Fetch_array(mysql_query("SELECT name, besitzer FROM arena WHERE id='$kampf1[arena_name]' LIMIT 1")); $arena = mysqli_fetch_array(db_query("SELECT name, besitzer FROM arena WHERE id='$kampf1[arena_name]' LIMIT 1"));
if($kampf1['dauer'] > time()) { if($kampf1['dauer'] > time()) {
displayErrorMessage(NULL,'Der Kampf ist noch nicht vorbei!', displayHistoryBackLink()); displayErrorMessage(NULL,'Der Kampf ist noch nicht vorbei!', displayHistoryBackLink());

@ -24,9 +24,9 @@ $art = validateString($_GET['art']);
if(!$spleoic) { $spleoic = "top_kampf"; if(!$spleoic) { $spleoic = "top_kampf";
} else { } else {
echo "<p align=center>$back<br>&nbsp;<br>"; echo "<p align=center>$back<br>&nbsp;<br>";
$kampf2 = mysql_Fetch_array(mysql_query("SELECT id FROM $spleoic ORDER BY id ASC LIMIT 1")); $kampf2 = mysqli_fetch_array(db_query("SELECT id FROM $spleoic ORDER BY id ASC LIMIT 1"));
$kampf1 = mysql_Fetch_array(mysql_query("SELECT * FROM $spleoic WHERE id='$kampf_id' LIMIT 1")); $kampf1 = mysqli_fetch_array(db_query("SELECT * FROM $spleoic WHERE id='$kampf_id' LIMIT 1"));
$turnier_uids = mysql_fetch_array(mysql_query("SELECT id FROM $spleoic WHERE art='$art' ORDER BY id ASC")); $turnier_uids = mysqli_fetch_array(db_query("SELECT id FROM $spleoic WHERE art='$art' ORDER BY id ASC"));
@ -36,14 +36,14 @@ exit;
} }
} }
$kampf1 = mysql_Fetch_array(mysql_query("SELECT * FROM turnier_kampf WHERE id='$kampf_id' LIMIT 1")); $kampf1 = mysqli_fetch_array(db_query("SELECT * FROM turnier_kampf WHERE id='$kampf_id' LIMIT 1"));
$char1 = getChar($kampf1['char1']); $char1 = getChar($kampf1['char1']);
$char2 = getChar($kampf1['char2']); $char2 = getChar($kampf1['char2']);
$char_1 = $char1; $char_1 = $char1;
$char_2 = $char2; $char_2 = $char2;
$arena = mysql_Fetch_array(mysql_query("SELECT name, besitzer FROM arena WHERE id='$kampf1[arena_name]' LIMIT 1")); $arena = mysqli_fetch_array(db_query("SELECT name, besitzer FROM arena WHERE id='$kampf1[arena_name]' LIMIT 1"));
$starke1 = explode(",", $kampf1['starke1']); $starke1 = explode(",", $kampf1['starke1']);

@ -26,14 +26,14 @@ $kampf_id = validateUnsignedInteger($_GET['kampf_id'], null);
if(!$spleoic) { $spleoic = "top_kampf"; if(!$spleoic) { $spleoic = "top_kampf";
} else { } else {
echo '<p align=center><a href="javascript:window.close();">Schlie&szlig;en</a><br>&nbsp;<br>'; echo '<p align=center><a href="javascript:window.close();">Schlie&szlig;en</a><br>&nbsp;<br>';
$kampf1 = mysql_Fetch_array(mysql_query("SELECT * FROM $spleoic WHERE id='$kampf_id' LIMIT 1")); $kampf1 = mysqli_fetch_array(db_query("SELECT * FROM $spleoic WHERE id='$kampf_id' LIMIT 1"));
/*if(($kampf_id * 300) + $kampf1[dauer] > time()) { /*if(($kampf_id * 300) + $kampf1[dauer] > time()) {
echo "Fehler Sie k&ouml;nnen diesen Kampf nicht anschauen bevor er vorbei ist"; echo "Fehler Sie k&ouml;nnen diesen Kampf nicht anschauen bevor er vorbei ist";
exit; exit;
}*/ }*/
} }
$kampf1 = mysql_Fetch_array(mysql_query("SELECT * FROM $spleoic WHERE id='$kampf_id' LIMIT 1")); $kampf1 = mysqli_fetch_array(db_query("SELECT * FROM $spleoic WHERE id='$kampf_id' LIMIT 1"));
$char_1 = getChar2($kampf1['char1']); $char_1 = getChar2($kampf1['char1']);
$char_2 = getChar2($kampf1['char2']); $char_2 = getChar2($kampf1['char2']);

@ -33,12 +33,12 @@ if (!$char_id) {
exit; exit;
} }
$user = mysql_fetch_array(mysql_query("SELECT id, geld FROM user WHERE nickname='$name'")); $user = mysqli_fetch_array(db_query("SELECT id, geld FROM user WHERE nickname='$name'"));
$char = getChar($char_id); $char = getChar($char_id);
if ($speed < 0 || $staerke < 0 || $verteidigung < 0 || $glueck < 0 || $ausdauer < 0 || $hp < 0 || $mp < 0) { if ($speed < 0 || $staerke < 0 || $verteidigung < 0 || $glueck < 0 || $ausdauer < 0 || $hp < 0 || $mp < 0) {
mysql_query("INSERT INTO cheater values('$user_ida[id]','Versuchte negative Werte in Levelup einzutragen!',now())"); db_query("INSERT INTO cheater values('$user_ida[id]','Versuchte negative Werte in Levelup einzutragen!',now())");
displayErrorMessage(NULL,'Nicht cheaten....', displayHistoryBackLink()); displayErrorMessage(NULL,'Nicht cheaten....', displayHistoryBackLink());
exit; exit;
} }
@ -66,7 +66,7 @@ if ($charm) {
$new_mp = $char_mp[1] + $mp * 5; $new_mp = $char_mp[1] + $mp * 5;
$new_lern = $char['lernpunkte'] - $speed - $staerke - $verteidigung - $glueck - $ausdauer - $hp - $mp; $new_lern = $char['lernpunkte'] - $speed - $staerke - $verteidigung - $glueck - $ausdauer - $hp - $mp;
mysql_query("UPDATE chars SET lernpunkte='$new_lern', starke='$new_st', verteidigung='$new_ver', speed='$new_speed', ausdauer='$new_ausdauer', db_query("UPDATE chars SET lernpunkte='$new_lern', starke='$new_st', verteidigung='$new_ver', speed='$new_speed', ausdauer='$new_ausdauer',
glueck='$new_glueck', hp='$char_hp[0],$new_hp', mp='$char_mp[0],$new_mp' WHERE id='$char_id'"); glueck='$new_glueck', hp='$char_hp[0],$new_hp', mp='$char_mp[0],$new_mp' WHERE id='$char_id'");
$fehler_m = " $fehler_m = "

@ -13,10 +13,10 @@ include_once(ROOT_PATH.'/include/parse.inc.php');
// GET-Section // GET-Section
// Leer // Leer
$chara = mysql_query("SELECT name, liga_siege, liga_niederlagen, bild, id, liga_punkte FROM chars order by liga_punkte DESC LIMIT 50"); $chara = db_query("SELECT name, liga_siege, liga_niederlagen, bild, id, liga_punkte FROM chars order by liga_punkte DESC LIMIT 50");
$x=1; $x=1;
while($row = mysql_Fetch_array($chara)) { while($row = mysqli_fetch_array($chara)) {
$PIC = "<img border=0 src=".$row['bild']." width=".$pic_g31." height=".$pic_g31.">"; $PIC = "<img border=0 src=".$row['bild']." width=".$pic_g31." height=".$pic_g31.">";

@ -37,7 +37,7 @@ $search = $_GET['search'];
if ($search) { if ($search) {
// TODO: Sollte irgndwie anders gelöst werden // TODO: Sollte irgndwie anders gelöst werden
$kampf_id2 = mysql_fetch_array(mysql_query("SELECT k.id FROM chars c LEFT JOIN liga_kampf k ON(k.char1=c.id OR k.char2=c.id) WHERE c.name='$kampf_name' LIMIT 1")); $kampf_id2 = mysqli_fetch_array(db_query("SELECT k.id FROM chars c LEFT JOIN liga_kampf k ON(k.char1=c.id OR k.char2=c.id) WHERE c.name='$kampf_name' LIMIT 1"));
?> ?>
<SCRIPT language="JavaScript"> <SCRIPT language="JavaScript">
window.open(<?php echo '"liga_kampf_anzeige.php?kampf_id=' .$kampf_id2['id']. '"'; ?>,"","status=no,hotkeys=no,Height=600,Width=820,scrollbars=yes"); window.open(<?php echo '"liga_kampf_anzeige.php?kampf_id=' .$kampf_id2['id']. '"'; ?>,"","status=no,hotkeys=no,Height=600,Width=820,scrollbars=yes");
@ -51,7 +51,7 @@ if ($kampf_id) {
echo "<p align=center>$back<br>&nbsp;<br>"; echo "<p align=center>$back<br>&nbsp;<br>";
$kampf1 = mysql_Fetch_array(mysql_query("SELECT * FROM liga_kampf WHERE id='$kampf_id' LIMIT 1")); $kampf1 = mysqli_fetch_array(db_query("SELECT * FROM liga_kampf WHERE id='$kampf_id' LIMIT 1"));
$char_1 = getChar($kampf1['char1']); $char_1 = getChar($kampf1['char1']);
$char_2 = getChar($kampf1['char2']); $char_2 = getChar($kampf1['char2']);
@ -88,7 +88,7 @@ if ($kampf_id) {
exit; exit;
} else { } else {
$kampf_search = mysql_query("SELECT c1.name AS c1_name, c2.name AS c2_name, k.id FROM liga_kampf k $kampf_search = db_query("SELECT c1.name AS c1_name, c2.name AS c2_name, k.id FROM liga_kampf k
LEFT JOIN chars c1 ON(c1.id=k.char1) LEFT JOIN chars c2 ON(c2.id=k.char2) LEFT JOIN user u ON(u.id=c1.besitzer OR u.id=c2.besitzer) WHERE u.id='$user_ida[id]'"); LEFT JOIN chars c1 ON(c1.id=k.char1) LEFT JOIN chars c2 ON(c2.id=k.char2) LEFT JOIN user u ON(u.id=c1.besitzer OR u.id=c2.besitzer) WHERE u.id='$user_ida[id]'");
?> ?>
@ -101,7 +101,7 @@ if ($kampf_id) {
$kampfs = 1; $kampfs = 1;
while ($row = mysql_fetch_array($kampf_search)) { while ($row = mysqli_fetch_array($kampf_search)) {
?> ?>
<tr> <tr>
<td width="102" height="23"> <td width="102" height="23">

@ -13,7 +13,7 @@ if (isset($_POST['nick_name']) and isset($_POST['pw_1'])) {
$nick_name = validateName($_POST['nick_name']); $nick_name = validateName($_POST['nick_name']);
$pw_1 = validateString($_POST['pw_1']); $pw_1 = validateString($_POST['pw_1']);
$ip_con = mysql_fetch_array(mysql_query("SELECT nickname FROM user WHERE ip='$REMOTE_ADDR' AND nickname !='$nick_name' LIMIT 1")); $ip_con = mysqli_fetch_array(db_query("SELECT nickname FROM user WHERE ip='$REMOTE_ADDR' AND nickname !='$nick_name' LIMIT 1"));
if (checkLoginPassword($nick_name, $pw_1)) { if (checkLoginPassword($nick_name, $pw_1)) {
// MumbleAddon!! // MumbleAddon!!

@ -16,7 +16,7 @@ include_once(ROOT_PATH . '/include/user.inc.php');
$nick_name = validateName($_POST['nick_name']); $nick_name = validateName($_POST['nick_name']);
$pw_1 = validateString($_POST['pw_1']); $pw_1 = validateString($_POST['pw_1']);
$ip_con = mysql_fetch_array(mysql_query("SELECT nickname FROM user WHERE ip='$REMOTE_ADDR' AND nickname !='$nick_name' LIMIT 1")); $ip_con = mysqli_fetch_array(db_query("SELECT nickname FROM user WHERE ip='$REMOTE_ADDR' AND nickname !='$nick_name' LIMIT 1"));
if (!checkLoginPassword($nick_name, $pw_1)) { if (!checkLoginPassword($nick_name, $pw_1)) {
displayErrorMessage(NULL,'Username oder Passwort falsch!', displayHistoryBackLink()); displayErrorMessage(NULL,'Username oder Passwort falsch!', displayHistoryBackLink());

@ -48,7 +48,7 @@ $as = $_GET['as'];
/////////////////////////Item Info /////////////////////////Item Info
if($info) { if($info) {
$item = mysql_fetch_array(mysql_query("SELECT * FROM item WHERE id='$info' and preis>0 LIMIT 1")); $item = mysqli_fetch_array(db_query("SELECT * FROM item WHERE id='$info' and preis>0 LIMIT 1"));
$head = "$item[name] Info"; $head = "$item[name] Info";
$text .= "St&auml;rke: $item[starke]<br>"; $text .= "St&auml;rke: $item[starke]<br>";
$text .= "Verteidigung: $item[verteidigung]<br>"; $text .= "Verteidigung: $item[verteidigung]<br>";
@ -97,7 +97,7 @@ $u=1;
while($u < count($w_item_anzahl)) { while($u < count($w_item_anzahl)) {
if($w_item_anzahl[$u]) { if($w_item_anzahl[$u]) {
$item = mysql_fetch_array(mysql_query("SELECT preis, anzahl, name FROM item WHERE id='$w_item_id[$u]' and preis>0 LIMIT 1")); $item = mysqli_fetch_array(db_query("SELECT preis, anzahl, name FROM item WHERE id='$w_item_id[$u]' and preis>0 LIMIT 1"));
$item_preis = $item_preis + ($item['preis'] * $w_item_anzahl[$u]); $item_preis = $item_preis + ($item['preis'] * $w_item_anzahl[$u]);
if($item['anzahl'] < $w_item_anzahl[$u]) { if($item['anzahl'] < $w_item_anzahl[$u]) {
@ -108,7 +108,7 @@ $item_preis = $item_preis + ($item['preis'] * $w_item_anzahl[$u]);
exit; exit;
} }
if($w_item_anzahl[$u] < 0){ if($w_item_anzahl[$u] < 0){
mysql_query("INSERT INTO cheater values('$user_ida[id]','Versuchte negative Werte in den Markt einzufuegen!',now())"); db_query("INSERT INTO cheater values('$user_ida[id]','Versuchte negative Werte in den Markt einzufuegen!',now())");
$fehler = "NICHT CHEATEN, VERDAMMT NOCHMAL!!!!!"; $fehler = "NICHT CHEATEN, VERDAMMT NOCHMAL!!!!!";
$link = $back; $link = $back;
eval("\$fehler1.=\"".gettemplate("gfx/markt_fehler")."\";"); eval("\$fehler1.=\"".gettemplate("gfx/markt_fehler")."\";");
@ -123,11 +123,11 @@ $u++;
$user = mysql_fetch_array(mysql_query("SELECT geld, item_res FROM user WHERE id='$user_ida[id]'")); $user = mysqli_fetch_array(db_query("SELECT geld, item_res FROM user WHERE id='$user_ida[id]'"));
$item_preis = ($item_preis / 100) * (100 - $user['item_res']); $item_preis = ($item_preis / 100) * (100 - $user['item_res']);
$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']; $auktionensumme = $auktionensumme['summe'];
if($user['geld']<$item_preis+$auktionensumme) { if($user['geld']<$item_preis+$auktionensumme) {
@ -144,20 +144,20 @@ while($u < count($w_item_anzahl)) {
if($w_item_anzahl[$u]) { if($w_item_anzahl[$u]) {
$item = mysql_fetch_array(mysql_query("SELECT anzahl, name, s_type FROM item WHERE id='$w_item_id[$u]' and preis>0 LIMIT 1")); $item = mysqli_fetch_array(db_query("SELECT anzahl, name, s_type FROM item WHERE id='$w_item_id[$u]' and preis>0 LIMIT 1"));
$t=0; $t=0;
while($t < $w_item_anzahl[$u]) { while($t < $w_item_anzahl[$u]) {
if($item['s_type'] != "Trank") { $ru_malss = 1; } if($item['s_type'] != "Trank") { $ru_malss = 1; }
mysql_query("INSERT ware SET ru_mal='$ru_malss', item_id='$w_item_id[$u]', user='$user_ida[id]'"); db_query("INSERT ware SET ru_mal='$ru_malss', item_id='$w_item_id[$u]', user='$user_ida[id]'");
$t++; $t++;
} }
mysql_query("UPDATE item SET anzahl=anzahl-'$w_item_anzahl[$u]' WHERE id='$w_item_id[$u]' LIMIT 1"); db_query("UPDATE item SET anzahl=anzahl-'$w_item_anzahl[$u]' WHERE id='$w_item_id[$u]' LIMIT 1");
$fehler .= "Sie haben $item[name] x $w_item_anzahl[$u] gekauft!<br>"; $fehler .= "Sie haben $item[name] x $w_item_anzahl[$u] gekauft!<br>";
} }
$u++; $u++;
} }
mysql_query("UPDATE user SET geld=geld-'$item_preis' WHERE id='$user_ida[id]' LIMIT 1"); db_query("UPDATE user SET geld=geld-'$item_preis' WHERE id='$user_ida[id]' LIMIT 1");
$fehler .= "<p>f&uuml;r $item_preis &#165;"; $fehler .= "<p>f&uuml;r $item_preis &#165;";
$link = "<a href=markt.php>weiter...</a>"; $link = "<a href=markt.php>weiter...</a>";
@ -185,9 +185,9 @@ exit;
if(!$oder) { $oder = 'level,preis'; } if(!$oder) { $oder = 'level,preis'; }
if(!$ords) { $ords = "Trank"; } if(!$ords) { $ords = "Trank"; }
$item_name = mysql_query("SELECT * FROM item WHERE preis>0 and $filter AND s_type='$ords' order by $oder ASC LIMIT $pagenum, 10"); $item_name = db_query("SELECT * FROM item WHERE preis>0 and $filter AND s_type='$ords' order by $oder ASC LIMIT $pagenum, 10");
$user = mysql_Fetch_array(mysql_query("SELECT id, geld, item_res FROM user WHERE id='$user_ida[id]' LIMIT 1")); $user = mysqli_fetch_array(db_query("SELECT id, geld, item_res FROM user WHERE id='$user_ida[id]' LIMIT 1"));
$user_item = mysql_query("SELECT name, id FROM item WHERE preis>0"); $user_item = db_query("SELECT name, id FROM item WHERE preis>0");
$GELD = $user['geld']; $GELD = $user['geld'];
@ -201,7 +201,7 @@ exit;
$x=0; $x=0;
$y=1; $y=1;
while($row = mysql_fetch_array($item_name)) while($row = mysqli_fetch_array($item_name))
{ {
@ -233,16 +233,16 @@ exit;
////////////STORE ////////////STORE
while($row2 = mysql_fetch_array($user_item)) { while($row2 = mysqli_fetch_array($user_item)) {
$user_items = mysql_num_rows(mysql_query("SELECT id FROM ware WHERE item_id='$row2[id]' AND user='$user_ida[id]' LIMIT 100")); $user_items = mysqli_stmt_num_rows(db_query("SELECT id FROM ware WHERE item_id='$row2[id]' AND user='$user_ida[id]' LIMIT 100"));
if($user_items) { if($user_items) {
$STORE_ITEMS .= "".$row2['name']." x ".$user_items."<br>"; $STORE_ITEMS .= "".$row2['name']." x ".$user_items."<br>";
} }
} }
$Total = mysql_num_rows(mysql_query("SELECT id FROM item WHERE preis>0 and $filter AND s_type='$ords'")); $Total = mysqli_stmt_num_rows(db_query("SELECT id FROM item WHERE preis>0 and $filter AND s_type='$ords'"));
$pages = ceil($Total/10); $pages = ceil($Total/10);
$z = 1; $z = 1;

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save