From 4e754d9a043b43a43d86eca8d736701afd20cb28 Mon Sep 17 00:00:00 2001 From: hecht Date: Wed, 26 Oct 2016 05:37:17 +0000 Subject: [PATCH] Added some bugfixes that were found by the community. --- ag/ag_popupchat.php | 2 +- ag/include/auktion_functions.inc.php | 8 +++++--- ag/include/semaphore.inc.php | 4 ++-- ag/include/sqlwrapper.inc.php | 16 +++++++++++----- 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/ag/ag_popupchat.php b/ag/ag_popupchat.php index 581ea36..5a83355 100644 --- a/ag/ag_popupchat.php +++ b/ag/ag_popupchat.php @@ -51,7 +51,7 @@ if(isset($user_ida['nickname'])){ $user_ida['nickname'] = 'anon_' . $usr['anon_id']; $anon_block = $usr['muted']==0?false:true; - db_query('UPDATE anon_chatter SET online = now() WHERE anon_ip = '.$usr['anon_id']); + db_query('UPDATE anon_chatter SET online = now() WHERE anon_id = '.$usr['anon_id']); } // diff --git a/ag/include/auktion_functions.inc.php b/ag/include/auktion_functions.inc.php index b8d8de4..0c87a65 100644 --- a/ag/include/auktion_functions.inc.php +++ b/ag/include/auktion_functions.inc.php @@ -114,12 +114,14 @@ function biete($userid, $auktionsid, $gebot){ // Speichern der neuen deadline in die deadlinevariable $res_deadline = mysqli_fetch_assoc(db_query('SELECT deadline FROM auktion WHERE auktionsid = '.$auktionsid)); $deadline = $res_deadline['deadline']; - } else{ + } else { // Ansonsten nur die Grundwerte 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]'); + if ( $bieter !== NULL || $bieter == '' ) { + // 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]'); + } // db_query($new_query); // echo '

'.$new_query.'

'; diff --git a/ag/include/semaphore.inc.php b/ag/include/semaphore.inc.php index 06fa18a..8f7f964 100644 --- a/ag/include/semaphore.inc.php +++ b/ag/include/semaphore.inc.php @@ -41,7 +41,7 @@ function semaphoreUP($resource){ // echo 'DEBUG: kritischer Bereich betreten
'; } // Loesche alte Ressourcen - db_query('DELETE FROM semaphore WHERE TIMESTAMPDIFF(MINUTE, zeit, now()) > 5 and ressource = \''.$resource.'\''); + db_query('DELETE FROM semaphore WHERE TIMESTAMPDIFF(MINUTE, zeit, now()) > 1 and ressource = \''.$resource.'\''); $sql = 'INSERT INTO semaphore(ressource) values(\''.$resource.'\')'; silent_query($sql); @@ -98,4 +98,4 @@ function installSemaphoreDatabase(){ db_query($sql2); } -?> \ No newline at end of file +?> diff --git a/ag/include/sqlwrapper.inc.php b/ag/include/sqlwrapper.inc.php index 9a72971..1f6104d 100755 --- a/ag/include/sqlwrapper.inc.php +++ b/ag/include/sqlwrapper.inc.php @@ -6,6 +6,12 @@ * @author hecht */ + +function send_report($report) { + $backtrace = debug_backtrace(); + @mail($GLOBALS['email_webmaster'],'Bugreport', 'Reporter:'.$_COOKIE['name']."\nFehler:\n".$report."\nBacktrace:\n".print_r($backtrace, true)."\n\n", 'From: Admin'."\n".'Reply-To: '$GLOBALS['email_webmaster']."\n".'X-Mailer: PHP/'.phpversion()); +} + function silent_query($sql) { return mysqli_query($GLOBALS['main_db'], $sql); } @@ -13,11 +19,11 @@ function silent_query($sql) { function db_query($sql) { $qry = mysqli_query($GLOBALS['main_db'], $sql); if(!$qry) { - echo $sql . '
'; - die('Query failed: ' - .'
  • errorno='.mysqli_errno($GLOBALS['main_db']) - .'
  • error='.mysqli_error($GLOBALS['main_db']) - .'
  • query='.$query); + send_report('Query failed: ' + .'
  • errorno='.mysqli_errno($GLOBALS['main_db']) + .'
  • error='.mysqli_error($GLOBALS['main_db']) + .'
  • query='.$sql); + die('Ein Fehler ist aufgetreten. Dieser wurde zum Administrator geschickt. Vielen Dank!'); } return $qry; }