summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArun Persaud <arun@nubati.net>2009-02-03 19:28:36 -0800
committerArun Persaud <arun@nubati.net>2009-02-03 19:28:36 -0800
commit65322d53842f9ee7e166970e5250f76c36fc3e6a (patch)
treedeacddce54178c5a790604d2f4cf856a8d34a160
parentc1585e23cb3ea757674c234c9193889b4f2f2090 (diff)
downloade-DoKo-65322d53842f9ee7e166970e5250f76c36fc3e6a.tar.gz
e-DoKo-65322d53842f9ee7e166970e5250f76c36fc3e6a.tar.bz2
e-DoKo-65322d53842f9ee7e166970e5250f76c36fc3e6a.zip
BUGFIX: for loop over a possible undefined variable
for the first game in a session there is no score to display yet, need to check if the score variable is empty or not before I loop over it.
-rw-r--r--include/game.php19
1 files changed, 15 insertions, 4 deletions
diff --git a/include/game.php b/include/game.php
index 377d0aa..845a562 100644
--- a/include/game.php
+++ b/include/game.php
@@ -215,12 +215,23 @@ if($session)
$finalscore = array_pop($tmpscore);
$finalscore = $finalscore['players'];
- echo " <div class=\"sessionscore\">Score: \n";
- foreach($finalscore as $user=>$value)
+ echo " <div class=\"sessionscore\">";
+ if($finalscore)
+ {
+ echo "Score: \n";
+ /* output the final score on the front page */
+ foreach($finalscore as $user=>$value)
+ {
+ $name = DB_get_name('userid',$user);
+ echo " ".substr($name,0,2).": $value ";
+ }
+ }
+ else
{
- $name = DB_get_name('userid',$user);
- echo " ".substr($name,0,2).": $value ";
+ /* first game, no score yet */
+ echo "&nbsp;";
}
+
echo format_score_table_html($score,$myid);
echo " </div>\n";