added fixes of live cronjobs

main
hecht 7 years ago
parent 1049e7b620
commit 2e96486cc1

@ -18,18 +18,16 @@ function getClanRanking() {
function distributeClanPrices(array $prices, array $results) {
$n = min(count($prices), count($results));
echo "Resultate";
echo "Resultate: ";
print_r($results);
for($i = 0; $i<$n; $i++) {
$points = $prices[$i];
foreach($results[$i] as $winner) {
$winner = $results[$i][0]; // second index is the elo value!
$clan = getClan($winner); // buffered so will not cause in a sql statement all the time!
$sql = 'UPDATE clan SET elo = 1000, geld = geld + ' . $points . ' WHERE id = ' . $clan['id'];
echo $sql . ' <br>';
db_query($sql);
insertClanTickerMessage($clan['id'], 'Das Preisgeld von '.$points.' f&uuml;r den '.$i.' Platz in der Clanliga erhalten!');
}
}
db_query('UPDATE clan SET elo = 1000');
}

@ -25,7 +25,7 @@ function generateTournamentResults($name, $additionalExpPerRound, $additionalMon
$charids = array();
// First calculate the money and exp the char gets just for doing good at fights ;)
$qry = db_query('select char1, char2, exp1, exp2, geld1, geld2, round from turnier_kampf where art = \''.$name.'\' order by round asc');
$qry = silent_query('select char1, char2, exp1, exp2, geld1, geld2, round from turnier_kampf where art = \''.$name.'\' order by round asc');
while($fight = mysqli_fetch_assoc($qry)) {
if(!isset($charArray[$fight['char1']])) {
@ -46,7 +46,7 @@ function generateTournamentResults($name, $additionalExpPerRound, $additionalMon
$returnArray = array();
// Now calculate the money and exp the char gets just for proceeding in the tournament (in this case ... order the chars right away ;))
$qry = db_query('Select count(win) as anzahl, win from turnier_kampf where art = \''.$name.'\' group by win order by count(win) desc');
$qry = silent_query('Select count(win) as anzahl, win from turnier_kampf where art = \''.$name.'\' group by win order by count(win) desc');
$maxRank = -1;
while ($participant = mysqli_fetch_assoc($qry)) {
$charids[$participant['win']] = 0; // okay we already proceeded this one :)
@ -63,7 +63,7 @@ function generateTournamentResults($name, $additionalExpPerRound, $additionalMon
$char = getChar($participant['win']);
$sql = 'UPDATE user set geld = geld + ' . $charArray[$participant['win']]['money'] . ' WHERE id = ' . $char['besitzer'];
echo $sql . ' <br>';
db_query($sql);
silent_query($sql);
}
foreach ($charids as $key => $value) {
@ -75,7 +75,7 @@ function generateTournamentResults($name, $additionalExpPerRound, $additionalMon
$char = getChar($key);
$sql = 'UPDATE user set geld = geld + ' . $charArray[$key]['money'] . ' WHERE id = ' . $char['besitzer'];
echo $sql . ' <br>';
db_query($sql);
silent_query($sql);
}
}
@ -111,7 +111,7 @@ function distributeShopPoints(array $prices, array $winners, $reason) {
$userid = $char['besitzer'];
$sql = 'UPDATE user set pkt = pkt + '.$points.' WHERE id = '. $userid;
echo $sql . ' <br>';
db_query($sql);
silent_query($sql);
insertUserTickerMessage($userid, $points .' IP durch den '.generateRanglistString($i).' Platz im '.$reason.' erhalten!');
}
}
@ -127,7 +127,7 @@ function distributeUserPrices(array $prices, array $winners, $reason) {
$userid = $char['besitzer'];
$sql = 'UPDATE user set geld = geld + '.$points.' WHERE id = '. $userid;
echo $sql . ' <br>';
db_query($sql);
silent_query($sql);
insertUserTickerMessage($userid, $points .' Preisgeld durch den '.generateRanglistString($i).' Platz im '.$reason.' erhalten!');
}
}
@ -142,11 +142,11 @@ function distributeClanPrices(array $prices, array $results, $reason) {
foreach($results[$i] as $winner) {
$char = getChar($winner); // buffered so will not cause in a sql statement all the time!
$userid = $char['besitzer'];
$data = mysqli_fetch_assoc(db_query('Select clan from user where id = ' .$userid ));
$data = mysqli_fetch_assoc(silent_query('Select clan from user where id = ' .$userid ));
if(is_numeric($data['clan'])) {
$sql = 'UPDATE clan SET geld = geld + ' . $points . ' WHERE id = ' . $data['clan'];
echo $sql . ' <br>';
db_query($sql);
silent_query($sql);
insertClanTickerMessage($row['clan'], 'Das Preisgeld von '.$points.' f&uuml;r den '.generateRanglistString($i).' Platz im '.$reason.' erhalten!');
}
}

@ -237,6 +237,7 @@ if (mysqli_num_rows($u_qry) != 0) {
while ($row = mysqli_fetch_assoc($c_qry)) {
$char[] = $char['id'];
}
if ( count($char) > 0 ) {
$chars = join(',', $char);
db_query('Delete from chars where id IN (' . $chars . ')');
db_query('Delete from lernen where besitzer IN (' . $chars . ')');
@ -247,5 +248,6 @@ if (mysqli_num_rows($u_qry) != 0) {
db_query('Delete from kampf_list where charakter IN (' . $chars . ')');
db_query('Delete from char_abholcodes where charid IN (' . $chars . ')');
}
}

@ -130,7 +130,7 @@ function bearbeiteAbgelaufeneAuktion($auktionsid){
if($anzahl > 1000 && $anzahl % 1000 == 0) {
echo date("H:i:s").' Anzahl maxi Auktion '.$anzahl."\n";
}
database_query('INSERT INTO '.$result['tablename'].' ('.$item_row_name.', user) VALUES('.$result['itemid'].','.$itemreceiver.')');
silent_query('INSERT INTO '.$result['tablename'].' ('.$item_row_name.', user) VALUES('.$result['itemid'].','.$itemreceiver.')');
}
database_query('DELETE FROM auktion WHERE auktionsid = '.$auktionsid);
@ -230,7 +230,7 @@ function detectMultiAccounts(){
while($tmp = mysqli_fetch_assoc($qry)){
$otime = min($tmp['o2'], $tmp['o1']);
$sql = 'INSERT INTO multiuser(user1, user2, occured, type) values(\'' . $tmp['uid1'] . '\', \''.$tmp['uid2'].'\',\''.$otime.'\', \'IP_'.$tmp['ip1'].'\')';
db_query($sql);
silent_query($sql);
}
}

Loading…
Cancel
Save