From: Alexander Schmidt Date: Thu, 27 Sep 2012 16:23:40 +0000 (+0200) Subject: ... X-Git-Url: https://git.treefish.org/banana.git/commitdiff_plain/64d981a433d9990d4c5ff9454464a520e169adfd?ds=inline ... --- diff --git a/admin/sessions.php b/admin/sessions.php index a04f485..f8153ba 100644 --- a/admin/sessions.php +++ b/admin/sessions.php @@ -8,7 +8,7 @@ block("lightgreen", "added session"); } - if($_GET['delete']!="") { + if(isset($_GET['delete'])) { $db->query("DELETE FROM sessions WHERE id=" . $_GET['delete']); block("red", "deleted session"); } @@ -31,6 +31,11 @@ "; diff --git a/include/banner.inc b/include/banner.inc index 1599111..6ae3c07 100644 --- a/include/banner.inc +++ b/include/banner.inc @@ -1,12 +1,6 @@ $line) { - $lecture[$line_num] = $line; - } - print ""; print ""; print ""; diff --git a/include/session.inc b/include/session.inc index 554ac1f..787d644 100644 --- a/include/session.inc +++ b/include/session.inc @@ -5,6 +5,7 @@ $result=$db->query("SELECT id,examples,nexamples FROM sessions ORDER BY id"); $SESSIONS_next = -1; $SESSIONS_actual = -1; + $SESSIONS_n = 0; while ($session = $result->fetch(PDO::FETCH_ASSOC)) { $SESSIONS[$session['id']] = array("id" => $session['id'], "timestr" => date("d.m.Y H:i", $session['id']), @@ -16,18 +17,23 @@ if ( strtotime("now") < $session['id'] + 3600 && ( $SESSIONS_actual==-1 || $SESSIONS_actual > $session['id'] ) ) { $SESSIONS_actual = $session['id']; } + $SESSIONS_n++; } if($SESSIONS_next == -1) unset($SESSIONS_next); if($SESSIONS_actual == -1) unset($SESSIONS_actual); $SESSIONS_totex = 0; - foreach ($SESSIONS as $session) { - if($session['id'] < $SESSIONS_next) { $SESSIONS_totex += $session['nexamples']; } + if(isset($SESSIONS)) { + foreach ($SESSIONS as $session) { + if($session['id'] < $SESSIONS_next) { $SESSIONS_totex += $session['nexamples']; } + } } $SESSIONS_totex_nextinc = 0; - foreach ($SESSIONS as $session) { - if($session['id'] <= $SESSIONS_next) { $SESSIONS_totex_nextinc += $session['nexamples']; } + if( isset($SESSIONS) && isset($SESSIONS_next) ) { + foreach ($SESSIONS as $session) { + if($session['id'] <= $SESSIONS_next) { $SESSIONS_totex_nextinc += $session['nexamples']; } + } } } ?>
Banana Exercise Management
 " . $PREFS['exname'] . ", Gruppe: " . $PREFS['groupname'] . "