$row = mysql_fetch_array(mysql_query("SELECT name, level, starke, speed, verteidigung, ausdauer, glueck, hp, mp FROM chars WHERE level<'150' AND rasse!='NPC' ORDER BY ($wahl) DESC LIMIT 1"));
$row = mysqli_fetch_array(db_query("SELECT name, level, starke, speed, verteidigung, ausdauer, glueck, hp, mp FROM chars WHERE level<'150' AND rasse!='NPC' ORDER BY ($wahl) DESC LIMIT 1"));
mysql_query("UPDATE chars SET hp='$beste_hp,$beste_hp', mp='$beste_mp,$beste_mp', starke='$beste_starke', speed='$beste_speed', verteidigung='$beste_verteidigung', ausdauer='$beste_ausdauer', glueck='$beste_glueck' WHERE id='$brolly' LIMIT 1");
db_query("UPDATE chars SET hp='$beste_hp,$beste_hp', mp='$beste_mp,$beste_mp', starke='$beste_starke', speed='$beste_speed', verteidigung='$beste_verteidigung', ausdauer='$beste_ausdauer', glueck='$beste_glueck' WHERE id='$brolly' LIMIT 1");
//////////////////////////////////NPCS!!!!
$row = mysql_fetch_array(mysql_query("SELECT name, level, starke, speed, verteidigung, ausdauer, glueck, hp, mp FROM chars WHERE level<'150' AND rasse!='NPC' ORDER BY starke DESC LIMIT 1"));
$row = mysqli_fetch_array(db_query("SELECT name, level, starke, speed, verteidigung, ausdauer, glueck, hp, mp FROM chars WHERE level<'150' AND rasse!='NPC' ORDER BY starke DESC LIMIT 1"));
$row = mysql_fetch_array(mysql_query("SELECT hp, mp, name, level, starke, speed, verteidigung, ausdauer, glueck FROM chars WHERE level<'150' AND rasse!='NPC' ORDER BY level DESC LIMIT 1"));
$row = mysqli_fetch_array(db_query("SELECT hp, mp, name, level, starke, speed, verteidigung, ausdauer, glueck FROM chars WHERE level<'150' AND rasse!='NPC' ORDER BY level DESC LIMIT 1"));
mysql_query("UPDATE chars SET hp='$beste_hp,$beste_hp', mp='$beste_mp,$beste_mp', starke='$beste_starke', speed='$beste_speed', verteidigung='$beste_verteidigung', ausdauer='$beste_ausdauer', glueck='$beste_glueck' WHERE id='$flamingo' LIMIT 1");
db_query("UPDATE chars SET hp='$beste_hp,$beste_hp', mp='$beste_mp,$beste_mp', starke='$beste_starke', speed='$beste_speed', verteidigung='$beste_verteidigung', ausdauer='$beste_ausdauer', glueck='$beste_glueck' WHERE id='$flamingo' LIMIT 1");
//////////////////NPC
$row = mysql_fetch_array(mysql_query("SELECT hp, mp, name, level, starke, speed, verteidigung, ausdauer, glueck FROM chars WHERE level<'150' AND rasse!='NPC' ORDER BY speed DESC LIMIT 1"));
$row = mysqli_fetch_array(db_query("SELECT hp, mp, name, level, starke, speed, verteidigung, ausdauer, glueck FROM chars WHERE level<'150' AND rasse!='NPC' ORDER BY speed DESC LIMIT 1"));
$sql = '(Select distinct(char1) as x from turnier_kampf where art = \'gross\' ) union (Select distinct(char2) as x from turnier_kampf where art = \'gross\' )';
$charids = array();
$qry1 = mysql_query($sql);
while($row = mysql_fetch_assoc($qry1)){
$qry1 = db_query($sql);
while($row = mysqli_fetch_assoc($qry1)){
$charids[] = $row['x'];
}
$sql2 = 'Select avg(level) as dlevel from chars where id in ('.join(',', $charids).')';
$sql = '(Select distinct(char1) as x from turnier_kampf where art = \''.$turnier_kurz.'\' ) union (Select distinct(char2) as x from turnier_kampf where art = \''.$turnier_kurz.'\' )';
$charids = array();
$qry1 = mysql_query($sql);
while($row = mysql_fetch_assoc($qry1)){
$qry1 = db_query($sql);
while($row = mysqli_fetch_assoc($qry1)){
$charids[] = $row['x'];
}
$sql2 = 'Select avg(level) as dlevel from chars where id in ('.join(',', $charids).')';
@ -33,32 +33,32 @@ function getStatus($charid, $buffer_enabled = true) {
}
$sql = 'SELECT count(*) as anzahl FROM turnier_kampf t where art != \'gross\' and (win = ' . $charid . ' or lose = ' . $charid . ') and dauer > now()';
$char_buffs = mysql_fetch_assoc(mysql_query('SELECT sum(i.hp) as hp, sum(i.mp) as mp, sum(i.starke) as starke, sum(i.verteidigung) as verteidigung, sum(i.speed) as speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id IN (' . $char['kampf_item'] . ')'));
$char_buffs = mysqli_fetch_assoc(db_query('SELECT sum(i.hp) as hp, sum(i.mp) as mp, sum(i.starke) as starke, sum(i.verteidigung) as verteidigung, sum(i.speed) as speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id IN (' . $char['kampf_item'] . ')'));
$char_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'] . ')'));
// mysql_query("UPDATE arena SET exp='$ne_exp1,$new_exp', level='$level1', skill='$skill_points' WHERE besitzer='$user_ida[id]' LIMIT 1");
// db_query("UPDATE arena SET exp='$ne_exp1,$new_exp', level='$level1', skill='$skill_points' WHERE besitzer='$user_ida[id]' LIMIT 1");
echo '<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);
$all_mess = mysql_query("SELECT n.nachricht, w.nickname FROM kampf_nachricht n LEFT JOIN user w ON(n.user=w.id) WHERE (n.user='$user1[id]' OR n.user='$user2[id]') AND (n.charakter='$kampf_a1[id]' OR n.charakter='$kampf_a2[id]') ORDER BY n.id ASC");
$all_mess = db_query("SELECT n.nachricht, w.nickname FROM kampf_nachricht n LEFT JOIN user w ON(n.user=w.id) WHERE (n.user='$user1[id]' OR n.user='$user2[id]') AND (n.charakter='$kampf_a1[id]' OR n.charakter='$kampf_a2[id]') ORDER BY n.id ASC");
$user_summon_id = mysql_fetch_array(mysql_query("SELECT f.starke, f.speed, f.verteidigung, f.ausdauer, f.hp, f.mp, f.level, m.name FROM user u LEFT JOIN quest_fang f ON(f.id=u.summon) LEFT JOIN quest_monster m ON(m.id=f.monster) WHERE u.id='$chara_1[besitzer]' LIMIT 1"));
$user_summon_id = mysqli_fetch_array(db_query("SELECT f.starke, f.speed, f.verteidigung, f.ausdauer, f.hp, f.mp, f.level, m.name FROM user u LEFT JOIN quest_fang f ON(f.id=u.summon) LEFT JOIN quest_monster m ON(m.id=f.monster) WHERE u.id='$chara_1[besitzer]' LIMIT 1"));
$user_summon_id = mysql_fetch_array(mysql_query("SELECT f.starke, f.speed, f.verteidigung, f.ausdauer, f.hp, f.mp, m.level, m.name FROM user u LEFT JOIN quest_fang f ON(f.id=u.summon) LEFT JOIN quest_monster m ON(m.id=f.monster) WHERE u.id='$chara_1[besitzer]' LIMIT 1"));
$user_summon_id = mysqli_fetch_array(db_query("SELECT f.starke, f.speed, f.verteidigung, f.ausdauer, f.hp, f.mp, m.level, m.name FROM user u LEFT JOIN quest_fang f ON(f.id=u.summon) LEFT JOIN quest_monster m ON(m.id=f.monster) WHERE u.id='$chara_1[besitzer]' LIMIT 1"));
if($user_summon_id[level]>$technick1[maxlvl]) {
@ -63,7 +63,7 @@ if($runden_summon2) {
if($runden_summon2 == $x) {
$user_summon_id = mysql_fetch_array(mysql_query("SELECT f.starke, f.speed, f.verteidigung, f.ausdauer, f.hp, f.mp, f.level, m.name FROM user u LEFT JOIN quest_fang f ON(f.id=u.summon) LEFT JOIN quest_monster m ON(m.id=f.monster) WHERE u.id='$chara_2[besitzer]' LIMIT 1"));
$user_summon_id = mysqli_fetch_array(db_query("SELECT f.starke, f.speed, f.verteidigung, f.ausdauer, f.hp, f.mp, f.level, m.name FROM user u LEFT JOIN quest_fang f ON(f.id=u.summon) LEFT JOIN quest_monster m ON(m.id=f.monster) WHERE u.id='$chara_2[besitzer]' LIMIT 1"));
$user_summon_id = mysql_fetch_array(mysql_query("SELECT f.starke, f.speed, f.verteidigung, f.ausdauer, f.hp, f.mp, m.level, m.name FROM user u LEFT JOIN quest_fang f ON(f.id=u.summon) LEFT JOIN quest_monster m ON(m.id=f.monster) WHERE u.id='$chara_2[besitzer]' LIMIT 1"));
$user_summon_id = mysqli_fetch_array(db_query("SELECT f.starke, f.speed, f.verteidigung, f.ausdauer, f.hp, f.mp, m.level, m.name FROM user u LEFT JOIN quest_fang f ON(f.id=u.summon) LEFT JOIN quest_monster m ON(m.id=f.monster) WHERE u.id='$chara_2[besitzer]' LIMIT 1"));
if($user_summon_id[level]>$technick2[maxlvl]) {
$schaden_2 = "$user_summon_id[name] ist zu Stark";
while($k_hp[0] > $k_aufgabe[0] AND $k_hp[1] > $k_aufgabe[1] AND $x <10){
$technick1 = mysql_fetch_array(mysql_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke1[$x]' LIMIT 10"));
$technick1 = mysqli_fetch_array(db_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke1[$x]' LIMIT 10"));
$prozent_technik1 = (20*$technick1[aktiv])-20;
$technick1 = mysql_fetch_array(mysql_query("SELECT * FROM attacken WHERE id='$technick1[at_id]' LIMIT 10"));
$technick1 = mysqli_fetch_array(db_query("SELECT * FROM attacken WHERE id='$technick1[at_id]' LIMIT 10"));
$technick2 = mysql_fetch_array(mysql_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke2[$x]' LIMIT 10"));
$technick2 = mysqli_fetch_array(db_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke2[$x]' LIMIT 10"));
$prozent_technik2 = (20*$technick2[aktiv])-20;
$technick2 = mysql_fetch_array(mysql_query("SELECT * FROM attacken WHERE id='$technick2[at_id]' LIMIT 10"));
$technick2 = mysqli_fetch_array(db_query("SELECT * FROM attacken WHERE id='$technick2[at_id]' LIMIT 10"));
///////////////////Hier laedt er den RELOAD der technik wenn die zusammen setzung nicht stimmen sollte
@ -133,9 +133,9 @@ include "include/kampf/kampf_rechnung.php";
$db_query = mysql_fetch_array(mysql_query("SELECT * FROM liga_kampf WHERE (char1='$chara_1[id]' OR char1='$chara_2[id]') AND dauer='0' order by id DESC LIMIT 1"));
$db_query = mysqli_fetch_array(db_query("SELECT * FROM liga_kampf WHERE (char1='$chara_1[id]' OR char1='$chara_2[id]') AND dauer='0' order by id DESC LIMIT 1"));
$res = mysql_fetch_assoc(mysql_query('Select max(channel_id) as mx FROM '.$mumbledb.'.channels where server_id = '.$serverid));
$res = mysqli_fetch_assoc(db_query('Select max(channel_id) as mx FROM '.$mumbledb.'.channels where server_id = '.$serverid));
$max_channel = $res['mx'];
$res = mysql_fetch_assoc(mysql_query('Select max(group_id) as mx FROM '.$mumbledb.'.groups where server_id = '.$serverid));
$res = mysqli_fetch_assoc(db_query('Select max(group_id) as mx FROM '.$mumbledb.'.groups where server_id = '.$serverid));
$max_group = $res['mx'];
$res = mysql_fetch_assoc(mysql_query('Select channel_id FROM '.$mumbledb.'.channels where name = \''.$clan_chan_name.'\' and server_id = '.$serverid));
$res = mysqli_fetch_assoc(db_query('Select channel_id FROM '.$mumbledb.'.channels where name = \''.$clan_chan_name.'\' and server_id = '.$serverid));
$clan_chan = $res['channel_id'];
$rename_sql = 'UPDATE '.$mumbledb.'.users p inner join '.$ag_db.'.user u on p.user_id = u.id set p.name = u.nickname WHERE p.name != u.nickname and server_id = '.$serverid;
$search_lost_players = 'Select p.user_id FROM '.$mumbledb.'.users as p left join '.$ag_db.'.user as u on p.user_id = u.id where p.user_id > 0 and u.nickname is null and p.server_id = '.$serverid;
$qry = mysql_query($search_lost_players);
$qry = db_query($search_lost_players);
while($row = mysql_fetch_assoc($qry)){
while($row = mysqli_fetch_assoc($qry)){
$player[] = $row['user_id'];
}
@ -51,13 +51,13 @@ if(count($player) > 0){
//$clan_channels_sql = 'SELECT distinct(clanname) as name from '.$mumbledb.'.channels c right join '.$ag_db.'.clan cl on c.name = cl.clanname where name is null';
$clan_channels_sql = 'SELECT distinct(clanname) as name, count(u.clan) anzahl, name is not null as existance from '.$mumbledb.'.channels c right join '.$ag_db.'.clan cl on c.name = cl.clanname left join '.$ag_db.'.user u on cl.id = u.clan group by clanname';
$qry = mysql_query($clan_channels_sql);
$qry = db_query($clan_channels_sql);
$insert_clan_channels = 'INSERT INTO '.$mumbledb.'.channels(server_id, channel_id, parent_id, name, inheritacl) values';
mysql_query('DELETE FROM '.$mumbledb.'.channels WHERE parent_id = '.$clan_chan. ' and name = \''.$row['name'].'\' and server_id = '.$serverid);
db_query('DELETE FROM '.$mumbledb.'.channels WHERE parent_id = '.$clan_chan. ' and name = \''.$row['name'].'\' and server_id = '.$serverid);
}
}
// Delete nonexistant Clan-Channels!
$search_lost_channels = 'select channel_id FROM '.$mumbledb.'.channels left join '.$ag_db.'.clan on name = clanname where clanname is null and parent_id = '.$clan_chan.' and server_id = '.$serverid;
$qry = mysql_query($search_lost_channels);
$qry = db_query($search_lost_channels);
while($row = mysql_fetch_assoc($qry)){
while($row = mysqli_fetch_assoc($qry)){
$channels[] = $row['channel_id'];
}
@ -117,34 +117,34 @@ $sql_user_select = 'Select p.user_id, ch.name as ch_name, ch2.name as ch2_name,
*/
mysql_query($rename_sql);
db_query($rename_sql);
if(isset($delete_sql)){
mysql_query($delete_sql);
db_query($delete_sql);
}
if($i!=1){
// echo $insert_clan_channels.'<br>';
mysql_query($insert_clan_channels);
mysql_query($insert_clan_groups);
mysql_query($insert_acl);
db_query($insert_clan_channels);
db_query($insert_clan_groups);
db_query($insert_acl);
}
// Entferne Channels von Clans die es nicht mehr gibt!
mysql_query($remove_clan_channel_sql);
db_query($remove_clan_channel_sql);
// Nun die User :)
$qry = mysql_query($sql_user_select);
$qry = db_query($sql_user_select);
while($row = mysql_fetch_assoc($qry)){
while($row = mysqli_fetch_assoc($qry)){
// Zu Gruppe hinzufuegen oder aus gruppe entfernen?
$row2 = mysql_query("SELECT c1.lernpunkte AS c1lern, c2.lernpunkte AS c2lern, u.round, u.win, u.hp1, u.hp2,c1.hp AS c1hp, c2.hp AS c2hp, c1.mp AS c1mp, c2.mp AS c2mp, u.mp1, u.mp2, c1.id AS c1id, c2.id AS c2id, c1.exp AS c1exp, c2.exp AS c2exp, i1.geld AS i1geld, i2.geld AS i2geld,
$row2 = db_query("SELECT c1.lernpunkte AS c1lern, c2.lernpunkte AS c2lern, u.round, u.win, u.hp1, u.hp2,c1.hp AS c1hp, c2.hp AS c2hp, c1.mp AS c1mp, c2.mp AS c2mp, u.mp1, u.mp2, c1.id AS c1id, c2.id AS c2id, c1.exp AS c1exp, c2.exp AS c2exp, i1.geld AS i1geld, i2.geld AS i2geld,
i1.id AS i1id, i2.id AS i2id FROM turnier_kampf u LEFT JOIN chars c1 ON(c1.id=u.char1) LEFT JOIN user i1 ON(i1.id=c1.besitzer) LEFT JOIN chars c2 ON(c2.id=u.char2) LEFT JOIN user i2 ON(i2.id=c2.besitzer) WHERE u.art='chu_pruef' ORDER BY u.round ASC");
$x=0;
while($row = mysql_fetch_array($row2)) {
while($row = mysqli_fetch_array($row2)) {
if($row[round] == 4) {
$new_geld1 = 200000;
@ -43,10 +43,10 @@ if($row[round] == 4) {
}
mysql_query("UPDATE chars SET n_missionpunkte=n_missionpunkte+45000, training_points=training_points+'$trainings_points1', lernpunkte='$new_lernpunkte1' WHERE id='$weiter_1[0]' LIMIT 1");
mysql_query("UPDATE chars SET n_missionpunkte=n_missionpunkte+45000, training_points=training_points+'$trainings_points2', lernpunkte='$new_lernpunkte2' WHERE id='$weiter_1[1]' LIMIT 1");
db_query("UPDATE chars SET n_missionpunkte=n_missionpunkte+45000, training_points=training_points+'$trainings_points1', lernpunkte='$new_lernpunkte1' WHERE id='$weiter_1[0]' LIMIT 1");
db_query("UPDATE chars SET n_missionpunkte=n_missionpunkte+45000, training_points=training_points+'$trainings_points2', lernpunkte='$new_lernpunkte2' WHERE id='$weiter_1[1]' LIMIT 1");
/*
mysql_query("UPDATE user SET geld='$new_geld1' WHERE id='$row[i1id]' LIMIT 1");
mysql_query("UPDATE user SET geld='$new_geld2' WHERE id='$row[i2id]' LIMIT 1");
db_query("UPDATE user SET geld='$new_geld1' WHERE id='$row[i1id]' LIMIT 1");
db_query("UPDATE user SET geld='$new_geld2' WHERE id='$row[i2id]' LIMIT 1");
$sql = 'Update arena set mietlasten = mietlasten + 1, steuerlasten = steuerlasten + '.$steuerbetrag.' where '.$steuerbetrag.' > 0';
// echo $sql.'<br>';
mysql_query($sql);
db_query($sql);
mysql_query('Update arena set einnahmen = 0');
db_query('Update arena set einnahmen = 0');
// Inaktive Clans löschen (Clanräume werden automatisch gelöscht durch Fremdschlüssel)
$sql = 'delete from clan where id NOT IN(SELECT distinct(clan) from user where clan is not null)';
//echo $sql . '<br>';
mysql_query($sql);
db_query($sql);
// Räume die Ticker auf (Massivster Datenmüll!!)
mysql_query('DELETE FROM clan_ticker WHERE date <TIMESTAMPADD(day,-7,now())');
mysql_query('DELETE FROM user_ticker WHERE date <TIMESTAMPADD(day,-7,now())');
db_query('DELETE FROM clan_ticker WHERE date <TIMESTAMPADD(day,-7,now())');
db_query('DELETE FROM user_ticker WHERE date <TIMESTAMPADD(day,-7,now())');
// Benutze Clan items!!
// Folgende SQL-Anweisung ermittelt mit einer kleinen Hilfsfunktion die Summe der Miete und das Geld des Clans
@ -109,10 +110,10 @@ if ($i == 11) {
$sql = 'SELECT cw.id as clan_train, if(count(ch.id)<'.$mindestchar.','.$mindestchar.',count(ch.id)) * miete as mietkosten, c.id as clan, c.geld as geld from clan_ware cw inner join clan_item ci on cw.item_id = ci.id inner join clan c on cw.clan = c.id inner join user u on u.clan = c.id left join chars ch on ch.clan_train = cw.id and ch.besitzer = u.id group by c.id, cw.id order by c.id';
// SQL-Anweisung, wenn Ungenutzte items nicht beruecksichtigt werden sollen -> 'SELECT ch.clan_train, if(count(ch.id)<40,40,count(ch.id))*mieteasmietkosten,c.idasclan,c.geldasgeldfromuseruinnerjoinclanconu.clan =c.idinnerjoincharschonu.id =ch.besitzerinnerjoinclan_warecwoncw.clan =c.idinnerjoinclan_itemcioncw.item_id =ci.idandch.clan_train =cw.idgroupbyc.id,cw.idorderbyc.id'
// echo '<br>'.$sql.'<br>';
$clan_kosten = mysql_query($sql);
$clan_kosten = db_query($sql);
$clan_raum_array = array();
while ($row = mysql_fetch_assoc($clan_kosten)){
while ($row = mysqli_fetch_assoc($clan_kosten)){
if($clan_raum_array[$row['clan']] === null){
$clan_raum_array[$row['clan']] = $row;
} else{
@ -121,7 +122,7 @@ if ($i == 11) {
}
$clans = array ();
// while ($row = mysql_fetch_assoc($clan_kosten)) {
// while ($row = mysqli_fetch_assoc($clan_kosten)) {
foreach($clan_raum_array as $row){
// print_r($row);
// Ermittle das Vermoegen und die Useranzahl des Clans!
@ -133,17 +134,17 @@ if ($i == 11) {
// Clan kann miete bezahlen, also in Trainingsliste aufnehmen
$clans[] = $row['clan'];
// Clan die Miete abziehen
mysql_query('UPDATE clan SET geld = geld - ' . $row['mietkosten'] . ' WHERE id = ' . $row['clan']);
db_query('UPDATE clan SET geld = geld - ' . $row['mietkosten'] . ' WHERE id = ' . $row['clan']);
insertClanTickerMessage($row['clan'], 'Die Miete für die Räume ('.displayMoney($row['mietkosten']).') wurde bezahlt!');
}
}
// Ermittle die Kosten fuer die Nutzer (es werden nur Chars beruecksichtigt, die genug TP haben)
$sql = 'select besitzer, user.geld, sum(1/(1+exp(3-level/12)) * nutzung) as nutzkosten from user inner join chars on chars.besitzer = user.id inner join clan_ware on chars.clan_train = clan_ware.id inner join clan_item on clan_ware.item_id = clan_item.id where user.clan = clan_ware.clan and user.clan IN (' . join(',', $clans) . ') and clan_item.tp <= chars.training_points group by besitzer order by besitzer';
$user_kosten = mysql_query($sql);
$user_kosten = db_query($sql);
// echo '<br>'.$sql.'<br>';
$users = array ();
if (count($clans) != 0) {
while ($row = mysql_fetch_assoc($user_kosten)) {
while ($row = mysqli_fetch_assoc($user_kosten)) {
if ($row['nutzkosten'] > $row['geld']) {
// User is pleite!
insertUserTickerMessage($row['besitzer'], 'Die Nutzungsgebühren ('.displayMoney($row['nutzkosten']).') für die Räume konnte nicht bezahlt werden!');
@ -151,27 +152,27 @@ if ($i == 11) {
// User kann Nutzkosten bezahlen, also in Trainingsliste aufnehmen
$users[] = $row['besitzer'];
// Clan die Miete abziehen
mysql_query('UPDATE user SET geld = geld - ' . $row['nutzkosten'] . ' WHERE id = ' . $row['besitzer']);
db_query('UPDATE user SET geld = geld - ' . $row['nutzkosten'] . ' WHERE id = ' . $row['besitzer']);
insertUserTickerMessage($row['besitzer'], 'Die Nutzungsgebühren ('.displayMoney($row['nutzkosten']).') für die Räume wurde bezahlt!');
}
}
$sql = 'Update chars inner join user on chars.besitzer = user.id inner join clan_ware on chars.clan_train = clan_ware.id inner join clan_item on clan_ware.item_id = clan_item.id SET chars.starke = clan_item.staerke + chars.starke, chars.speed = chars.speed + clan_item.geschwindigkeit, chars.verteidigung = chars.verteidigung + clan_item.verteidigung, chars.glueck = chars.glueck + clan_item.glueck, chars.ausdauer = chars.ausdauer + clan_item.ausdauer, chars.training_points = chars.training_points - clan_item.tp WHERE user.clan = clan_ware.clan and chars.besitzer IN(' . join(',', $users) . ') and chars.training_points >= clan_item.tp';
mysql_query("UPDATE chars SET hp='$hp[1],$hp[1]', mp='$mp[1],$mp[1]' WHERE id='$row[id]' LIMIT 1");
db_query("UPDATE chars SET hp='$hp[1],$hp[1]', mp='$mp[1],$mp[1]' WHERE id='$row[id]' LIMIT 1");
} else {
if ($row[training_points] > 1) {
@ -184,16 +185,16 @@ while ($row = mysql_fetch_array($char_info)) {
$zu[$x] = "$mp[0],$zu[$x]";
}
// echo "UPDATE chars SET $trains[$i]='$zu[$x]', training_points=training_points-2 WHERE id='$row[id]' LIMIT 1<br>";
mysql_query("UPDATE chars SET $trains[$i]='$zu[$x]', training_points=training_points-4 WHERE id='$row[id]' LIMIT 1");
db_query("UPDATE chars SET $trains[$i]='$zu[$x]', training_points=training_points-4 WHERE id='$row[id]' LIMIT 1");
} else {
$event = mysql_fetch_assoc(mysql_query('SELECT CURRENT_TIMESTAMP between TIMESTAMP(\'2009-04-25 00:00:00\') and TIMESTAMP(\'2009-05-02 23:59:59\') as betw'));
$event = mysqli_fetch_assoc(db_query('SELECT CURRENT_TIMESTAMP between TIMESTAMP(\'2009-04-25 00:00:00\') and TIMESTAMP(\'2009-05-02 23:59:59\') as betw'));
$step = 2 + ($event['betw']*3);
$news2 = $trains[$i];
$news[$x] = $row[$news2] + $step;
$step*=2;
$sql = "UPDATE chars SET $news2='$news[$x]', training_points=training_points-$step WHERE id='$row[id]' LIMIT 1";
// echo $sql.'<br>'."\n";
mysql_query($sql);
db_query($sql);
}
}
@ -201,50 +202,50 @@ while ($row = mysql_fetch_array($char_info)) {
$x++;
}
mysql_query('DELETE FROM ag_chat where TIMESTAMPDIFF(Hour,zeit,now()) > 48');
mysql_query('DELETE FROM user_activation where TIMESTAMPDIFF(day, registerdate, now()) > 7');
db_query('DELETE FROM ag_chat where TIMESTAMPDIFF(Hour,zeit,now()) > 48');
db_query('DELETE FROM user_activation where TIMESTAMPDIFF(day, registerdate, now()) > 7');
// Loesche inaktive anons :)
mysql_query('DELETE FROM anon_chatter WHERE TIMESTAMPDIFF(day, online, now()) > 35'); // 5 Wochen
db_query('DELETE FROM anon_chatter WHERE TIMESTAMPDIFF(day, online, now()) > 35'); // 5 Wochen
// Loesche inaktive user!
$sql = 'Select * from user where TIMESTAMPDIFF(week, online_zeit, now()) > 10 and id > 2 and id not in (SELECT user_id FROM user_gruppe_zuordnung WHERE gruppen_id = '.AKTIV_LOESCHSCHUTZ.' AND user_id = id)';
// Da es wichtig ist, dass die Querys korrekt abgehandelt werden wurde folgender Code eingefuehrt
function database_query($sql){
$tmp = mysql_query($sql);
$tmp = db_query($sql);
if(!$tmp){
echo 'SQL-Anweisung '.$sql.' konnte nicht ausgefuehrt werden!!<br>';
}
@ -30,8 +31,8 @@ function bearbeiteAbgelaufeneAuktion($auktionsid){
// echo '<br>bearbeite '.$auktionsid.'</br>';
$qry = database_query('SELECT u.nickname AS anbietername, u2.nickname AS bietername, a.auktionsid,a.anbieter,a.bieter,a.itemid,a.itemname,a.tablename,a.anzahl,a.startgebot,a.aktuellesgebot,a.deadline,a.startdate,a.cheatingverdacht, TIMESTAMPDIFF(Minute,now(),deadline) AS zeitdifferenz FROM auktion AS a INNER JOIN user as u ON a.anbieter = u.id LEFT JOIN user as u2 ON a.bieter = u2.id WHERE auktionsid = '.$auktionsid);
if(mysql_num_rows($qry) == 0){ return NULL; }
$result = mysql_fetch_assoc($qry);
if(mysqli_num_rows($qry) == 0){ return NULL; }
$result = mysqli_fetch_assoc($qry);
$itemreceiver = '';
// Nun muss geprüft werden, ob überhaupt jemand geboten hat!
@ -93,7 +94,7 @@ function bearbeiteAlleAbgelaufenenAuktionen(){
$qry = database_query('SELECT auktionsid from auktion where TIMESTAMPDIFF(Minute,now(),deadline) <0');
// erstmal checken obs schon Auktionen für kommende Woche gibt
$number = mysql_num_rows(database_query('SELECT * FROM auktion WHERE anbieter = 1 and TIMESTAMPDIFF(Second,startdate,now()) <0'));
$number = mysqli_num_rows(database_query('SELECT * FROM auktion WHERE anbieter = 1 and TIMESTAMPDIFF(Second,startdate,now()) <0'));
// echo $number.'= Number of effected rows';
if($number == 0){
// So, also es sind noch keine Auktionen vorhanden!!
// Nun 6 Auktionen erstellen 3x2 Auktionen (update 2x2)
$date = mysql_fetch_assoc(database_query('Select current_date AS date'));
$date = mysqli_fetch_assoc(database_query('Select current_date AS date'));
$qry = database_query('SELECT id FROM `wochen_markt` WHERE aktiv = \'ja\'');
$fruchtcount = 0;
$frucht = array();
while($result = mysql_fetch_assoc($qry)){
while($result = mysqli_fetch_assoc($qry)){
$frucht[$fruchtcount++] = $result[id];
}
// Ermittle die "Niete" (das wertloseste Item auf der Schatzsuche)
$qry = database_query('Select id from `sp_item` where wert = (Select min(wert) from `sp_item`)');
$nieten_id = mysql_fetch_assoc($qry);
$nieten_id = mysqli_fetch_assoc($qry);
$nieten_id = $nieten_id['id'];
for($i = 0; $i<$anzahl_auktionen; $i++) {
@ -167,11 +168,11 @@ function insertAuktionen(){
function detectMultiAccounts(){
$sql = 'Select u1.id as uid1, u2.id as uid2, u1.nickname as n1, u2.nickname as n2 , u1.ip as ip1, u2.ip as ip2, u1.online_zeit as o1, u2.online_zeit as o2 from user as u1 inner join user as u2 on u1.ip = u2.ip and u1.id <u2.idandu1.ip!=\'\'andabs(TIMESTAMPDIFF(HOUR,u1.online_zeit,u2.online_zeit))<24and(abs(TIMESTAMPDIFF(HOUR,now(),u1.online_zeit))<1||abs(TIMESTAMPDIFF(HOUR,now(),u2.online_zeit))<1)';
@ -179,7 +180,7 @@ function detectMultiAccounts(){
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';
$max_charakter = mysql_num_rows(mysql_query('SELECT id FROM chars WHERE rasse NOT IN ('.implode(',', $exclude_race_ids).') LIMIT 500'));
$max_charakter = mysqli_num_rows(db_query('SELECT id FROM chars WHERE rasse NOT IN ('.implode(',', $exclude_race_ids).') LIMIT 500'));
if($max_charakter%2!=0) { $max_charakter--; }
@ -46,11 +47,11 @@ if($max_charakter==0) {
exit;
}
$charakter = mysql_query('SELECT name, id FROM chars WHERE rasse NOT IN ('.implode(',', $exclude_race_ids).') ORDER BY level DESC LIMIT '.$max_charakter);
$charakter = db_query('SELECT name, id FROM chars WHERE rasse NOT IN ('.implode(',', $exclude_race_ids).') ORDER BY level DESC LIMIT '.$max_charakter);
while($k_hp[0] > $k_aufgabe[0] AND $k_hp[1] > $k_aufgabe[1] AND $x <10){
$technick1 = mysql_fetch_array(mysql_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke1[$x]' LIMIT 10"));
$technick1 = mysqli_fetch_array(db_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke1[$x]' LIMIT 10"));
$prozent_technik1 = (20*$technick1[aktiv])-20;
$technick1 = mysql_fetch_array(mysql_query("SELECT * FROM attacken WHERE id='$technick1[at_id]' LIMIT 10"));
$technick1 = mysqli_fetch_array(db_query("SELECT * FROM attacken WHERE id='$technick1[at_id]' LIMIT 10"));
$technick2 = mysql_fetch_array(mysql_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke2[$x]' LIMIT 10"));
$technick2 = mysqli_fetch_array(db_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke2[$x]' LIMIT 10"));
$prozent_technik2 = (20*$technick2[aktiv])-20;
$technick2 = mysql_fetch_array(mysql_query("SELECT * FROM attacken WHERE id='$technick2[at_id]' LIMIT 10"));
$technick2 = mysqli_fetch_array(db_query("SELECT * FROM attacken WHERE id='$technick2[at_id]' LIMIT 10"));
///////////////////Hier laedt er den RELOAD der technik wenn die zusammen setzung nicht stimmen sollte
@ -132,9 +132,9 @@ include "include/kampf/kampf_rechnung.php";
$db_query = mysql_fetch_array(mysql_query("SELECT * FROM wanted_kampf WHERE (char1='$chara_1[id]' OR char1='$chara_2[id]') AND dauer='0' order by id DESC LIMIT 1"));
$db_query = mysqli_fetch_array(db_query("SELECT * FROM wanted_kampf WHERE (char1='$chara_1[id]' OR char1='$chara_2[id]') AND dauer='0' order by id DESC LIMIT 1"));