diff --git a/ag/include/event.inc.php b/ag/include/event.inc.php index 45a3543..dfb0ab9 100644 --- a/ag/include/event.inc.php +++ b/ag/include/event.inc.php @@ -156,10 +156,11 @@ function persistFight($event_id, array $combinedArray, $startTimestamp, $endTime // first persist char1 $chara_1 = $roundsArray[$round]['char1_array']; - $visible_ts = date("Y-m-d H:i:s", ($startTimestamp + ($endTimestamp - $startTimestamp) / 10) * $round); + $visible_ts_value = $startTimestamp + (($endTimestamp - $startTimestamp) / 10) * $round; + $visible_ts = date("Y-m-d H:i:s", $visible_ts_value); $sql = 'INSERT INTO event_fight_rounds(event_id, event_fight_id, round, event_char_id, hp, mp, strength, speed, defense, luck, stamina, attack, damage, visible)'; - $sql .= ' values('.$event_id.','.$event_fight_id.','.$round.',' .$chara_1['id'].',\''. $chara_1['hp'].'\', \''. $chara_1['mp'].'\', '. $chara_1['starke'].', '. $chara_1['speed'].', '. $chara_1['verteidigung'].', '. $chara_1['glueck'].', '. $chara_1['ausdauer'].', '. ($roundsArray[$round]['atk_char1']===NULL?'NULL': '\''.$roundsArray[$round]['atk_char1'].'\'' ).', '. ($roundsArray[$round]['dmg_char1']===NULL?'NULL': '\''.$roundsArray[$round]['dmg_char1'].'\'' ).', \''.date("Y-m-d H:i:s", $visible_ts).'\')'; + $sql .= ' values('.$event_id.','.$event_fight_id.','.$round.',' .$chara_1['id'].',\''. $chara_1['hp'].'\', \''. $chara_1['mp'].'\', '. $chara_1['starke'].', '. $chara_1['speed'].', '. $chara_1['verteidigung'].', '. $chara_1['glueck'].', '. $chara_1['ausdauer'].', '. ($roundsArray[$round]['atk_char1']===NULL?'NULL': '\''.$roundsArray[$round]['atk_char1'].'\'' ).', '. ($roundsArray[$round]['dmg_char1']===NULL?'NULL': '\''.$roundsArray[$round]['dmg_char1'].'\'' ).', \''.$visible_ts.'\')'; $res = db_query($sql); @@ -169,7 +170,7 @@ function persistFight($event_id, array $combinedArray, $startTimestamp, $endTime $chara_2 = $roundsArray[$round]['char2_array']; $sql = 'INSERT INTO event_fight_rounds(event_id, event_fight_id, round, event_char_id, hp, mp, strength, speed, defense, luck, stamina, attack, damage, visible)'; - $sql .= ' values('.$event_id.','.$event_fight_id.','.$round.',' .$chara_2['id'].',\''. $chara_2['hp'].'\', \''. $chara_2['mp'].'\', '. $chara_2['starke'].', '. $chara_2['speed'].', '. $chara_2['verteidigung'].', '. $chara_2['glueck'].', '. $chara_2['ausdauer'].', '. ($roundsArray[$round]['atk_char2']===NULL?'NULL': '\''.$roundsArray[$round]['atk_char2'].'\'' ).', '. ($roundsArray[$round]['dmg_char2']===NULL?'NULL': '\''.$roundsArray[$round]['dmg_char2'].'\'' ).', \''.date("Y-m-d H:i:s", $visible_ts).'\')'; + $sql .= ' values('.$event_id.','.$event_fight_id.','.$round.',' .$chara_2['id'].',\''. $chara_2['hp'].'\', \''. $chara_2['mp'].'\', '. $chara_2['starke'].', '. $chara_2['speed'].', '. $chara_2['verteidigung'].', '. $chara_2['glueck'].', '. $chara_2['ausdauer'].', '. ($roundsArray[$round]['atk_char2']===NULL?'NULL': '\''.$roundsArray[$round]['atk_char2'].'\'' ).', '. ($roundsArray[$round]['dmg_char2']===NULL?'NULL': '\''.$roundsArray[$round]['dmg_char2'].'\'' ).', \''.$visible_ts.'\')'; $res = db_query($sql); if(!$res) diff --git a/ag/include/halloffame.inc.php b/ag/include/halloffame.inc.php index 1a38dc6..54bf16c 100644 --- a/ag/include/halloffame.inc.php +++ b/ag/include/halloffame.inc.php @@ -38,7 +38,7 @@ function insertIntoHallOfFame($title, $charid, $userid){ * @param unknown_type $date (Whatch out date is not escaped!!) * @return unknown_type */ -function insertIntoHallOfFameFull($round = '', $title = '', $charid = '', $charname = '', $userid = '', $username = '', $date = ''){ +function insertIntoHallOfFameFull($round = '', $title = '', $charid = '', $charname = '', $userid = '', $username = '', $date = '', $tournament_id = ''){ // These Entries may not be '' if(!is_numeric($round) || $charname == '' || $username == '' || $date == '' || $title == ''){ echo '('.$round.') ('.$charname.') ('.$username.')'.') ('.$date.')'.') ('.$title.')'.'
'; @@ -55,9 +55,14 @@ function insertIntoHallOfFameFull($round = '', $title = '', $charid = '', $charn $columns .= ',userid'; $values .= ','.$userid; } + if(is_numeric($tournament_id)) { + $columns .= ',tournament_id'; + $values .= ','.$tournament_id; + } + $sql = 'INSERT INTO highscore('.$columns.') values('.$values.')'; // echo $sql.'
'; - $qry = db_query($sql); + silent_query($sql); return db_affected_rows() > 0; }