$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));
mysql_query('DELETE from user_activation where username = \''.$user_k['username'].'\'');
db_query($sql);
db_query('DELETE from user_activation where username = \''.$user_k['username'].'\'');
displayErrorMessage(NULL,'Account wurde aktiviert!', '<ahref="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');
@ -315,7 +315,7 @@ function renovate($user, $arena, $vermoegen){
$arena = getArena($user_ida['id']);
$auktionensumme = mysql_fetch_assoc(mysql_query('SELECT SUM(aktuellesgebot) as summe FROM auktion WHERE bieter = '.$user_ida['id'].' GROUP BY bieter'));
$auktionensumme = mysqli_fetch_assoc(db_query('SELECT SUM(aktuellesgebot) as summe FROM auktion WHERE bieter = '.$user_ida['id'].' GROUP BY bieter'));
$auktionensumme = $auktionensumme['summe'];
$vermoegen = $user['geld'] - $auktionensumme;
$unterhalt = calculateUnterhaltsKosten($arena);
@ -325,9 +325,9 @@ if($action == 'miete'){
if($vermoegen < $unterhalt){
displayErrorMessage(NULL, 'Du hast nicht genug Geld um die Unterhaltskosten zu bezahlen!', displayHistoryBackLink());
} else{
mysql_query('Update user set geld = geld - '.$unterhalt.' WHERE id = '.$user_ida['id']);
mysql_query('Update arena set mietlasten = 0, steuerlasten = 0 WHERE id = '.$arena['id']);
$arena = mysql_fetch_assoc(mysql_query('SELECT * FROM arena where besitzer = \''.$user_ida['id'].'\''));
db_query('Update user set geld = geld - '.$unterhalt.' WHERE id = '.$user_ida['id']);
db_query('Update arena set mietlasten = 0, steuerlasten = 0 WHERE id = '.$arena['id']);
$arena = mysqli_fetch_assoc(db_query('SELECT * FROM arena where besitzer = \''.$user_ida['id'].'\''));
$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'] . ')'));
$e_schuhe = mysql_query("SELECT i.name, w.id, i.level FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE (i.type='$char_1[type]' OR i.type='ALL') AND w.user='$user_ida[id]' AND w.ru_mal='1' AND i.s_type='Schuhe' AND i.level <='$char_1[level]' group by i.name order by i.level desc");
$e_schwert = mysql_query("SELECT i.name, w.id, i.level FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE (i.type='$char_1[type]' OR i.type='ALL') AND w.user='$user_ida[id]' AND w.ru_mal='1' AND i.s_type='Schwert' AND i.level <='$char_1[level]' group by i.name order by i.level desc");
$e_rustung = mysql_query("SELECT i.name, w.id, i.level FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE (i.type='$char_1[type]' OR i.type='ALL') AND w.user='$user_ida[id]' AND w.ru_mal='1' AND i.s_type='Ruestung' AND i.level <='$char_1[level]' group by i.name order by i.level desc");
$e_schild = mysql_query("SELECT i.name, w.id, i.level FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE (i.type='$char_1[type]' OR i.type='ALL') AND w.user='$user_ida[id]' AND w.ru_mal='1' AND i.s_type='Schild' AND i.level <='$char_1[level]' group by i.name order by i.level desc");
$e_helm = mysql_query("SELECT i.name, w.id, i.level FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE (i.type='$char_1[type]' OR i.type='ALL') AND w.user='$user_ida[id]' AND w.ru_mal='1' AND i.s_type='Helm' AND i.level <='$char_1[level]' group by i.name order by i.level desc");
$e_schuhe = db_query("SELECT i.name, w.id, i.level FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE (i.type='$char_1[type]' OR i.type='ALL') AND w.user='$user_ida[id]' AND w.ru_mal='1' AND i.s_type='Schuhe' AND i.level <='$char_1[level]' group by i.name order by i.level desc");
$e_schwert = db_query("SELECT i.name, w.id, i.level FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE (i.type='$char_1[type]' OR i.type='ALL') AND w.user='$user_ida[id]' AND w.ru_mal='1' AND i.s_type='Schwert' AND i.level <='$char_1[level]' group by i.name order by i.level desc");
$e_rustung = db_query("SELECT i.name, w.id, i.level FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE (i.type='$char_1[type]' OR i.type='ALL') AND w.user='$user_ida[id]' AND w.ru_mal='1' AND i.s_type='Ruestung' AND i.level <='$char_1[level]' group by i.name order by i.level desc");
$e_schild = db_query("SELECT i.name, w.id, i.level FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE (i.type='$char_1[type]' OR i.type='ALL') AND w.user='$user_ida[id]' AND w.ru_mal='1' AND i.s_type='Schild' AND i.level <='$char_1[level]' group by i.name order by i.level desc");
$e_helm = db_query("SELECT i.name, w.id, i.level FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE (i.type='$char_1[type]' OR i.type='ALL') AND w.user='$user_ida[id]' AND w.ru_mal='1' AND i.s_type='Helm' AND i.level <='$char_1[level]' group by i.name order by i.level desc");
$checked = explode(',',$char_1['kampf_item']);
?>
<body>
@ -251,7 +251,7 @@ function stelledar($char_id,$user_ida,$name) {
$sql = 'SELECT * FROM user_clan_invitations WHERE userid = '.$user_ida['id'].' and valid > now();';
$qry = mysql_query($sql);
while($row = mysql_fetch_assoc($qry)){
$qry = db_query($sql);
while($row = mysqli_fetch_assoc($qry)){
?>
@ -108,9 +108,9 @@ if ($action == 'accept') {
</tr>
<?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';
$clan = mysql_query($sql);
while ($row = mysql_fetch_array($clan)) {
$mitglieder = mysql_num_rows(mysql_query('SELECT id FROM user WHERE clan='.$row['id']));
$clan = db_query($sql);
while ($row = mysqli_fetch_array($clan)) {
$mitglieder = mysqli_stmt_num_rows(db_query('SELECT id FROM user WHERE clan='.$row['id']));
$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';
$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]'");
$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]'");
@ -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()');
@ -256,10 +256,10 @@ function displayClanProfileReadOnly($clan, $ownclan, $userid){
}
function displayClanProfileEditable($clan, $userid){
$member_qry = mysql_query('Select id from user where clan = '.$clan['id']);
$member_qry = db_query('Select id from user where clan = '.$clan['id']);
$member = array();
$count = mysql_num_rows($member_qry);
while($row = mysql_fetch_assoc($member_qry)){
$count = mysqli_stmt_num_rows($member_qry);
while($row = mysqli_fetch_assoc($member_qry)){
$tmp = generateUserLinkByID($row['id']);
$kickable = true;
@ -278,10 +278,10 @@ function displayClanProfileEditable($clan, $userid){
}
}
$inv_qry = mysql_query('SELECT userid, TIMESTAMPDIFF(HOUR, now(), valid) as till FROM user_clan_invitations WHERE clanid = '.$clan['id'].' and valid > now()');
$inv_qry = db_query('SELECT userid, TIMESTAMPDIFF(HOUR, now(), valid) as till FROM user_clan_invitations WHERE clanid = '.$clan['id'].' and valid > now()');
@ -30,9 +30,9 @@ function getEventChars($challenge_id, $event_id) {
$sql = 'SELECT * FROM clan_challenge_participants ccp INNER JOIN event_chars ec ON ccp.char_id=ec.event_char_id
INNER JOIN event_fights ef ON ccp.slot=ef.event_fight_id
WHERE ccp.clan_challenge_id = '.$challenge_id.' AND ec.event_id= '.$event_id.' AND ef.event_id= '.$event_id.' ORDER BY slot;';
$qry = mysql_query($sql);
$qry = db_query($sql);
$chars = array();
while($row = mysql_fetch_array($qry)) {
while($row = mysqli_fetch_array($qry)) {
$chars[] = $row;
}
return $chars;
@ -41,9 +41,9 @@ function getEventChars($challenge_id, $event_id) {
function getChallengeClans($challenge_id) {
$sql = 'SELECT ccc.id, c.clanname, ccc.elo_change, ccc.exp_change, c.id as clan_id, ccc.points FROM clan_challenge_clans ccc INNER JOIN clan c ON ccc.clan_id=c.id WHERE clan_challenge_id='.$challenge_id.';';
@ -231,7 +231,7 @@ function displayShowChallenge($clan_challenge_id, $user) {
<?phpif($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'].')');
$clan = mysql_fetch_array(mysql_query("SELECT geld FROM clan WHERE id='$user_ida[clan]' LIMIT 1"));
$user = mysql_fetch_array(mysql_Query("SELECT nickname, geld FROM user WHERE id='$user_ida[id]' LIMIT 1"));
$clan = mysqli_fetch_array(db_query("SELECT geld FROM clan WHERE id='$user_ida[clan]' LIMIT 1"));
$user = mysqli_fetch_array(db_query("SELECT nickname, geld FROM user WHERE id='$user_ida[id]' LIMIT 1"));
if ($charm == 1) {
if($clan_geld <= 0) {
mysql_query("INSERT INTO cheater values('$user_ida[id]','Versuchte mehr weniger als 0 zu Spenden! (Eingabe:".$clan_geld.")',now())");
db_query("INSERT INTO cheater values('$user_ida[id]','Versuchte mehr weniger als 0 zu Spenden! (Eingabe:".$clan_geld.")',now())");
displayErrorMessage(NULL,'Geld darf nicht unter 0 sein!', '<ahref="index.php?as=clan/spende">weiter...</a>');
exit;
}
@ -33,19 +33,19 @@ if ($charm == 1) {
// Um Pufferueberlaeufe zu vermeiden, einfach die Laenge der Zeichenkette abfragen, ab der 8ten stelle also uerbe 99 Mio geht nicht aufeinmal!
if(strlen($clan_geld)>8) {
mysql_query("INSERT INTO cheater values('$user_ida[id]','Versuchte mehr als 99.999.999 aufeinmal zu Spenden! (Eingabe:".$clan_geld.")',now())");
db_query("INSERT INTO cheater values('$user_ida[id]','Versuchte mehr als 99.999.999 aufeinmal zu Spenden! (Eingabe:".$clan_geld.")',now())");
displayErrorMessage(NULL,'Es kann nicht mehr als 99.999.999 aufeinmal gespendet werden!', '<ahref="index.php?as=clan/spende">weiter...</a>');
exit;
}
if($clan_geld <= 0) {
mysql_query("INSERT INTO cheater values('$user_ida[id]','Versuchte mehr weniger als 0 zu Spenden! (Eingabe:".$clan_geld.")',now())");
db_query("INSERT INTO cheater values('$user_ida[id]','Versuchte mehr weniger als 0 zu Spenden! (Eingabe:".$clan_geld.")',now())");
displayErrorMessage(NULL,'Geld darf nicht unter 0 sein!', '<ahref="index.php?as=clan/spende">weiter...</a>');
exit;
}
// Damit das minus nicht ausgenutzt wird!!
$auktionensumme = mysql_fetch_assoc(mysql_query('SELECT SUM(aktuellesgebot) as summe FROM auktion WHERE bieter = '.$user_ida['id'].' GROUP BY bieter'));
$auktionensumme = mysqli_fetch_assoc(db_query('SELECT SUM(aktuellesgebot) as summe FROM auktion WHERE bieter = '.$user_ida['id'].' GROUP BY bieter'));
//$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 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 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';
$clans_spend = mysql_query('SELECT spende, nickname, user.id as userid FROM user left join user_clan on user.id = user_clan.userid and user.clan = user_clan.clanid WHERE user.clan = '.$user_ida['clan'].' ORDER BY spende DESC');
$member = mysql_num_rows($clans_spend);
$clans_spend = db_query('SELECT spende, nickname, user.id as userid FROM user left join user_clan on user.id = user_clan.userid and user.clan = user_clan.clanid WHERE user.clan = '.$user_ida['clan'].' ORDER BY spende DESC');
$member = mysqli_stmt_num_rows($clans_spend);
$sql = 'select besitzer, round(sum(1/(1+exp(3-level/12)) * nutzung)) as nutzkosten from user inner join chars on chars.besitzer = user.id inner join clan_ware on chars.clan_train = clan_ware.id inner join clan_item on clan_ware.item_id = clan_item.id where user.clan = clan_ware.clan and user.clan = '.$user_ida['clan'].' group by besitzer order by besitzer';
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;
}
function wuenschePotaras($user){
mysql_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']);
db_query('INSERT sp_ware SET item=1, user='.$user['id']);
return true;
}
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) {
displayErrorMessage(NULL,'Du besitzt das benötigte Item nicht!!',displayHistoryBackLink());
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){
displayErrorMessage(NULL,'Die Wahrscheinlichkeit eine Frucht zu bekommen entspricht nicht 100%, Melde dich bei einem der GM!!',displayHistoryBackLink());
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);
$peak = 0;
while($row = mysql_fetch_assoc($natur_frucht)){
while($row = mysqli_fetch_assoc($natur_frucht)){
$peak += $row['verteilung'];
if($value <= $peak){
break;
}
}
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;
}
@ -81,8 +81,8 @@ function wuenscheSpecialChar($user, $specialcharname, $newname = ''){
}
// Hat der User überhaupt das Item ???
$qry = mysql_query('SELECT count(*) AS anzahl FROM sp_ware WHERE item='.$spitem.' AND user='.$user['id']);
$row = mysql_fetch_assoc($qry);
$qry = db_query('SELECT count(*) AS anzahl FROM sp_ware WHERE item='.$spitem.' AND user='.$user['id']);
$row = mysqli_fetch_assoc($qry);
if($row['anzahl'] <1){
// Er hat das Item garnicht!!
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!
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;
}
@ -116,8 +116,8 @@ function wuenscheUserRename($user, $newname){
$sql = 'Insert into gm_actions(userid, time, message, ip) values('.$_SESSION['user'].', now(), \''.$message.'\', \''.$_SERVER['REMOTE_ADDR'].'\')';
// echo $sql.'<br>';
mysql_query($sql);
db_query($sql);
}
function showActionLog(){
$qry = mysql_query('Select g.time, u.nickname, g.ip, g.message from gm_actions as g inner join user as u on g.userid = u.id order by time desc LIMIT 100');
while($row = mysql_fetch_assoc($qry)){
$qry = db_query('Select g.time, u.nickname, g.ip, g.message from gm_actions as g inner join user as u on g.userid = u.id order by time desc LIMIT 100');
echo "\t\t\t".'<tr><tdcolspan="2">Änderungen wurden übernommen!</td></tr>';
@ -614,7 +614,7 @@ function createAttackentyp($data) {
$sql .= '\''.$data['kategorie'].'\'';
}
$sql .= ');';
$identifier = mysql_query($sql);
$identifier = db_query($sql);
if($identifier == FALSE){
echo "\t".'<tr><tdcolspan="2"style="text-align:center">Es gab Probleme beim erstellen des Attacktyps!</td></tr>'."\n";
} else {
@ -628,7 +628,7 @@ function deleteAttackentyp($attid) {
$colspan = 1;
$sql = 'DELETE FROM attackentyp WHERE id = '.$attid.';';
$qry = db_query($sql);
if($qry === FALSE || mysql_affected_rows() <= 0){
if($qry === FALSE || db_affected_rows() <= 0){
echo "\t".'<tr><tdcolspan="'.$colspan.'"style="text-align:center;color:red">Der Attackentyp '.$row['name'].' konnte nicht gelöscht werden!</td></tr>'."\n";;
} else {
echo "\t".'<tr><tdcolspan="'.$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;
$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';
$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';
$auser = mysql_query('SELECT distinct(user.nickname) FROM chars inner join user on chars.besitzer = user.id where SUBSTRING(nickname,1,1) < \'a\' and bild != \'design/bilder/avatare/noavart.gif\' and bild != \'\' group by user.id order by nickname ASC LIMIT '.($begin*10).', 10');
$total = mysql_fetch_assoc(mysql_query('SELECT count(distinct(user.id)) as anzahl FROM chars inner join user on chars.besitzer = user.id where SUBSTRING(nickname,1,1) < \'a\' and bild != \'design/bilder/avatare/noavart.gif\' and bild != \'\''));
$auser = db_query('SELECT distinct(user.nickname) FROM chars inner join user on chars.besitzer = user.id where SUBSTRING(nickname,1,1) < \'a\' and bild != \'design/bilder/avatare/noavart.gif\' and bild != \'\' group by user.id order by nickname ASC LIMIT '.($begin*10).', 10');
$total = mysqli_fetch_assoc(db_query('SELECT count(distinct(user.id)) as anzahl FROM chars inner join user on chars.besitzer = user.id where SUBSTRING(nickname,1,1) < \'a\' and bild != \'design/bilder/avatare/noavart.gif\' and bild != \'\''));
} else if($letter == null){
$auser = mysql_query('SELECT * FROM chars inner join user on chars.besitzer = user.id where bild != \'design/bilder/avatare/noavart.gif\' and bild != \'\' group by user.id order by nickname ASC LIMIT '.($begin*10).', 10');
$total = mysql_fetch_assoc(mysql_query('SELECT count(distinct(user.id)) as anzahl FROM chars inner join user on chars.besitzer = user.id where bild != \'design/bilder/avatare/noavart.gif\' and bild != \'\''));
$auser = db_query('SELECT * FROM chars inner join user on chars.besitzer = user.id where bild != \'design/bilder/avatare/noavart.gif\' and bild != \'\' group by user.id order by nickname ASC LIMIT '.($begin*10).', 10');
$total = mysqli_fetch_assoc(db_query('SELECT count(distinct(user.id)) as anzahl FROM chars inner join user on chars.besitzer = user.id where bild != \'design/bilder/avatare/noavart.gif\' and bild != \'\''));
} else{
$auser = mysql_query('SELECT * FROM chars inner join user on chars.besitzer = user.id where nickname like \''.$letter.'%\' and bild != \'design/bilder/avatare/noavart.gif\' and bild != \'\' group by user.id order by nickname ASC LIMIT '.($begin*10).', 10');
$total = mysql_fetch_assoc(mysql_query('SELECT count(distinct(user.id)) as anzahl FROM chars inner join user on chars.besitzer = user.id where nickname like \''.$letter.'%\' and bild != \'design/bilder/avatare/noavart.gif\' and bild != \'\''));
$auser = db_query('SELECT * FROM chars inner join user on chars.besitzer = user.id where nickname like \''.$letter.'%\' and bild != \'design/bilder/avatare/noavart.gif\' and bild != \'\' group by user.id order by nickname ASC LIMIT '.($begin*10).', 10');
$total = mysqli_fetch_assoc(db_query('SELECT count(distinct(user.id)) as anzahl FROM chars inner join user on chars.besitzer = user.id where nickname like \''.$letter.'%\' and bild != \'design/bilder/avatare/noavart.gif\' and bild != \'\''));
$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';
$row = mysql_fetch_assoc(mysql_query('select max(max_id) + 1 as id from (select max(s.id) as max_id from sp_item s union select max(i.id) as max_id from item i union select max(w.id) as max_id from wochen_markt w) gno'));
// $row = mysql_fetch_assoc(mysql_query('SELECT max(id) +1 as id FROM '.$itemtable));
$row = mysqli_fetch_assoc(db_query('select max(max_id) + 1 as id from (select max(s.id) as max_id from sp_item s union select max(i.id) as max_id from item i union select max(w.id) as max_id from wochen_markt w) gno'));
// $row = mysqli_fetch_assoc(db_query('SELECT max(id) +1 as id FROM '.$itemtable));
$itemid = $row['id'];
$sql = 'INSERT INTO '.$itemtable.' (id, '.join($d_array,', ').') values('.$itemid;
$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');
while($row = mysql_fetch_assoc($cheater_qry)){
$cheater_qry = db_query('Select u1.nickname as u1n, u1.id as u1i, u2.nickname u2n, u2.id u2i, count(occured) as anzahl from multiuser left join user as u1 on multiuser.user1 = u1.id left join user as u2 on multiuser.user2 = u2.id where occured >= \''.$low.' 00:00:00\' and occured <= \''.$high.' 23:59:59\' group by u1i, u2i order by anzahl');
$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 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, 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\'';
$qry = mysql_query('select id, nickname from user where id in ('.$user1.', '.$user2.')');
while($row = mysql_fetch_assoc($qry)){
$qry = db_query('select id, nickname from user where id in ('.$user1.', '.$user2.')');
while($row = mysqli_fetch_assoc($qry)){
$users[] = $row['nickname'];
}
displayErrorMessage('Verwarnung ausgesprochen', 'Die User '.join(' und ',$users).' sind nun verwarnt!', '<ahref="'.$_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 Überschneidungen, wir bitten euch dies zu unterlassen, da wir uns sonst gezwungen sehen diese Aktivitäten zu bestrafen!\', '.$user1.')');
mysql_query('INSERT INTO nachricht(betreff, von, datum, text, besitzer) values(\'Verwarnung\', \'AG-Team\', now(), \'Es kam zwischen den Accounts '.join(' und ',$users).' zu Überschneidungen, wir bitten euch dies zu unterlassen, da wir uns sonst gezwungen sehen diese Aktivitäten zu bestrafen!\', '.$user2.')');
db_query('INSERT INTO nachricht(betreff, von, datum, text, besitzer) values(\'Verwarnung\', \'AG-Team\', now(), \'Es kam zwischen den Accounts '.join(' und ',$users).' zu Überschneidungen, wir bitten euch dies zu unterlassen, da wir uns sonst gezwungen sehen diese Aktivitäten zu bestrafen!\', '.$user1.')');
db_query('INSERT INTO nachricht(betreff, von, datum, text, besitzer) values(\'Verwarnung\', \'AG-Team\', now(), \'Es kam zwischen den Accounts '.join(' und ',$users).' zu Überschneidungen, wir bitten euch dies zu unterlassen, da wir uns sonst gezwungen sehen diese Aktivitäten zu bestrafen!\', '.$user2.')');
logaction('Die User '.join(' und ',$users).' wurden verwarnt!');
} else{
$qry = mysql_query('select id, nickname from user where id in ('.$user1.', '.$user2.')');
while($row = mysql_fetch_assoc($qry)){
$qry = db_query('select id, nickname from user where id in ('.$user1.', '.$user2.')');
while($row = mysqli_fetch_assoc($qry)){
$users[] = $row['nickname'];
}
displayErrorMessage('Verwarnen', 'Sollen die User '.join(' und ',$users).' wirklich verwarnt werden?', '<ahref="'.$_SERVER['PHP_SELF'].'?choose=cheat&action=vwarn&user1='.$user1.'&user2='.$user2.'&verify=1">weiter</a> | '.displayHistoryBackLink());
$qry = mysql_query('select id, nickname from user where id in ('.$user1.', '.$user2.')');
while($row = mysql_fetch_assoc($qry)){
$qry = db_query('select id, nickname from user where id in ('.$user1.', '.$user2.')');
while($row = mysqli_fetch_assoc($qry)){
$users[] = $row['nickname'];
}
displayErrorMessage('Bann vollzogen!', 'Die User '.join(' und ',$users).' sind nun verwarnt!', '<ahref="'.$_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 Überschneidungen. Deswegen sahen wir uns gezwungen diese Aktivitäten zu bestrafen!\', '.$user1.')');
mysql_query('INSERT INTO nachricht(betreff, von, datum, text, besitzer) values(\'Bann\', \'AG-Team\', now(), \'Es kam zwischen den Accounts '.join(' und ',$users).' zu Überschneidungen. Deswegen sahen wir uns gezwungen diese Aktivitäten zu bestrafen!\', '.$user2.')');
mysql_query('Update user set bann = \'ja\' where id IN('.$user1.', '.$user2.')');
db_query('INSERT INTO nachricht(betreff, von, datum, text, besitzer) values(\'Bann\', \'AG-Team\', now(), \'Es kam zwischen den Accounts '.join(' und ',$users).' zu Überschneidungen. Deswegen sahen wir uns gezwungen diese Aktivitäten zu bestrafen!\', '.$user1.')');
db_query('INSERT INTO nachricht(betreff, von, datum, text, besitzer) values(\'Bann\', \'AG-Team\', now(), \'Es kam zwischen den Accounts '.join(' und ',$users).' zu Überschneidungen. Deswegen sahen wir uns gezwungen diese Aktivitäten zu bestrafen!\', '.$user2.')');
db_query('Update user set bann = \'ja\' where id IN('.$user1.', '.$user2.')');
logaction('Die User '.join(' und ',$users).' wurden gebannt!');
} else{
$qry = mysql_query('select id, nickname from user where id in ('.$user1.', '.$user2.')');
while($row = mysql_fetch_assoc($qry)){
$qry = db_query('select id, nickname from user where id in ('.$user1.', '.$user2.')');
while($row = mysqli_fetch_assoc($qry)){
$users[] = $row['nickname'];
}
displayErrorMessage('Bannen', 'Sollen die User '.join(' und ',$users).' wirklich gebannt werden?', '<ahref="'.$_SERVER['PHP_SELF'].'?choose=cheat&action=ban&user1='.$user1.'&user2='.$user2.'&verify=1">weiter</a> | '.displayHistoryBackLink());
$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!', '<ahref="'.$_SERVER['PHP_SELF'].'?choose=cheat">weiter</a>');
logaction('Der Handel zwischen '.$trade['u1n'].' und '.$trade['u2n'].' wurde als \'Ok\' markiert (Tradeid = '.$tradeid.')!');
mysql_query('Update auktion_transaktionen set cheatingverdacht = 0 where transaktionsid = '.$tradeid);
db_query('Update auktion_transaktionen set cheatingverdacht = 0 where transaktionsid = '.$tradeid);
} else{
$trade = mysql_fetch_assoc(mysql_query('SELECT u1.nickname as u1n, u1.id as u1i, u2.nickname u2n, u2.id u2i, at.anzahl, betrag, deadline, cheatingverdacht, it.name as i_name, si.name as s_name, wm.item as w_name, itemid, tablename FROM auktion_transaktionen at left join sp_item si on tablename = \'sp_ware\' and itemid = si.id left join item as it on tablename = \'ware\' and itemid = it.id left join wochen_markt as wm on tablename = \'wochen_ware\' and itemid = wm.id left join user as u1 on at.anbieter = u1.id left join user as u2 on at.bieter = u2.id where transaktionsid = '.$tradeid));
$trade = mysqli_fetch_assoc(db_query('SELECT u1.nickname as u1n, u1.id as u1i, u2.nickname u2n, u2.id u2i, at.anzahl, betrag, deadline, cheatingverdacht, it.name as i_name, si.name as s_name, wm.item as w_name, itemid, tablename FROM auktion_transaktionen at left join sp_item si on tablename = \'sp_ware\' and itemid = si.id left join item as it on tablename = \'ware\' and itemid = it.id left join wochen_markt as wm on tablename = \'wochen_ware\' and itemid = wm.id left join user as u1 on at.anbieter = u1.id left join user as u2 on at.bieter = u2.id where transaktionsid = '.$tradeid));
displayErrorMessage('Trade validieren!', 'Sollen der Handel zwischen '.$trade['u1n'].' und '.$trade['u2n'].' als \'Ok\' markiert werden?', '<ahref="'.$_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>
<?php
} 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>
<tr>
@ -539,7 +539,7 @@ function displayBannOptions($action, $username,$opfer,$gamebann,$shoutbann,$fore
<?php
} else if($action == "search"){
// 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.'%\'');
$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'] . ')'));
$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'));
$qry = mysql_query('SELECT aktuellesgebot, startgebot FROM auktion WHERE auktionsid = '.$auktionsid);
if(mysql_num_rows($qry) != 1){ // Auktion nicht vorhanden??
$qry = db_query('SELECT aktuellesgebot, startgebot FROM auktion WHERE auktionsid = '.$auktionsid);
if(mysqli_stmt_num_rows($qry) != 1){ // Auktion nicht vorhanden??
return -1;
}
$result = mysql_fetch_assoc($qry); // Hole dir den einen Datensatz
$result = mysqli_fetch_assoc($qry); // Hole dir den einen Datensatz
// Aktuelles Gebot vorhanden??
if($result['aktuellesgebot']!=NULL){
$minBetrag = $result['aktuellesgebot']*1.02; // Mindestens 2% mehr muss geboten werden
@ -49,9 +49,9 @@ function aktuellesMindestgebot($auktionsid){
*/
function getUserAvailableMoney($userid) {
//Nun muss noch geprueft werden ob der User genug Geld hat und auch mit allen Geboten gesamt nicht in den Minusbereich kommt
$user_a = mysql_fetch_assoc(mysql_query('SELECT nickname, geld FROM user WHERE id = '.$userid));
$user_a = mysqli_fetch_assoc(db_query('SELECT nickname, geld FROM user WHERE id = '.$userid));
$usermoney = $user_a['geld'];
$auktionensumme = mysql_fetch_assoc(mysql_query('SELECT SUM(aktuellesgebot) as summe FROM auktion WHERE bieter = '.$userid));
$auktionensumme = mysqli_fetch_assoc(db_query('SELECT SUM(aktuellesgebot) as summe FROM auktion WHERE bieter = '.$userid));
$auktionensumme = $auktionensumme['summe'];
return $usermoney - $auktionensumme;
@ -99,9 +99,9 @@ function biete($userid, $auktionsid, $gebot){
//Nun muss noch geprueft werden ob der User genug Geld hat und auch mit allen Geboten gesamt nicht in den Minusbereich kommt
$user_a = mysql_fetch_assoc(mysql_query('SELECT nickname, geld FROM user WHERE id = '.$userid));
$user_a = mysqli_fetch_assoc(db_query('SELECT nickname, geld FROM user WHERE id = '.$userid));
$usermoney = $user_a['geld'];
$auktionensumme = mysql_fetch_assoc(mysql_query('SELECT SUM(aktuellesgebot) as summe FROM auktion WHERE bieter = '.$userid.' AND auktionsid != '.$auktionsid.' GROUP BY bieter'));
$auktionensumme = mysqli_fetch_assoc(db_query('SELECT SUM(aktuellesgebot) as summe FROM auktion WHERE bieter = '.$userid.' AND auktionsid != '.$auktionsid.' GROUP BY bieter'));
$auktionensumme = $auktionensumme['summe'];
if($usermoney < $auktionensumme + $gebot){
@ -110,18 +110,18 @@ function biete($userid, $auktionsid, $gebot){
//Wenn 10 minuten vor Deadline-ende geboten wird wird die deadline um 10 Minuten verschoben
if($zeitdifferenz <10){
mysql_query('UPDATE auktion SET bieter='.$userid.', aktuellesgebot='.$gebot.', deadline=TIMESTAMPADD(Minute,10,TIMESTAMPADD(Second,-second(now()),now())) WHERE auktionsid='.$auktionsid);
db_query('UPDATE auktion SET bieter='.$userid.', aktuellesgebot='.$gebot.', deadline=TIMESTAMPADD(Minute,10,TIMESTAMPADD(Second,-second(now()),now())) WHERE auktionsid='.$auktionsid);
// Speichern der neuen deadline in die deadlinevariable
$res_deadline = mysql_fetch_assoc(mysql_query('SELECT deadline FROM auktion WHERE auktionsid = '.$auktionsid));
$res_deadline = mysqli_fetch_assoc(db_query('SELECT deadline FROM auktion WHERE auktionsid = '.$auktionsid));
$deadline = $res_deadline['deadline'];
} else{
// Ansonsten nur die Grundwerte
mysql_query('UPDATE auktion SET bieter='.$userid.', aktuellesgebot='.$gebot.' WHERE auktionsid='.$auktionsid);
db_query('UPDATE auktion SET bieter='.$userid.', aktuellesgebot='.$gebot.' WHERE auktionsid='.$auktionsid);
}
// Nun noch den aktuellen bieter eine Nachricht senden
sendMessage('Auktionsmarkt', $bieter, 'Überboten worden', 'Sie sind von '.$user_a['nickname'].' überboten worden, er bietet '.$gebot.' für das Item '.debbcode($itemname).'. Deadline: '.$deadline.' Link: [url='.$GLOBALS['server_url_long'].ROOT_URL.'/index.php?as=auktion&action=1&auktionsid='.$auktionsid.']Auktion[/url]');
// mysql_query($new_query);
// db_query($new_query);
// echo '<br><br>'.$new_query.'<br><br>';
return ''; // Leerer String, also kein Fehler!
}
@ -139,9 +139,9 @@ function getItemOptions($userid,$preselected){
union
SELECT i.id, i.item AS name, count(i.id) AS anzahl, \'wochen_ware\' as tablename FROM wochen_ware w INNER JOIN wochen_markt i ON(i.id=w.item) WHERE w.user = '.$userid.' GROUP BY (i.id)';
$qry = mysql_query($query);
$qry = db_query($query);
// Damit waeren alle noetigen Datenbankaufrufe erledigt!
@ -189,23 +189,23 @@ function insertItem($userid,$id_db_mix, $anzahl, $startgebot){
// Nun die Anzahl vergleichen
$test = 'SELECT count(i.id) AS anzahl FROM '.$db[0].' as w INNER JOIN '.$db[1].' as i ON(i.id=w.'.$db[2].') where w.user= '.$userid.' AND i.id = '.$id;
`transaktionsid` int(10) unsigned NOT NULL auto_increment,
`anbieter` int(10) unsigned NOT NULL,
@ -267,11 +267,11 @@ function getAuktionTotalCount($kategorie,$itemnamepart,$maxPrice){
$stringDelimiter = ' AND itemname LIKE \'%'.$itemnamepart.'%\' ';
}
$test = 'SELECT count(auktionsid) as anzahl FROM auktion WHERE 1 '.$kategorieDelimitier.$stringDelimiter.$priceDelimiter.' AND TIMESTAMPDIFF(Minute,now(),deadline) >= 0';
$qry = mysql_query($test);
if(mysql_num_rows($qry) == 0){
$qry = db_query($test);
if(mysqli_stmt_num_rows($qry) == 0){
return 0;
}
$result = mysql_fetch_assoc($qry);
$result = mysqli_fetch_assoc($qry);
return $result['anzahl'];
}
@ -294,9 +294,9 @@ function getAuktionEntries($kategorie,$itemnamepart,$entriesPerSite,$pageNumber,
}
$index = 0;
$test = 'SELECT a.auktionsid, u.nickname AS anbietername, u2.nickname AS bietername, a.deadline, a.aktuellesgebot, a.startgebot, a.anzahl, a.itemname, a.bieter, a.anbieter, a.itemid, a.tablename FROM auktion AS a INNER JOIN user as u ON a.anbieter = u.id LEFT JOIN user as u2 ON a.bieter = u2.id WHERE 1 '.$kategorieDelimitier.$stringDelimiter.$priceDelimiter.' AND TIMESTAMPDIFF(Minute,now(),deadline) >= 0 ORDER BY '.$order.' '.$dir.' '.$interval;
$qry = mysql_query($test);
$qry = db_query($test);
//echo '<br>'.$test.'<br>';
while($result = mysql_fetch_assoc($qry)){
while($result = mysqli_fetch_assoc($qry)){
$returnArray[$index++] = $result;
}
return $returnArray;
@ -304,9 +304,9 @@ function getAuktionEntries($kategorie,$itemnamepart,$entriesPerSite,$pageNumber,
function getEntryInformation($auktionsid){
if(!is_numeric($auktionsid)){return;}
$qry = mysql_query('SELECT u.nickname AS anbietername, u2.nickname AS bietername, a.auktionsid,a.anbieter,a.bieter,a.itemid,a.itemname,a.tablename,a.anzahl,a.startgebot,a.aktuellesgebot,a.deadline,a.startdate,a.cheatingverdacht, TIMESTAMPDIFF(Minute,now(),deadline) AS zeitdifferenz FROM auktion AS a INNER JOIN user as u ON a.anbieter = u.id LEFT JOIN user as u2 ON a.bieter = u2.id WHERE auktionsid = '.$auktionsid);
if(mysql_num_rows($qry) == 0){ return NULL; }
return mysql_fetch_assoc($qry);
$qry = db_query('SELECT u.nickname AS anbietername, u2.nickname AS bietername, a.auktionsid,a.anbieter,a.bieter,a.itemid,a.itemname,a.tablename,a.anzahl,a.startgebot,a.aktuellesgebot,a.deadline,a.startdate,a.cheatingverdacht, TIMESTAMPDIFF(Minute,now(),deadline) AS zeitdifferenz FROM auktion AS a INNER JOIN user as u ON a.anbieter = u.id LEFT JOIN user as u2 ON a.bieter = u2.id WHERE auktionsid = '.$auktionsid);
@ -318,8 +318,8 @@ function getKategorieOptions($preselect){
$total = 0;
$select = false;
$qry = mysql_query('SELECT tablename,count(tablename) as anzahl FROM auktion WHERE TIMESTAMPDIFF(Minute,now(),deadline) >= 0 AND itemname != \'Geheim!\' GROUP BY tablename');
while($row = mysql_fetch_assoc($qry)){
$qry = db_query('SELECT tablename,count(tablename) as anzahl FROM auktion WHERE TIMESTAMPDIFF(Minute,now(),deadline) >= 0 AND itemname != \'Geheim!\' GROUP BY tablename');
$sql = 'INSERT INTO '.$auktionsdaten['tablename'].' ('.$item_row_name.', user) VALUES('.$auktionsdaten['itemid'].','.$userid.')';
mysql_query($sql);
db_query($sql);
// echo '<br>'.$sql.'<br>';
}
$sql = 'INSERT INTO nachricht(von, besitzer, betreff, text) VALUES (\'Auktionsmarkt\', '.$auktionsdaten['anbieter'].', \'Item zurückgezogen!\', \' Sie haben das Item '.$auktionsdaten['itemname'].' für eine Gebühr von '.$gebuehr.' zurückgezogen!\')';
mysql_query($sql);
db_query($sql);
// echo '<br>'.$sql.'<br>';
if($auktionsdaten['bieter'] != NULL){
$sql = 'INSERT INTO nachricht(von, besitzer, betreff, text) VALUES (\'Auktionsmarkt\', '.$auktionsdaten['bieter'].', \'Item zurückgezogen!\', \' Das Item '.$auktionsdaten['itemname'].' wurde von '.$auktionsdaten['anbietername'].' zurückgezogen!\')';
mysql_query($sql);
db_query($sql);
// echo '<br>'.$sql.'<br>';
}
}
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';
$result = mysql_fetch_assoc(mysql_query('SELECT TIMESTAMPDIFF(Second,max(bann_until),now()) as anzahl from spammer WHERE userid='.$id.' group by userid'));
$result = mysqli_fetch_assoc(db_query('SELECT TIMESTAMPDIFF(Second,max(bann_until),now()) as anzahl from spammer WHERE userid='.$id.' group by userid'));
if($result['anzahl'] <0){
return true;
} else{
@ -17,11 +17,11 @@ function isSpammer($id){
function becomeSpammer($id,$nick,$text){
// Es gibt 2 indikatoren ein Spammer zu sein
// Man schreibt min 10 posts innerhalb von 20 Sekunden
$result1 = mysql_num_rows(mysql_query('SELECT * FROM ag_chat WHERE user=\''.$nick.'\' and TIMESTAMPDIFF(Second,zeit,now()) <= 20'));
$result1 = mysqli_stmt_num_rows(db_query('SELECT * FROM ag_chat WHERE user=\''.$nick.'\' and TIMESTAMPDIFF(Second,zeit,now()) <= 20'));
// Man schreibt min 30 Posts innerhalb einer Minute
$result2 = mysql_num_rows(mysql_query('SELECT * FROM ag_chat WHERE user=\''.$nick.'\' and TIMESTAMPDIFF(Second,zeit,now()) <= 60'));
$result2 = mysqli_stmt_num_rows(db_query('SELECT * FROM ag_chat WHERE user=\''.$nick.'\' and TIMESTAMPDIFF(Second,zeit,now()) <= 60'));
// Innerhalb einer halben Minute 4 mal den selben Post!!
$result3 = mysql_num_rows(mysql_query('SELECT * FROM ag_chat WHERE user=\''.$nick.'\' AND TIMESTAMPDIFF(Second,zeit,now()) <= 30 AND nachricht = \''.$text.'\''));
$result3 = mysqli_stmt_num_rows(db_query('SELECT * FROM ag_chat WHERE user=\''.$nick.'\' AND TIMESTAMPDIFF(Second,zeit,now()) <= 30 AND nachricht = \''.$text.'\''));
// Und nun noch ein paar Aergernisse
@ -40,21 +40,21 @@ function becomeSpammer($id,$nick,$text){
}
function setSpamblock($id){
$anzahl = mysql_num_rows(mysql_query('SELECT * FROM spammer WHERE userid='.$id.' AND TIMESTAMPDIFF(Day,bann_until,now()) <=14'));
$anzahl = mysqli_stmt_num_rows(db_query('SELECT * FROM spammer WHERE userid='.$id.' AND TIMESTAMPDIFF(Day,bann_until,now()) <=14'));
$zeit = pow(5,($anzahl+1));
mysql_query('INSERT INTO spammer(userid, bann_until) values('.$id.',TIMESTAMPADD(Minute,'.$zeit.',now()))');
db_query('INSERT INTO spammer(userid, bann_until) values('.$id.',TIMESTAMPADD(Minute,'.$zeit.',now()))');
}
function releaseSpamblock($id){
mysql_query('DELETE from spammer where userid='.$id.' and TIMESTAMPDIFF(Second,bann_until,now()) <0');
db_query('DELETE from spammer where userid='.$id.' and TIMESTAMPDIFF(Second,bann_until,now()) <0');
}
function bannAccount($id){
mysql_query('UPDATE user SET bann = \'ja\' WHERE id='.$id);
db_query('UPDATE user SET bann = \'ja\' WHERE id='.$id);
}
function unbannAccount($id){
mysql_query('UPDATE user SET bann = \'nein\' WHERE id='.$id);
db_query('UPDATE user SET bann = \'nein\' WHERE id='.$id);
@ -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()';
@ -171,7 +171,7 @@ function getCharWithBuffs($charid, $buffer_enabled = true){
function getCharBuffs($items) {
if($items != NULL && $items != ',,,,'){
$char_buffs = mysql_fetch_assoc(mysql_query('SELECT sum(i.hp) as hp, sum(i.mp) as mp, sum(i.starke) as starke, sum(i.verteidigung) as verteidigung, sum(i.speed) as speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id IN ('.$items.')'));
$char_buffs = mysqli_fetch_assoc(db_query('SELECT sum(i.hp) as hp, sum(i.mp) as mp, sum(i.starke) as starke, sum(i.verteidigung) as verteidigung, sum(i.speed) as speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id IN ('.$items.')'));
}
return $char_buffs;
}
@ -206,8 +206,8 @@ function getCharsOfUser($userid, $buffer_enabled = true) {
if ($GLOBALS['chars_read_out_user'][$userid] == null || !$buffer_enabled) {
$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'] . ')'));
$sql = 'INSERT INTO user_clan_invitations(userid, clanid, valid) values('.$userid.','.$user['clan'].',TIMESTAMPADD(DAY, 5, now()))';
// echo $sql.'<br>';
mysql_query($sql);
if(mysql_affected_rows() <= 0){ // Fehler?
db_query($sql);
if(db_affected_rows() <= 0){ // Fehler?
$sql = 'UPDATE user_clan_invitations SET valid = TIMESTAMPADD(DAY, 5, now()) where userid = '.$userid.' and clanid = '.$user['clan'];
// echo $sql.'<br>';
mysql_query($sql);
if(mysql_affected_rows() <= 0){ // Fehler?
db_query($sql);
if(db_affected_rows() <= 0){ // Fehler?
return 'Fehler! Konnte Nutzer nicht einladen!';
} else{
sendMessage($user['nickname'], $userid, 'Einladung in Clan', 'Die Einladung des Clans '.$clan['clanname'].' wurde aufgefrischt! Klicke auf "Clan beitreten" um die Einladung anzunehmen!');
@ -191,19 +191,19 @@ function fireMember($user, $member){
$sql = 'Update user set clan = NULL where id = '.$member.' AND clan = '.$user['clan'];
// echo $sql.'<br>';
mysql_query($sql);
if(mysql_affected_rows() > 0){ // Soll nur ausgeführt werden, wenn member wirklich gekickt wurde!!
db_query($sql);
if(db_affected_rows() > 0){ // Soll nur ausgeführt werden, wenn member wirklich gekickt wurde!!
$sql = 'Update chars set clan_train = NULL where besitzer = '.$member;
mysql_query($sql);
db_query($sql);
if($user['id'] != $member) {
sendMessage($user['nickname'], $member, 'Clan rauswurf!', 'Du wurdest von '.$user['nickname'].' aus deinem Clan geworfen. Du wirst dir wohl einen neuen suchen müssen!');
mysql_query('DELETE FROM clan WHERE id =' .$user['clan']);
db_query('DELETE FROM clan WHERE id =' .$user['clan']);
}
// delete the participation in open clan fights! Thats tricky because the user itself is not stored in the database!!
mysql_query('DELETE FROM clan_challenge_whitelist WHERE clan_id = ' .$clan['id'] . ' AND user_id = ' .$user['id']);
mysql_query('DELETE FROM clan_challenge_participants WHERE clan_challenge_id in (SELECT clan_challenge_id FROM clan_challenge where calculated = FALSE) and char_id IN (Select id FROM chars where besitzer = '.$user['id'].')');
db_query('DELETE FROM clan_challenge_whitelist WHERE clan_id = ' .$clan['id'] . ' AND user_id = ' .$user['id']);
db_query('DELETE FROM clan_challenge_participants WHERE clan_challenge_id in (SELECT clan_challenge_id FROM clan_challenge where calculated = FALSE) and char_id IN (Select id FROM chars where besitzer = '.$user['id'].')');
}
} else{
echo displayErrorMessage(NULL, 'Du kannst den Member nicht feuern!', displayHistoryBackLink());
@ -216,8 +216,8 @@ function fireMember($user, $member){
*
*/
function getAllClans() {
$qry = mysql_query('SELECT id,clanname FROM clan;');
while ($result = mysql_fetch_assoc($qry)) {
$qry = db_query('SELECT id,clanname FROM clan;');
while ($result = mysqli_fetch_assoc($qry)) {
$clans[] = $result;
}
return $clans;
@ -228,7 +228,7 @@ function joinClan($user, $clanid, $check_invitation = true){
isClanLocked($clanid); // we only require the calculation not the result!
$sql = 'SELECT * FROM user_clan_invitations WHERE userid = '.$user['id'].' and clanid = '.$clanid.' and valid > now();';
@ -241,13 +241,13 @@ function joinClan($user, $clanid, $check_invitation = true){
} else{
$sql = 'UPDATE user SET clan = '.$clanid.' WHERE id = '.$user['id'];
// echo $sql.'<br>';
mysql_query($sql);
db_query($sql);
// unset the leader if the user is moving from one clan to another
mysql_query('UPDATE clan SET leader = NULL WHERE leader = ' .$user['id'] . ' and id != ' .$clanid);
mysql_query('UPDATE clan SET co_leader = NULL WHERE co_leader = ' .$user['id'] . ' and id != ' .$clanid);
mysql_query('DELETE FROM clan_challenge_whitelist WHERE clan_id = ' .$clanid . ' AND user_id = ' .$user['id']);
mysql_query('DELETE FROM clan_challenge_participants where char_id IN (SELECT id from chars where besitzer = '.$user['id'].') and clan_challenge_id IN (SELECT clan_challenge_id from clan_challenges WHERE calculated = 0)');
db_query('UPDATE clan SET leader = NULL WHERE leader = ' .$user['id'] . ' and id != ' .$clanid);
db_query('UPDATE clan SET co_leader = NULL WHERE co_leader = ' .$user['id'] . ' and id != ' .$clanid);
db_query('DELETE FROM clan_challenge_whitelist WHERE clan_id = ' .$clanid . ' AND user_id = ' .$user['id']);
db_query('DELETE FROM clan_challenge_participants where char_id IN (SELECT id from chars where besitzer = '.$user['id'].') and clan_challenge_id IN (SELECT clan_challenge_id from clan_challenges WHERE calculated = 0)');
if($check_invitation) {
displayErrorMessage('Aufgenommen','Du wurdest erfolgreich in den Clan aufgenommen!','<ahref="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());
return;
}
mysql_query('DELETE FROM user_clan_invitations WHERE userid = '.$user['id'].' and clanid = '.$clanid);
db_query('DELETE FROM user_clan_invitations WHERE userid = '.$user['id'].' and clanid = '.$clanid);
}
function denyClan($user, $clanid){
mysql_query('DELETE FROM user_clan_invitations WHERE userid = '.$user['id'].' and clanid = '.$clanid);
if(mysql_affected_rows() > 0){
db_query('DELETE FROM user_clan_invitations WHERE userid = '.$user['id'].' and clanid = '.$clanid);
if(db_affected_rows() > 0){
displayErrorMessage('Abgelehnt','Du hast die Einladung erfolgreich abgelehnt!','<ahref="index.php?as=clan/add">weiter</a>');
} else{
displayErrorMessage(NULL,'Einladung des Clans konnte nicht abgelehnt werden!',displayHistoryBackLink());
@ -280,15 +280,15 @@ function deleteClan($userid) {
// Okay notify the members :)
$qry = mysql_query('SELECT id FROM user WHERE clan = '.$user['clan']);
while($member = mysql_fetch_assoc($qry)) {
$qry = db_query('SELECT id FROM user WHERE clan = '.$user['clan']);
while($member = mysqli_fetch_assoc($qry)) {
sendMessage($user['nickname'], $member['id'], 'Clan wurde gelöscht!', 'Dein Clan wurde von '.$user['nickname'].' gelöscht. Du wirst dir wohl einen neuen suchen müssen!');
}
// Check if this clan is level 0 and has 0 exp ...
if($clan['exp'] == 0 && $clan['level'] == 1) {
// really do delete the clan !!
mysql_query('DELETE FROM clan where id = '.$user['clan']);
db_query('DELETE FROM clan where id = '.$user['clan']);
} else {
// cleanup the clan!
$sql1 = 'UPDATE user SET clan = NULL WHERE clan = ' . $clanid;
@ -298,8 +298,8 @@ function deleteClan($userid) {
// echo $sql1 . '<br>';
// echo $sql2 . '<br>';
mysql_query($sql1);
mysql_query($sql2);
db_query($sql1);
db_query($sql2);
}
return NULL;
@ -308,15 +308,15 @@ function deleteClan($userid) {
function conquerClan($clanid, $userid) {
// It is possible to enter a clan that is empty :)
$user = getUser($userid);
$result = mysql_fetch_row(mysql_query('SELECT count(*) FROM user WHERE clan = ' . $clanid));
$result = mysqli_fetch_row(db_query('SELECT count(*) FROM user WHERE clan = ' . $clanid));
if($result[0] != 0) {
return 'Der Clan ('.$clanid.') ist nicht leer!';
}
$sql = 'UPDATE clan SET leader = ' . $userid . ' WHERE leader is NULL AND id = '. $clanid;
mysql_query($sql);
db_query($sql);
$done = mysql_affected_rows() > 0;
$done = db_affected_rows() > 0;
if(!$done) {
return 'Der Clan ist schon übernommen worden!';
}
@ -327,8 +327,8 @@ function conquerClan($clanid, $userid) {
}
function setMeAsLeader($user){
mysql_query('UPDATE clan set leader = '.$user['id'].' WHERE id = '.$user['clan'].' and leader IS null AND co_leader IS null');
return mysql_affected_rows() > 0;
db_query('UPDATE clan set leader = '.$user['id'].' WHERE id = '.$user['clan'].' and leader IS null AND co_leader IS null');
return db_affected_rows() > 0;
}
@ -354,8 +354,8 @@ function sendClanNewsletter($user, $text){
}
$errors = FALSE;
$sql = 'SELECT id FROM user WHERE clan='.$user['clan'];
@ -378,15 +378,15 @@ function addClanExp($clan_id, $exp) {
$n_exp = 0;
$n_level++;
}
mysql_query('UPDATE clan SET exp = ' .$n_exp. ', level = ' .$n_level . ' WHERE id = ' .$clan_id . ' AND exp = ' .$clan['exp'] . ' AND level = ' .$clan['level']);
if(mysql_affected_rows() == 0) {
db_query('UPDATE clan SET exp = ' .$n_exp. ', level = ' .$n_level . ' WHERE id = ' .$clan_id . ' AND exp = ' .$clan['exp'] . ' AND level = ' .$clan['level']);
if(db_affected_rows() == 0) {
echo 'Fehler beim zuweisen der Clanexp, dadurch sind dem Clan mit der ID ' . $clan['level'] . ' ' .$exp . ' exp fl&omul;ten gegangen!! Neue exp wären ' . $n_exp . ' bei level ' .$n_level;
} else {
$money = getMoneyBonusByLevel($n_level);
if($money > 0) {
// nice we can give the clan some money :D
insertClanTickerMessage($clan_id, 'Durch Erreichen von Level ' .$n_level . ' habt ihr ' . displayMoney($money) . ' bekommen!!');
mysql_query('UPDATE clan SET geld = geld + ' . $money . ' WHERE id = ' .$clan_id );
db_query('UPDATE clan SET geld = geld + ' . $money . ' WHERE id = ' .$clan_id );
// check if both clans have already been challengeing each other since 24h?
$sql = 'SELECT count(*) as anzahl FROM clan_challenge_requests WHERE clan_requester IN ('.$user['clan'].', '.$clanid.') AND clan_challenged IN ('.$user['clan'].', '.$clanid.') AND challenged_time > TIMESTAMPADD(hour, -'.CLANFIGHTS_RECHALLENGE_DELAY.', now())';
$qry = mysql_query($sql);
$qry = db_query($sql);
$row = mysql_fetch_assoc($qry);
$row = mysqli_fetch_assoc($qry);
if($row['anzahl'] > 0) {
semaphoreDown($ressource_clan1); // free the previously reserved semaphore!
semaphoreDown($ressource_clan2); // free the previously reserved semaphore!
// it should not be possible to challenge a clan that already has an open match that is not yet calculated! ( not completely possible in sql)
$sql = 'select count(k.anzahl) as anzahl from (SELECT count(*) as anzahl FROM clan_challenges c inner join clan_challenge_clans ccc on c.clan_challenge_id = ccc.clan_challenge_id where (calculated = 1 or enddate > now()) and clan_id IN ('.$user['clan'].', '.$clanid.') group by c.clan_challenge_id) k where k.anzahl = 0';
//echo $sql .'<br>';
$row = mysql_fetch_assoc(mysql_query($sql));
$row = mysqli_fetch_assoc(db_query($sql));
if($row['anzahl'] > 0) {
semaphoreDown($ressource_clan1); // free the previously reserved semaphore!
semaphoreDown($ressource_clan2); // free the previously reserved semaphore!
// 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()) <enddateandclan_idIN('.$user['clan'].','.$clanid.')groupbyclan_id)kwherek.anz>= ' . CLANFIGHTS_MAX_FIGHTS_PER_24H;
//echo $sql .'<br>';
$row = mysql_fetch_assoc(mysql_query($sql));
$row = mysqli_fetch_assoc(db_query($sql));
if($row['anzahl'] > 0) {
semaphoreDown($ressource_clan1); // free the previously reserved semaphore!
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())';
// okay we cannot accept the challenge so make it inactive!
mysql_query('UPDATE clan_challenge_requests SET active = FALSE WHERE clan_challenge_id = ' .$clan_challenge_id);
db_query('UPDATE clan_challenge_requests SET active = FALSE WHERE clan_challenge_id = ' .$clan_challenge_id);
return 'Einer der Clans erfüllt die Anforderungen an Clanfights nichtmehr (wahrscheinlich zu wenig Members)!';
}
// now calculate how many open fights we currently had or have! // FIXME: Good idea to pach this in a semaphore?
$sql = 'select count(*) as anzahl from (SELECT count(*) as anz FROM clan_challenges c inner join clan_challenge_clans ccc on c.clan_challenge_id = ccc.clan_challenge_id where calculated = 0 or TIMESTAMPADD(day, -1, now()) <enddateandclan_idIN('.$clan_challenge['clan_challenged'].','.$clan_challenge['clan_requester'].')groupbyclan_id)kwherek.anz>= ' . CLANFIGHTS_MAX_FIGHTS_PER_24H;
// echo $sql . '<br>';
$row = mysql_fetch_assoc(mysql_query($sql));
$row = mysqli_fetch_assoc(db_query($sql));
if($row['anzahl'] > 0) {
return 'Einer der beiden Clans hat das Limit von ' . CLANFIGHTS_MAX_FIGHTS_PER_24H . ' offenen und abgeschlossenen Clanfights innerhalb von 24 erreicht. Daher kann die Herausforderung nicht angenommen werden!';
@ -209,11 +209,11 @@ function acceptChallengeRequest($challenged_clan, array $user) {
mysql_query('UPDATE clan_challenge_requests SET active = false WHERE clan_challenged = ' .$user['clan'] . ' AND clan_requester = ' .$challenged_clan . ' AND active = TRUE AND challenged_time > TIMESTAMPADD(day, -1, now())');
db_query('UPDATE clan_challenge_requests SET active = false WHERE clan_challenged = ' .$user['clan'] . ' AND clan_requester = ' .$challenged_clan . ' AND active = TRUE AND challenged_time > TIMESTAMPADD(day, -1, now())');
if(mysql_affected_rows() > 0) {
if(db_affected_rows() > 0) {
// okay and for failsaveness just deactivate old requests
mysql_query('UPDATE clan_challenge_requests SET active = false WHERE clan_challenged = ' .$user['clan'] . ' AND clan_requester = ' .$challenged_clan. ' AND active = TRUE');
db_query('UPDATE clan_challenge_requests SET active = false WHERE clan_challenged = ' .$user['clan'] . ' AND clan_requester = ' .$challenged_clan. ' AND active = TRUE');
if(is_numeric($oclan['leader'])) {
sendMessage($user['nickname'], $oclan['leader'], 'Clan-Fight', 'Der Clan '.$clan['clanname'].' hat eure Herausforderungen zu einem Clan-Fight angenommen! Über "Mein Clan" könnt ihr nun Chars anmelden!');
@ -231,17 +231,17 @@ function acceptChallengeRequest($challenged_clan, array $user) {
$id = -1;
// get id
while(!$finished) {
$row = mysql_fetch_row(mysql_query('select IFNULL(max(clan_challenge_id),0) + 1 from clan_challenges'));
mysql_query('INSERT INTO clan_challenges(clan_challenge_id, type, anzahl_chars) values('.$row[0].', '.$clan_challenge['type'].', '.$clan_challenge['anzahl_chars'].')');
$finished = mysql_affected_rows() > 0;
$row = mysqli_fetch_row(db_query('select IFNULL(max(clan_challenge_id),0) + 1 from clan_challenges'));
db_query('INSERT INTO clan_challenges(clan_challenge_id, type, anzahl_chars) values('.$row[0].', '.$clan_challenge['type'].', '.$clan_challenge['anzahl_chars'].')');
// 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())';
return 'Konnte die Herausforderung nicht zurückziehen, da diese Herausforderung nicht exisitiert!';
@ -280,7 +280,7 @@ function cancelChallengeRequest($challenged_clan, array $user) {
}
// okay seems to be okay
mysql_query('UPDATE clan_challenge_requests SET active = false WHERE clan_challenged = ' .$challenged_clan . ' AND clan_requester = ' .$user['clan'] . ' AND active = TRUE');
db_query('UPDATE clan_challenge_requests SET active = false WHERE clan_challenged = ' .$challenged_clan . ' AND clan_requester = ' .$user['clan'] . ' AND active = TRUE');
if(is_numeric($oclan['leader'])) {
sendMessage($user['nickname'], $oclan['leader'], 'Clan-Fight', 'Der Clan '.$clan['clanname'].' hat die Herausforderungen zu einem Clan-Fight zurückgezogen! Über "Mein Clan" kann eine neue Herausforderungen erstellt werden!');
@ -311,7 +311,7 @@ function denyChallengeRequest($challenge_requester, array $user) {
$sql = 'SELECT * FROM clan_challenge_requests WHERE clan_challenged = ' .$user['clan'] . ' AND clan_requester = ' .$challenge_requester . ' AND active = TRUE AND challenged_time > TIMESTAMPADD(day, -1, now())';
return 'Konnte die Herausforderung nicht ablehnen, da diese Herausforderung nicht exisitiert!';
@ -325,7 +325,7 @@ function denyChallengeRequest($challenge_requester, array $user) {
}
// okay seems to be okay
mysql_query('UPDATE clan_challenge_requests SET active = false WHERE clan_challenged = ' .$user['clan'] . ' AND clan_requester = ' .$challenge_requester. ' AND active = TRUE');
db_query('UPDATE clan_challenge_requests SET active = false WHERE clan_challenged = ' .$user['clan'] . ' AND clan_requester = ' .$challenge_requester. ' AND active = TRUE');
if(is_numeric($oclan['leader'])) {
sendMessage($user['nickname'], $oclan['leader'], 'Clan-Fight', 'Der Clan '.$clan['clanname'].' hat eure Herausforderungen zu einem Clan-Fight abgelehnt! Über "Mein Clan" könnt neue Herausforderungen erstellen!');
@ -353,8 +353,8 @@ function getChallenge($challenge_id, $buffer = TRUE) {
return $GLOBALS['clan_challenge_buffered_instances'][$challenge_id]; // okay, we already buffered the clan :)
}
$qry = mysql_query('SELECT * from clan_challenges WHERE clan_challenge_id = ' .$challenge_id);
return $GLOBALS['clan_challenge_buffered_instances'][$challenge_id]; // okay, we already buffered the clan :)
}
@ -371,8 +371,8 @@ function getOpenChallengeRequests($clanid) {
$sql = 'SELECT * from clan_challenge_requests WHERE challenged_time > TIMESTAMPADD(day, -1, now()) and active = TRUE AND (clan_requester = '.$clanid.' OR clan_challenged = '.$clanid.')';
// echo $sql . '<br>';
$qry = mysql_query($sql);
while($row = mysql_fetch_assoc($qry)) {
$qry = db_query($sql);
while($row = mysqli_fetch_assoc($qry)) {
$array[] = $row;
}
return $array;
@ -384,7 +384,7 @@ function getOpenChallengeRequestCount($clanid) {
}
$sql = 'SELECT count(*) from clan_challenge_requests where challenged_time > TIMESTAMPADD(day, -1, now()) and active = TRUE AND (clan_requester = '.$clanid.' OR clan_challenged = '.$clanid.')';
// echo $sql . '<br>';
$row = mysql_fetch_row(mysql_query($sql));
$row = mysqli_fetch_row(db_query($sql));
return $row[0];
}
@ -397,8 +397,8 @@ function getOpenChallengeIDs($clanid) {
}
$sql = 'SELECT cc.clan_challenge_id FROM clan_challenges AS cc inner join clan_challenge_clans AS ccp ON cc.clan_challenge_id = ccp.clan_challenge_id WHERE clan_id = ' . $clanid . ' AND calculated = FALSE';
$qry = mysql_query($sql);
while($row = mysql_fetch_row($qry)) {
$qry = db_query($sql);
while($row = mysqli_fetch_row($qry)) {
$array[] = $row[0];
}
// return the ids
@ -413,8 +413,8 @@ function getActiveChallengeIDs($clanid) {
}
$sql = 'SELECT cc.clan_challenge_id FROM clan_challenges AS cc inner join clan_challenge_clans AS ccp ON cc.clan_challenge_id = ccp.clan_challenge_id WHERE clan_id = ' . $clanid . ' AND calculated = TRUE AND enddate > now() ORDER BY cc.date DESC ' . $addition;
$qry = mysql_query($sql);
while($row = mysql_fetch_row($qry)) {
$qry = db_query($sql);
while($row = mysqli_fetch_row($qry)) {
$array[] = $row[0];
}
// return the ids
@ -431,8 +431,8 @@ function getAwatingChallengeIDs() {
$array = array();
$sql = 'SELECT distinct(cc.clan_challenge_id) FROM clan_challenges AS cc inner join clan_challenge_clans AS ccp ON cc.clan_challenge_id = ccp.clan_challenge_id WHERE elo_change is null AND calculated = TRUE AND enddate <now()';
// echo $sql . '<br>';
$qry = mysql_query($sql);
while($row = mysql_fetch_row($qry)) {
$qry = db_query($sql);
while($row = mysqli_fetch_row($qry)) {
$array[] = $row[0];
}
// return the ids
@ -447,8 +447,8 @@ function getHistoricalChallengeIDs($clanid, $limit = NULL) {
$addition = ' LIMIT ' .$limit;
}
$sql = 'SELECT cc.clan_challenge_id FROM clan_challenges AS cc inner join clan_challenge_clans AS ccp ON cc.clan_challenge_id = ccp.clan_challenge_id WHERE clan_id = ' . $clanid . ' AND calculated = TRUE AND enddate <now()ORDERBYcc.dateDESC'.$addition;
$qry = mysql_query($sql);
while($row = mysql_fetch_row($qry)) {
$qry = db_query($sql);
while($row = mysqli_fetch_row($qry)) {
$array[] = $row[0];
}
// return the ids
@ -458,8 +458,8 @@ function getHistoricalChallengeIDs($clanid, $limit = NULL) {
function getParticipatingClanIDs($clan_challenge_id) {
$array = array();
$sql = 'SELECT clan_id FROM clan_challenge_clans AS ccp WHERE clan_challenge_id = ' . $clan_challenge_id . ' ORDER BY id';
$qry = mysql_query($sql);
while($row = mysql_fetch_row($qry)) {
$qry = db_query($sql);
while($row = mysqli_fetch_row($qry)) {
$array[] = $row[0];
}
// return the ids
@ -468,24 +468,24 @@ function getParticipatingClanIDs($clan_challenge_id) {
function getParticipatingClanData($clan_challenge_id, $clan_id) {
$sql = 'SELECT * FROM clan_challenge_clans AS ccp WHERE clan_challenge_id = ' . $clan_challenge_id . ' AND clan_id = ' .$clan_id;
$qry = mysql_query($sql);
$qry = db_query($sql);
if(!$qry) {
echo $sql .'<br>';
}
return mysql_fetch_assoc($qry);
return mysqli_fetch_assoc($qry);
}
function isCharBusyWithClanfighting($char_id) {
$sql = 'SELECT count(*) as anzahl FROM clan_challenge_participants ccp INNER JOIN clan_challenges cc on ccp.clan_challenge_id = cc.clan_challenge_id WHERE cc.calculated = FALSE AND char_id = ' .$char_id;
$row = mysql_fetch_row(mysql_query($sql));
$row = mysqli_fetch_row(db_query($sql));
return $row[0] > 0;
}
function getParticipatingCharIDs($clan_challenge_id, $clan_id) {
$array = array();
$sql = 'SELECT char_id, slot FROM clan_challenge_participants WHERE clan_challenge_id = ' . $clan_challenge_id . ' AND clan_id = ' .$clan_id;
$qry = mysql_query($sql);
while($row = mysql_fetch_assoc($qry)) {
$qry = db_query($sql);
while($row = mysqli_fetch_assoc($qry)) {
$array[$row['slot']] = $row['char_id'];
}
// return the ids
@ -494,7 +494,7 @@ function getParticipatingCharIDs($clan_challenge_id, $clan_id) {
function getParticipatingChar($clan_challenge_id, $clan_id, $char_id) {
$qry = db_query('SELECT * FROM clan_challenge_participants WHERE clan_challenge_id = ' . $clan_challenge_id . ' AND clan_id = ' .$clan_id . ' AND char_id = ' . $char_id);
$row = mysql_fetch_assoc($qry);
$row = mysqli_fetch_assoc($qry);
return $row;
}
@ -504,7 +504,7 @@ function getClanLockedTime($clan_id) {
return 0;
}
$sql = 'SELECT TIMESTAMPDIFF(SECOND, NOW(), locked_until) FROM clan_locked WHERE clanid = ' . $clan_id;
$row = mysql_fetch_row(mysql_query($sql));
$row = mysqli_fetch_row(db_query($sql));
if($row)
return $row[0];
return 0;
@ -518,7 +518,7 @@ function isClanLocked($clanid) {
// we really want to know if we are locked at the moment. So readout everything at once ;), right join so we always have a row :D
$sql = 'SELECT *, locked_until > now() as `lock`, (Select count(id) from user where clan = c2.id) as members FROM clan_locked right join clan c2 on c2.id = clan_locked.clanid where c2.id = ' . $clanid;
// echo $sql.'<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
// we do not have data in the clan locked table so we are not locked :D
@ -529,7 +529,7 @@ function isClanLocked($clanid) {
if($lock['members'] >= MIN_MEMBERS) {
if($lock['lock'] === 0) { // If data is available in 'clan_locked' remove it
$sql = 'DELETE FROM clan_locked WHERE clanid = ' .$clanid .' AND locked_until <now()';
mysql_query($sql);
db_query($sql);
}
// key so every thing seems to be fine :)
@ -538,23 +538,23 @@ function isClanLocked($clanid) {
// INSERT
$sql = 'INSERT INTO clan_locked(clanid, locked_until) values('.$clanid.', TIMESTAMPADD(HOUR, 24, CURRENT_TIMESTAMP))';
// echo $sql.'<br>';
$res = mysql_query($sql);
$res = db_query($sql);
if(!$res)
echo $sql . '<br>';
mysql_query('UPDATE clan_challenge_requests SET active = FALSE WHERE (clan_challenged = '.$clanid.' OR clan_requester = '.$clanid);
mysql_query('DELETE FROM clan_challenges WHERE calculated = FALSE AND clan_challenge_id IN (SELECT clan_challenge_id from clan_challenge_clans WHERE clan_id = '.$clanid.')');
db_query('UPDATE clan_challenge_requests SET active = FALSE WHERE (clan_challenged = '.$clanid.' OR clan_requester = '.$clanid);
db_query('DELETE FROM clan_challenges WHERE calculated = FALSE AND clan_challenge_id IN (SELECT clan_challenge_id from clan_challenge_clans WHERE clan_id = '.$clanid.')');
if($forced && ($char['status'] == 'Kampf' || $char['status'] == 'Schatz Suche' || $char['status'] == 'Clanfight')) { // foreign assignment may also possible if the status is in "fetching" state
// okay now check if the fetch-time is reached!!
if($char['status'] == 'Schatz Suche') {
$row = mysql_fetch_row(db_query('SELECT Timestampdiff(Second,now(),dauer) as dauer from quests where charid = '.$charid));
$row = mysqli_fetch_row(db_query('SELECT Timestampdiff(Second,now(),dauer) as dauer from quests where charid = '.$charid));
} else if($char['status'] == 'Clanfight') {
if(isCharBusyWithClanfighting($charid)) {
$row[0] = '???'; // we do not know when the fight is starting!
$row = mysql_fetch_row(db_query('SELECT dauer - ' . time() . ' FROM kampf WHERE db_satz='.$charid ));
$row = mysqli_fetch_row(db_query('SELECT dauer - ' . time() . ' FROM kampf WHERE db_satz='.$charid ));
}
if(!is_numeric($row[0]) || $row[0] > 0) {
return 'Du kannst den Char \''.$char['name'].'\' nicht an dem Kampf teilnehmen lassen, da er im Moment noch für ' . $row[0] . ' Sekunden mit ' . $char['status']. ' beschäftigt ist!';
// okay does this user already has a char in the fight??
$qry = mysql_query('SELECT count(*) as anzahl FROM clan_challenge_participants ccp inner join chars c on ccp.char_id = c.id WHERE besitzer = ' .$user['id'] . ' AND clan_challenge_id = ' . $clan_challenge_id);
$row = mysql_fetch_assoc($qry);
$qry = db_query('SELECT count(*) as anzahl FROM clan_challenge_participants ccp inner join chars c on ccp.char_id = c.id WHERE besitzer = ' .$user['id'] . ' AND clan_challenge_id = ' . $clan_challenge_id);
'WHERE ccp.clan_challenge_id = cc.clan_challenge_id AND clan_id = '.$clan_ids[1].
') = ' . $clan_challenge['anzahl_chars'];
mysql_query($sql);
$rows = mysql_affected_rows();
db_query($sql);
$rows = db_affected_rows();
semaphoreDown($ressource);
if($forced) {
semaphoreDown($ressource2);
@ -753,9 +753,9 @@ function leaveChallenge($clan_challenge_id, array $user, $charid) {
// Okay, the rest we can check with the delete statement much easier!
// basically the check consists of a) is the challenge not yet calculated b) is char active in the challenge?
$sql = 'DELETE FROM clan_challenge_participants WHERE (SELECT calculated FROM clan_challenges AS cc WHERE cc.clan_challenge_id = clan_challenge_participants.clan_challenge_id) = FALSE AND char_id = ' . $charid;
mysql_query($sql);
db_query($sql);
if(mysql_affected_rows() == 0) {
if(db_affected_rows() == 0) {
return 'Der Char kann nicht aus dem Kampf zurückgezogen werden.';
}
@ -803,7 +803,7 @@ function cancelChallenge($clan_challenge_id, array $user) {
// kay, finish him !!!
$sql = 'DELETE FROM clan_challenges WHERE clan_challenge_id = ' .$clan_challenge_id . ' AND calculated = FALSE';
// echo $sql . '<br>';
$res = mysql_query($sql);
$res = db_query($sql);
if(!$res)
return 'Beim zurückziehen des Clan-Fights ist ein technischer Fehler aufgetreten!';
@ -835,7 +835,7 @@ function calculateChallenge($clan_challenge_id) {
@ -132,10 +132,10 @@ function persistFight($event_id, array $combinedArray, $startTimestamp, $endTime
foreach ($data as $key => $value) {
$sql = 'INSERT INTO event_fight_metadata(event_id, event_fight_id, `key`, `value`) values('.$event_id.','.$event_fight_id.',\''.$key.'\',\''.$value.'\')';
// echo $sql . ' <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) {
$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>';
$qry = mysql_query($sql);
$row = mysql_fetch_assoc($qry);
$qry = db_query($sql);
$row = mysqli_fetch_assoc($qry);
switch ($row['event_type']) {
case EVENT_TEST:
return 'Test';
@ -166,7 +166,7 @@ function getEventStatus($charid) {
function getOngoingEventCount($charid) {
$sql = 'SELECT count(*) FROM event_chars e WHERE abgeholt = FALSE AND char_id = ' .$charid;
$row = mysql_fetch_row(mysql_query($sql));
$row = mysqli_fetch_row(db_query($sql));
return $row[0];
}
@ -174,24 +174,24 @@ function getOngoingEventCount($charid) {
function getEventStatusBlocked($charid) {
$sql = 'SELECT Timestampdiff(Second,now(),MAX(block_end)) FROM event_chars WHERE abgeholt = FALSE AND char_id = ' . $charid;
// echo $sql . '<br>';
$row = mysql_fetch_row(mysql_query($sql));
$row = mysqli_fetch_row(db_query($sql));
return $row[0];
}
function isEventToFetchAwaiting($charid) {
$sql = 'SELECT count(*) FROM event_chars e WHERE abgeholt = FALSE AND char_id = ' .$charid;
$row = mysql_fetch_row(mysql_query($sql));
$row = mysqli_fetch_row(db_query($sql));
return $row[0] > 0;
}
function getEventIdsToFetch($char_id) {
$sql = 'SELECT event_id FROM event_chars e WHERE block_end <now()andabgeholt =FALSEANDchar_id =' .$char_id . 'ORDERBYevent_idASC';
$qry = mysql_query($sql);
$qry = db_query($sql);
if(!$qry)
echo $sql . '<br>';
$result = array();
while ($row = mysql_fetch_row($qry)) {
while ($row = mysqli_fetch_row($qry)) {
$result[] = $row[0];
}
return $result;
@ -255,19 +255,19 @@ function abholenChar(array $user, $event_id, $char_id) {
// Okay and now we want to learn the attacks :)
$sql = 'SELECT attack, count(attack) as anzahl FROM event_fight_rounds e where event_id = ' . $event_id . ' AND event_char_id = ' . $char_id . ' group by attack';
$sql = 'UPDATE event_chars SET abgeholt = TRUE WHERE char_id = ' . $char_id . ' AND event_id = ' . $event_id;
$qry = mysql_query($sql);
$qry = db_query($sql);
if(!$qry)
echo $sql .'<br>';
@ -277,14 +277,14 @@ function abholenChar(array $user, $event_id, $char_id) {
function getEvent($event_id) {
$result = mysql_fetch_assoc(mysql_query('SELECT * FROM events WHERE event_id = ' . $event_id));
$result = mysqli_fetch_assoc(db_query('SELECT * FROM events WHERE event_id = ' . $event_id));
if($result)
return $result;
return NULL;
}
function getEventChar($event_id, $event_char_id) {
$result = mysql_fetch_assoc(mysql_query('SELECT * FROM event_chars WHERE event_id = ' . $event_id . ' AND event_char_id = ' . $event_char_id));
$result = mysqli_fetch_assoc(db_query('SELECT * FROM event_chars WHERE event_id = ' . $event_id . ' AND event_char_id = ' . $event_char_id));
if($result)
return $result;
return NULL;
@ -292,24 +292,24 @@ function getEventChar($event_id, $event_char_id) {
}
function getEventFight($event_id, $event_fight_id) {
$result = mysql_fetch_assoc(mysql_query('SELECT * FROM event_fights WHERE event_id = ' . $event_id. ' AND event_fight_id = ' .$event_fight_id ));
$result = mysqli_fetch_assoc(db_query('SELECT * FROM event_fights WHERE event_id = ' . $event_id. ' AND event_fight_id = ' .$event_fight_id ));
if($result)
return $result;
return NULL;
}
function getEventFightMetaData($event_id, $event_fight_id) {
$qry = mysql_query('SELECT * FROM event_fight_metadata WHERE event_id = ' . $event_id. ' AND event_fight_id = ' .$event_fight_id);
while($row = mysql_fetch_assoc($qry)) {
$qry = db_query('SELECT * FROM event_fight_metadata WHERE event_id = ' . $event_id. ' AND event_fight_id = ' .$event_fight_id);
while($row = mysqli_fetch_assoc($qry)) {
$result[$row['key']]= $row['value'];
}
return $result;
}
function getEventFightIds($event_id) {
$qry = mysql_query('SELECT event_fight_id FROM event_fights WHERE event_id = ' . $event_id . ' ORDER by event_fight_id ASC');
$qry = db_query('SELECT event_fight_id FROM event_fights WHERE event_id = ' . $event_id . ' ORDER by event_fight_id ASC');
$result = array();
while($row = mysql_fetch_assoc($qry)) {
while($row = mysqli_fetch_assoc($qry)) {
$result[]= $row['event_fight_id'];
}
return $result;
@ -318,10 +318,10 @@ function getEventFightIds($event_id) {
// this is more tricky XD
function getEventFightIdsByChar($event_id, $event_char_id) {
$sql = 'SELECT event_fight_id FROM event_fight_rounds where event_id = ' . $event_id . ' AND event_char_id = ' . $event_char_id . ' AND `round` = 0 ORDER BY event_fight_id ASC';
$qry = mysql_query($sql);
$qry = db_query($sql);
if(!$qry)
echo $sql . '<br>';
while($row = mysql_fetch_assoc($qry)) {
while($row = mysqli_fetch_assoc($qry)) {
$result[]= $row['event_fight_id'];
}
return $result;
@ -330,12 +330,12 @@ function getEventFightIdsByChar($event_id, $event_char_id) {
function getEventFightRoundData($event_id, $event_fight_id, $round) {
$sql = 'SELECT * FROM event_fight_rounds WHERE event_id = ' . $event_id . ' AND event_fight_id = ' . $event_fight_id . ' AND `round` = ' .$round;
@ -67,15 +67,15 @@ function addAttackUsageToChar($char_id, $attacken){
$sql = 'Update lernen set benutzt = benutzt + '.$attacken[$i]['anzahl'].' where at_id = \''.$attacken[$i]['id'].'\' and besitzer = '.$char_id;
}
// echo $sql.'<br>';
mysql_query($sql);
db_query($sql);
}
// Sooo und nun gehts darum ob wir neue Attacken lernen können
// Ersma die ganzen Infos laden
$sql = 'SELECT * FROM lernen where besitzer = '.$char_id;
$qry = mysql_query($sql);
while($row = mysql_fetch_assoc($qry)){
$qry = db_query($sql);
while($row = mysqli_fetch_assoc($qry)){
$lern[$row['at_id']] = $row; // Zum späteren Check ob die Reqs erfüllt sind
$atkid[] = $row['at_id']; // Zum ausschliessen der Attacken
}
@ -94,7 +94,7 @@ function addAttackUsageToChar($char_id, $attacken){
// echo $sql.'<br>';
$qry = mysql_query($sql);
$qry = db_query($sql);
// Das geht leider nicht mit dieser Datenstruktur direkt auszuwählen
$raceid[] = getCharRaceId($char_id);
@ -103,7 +103,7 @@ function addAttackUsageToChar($char_id, $attacken){
}
// So und nun arbeite jede Attacke durch die nur im geringsten Lernbar sein könnte ...
while($row = mysql_fetch_assoc($qry)) {
while($row = mysqli_fetch_assoc($qry)) {
// Erstmal checken ob es eine Fruchtattacke ist (durch die SQL-Anweisung werden alle nicht zutreffenden Früchte ausgeblockt)
$learnable = false;
if(!is_null($row['Frucht'])){
@ -138,7 +138,7 @@ function addAttackUsageToChar($char_id, $attacken){
}
if($learnable){
mysql_query('INSERT lernen SET name=\''.$row['name'].'\', at_id=\''.$row['id'].'\', besitzer=\''.$char_id.'\', aktiv=\'1\'');
db_query('INSERT lernen SET name=\''.$row['name'].'\', at_id=\''.$row['id'].'\', besitzer=\''.$char_id.'\', aktiv=\'1\'');
echo '<scriptlanguage="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;
}
// echo $sql.'<br>';
mysql_query($sql);
db_query($sql);
$char = getChar($char_id, false); // We really want the actual char!!
if($char['level'] > 25) {
// remove this char out of the registration of the beginners tournament
mysql_query('Delete from turnier1 where art = \'klein\' and charakter = \''.$char_id.'\'');
db_query('Delete from turnier1 where art = \'klein\' and charakter = \''.$char_id.'\'');
}
}
@ -193,9 +193,9 @@ function addExpToArena($user_id, $n_exp){
}
if($lvls > 0){
echo '<scriptlanguage="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{
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);
$sql = 'UPDATE faq_entries SET '.$parentpart.' header = \''.encodeNoHTMLWithBB($header).'\', body = \''.encodeNoHTMLWithBB($body).'\' WHERE id = '.$faqentry;
mysql_query($sql);
db_query($sql);
}
function moveUp($faqentry){
$entry = getEntry($faqentry);
$sql = 'Select * from faq_entries WHERE parent = '.$entry['parent'].' AND id < '.$entry['id'].' order by id desc LIMIT 1';
$qry = mysql_query($sql);
$entry2 = mysql_fetch_assoc($qry);
$qry = db_query($sql);
$entry2 = mysqli_fetch_assoc($qry);
if(!$entry2){ // Er ist schon der höchste
return;
}
$sql2 = 'Select * from faq_entries WHERE parent = '.$faqentry;
$qry2 = mysql_query($sql2);
while($row = mysql_fetch_assoc($qry2)){
$qry2 = db_query($sql2);
while($row = mysqli_fetch_assoc($qry2)){
$ids[] = $row['id'];
}
mysql_query('UPDATE faq_entries SET header = \''.$entry2['header'].'\', body = \''.$entry2['body'].'\' where id = '.$entry['id']);
mysql_query('UPDATE faq_entries SET header = \''.$entry['header'].'\', body = \''.$entry['body'].'\' where id = '.$entry2['id']);
db_query('UPDATE faq_entries SET header = \''.$entry2['header'].'\', body = \''.$entry2['body'].'\' where id = '.$entry['id']);
db_query('UPDATE faq_entries SET header = \''.$entry['header'].'\', body = \''.$entry['body'].'\' where id = '.$entry2['id']);
mysql_query('Update faq_entries SET parent = '.$entry['id'].' where parent = '.$entry2['id']);
mysql_query('Update faq_entries SET parent = '.$entry2['id'].' where id IN ('.join($ids, ',').')');
db_query('Update faq_entries SET parent = '.$entry['id'].' where parent = '.$entry2['id']);
db_query('Update faq_entries SET parent = '.$entry2['id'].' where id IN ('.join($ids, ',').')');
}
function moveDown($faqentry){
$entry = getEntry($faqentry);
$sql = 'Select * from faq_entries WHERE parent = '.$entry['parent'].' AND id > '.$entry['id'].' order by id asc LIMIT 1';
$qry = mysql_query($sql);
$entry2 = mysql_fetch_assoc($qry);
$qry = db_query($sql);
$entry2 = mysqli_fetch_assoc($qry);
if(!$entry2){ // Er ist schon der höchste
return;
}
$sql2 = 'Select * from faq_entries WHERE parent = '.$faqentry;
$qry2 = mysql_query($sql2);
while($row = mysql_fetch_assoc($qry2)){
$qry2 = db_query($sql2);
while($row = mysqli_fetch_assoc($qry2)){
$ids[] = $row['id'];
}
mysql_query('UPDATE faq_entries SET header = \''.$entry2['header'].'\', body = \''.$entry2['body'].'\' where id = '.$entry['id']);
mysql_query('UPDATE faq_entries SET header = \''.$entry['header'].'\', body = \''.$entry['body'].'\' where id = '.$entry2['id']);
db_query('UPDATE faq_entries SET header = \''.$entry2['header'].'\', body = \''.$entry2['body'].'\' where id = '.$entry['id']);
db_query('UPDATE faq_entries SET header = \''.$entry['header'].'\', body = \''.$entry['body'].'\' where id = '.$entry2['id']);
mysql_query('Update faq_entries SET parent = '.$entry['id'].' where parent = '.$entry2['id']);
mysql_query('Update faq_entries SET parent = '.$entry2['id'].' where id IN ('.join($ids, ',').')');
db_query('Update faq_entries SET parent = '.$entry['id'].' where parent = '.$entry2['id']);
db_query('Update faq_entries SET parent = '.$entry2['id'].' where id IN ('.join($ids, ',').')');
}
function getChildren($faqentry){
$sql = 'Select * from faq_entries where parent = '.$faqentry.' order by id asc';
function __construct($char, $alternative = true, $buffs = true){
if(is_numeric($char)){ // ID, wenn keine Abfrage vorhanden
$char = mysql_fetch_assoc(mysql_query('SELECT * FROM chars WHERE id='.$char));
$char = mysqli_fetch_assoc(db_query('SELECT * FROM chars WHERE id='.$char));
} else if(!is_array($char)){ // Wenn es weder ID noch Array ist
return; // breche ab, dann kann nichts mit angefangen werden
}
@ -43,7 +43,7 @@ class Kaempfer{
$this->charid = $char['id'];
if($buffs == true){ // Ruestungen erlaubt???
$char_buffs = mysql_fetch_assoc(mysql_query('SELECT sum(i.hp) as hp, sum(i.mp) as mp, sum(i.starke) as starke, sum(i.verteidigung) as verteidigung, sum(i.speed) as speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id IN ('.$char['kampf_item'].')'));
$char_buffs = mysqli_fetch_assoc(db_query('SELECT sum(i.hp) as hp, sum(i.mp) as mp, sum(i.starke) as starke, sum(i.verteidigung) as verteidigung, sum(i.speed) as speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id IN ('.$char['kampf_item'].')'));
$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><thclass="top"colspan="3">Schatzsuche in '.$ort['stadt'].'</th></tr>';
// Hole die Ergebnisse die auch in die Datenbank eingetragen werden muessen!
$row = mysql_fetch_assoc(mysql_query('Select sum(exp) as exp, sum(geld) as geld, count(*) as anzahl from quest_fights where charid = '.$char['id']));
$row = mysqli_fetch_assoc(db_query('Select sum(exp) as exp, sum(geld) as geld, count(*) as anzahl from quest_fights where charid = '.$char['id']));
// Ermittle den Endzustand des Chars
$end_qf = mysql_fetch_assoc(mysql_query('select max(fightnr) as mf from quest_fights where charid = '.$char['id']));
$end_qr = mysql_fetch_assoc(mysql_query('select max(roundnr) as mr from quest_rounds where fightnr = '.$end_qf['mf'].' and charid = '.$char['id']));
$last_round = mysql_fetch_assoc(mysql_query('Select * from quest_rounds where roundnr = '.$end_qr['mr'].' and fightnr = '.$end_qf['mf'].' and charid = '.$char['id']));
$last_fight = mysql_fetch_assoc(mysql_query('Select * from quest_fights where fightnr = '.$end_qf['mf'].' and charid = '.$char['id']));
$end_qf = mysqli_fetch_assoc(db_query('select max(fightnr) as mf from quest_fights where charid = '.$char['id']));
$end_qr = mysqli_fetch_assoc(db_query('select max(roundnr) as mr from quest_rounds where fightnr = '.$end_qf['mf'].' and charid = '.$char['id']));
$last_round = mysqli_fetch_assoc(db_query('Select * from quest_rounds where roundnr = '.$end_qr['mr'].' and fightnr = '.$end_qf['mf'].' and charid = '.$char['id']));
$last_fight = mysqli_fetch_assoc(db_query('Select * from quest_fights where fightnr = '.$end_qf['mf'].' and charid = '.$char['id']));
// Ermittle die Reqs des Chars!
$sql = 'SELECT c_attack as a_name, count(*) as anzahl FROM quest_rounds q where roundnr > 0 and charid = '.$char['id'].' group by c_attack';
// echo $sql.'<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;
// print_r($c_attacken);
// echo '<br>';
@ -269,10 +269,10 @@ function displaySchatzSuche($char){
$items = getSchatzItems($row['anzahl']);
for($i=0;$items[$i];$i++){
$res = mysql_query('Update quest_item_stats set anzahl = anzahl + 1 WHERE monster = '.$row['anzahl'].' and id = '.$items[$i]['id']);
if(mysql_affected_rows() == 0){
$res = db_query('Update quest_item_stats set anzahl = anzahl + 1 WHERE monster = '.$row['anzahl'].' and id = '.$items[$i]['id']);
if(db_affected_rows() == 0){
// entry not yet present
mysql_query('INSERT INTO quest_item_stats (monster, id, anzahl) values('.$row['anzahl'].', '.$items[$i]['id'].', 1)');
db_query('INSERT INTO quest_item_stats (monster, id, anzahl) values('.$row['anzahl'].', '.$items[$i]['id'].', 1)');
}
}
} else{
@ -285,9 +285,9 @@ function displaySchatzSuche($char){
}
}
$res = mysql_query('Update quest_stats set anzahl = anzahl + 1 WHERE zeit = '.$std.' AND monster = '.$row['anzahl'].' AND status = '.($final_result=='won'?1:0));
$res = db_query('Update quest_stats set anzahl = anzahl + 1 WHERE zeit = '.$std.' AND monster = '.$row['anzahl'].' AND status = '.($final_result=='won'?1:0));
@ -372,8 +372,8 @@ function displayEventFight($event_id, $event_fight_id) {
// Okay and now get the data of the chars ;)
$sql = 'SELECT * FROM event_chars e where event_id = '.$event_id.' and event_char_id IN (SELECT event_char_id from event_fight_rounds where event_id = '.$event_id.' and event_fight_id = '.$event_fight_id.' and `round` = 0)';
$online_r = mysql_fetch_assoc(mysql_query('Select count(*) as anzahl from user WHERE online_zeit between TIMESTAMPADD(Minute, -15, now()) and now()'));
$online_r = mysqli_fetch_assoc(db_query('Select count(*) as anzahl from user WHERE online_zeit between TIMESTAMPADD(Minute, -15, now()) and now()'));
$online_r = $online_r['anzahl'];
$online_rekord_1_0 = mysql_fetch_assoc(mysql_query('SELECT * FROM online WHERE id=1'));
$online_rekord_1_0 = mysqli_fetch_assoc(db_query('SELECT * FROM online WHERE id=1'));
function stimme($pollid, $polloptionid, $userid, $kommentar){
if(mysql_num_rows(mysql_query('SELECT * FROM poll_votes WHERE pollid = '.$pollid.' and userid = '.$userid)) == 0){
if(mysqli_stmt_num_rows(db_query('SELECT * FROM poll_votes WHERE pollid = '.$pollid.' and userid = '.$userid)) == 0){
// NEU einfuegen!
$sql = 'INSERT INTO poll_votes(pollid, polloptionid, userid, comment) values ('.$pollid.','.$polloptionid.','.$userid.',\''.$kommentar.'\')';
mysql_query($sql);
db_query($sql);
//echo $sql.'<br>';
} else{
mysql_query('UPDATE poll_votes SET polloptionid='.$polloptionid.', comment = \''.encodeNoHTMLNoBB($kommentar).'\' WHERE pollid='.$pollid.' and userid = '.$userid);
db_query('UPDATE poll_votes SET polloptionid='.$polloptionid.', comment = \''.encodeNoHTMLNoBB($kommentar).'\' WHERE pollid='.$pollid.' and userid = '.$userid);
}
}
// Liefert den Datensatz der Stimme (Nr und eigener Kommentar)
function getStimme($pollid, $userid){
$qry = mysql_query('SELECT * FROM poll_votes WHERE pollid = '.$pollid.' and userid = '.$userid);
$result = mysql_fetch_assoc($qry);
$qry = db_query('SELECT * FROM poll_votes WHERE pollid = '.$pollid.' and userid = '.$userid);
$result = mysqli_fetch_assoc($qry);
return $result;
}
function getUmfrage($pollid){
$umfrage = array();
$qry = mysql_query('SELECT p.thema, p.pollid, p.text, u.nickname FROM poll as p inner join user as u on p.ersteller = u.id WHERE pollid='.$pollid);
$umfrage['poll'] = mysql_fetch_assoc($qry);
$qry = mysql_query('SELECT * FROM poll_options WHERE pollid ='.$pollid);
while($result = mysql_fetch_assoc($qry)){
$qry = db_query('SELECT p.thema, p.pollid, p.text, u.nickname FROM poll as p inner join user as u on p.ersteller = u.id WHERE pollid='.$pollid);
$umfrage['poll'] = mysqli_fetch_assoc($qry);
$qry = db_query('SELECT * FROM poll_options WHERE pollid ='.$pollid);
$qry = mysql_query('SELECT p.thema, p.pollid, u.nickname FROM poll as p inner join user as u on p.ersteller = u.id LIMIT '.$entries*$page.','.$entries);
$qry = db_query('SELECT p.thema, p.pollid, u.nickname FROM poll as p inner join user as u on p.ersteller = u.id LIMIT '.$entries*$page.','.$entries);
$i=0;
while($result=mysql_fetch_assoc($qry)){
while($result=mysqli_fetch_assoc($qry)){
$returnArray[$i++] = $result;
}
return $returnArray;
}
function getUmfragenCount(){
$temp = mysql_fetch_assoc(mysql_query('SELECT count(*) as anzahl FROM poll'));
$temp = mysqli_fetch_assoc(db_query('SELECT count(*) as anzahl FROM poll'));
return $temp['anzahl'];
}
function getComments($pollid, $entries, $page){
$returnArray = array();
$sql = 'SELECT polloptionid, comment FROM poll_votes where comment != \'\' and pollid= '.$pollid.' LIMIT '.$entries*$page.','.$entries;
$temp = mysql_fetch_assoc(mysql_query('Select count(*) as anzahl from poll_votes where comment != \'\' and pollid= '.$pollid));
$temp = mysqli_fetch_assoc(db_query('Select count(*) as anzahl from poll_votes where comment != \'\' and pollid= '.$pollid));
return $temp['anzahl'];
}
function getPollResult($pollid){
$returnArray = array();
$sql = 'SELECT text, pv.polloptionid, count(pv.polloptionid) as anzahl FROM poll_votes as pv inner join poll_options as po on pv.polloptionid = po.polloptionid and pv.pollid = po.pollid where pv.pollid = '.$pollid.' group by polloptionid';
mysql_query('Delete from quest_rounds where charid ='.$charid);
mysql_query('Delete from quest_fights where charid ='.$charid);
mysql_query('Delete from quests where charid ='.$charid);
mysql_query('Update chars set status = \'Frei\' where id = '.$charid);
db_query('Delete from quest_rounds where charid ='.$charid);
db_query('Delete from quest_fights where charid ='.$charid);
db_query('Delete from quests where charid ='.$charid);
db_query('Update chars set status = \'Frei\' where id = '.$charid);
}
function getMonsterCount($ort){
return mysql_fetch_assoc(mysql_query('Select count(*) as arten, sum(anzahl) as anzahl from quest_monster_orte as qma inner join quest_monster as qm on qma.monsterid = qm.id where ortid = '.$ort));
return mysqli_fetch_assoc(db_query('Select count(*) as arten, sum(anzahl) as anzahl from quest_monster_orte as qma inner join quest_monster as qm on qma.monsterid = qm.id where ortid = '.$ort));
}
// Die Monsterauswahl in eine Funktion gekapselt um es spaeter optimieren zu koennen!
@ -37,10 +37,10 @@ function getMonster($char_level, $city_id, $min, $max){
$rechnung = 'ROUND(1/SQRT(PI()*2) * EXP(-1/(('.$top.'-'.$bottom.')*2.5)*POW((level-floor(('.$bottom.'+'.$min_l.')/2)),2))*250) as guete';
$sql = 'select *, '.$rechnung.' from quest_monster as qm inner join quest_monster_orte as qmo on qm.id = qmo.monsterid where ortid = '.$city_id.' and level <= 20 + '.$char_level.' order by rand()';
// echo $sql.'<br>';
$qry = mysql_query($sql); // Lade alle Monster
// while($monster[] = mysql_fetch_assoc($qry)); // Lade alle monster in einen Array
$qry = db_query($sql); // Lade alle Monster
// while($monster[] = mysqli_fetch_assoc($qry)); // Lade alle monster in einen Array
$gesamtguete = 0;
while($row = mysql_fetch_assoc($qry)){
while($row = mysqli_fetch_assoc($qry)){
if($row['guete'] == 0){
$row['guete'] += 1;
}
@ -89,7 +89,7 @@ function monsterfight_neu($chara_1, $fight_monster, $std, $ort){
$char1_buffs = mysql_fetch_assoc(mysql_query('SELECT sum(i.hp) as hp, sum(i.mp) as mp, sum(i.starke) as starke, sum(i.verteidigung) as verteidigung, sum(i.speed) as speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id IN (' . $chara_1['kampf_item'] . ')'));
$char1_buffs = mysqli_fetch_assoc(db_query('SELECT sum(i.hp) as hp, sum(i.mp) as mp, sum(i.starke) as starke, sum(i.verteidigung) as verteidigung, sum(i.speed) as speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id IN (' . $chara_1['kampf_item'] . ')'));
}
// Retrieve the attack set for the treasure hunt!
@ -130,10 +130,10 @@ function monsterfight_neu($chara_1, $fight_monster, $std, $ort){
$in_hp_max.', '.
$in_mp_max.')';
// echo 'Debug-Message: '.$sql.'<br>';
mysql_query($sql);
db_query($sql);
$Dead1 = 0;
// while ($chara_2 = mysql_fetch_assoc($fight_monster)) { // Schleife in monsterfight.inc.php rein!!!
// while ($chara_2 = mysqli_fetch_assoc($fight_monster)) { // Schleife in monsterfight.inc.php rein!!!
// @Returns TRUE if ok, FALSE on Semaphore error, NULL on MYQL Error
function semaphoreDown($resource){
$sql = 'DELETE FROM semaphore where ressource = \''.$resource.'\'';
mysql_query($sql);
if(mysql_affected_rows() == 0){
db_query($sql);
if(db_affected_rows() == 0){
// echo 'DEBUG: Semaphore '.$ressource.' war schon freigegeben<br>';
return false;
}
@ -81,7 +81,7 @@ function semaphoreDown($resource){
* returns true, wenn Semaphore belegt ist, false wenn nicht
*/
function isSemaphoreUP($ressource){
return mysql_fetch_assoc(mysql_query('Select * from semaphore where WHERE TIMESTAMPDIFF(MINUTE, zeit, now()) > 5 and ressource = \''.$ressource.'\'')) != false;
return mysqli_fetch_assoc(db_query('Select * from semaphore where WHERE TIMESTAMPDIFF(MINUTE, zeit, now()) > 5 and ressource = \''.$ressource.'\'')) != false;
}
function installSemaphoreDatabase(){
@ -94,8 +94,8 @@ function installSemaphoreDatabase(){
')' .
'ENGINE = MYISAM ' .
'COMMENT = \'Die Tabelle, die hoffentlich alle Zugriffsprobleme loesen wird\'';
@ -19,7 +19,7 @@ function getUser($userid, $buffer_enabled = true) {
}
// Wenn Char nicht im Puffer ist, oder nicht gepuffert werden soll
if ($GLOBALS['user_buffered_instances'][$userid] == null || !$buffer_enabled) {
$user = mysql_fetch_assoc(db_query('SELECT *, (online_zeit between TIMESTAMPADD(Minute, -15, now()) and now()) as online FROM user WHERE id = '.$userid));
$user = mysqli_fetch_assoc(db_query('SELECT *, (online_zeit between TIMESTAMPADD(Minute, -15, now()) and now()) as online FROM user WHERE id = '.$userid));
@ -42,12 +42,12 @@ function getOwnerOfChar($charid, $buffer_enabled = true) {
return null;
}
$user = mysql_fetch_assoc(mysql_query('SELECT u.id FROM user u INNER JOIN chars ch ON ch.besitzer=u.id WHERE ch.id = '.$charid));
$user = mysqli_fetch_assoc(db_query('SELECT u.id FROM user u INNER JOIN chars ch ON ch.besitzer=u.id WHERE ch.id = '.$charid));
return getUser($user['id']);
}
function addMoneyToUser($userid, $amount) {
mysql_query('update user set geld = geld + ' . $amount . ' WHERE id = ' .$userid);
db_query('update user set geld = geld + ' . $amount . ' WHERE id = ' .$userid);
}
/**
@ -56,7 +56,7 @@ function addMoneyToUser($userid, $amount) {
*/
function getRelevantMoney($userid) {
$user = getUser($userid);
$auktionensumme = mysql_fetch_assoc(mysql_query('SELECT SUM(aktuellesgebot) as summe FROM auktion WHERE bieter = ' . $user['id'] . ' GROUP BY bieter'));
$auktionensumme = mysqli_fetch_assoc(db_query('SELECT SUM(aktuellesgebot) as summe FROM auktion WHERE bieter = ' . $user['id'] . ' GROUP BY bieter'));
$auktionensumme = $auktionensumme['summe'];
if ($auktionensumme == 0) {
@ -69,7 +69,7 @@ function getRelevantMoney($userid) {
function checkSessionPasswort($userid, $password){
$sql = 'SELECT passwort from user where id = \''.$userid.'\'';
$row = mysql_fetch_assoc(mysql_query($sql));
$row = mysqli_fetch_assoc(db_query($sql));
if($row['passwort'] != null){
// echo $password.' == '.$row['passwort'];
return $password == $row['passwort'];
@ -81,7 +81,7 @@ function checkSessionPasswort($userid, $password){
function checkCookiePassword($username, $password){
$sql = 'SELECT passwort from user where nickname = \''.$username.'\'';
$row = mysql_fetch_assoc(mysql_query($sql));
$row = mysqli_fetch_assoc(db_query($sql));
if($row['passwort'] != null){
return $password == $row['passwort'];
} else{
@ -95,7 +95,7 @@ function checkLoginPassword($username, $password){
$sql = 'SELECT SHA1(AES_ENCRYPT(\''.$password.'\',\''.$GLOBALS['PW_AES_KEY'].'\')) as encrypt_password, passwort from user where nickname = \''.$username.'\'';
// echo $sql.'<br>';
$row = mysql_fetch_assoc(mysql_query($sql));
$row = mysqli_fetch_assoc(db_query($sql));
if($row){
if($row['passwort'] == $pw) {
return true; // already bcrypt based!
@ -120,7 +120,7 @@ function setPassword($username, $password){
$pw = encryptPassword($password);
$sql = 'UPDATE user set passwort = \''.$pw.'\' where nickname = \''.$username.'\'';
// echo $sql.'<br>';
mysql_query($sql);
db_query($sql);
}
function encryptPassword($password){
@ -130,7 +130,7 @@ function encryptPassword($password){
function getUserMetaData($userid) {
$sql = 'SELECT * FROM user_meta_data WHERE user_id = ' . $userid;
$qry = mysql_query($sql);
$qry = db_query($sql);
$result = array();
if(!$qry)
@ -139,7 +139,7 @@ function getUserMetaData($userid) {
return $result;
}
while ($row = mysql_fetch_assoc($qry)) {
while ($row = mysqli_fetch_assoc($qry)) {
$result[$row['key']] = $row['value'];
}
return $result;
@ -147,15 +147,15 @@ function getUserMetaData($userid) {
function setUserMetaDataEntry($userid, $key, $value) {
$sql = 'UPDATE user_meta_data SET `value` = \''.$value.'\' WHERE user_id = \''.$userid.'\' and `key` = \''.$key.'\'';
$qry = mysql_query($sql);
$qry = db_query($sql);
if(!qry)
return;
if(mysql_affected_rows() > 0)
if(db_affected_rows() > 0)
return;
$sql = 'INSERT INTO user_meta_data(user_id, `key`, `value`) values (\''.$userid.'\',\''.$key.'\',\''.$value.'\')';
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 '<formaction=index.phpmethod="get"><inputtype="hidden"name="as"value="'.$as.'"><inputname="agb"value="ok"type="hidden">Die Regeln haben sich verändert. Bist du mit den neuen Regeln einverstanden? <ahref="index.php?as=info/agb"target="_blank">Hier Klicken um die neuen Regeln zu lesen</a><br><inputtype="submit"value="Einverstanden"></form>';
$at_info = mysql_Fetch_array(mysql_query("SELECT * FROM attacken WHERE id='".$at_id."' LIMIT 1"));
$at_info = mysqli_fetch_array(db_query("SELECT * FROM attacken WHERE id='".$at_id."' LIMIT 1"));
$req_atk = explode(",", $at_info['req_atk']);
$req_lvl = explode(",", $at_info['req_lvl']);
$req_attack = mysql_fetch_array(mysql_query("SELECT f.name AS f_name, b.name AS b_name, c.name AS c_name, d.name AS d_name, e.name AS e_name FROM attacken a LEFT JOIN attacken b ON(b.id='".$req_atk[0]."') LEFT JOIN attacken c ON(c.id='".$req_atk[1]."') LEFT JOIN attacken d ON(d.id='".$req_atk[2]."') LEFT JOIN attacken e ON(e.id='".$req_atk[3]."') LEFT JOIN attacken f ON(f.id='".$req_atk[4]."') WHERE a.id='".$at_id."'"));
$req_attack = mysqli_fetch_array(db_query("SELECT f.name AS f_name, b.name AS b_name, c.name AS c_name, d.name AS d_name, e.name AS e_name FROM attacken a LEFT JOIN attacken b ON(b.id='".$req_atk[0]."') LEFT JOIN attacken c ON(c.id='".$req_atk[1]."') LEFT JOIN attacken d ON(d.id='".$req_atk[2]."') LEFT JOIN attacken e ON(e.id='".$req_atk[3]."') LEFT JOIN attacken f ON(f.id='".$req_atk[4]."') WHERE a.id='".$at_id."'"));
$arenalvl = mysql_fetch_array(mysql_query("SELECT level FROM arena WHERE besitzer = ".$userid.";"));
$arenalvl = mysqli_fetch_array(db_query("SELECT level FROM arena WHERE besitzer = ".$userid.";"));
// Die etwas abgewandelten SQL-Querys aus dem auktion_functions.php
$query = 'SELECT i.id, i.name, count(i.id) AS anzahl, tausch_anzahl, tausch_lvl, \'ware\' as tablename FROM ware w INNER JOIN item i ON(i.id=w.item_id) WHERE w.user = '.$userid.' AND s_type = \'Trank\' AND tausch_lvl <= '.$arenalvl['level'].' GROUP BY i.id
union
@ -57,9 +57,9 @@ function getTradeItems($userid){
union
SELECT i.id, i.item AS name, count(i.id) AS anzahl, tausch_anzahl, tausch_lvl, \'wochen_ware\' as tablename FROM wochen_ware w INNER JOIN wochen_markt i ON(i.id=w.item) WHERE w.user = '.$userid.' AND tausch_lvl <= '.$arenalvl['level'].' GROUP BY (i.id)';
$qry = mysql_query($query);
$qry = db_query($query);
// Damit waeren alle noetigen Datenbankaufrufe erledigt!
$qry = 'UPDATE ware SET user = '.$tausch_user_id.' WHERE item_id = '.$tausch_item[0].' AND user = '.$user['id'].' LIMIT '.$tausch_anzahl.';';
mysql_query($qry);
db_query($qry);
} else {
$qry = 'UPDATE '.$tausch_item[1].' SET user = '.$tausch_user_id.' WHERE item = '.$tausch_item[0].' AND user = '.$user['id'].' LIMIT '.$tausch_anzahl.';';
mysql_query($qry);
db_query($qry);
}
sendMessage($user['nickname'], $tausch_user_id, 'Geschenk', 'Der Spieler '.$user['nickname'].' hat dir das Item '.$row['name'].$row['item'].' geschenkt!');
$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"));
@ -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);
$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';
$char1_item_helm = mysql_Fetch_Array(mysql_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char1_quis_item[0]' LIMIT 1"));
$char1_item_rustung = mysql_Fetch_Array(mysql_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char1_quis_item[1]' LIMIT 1"));
$char1_item_schild = mysql_Fetch_Array(mysql_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char1_quis_item[2]' LIMIT 1"));
$char1_item_schwert = mysql_Fetch_Array(mysql_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char1_quis_item[3]' LIMIT 1"));
$char1_item_schuhe = mysql_Fetch_Array(mysql_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char1_quis_item[4]' LIMIT 1"));
$char1_item_helm = mysqli_fetch_array(db_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char1_quis_item[0]' LIMIT 1"));
$char1_item_rustung = mysqli_fetch_array(db_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char1_quis_item[1]' LIMIT 1"));
$char1_item_schild = mysqli_fetch_array(db_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char1_quis_item[2]' LIMIT 1"));
$char1_item_schwert = mysqli_fetch_array(db_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char1_quis_item[3]' LIMIT 1"));
$char1_item_schuhe = mysqli_fetch_array(db_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char1_quis_item[4]' LIMIT 1"));
$char2_item_helm = mysql_Fetch_Array(mysql_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char2_quis_item[0]' LIMIT 1"));
$char2_item_rustung = mysql_Fetch_Array(mysql_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char2_quis_item[1]' LIMIT 1"));
$char2_item_schild = mysql_Fetch_Array(mysql_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char2_quis_item[2]' LIMIT 1"));
$char2_item_schwert = mysql_Fetch_Array(mysql_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char2_quis_item[3]' LIMIT 1"));
$char2_item_schuhe = mysql_Fetch_Array(mysql_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char2_quis_item[4]' LIMIT 1"));
$char2_item_helm = mysqli_fetch_array(db_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char2_quis_item[0]' LIMIT 1"));
$char2_item_rustung = mysqli_fetch_array(db_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char2_quis_item[1]' LIMIT 1"));
$char2_item_schild = mysqli_fetch_array(db_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char2_quis_item[2]' LIMIT 1"));
$char2_item_schwert = mysqli_fetch_array(db_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char2_quis_item[3]' LIMIT 1"));
$char2_item_schuhe = mysqli_fetch_array(db_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char2_quis_item[4]' LIMIT 1"));
$k_hp2 = explode(",", $chara_2['hp']);
$k_mp2 = explode(",", $chara_2['mp']);
@ -101,9 +101,9 @@ $runden_gif_technik2 = "";
if ($k_hp[0] > $k_aufgabe[0] AND $k_hp[1] > $k_aufgabe[1] AND $x <10){
$technick2 = mysql_fetch_array(mysql_query("SELECT * FROM attacken WHERE id='$technick2[at_id]' LIMIT 10"));
$technick2 = mysqli_fetch_array(db_query("SELECT * FROM attacken WHERE id='$technick2[at_id]' LIMIT 10"));
///////////////////Hier laedt er den RELOAD der technik wenn die zusammen setzung nicht stimmen sollte
include (ROOT_PATH . '/include/kampf/andere_technik.php'); /////////////////// Wenn man ne andere technik sich aussuchen will...
@ -217,9 +217,9 @@ while ($k_hp[0] > $k_aufgabe[0] AND $k_hp[1] > $k_aufgabe[1] AND $x < 10) {
#####################################KAMPF SYSTEM
include (ROOT_PATH . '/include/kampf/kampf_rechnung.php');
$db_query = mysql_fetch_array(mysql_query("SELECT * FROM kampf WHERE (char1='$chara_1[id]' OR char1='$chara_2[id]') AND dauer='0' order by id DESC LIMIT 1"));
$db_query = mysqli_fetch_array(db_query("SELECT * FROM kampf WHERE (char1='$chara_1[id]' OR char1='$chara_2[id]') AND dauer='0' order by id DESC LIMIT 1"));
@ -31,10 +31,10 @@ if (!isUserOwnerOf($user['id'], $char_id)) {
exit;
}
$kampf1 = mysql_Fetch_array(mysql_query("SELECT * FROM kampf WHERE db_satz='$char_id' order by id DESC LIMIT 1"));
$kampf1 = mysqli_fetch_array(db_query("SELECT * FROM kampf WHERE db_satz='$char_id' order by id DESC LIMIT 1"));
$char_1 = getChar($kampf1['char1']);
$char_2 = getChar($kampf1['char2']);
$arena = mysql_Fetch_array(mysql_query("SELECT * FROM arena WHERE id='$kampf1[arena_name]' LIMIT 1"));
$arena = mysqli_fetch_array(db_query("SELECT * FROM arena WHERE id='$kampf1[arena_name]' LIMIT 1"));
$ressource = 'Kampf:' . $kampf1['id'];
if (!semaphoreUP($ressource)) {
@ -54,8 +54,8 @@ if (!checkAbholcode($char_id, $code)) {
exit;
}
mysql_query('DELETE FROM kampf WHERE db_satz='.$char_id);
if (mysql_affected_rows() == 0) {
db_query('DELETE FROM kampf WHERE db_satz='.$char_id);
if (db_affected_rows() == 0) {
displayErrorMessage(NULL, 'Der Kampf wurde schon abgeholt!', displayHistoryBackLink());
semaphoreDown($ressource);
exit;
@ -132,7 +132,7 @@ if ($kampf1['id']) {
if ($new_mp > $a_mp1[1]) {
$new_mp = $a_mp1[1];
}
mysql_query("UPDATE chars SET status='Frei', mp='$new_mp,$a_mp1[1]', hp='$new_hp,$a_hp1[1]' WHERE id='$char_id' LIMIT 1");
db_query("UPDATE chars SET status='Frei', mp='$new_mp,$a_mp1[1]', hp='$new_hp,$a_hp1[1]' WHERE id='$char_id' LIMIT 1");
} else {
$new_exp = $kampf1['exp2'];
$new_geld = $user['geld'] + $kampf1['geld2'];
@ -153,7 +153,7 @@ if ($kampf1['id']) {
$new_mp = $a_mp2[1];
}
mysql_query("UPDATE chars SET status='Frei', mp='$new_mp,$a_mp2[1]', hp='$new_hp,$a_hp2[1]' WHERE id='$char_id' LIMIT 1");
db_query("UPDATE chars SET status='Frei', mp='$new_mp,$a_mp2[1]', hp='$new_hp,$a_hp2[1]' WHERE id='$char_id' LIMIT 1");
}
@ -164,9 +164,9 @@ if ($kampf1['id']) {
////////NPC item verteilung
if ($kampf1['art2'] == "NPC") {
$item = mysql_fetch_array(mysql_query('SELECT item, mal, datensatz, wieviel, feld FROM npc_item WHERE charakter='.$kampf1['char2'].';'));
$item = mysqli_fetch_array(db_query('SELECT item, mal, datensatz, wieviel, feld FROM npc_item WHERE charakter='.$kampf1['char2'].';'));
$schon_bekommen = mysql_fetch_assoc(mysql_query("SELECT Count(*) as anzahl FROM npc_ware WHERE charakter='$kampf1[char2]' AND user='$user_ida[id]'"));
$schon_bekommen = mysqli_fetch_assoc(db_query("SELECT Count(*) as anzahl FROM npc_ware WHERE charakter='$kampf1[char2]' AND user='$user_ida[id]'"));
if ($schon_bekommen['anzahl'] >= $item['mal']) {
/////item schon bekommen
@ -184,12 +184,12 @@ if ($kampf1['id']) {
$chars = getCharsOfUser($user_ida['id']);
foreach ($chars as $tmp_char) {
$values = explode(',', $tmp_char[$item['feld']]);
mysql_query('UPDATE '.$item['datensatz'].' SET '.$item['feld'].'=\''.$values[0].','.($values[1]+$item['wieviel']).'\' WHERE besitzer='.$user_ida['id'].' AND id='.$tmp_char['id']);
db_query('UPDATE '.$item['datensatz'].' SET '.$item['feld'].'=\''.$values[0].','.($values[1]+$item['wieviel']).'\' WHERE besitzer='.$user_ida['id'].' AND id='.$tmp_char['id']);
}
} else {
mysql_query("UPDATE $item[datensatz] SET $item[feld]=$item[feld]+'$item[wieviel]' WHERE besitzer='$user_ida[id]' LIMIT 10");
db_query("UPDATE $item[datensatz] SET $item[feld]=$item[feld]+'$item[wieviel]' WHERE besitzer='$user_ida[id]' LIMIT 10");
}
mysql_query("INSERT npc_ware SET user='$user_ida[id]', charakter='$kampf1[char2]'");
db_query("INSERT npc_ware SET user='$user_ida[id]', charakter='$kampf1[char2]'");
} else {
$satz = "item";
$new_item = "sp_item";
@ -201,7 +201,7 @@ if ($kampf1['id']) {
} else {
$ut = 0;
while ($ut < $item['wieviel']) {
mysql_query("INSERT $item[datensatz] SET $satz='$item[item]', user='$user_ida[id]'");
db_query("INSERT $item[datensatz] SET $satz='$item[item]', user='$user_ida[id]'");
if (!$ut) {
$itemname = $item['item'];
@ -211,13 +211,13 @@ if ($kampf1['id']) {
$ut++;
}
mysql_query("INSERT npc_ware SET user='$user_ida[id]', charakter='$kampf1[char2]'");
db_query("INSERT npc_ware SET user='$user_ida[id]', charakter='$kampf1[char2]'");
}
}
}
///ENDE
mysql_query("UPDATE chars SET siege='$new_siege' WHERE id='$char_id'");
db_query("UPDATE chars SET siege='$new_siege' WHERE id='$char_id'");
mysql_query("UPDATE chars SET status='Tod' WHERE id='$char_id'");
db_query("UPDATE chars SET status='Tod' WHERE id='$char_id'");
} else {
@ -248,7 +248,7 @@ if ($kampf1['id']) {
}
mysql_query("UPDATE chars SET niederlagen='$new_niederlagen', liga_niederlagen='$new_liga_niederlagen', preis='$new_preis', dead_list='$new_dead_list' WHERE id='$char_id'");
db_query("UPDATE chars SET niederlagen='$new_niederlagen', liga_niederlagen='$new_liga_niederlagen', preis='$new_preis', dead_list='$new_dead_list' WHERE id='$char_id'");
}
@ -258,26 +258,26 @@ if ($kampf1['id']) {
// Leveln der Arena :) (Um Rundungsfehler zu vermeiden diese umstaendliche Rechnung)
$row = mysql_fetch_assoc(mysql_query('Select mietlasten FROM arena WHERE besitzer='.$user['id']));
$row = mysqli_fetch_assoc(db_query('Select mietlasten FROM arena WHERE besitzer='.$user['id']));
if($row['mietlasten'] > 2){
// Steuerschulden
$tilgung = ceil($new_geld_offset * 0.75);
$restgeld = $new_geld_offset - $tilgung;
mysql_query('UPDATE user SET geld=geld+'.$restgeld.' WHERE id= '.$user['id']);
db_query('UPDATE user SET geld=geld+'.$restgeld.' WHERE id= '.$user['id']);
echo '<scripttype="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ä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{
mysql_query('UPDATE user SET geld=' . $new_geld . ' WHERE id=' . $user['id'] . ' LIMIT 1');
db_query('UPDATE user SET geld=' . $new_geld . ' WHERE id=' . $user['id'] . ' LIMIT 1');
}
// mysql_query("DELETE FROM kampf_nachricht WHERE charakter='$char_id'");
// db_query("DELETE FROM kampf_nachricht WHERE charakter='$char_id'");
// include_once (ROOT_PATH . '/include/exp.php');
@ -309,10 +309,10 @@ if ($kampf1['id']) {
addAttackUsageToChar($char_id, $l_attacken);
if ($itemname) {
$item_names = mysql_query("SELECT name FROM $new_item WHERE id IN(" . $itemname . ")");
$item_names = db_query("SELECT name FROM $new_item WHERE id IN(" . $itemname . ")");
$x2 = 0;
while ($new_row = @ mysql_fetch_array($item_names)) {
while ($new_row = @ mysqli_fetch_array($item_names)) {
$char1_item_helm = mysql_Fetch_Array(mysql_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char1_quis_item[0]' LIMIT 1"));
$char1_item_rustung = mysql_Fetch_Array(mysql_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char1_quis_item[1]' LIMIT 1"));
$char1_item_schild = mysql_Fetch_Array(mysql_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char1_quis_item[2]' LIMIT 1"));
$char1_item_schwert = mysql_Fetch_Array(mysql_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char1_quis_item[3]' LIMIT 1"));
$char1_item_schuhe = mysql_Fetch_Array(mysql_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char1_quis_item[4]' LIMIT 1"));
$char1_item_helm = mysqli_fetch_array(db_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char1_quis_item[0]' LIMIT 1"));
$char1_item_rustung = mysqli_fetch_array(db_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char1_quis_item[1]' LIMIT 1"));
$char1_item_schild = mysqli_fetch_array(db_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char1_quis_item[2]' LIMIT 1"));
$char1_item_schwert = mysqli_fetch_array(db_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char1_quis_item[3]' LIMIT 1"));
$char1_item_schuhe = mysqli_fetch_array(db_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char1_quis_item[4]' LIMIT 1"));
$char2_item_helm = mysql_Fetch_Array(mysql_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char2_quis_item[0]' LIMIT 1"));
$char2_item_rustung = mysql_Fetch_Array(mysql_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char2_quis_item[1]' LIMIT 1"));
$char2_item_schild = mysql_Fetch_Array(mysql_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char2_quis_item[2]' LIMIT 1"));
$char2_item_schwert = mysql_Fetch_Array(mysql_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char2_quis_item[3]' LIMIT 1"));
$char2_item_schuhe = mysql_Fetch_Array(mysql_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char2_quis_item[4]' LIMIT 1"));
$char2_item_helm = mysqli_fetch_array(db_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char2_quis_item[0]' LIMIT 1"));
$char2_item_rustung = mysqli_fetch_array(db_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char2_quis_item[1]' LIMIT 1"));
$char2_item_schild = mysqli_fetch_array(db_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char2_quis_item[2]' LIMIT 1"));
$char2_item_schwert = mysqli_fetch_array(db_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char2_quis_item[3]' LIMIT 1"));
$char2_item_schuhe = mysqli_fetch_array(db_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char2_quis_item[4]' LIMIT 1"));
@ -120,9 +120,9 @@ function erstelleEinenFight($charid, &$user, $kampf_name, $kampf_pw, $kampf_zeit
}
// echo $sql.'<br';
mysql_query($sql);
db_query($sql);
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']--;
}
@ -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.'\')';
$arena = mysqli_fetch_assoc(db_query('Select * from arena where besitzer = '.$user['id']));
}
if($arena['mietlasten'] > 7){
displayErrorMessage('Kampf erstellen nicht Möglich!', 'Ihre Arena ist geschlossen', displayHistoryBackLink());
@ -565,23 +565,23 @@ function display($user, $portal, $pagenum){
<?php
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');
$total = mysql_fetch_row(mysql_query('SELECT count(*) FROM kampf_list WHERE rasse=\'NPC\''));
$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 = mysqli_fetch_row(db_query('SELECT count(*) FROM kampf_list WHERE rasse=\'NPC\''));
$total = $total[0];
$entriesPerPage = $total;
} else if($portal == 'LVL'){
$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);
$total = mysql_fetch_row(mysql_query('SELECT count(*) FROM kampf_list WHERE rasse=\'ALL\' and lvlmax != 0 or passwort != \'\''));
$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 = mysqli_fetch_row(db_query('SELECT count(*) FROM kampf_list WHERE rasse=\'ALL\' and lvlmax != 0 or passwort != \'\''));
$total = $total[0];
} else{
$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);
$total = mysql_fetch_row(mysql_query('SELECT count(*) FROM kampf_list WHERE rasse=\'ALL\' and lvlmax = 0 and passwort = \'\''));
$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 = mysqli_fetch_row(db_query('SELECT count(*) FROM kampf_list WHERE rasse=\'ALL\' and lvlmax = 0 and passwort = \'\''));
$total = $total[0];
}
while($row = mysql_fetch_array($kampf_l)) {
while($row = mysqli_fetch_array($kampf_l)) {
$char = getChar($row['charakter']);
if($row['passwort']){
$pw_exe = 'pass1';
@ -629,7 +629,7 @@ function display($user, $portal, $pagenum){
<tdid="content"align="center">
<?php
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'));
$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"));
$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_2 = getChar($kampf1['char2']);
@ -88,7 +88,7 @@ if ($kampf_id) {
exit;
} 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]'");
?>
@ -101,7 +101,7 @@ if ($kampf_id) {
$kampfs = 1;
while ($row = mysql_fetch_array($kampf_search)) {
while ($row = mysqli_fetch_array($kampf_search)) {
$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'));