From e8c9641530e5d13b3677b835052134492eac08aa Mon Sep 17 00:00:00 2001 From: hecht Date: Tue, 6 Sep 2011 17:10:15 +0000 Subject: [PATCH] more failsave (e.g. if someone deletes his char while the tournament is busy) --- cronjob/inclu/halloffame.inc.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/cronjob/inclu/halloffame.inc.php b/cronjob/inclu/halloffame.inc.php index 40d1c7f..7b81de1 100644 --- a/cronjob/inclu/halloffame.inc.php +++ b/cronjob/inclu/halloffame.inc.php @@ -9,33 +9,37 @@ include_once('char.inc.php'); /** - * + * * @param unknown_type $title * @param unknown_type $charid * @param unknown_type $userid * @return boolean if the insert was successful */ function insertIntoHallOfFame($title, $charid, $userid){ + echo 'insertIntoHallOfFame('.$title.', '.$charid.', '.$userid.')
'; $row = mysql_fetch_assoc(mysql_query('Select max(id) as round from online')); $char = getChar($charid); $user = mysql_fetch_assoc(mysql_query('Select * from user where id = '.$userid)); - - if(!$row || is_null($char) || is_null($user)){ + + if(!$row){ + echo 'insertIntoHallOfFame failed as the basic methods failed!
'; return false; } - + return insertIntoHallOfFameFull($row['round'], $title, $charid, $char['name'], $userid, $user['nickname'], 'CURRENT_DATE'); } function insertIntoHallOfFameFull($round = '', $title = '', $charid = '', $charname = '', $userid = '', $username = '', $date = ''){ + echo 'insertIntoHallOfFame('.$title.', '.$charid.', '.$charname.', '.$username.', '.$userid.', '.$date.')
'; // These Entries may not be '' if(!is_numeric($round) || $date == '' || $title == ''){ + echo 'insertIntoHallOfFame failed as the extended methods failed!
'; return false; } - + $columns = 'art, runde, datum, charname, username'; $values = '\''.$title.'\','.$round.','.$date.',\''.$charname.'\',\''.$username.'\''; - + if(is_numeric($charid)){ $columns .= ',charid'; $values .= ','.$charid;