Minor changes
authorAndrew DeFaria <Andrew@DeFaria.com>
Wed, 5 May 2021 17:53:19 +0000 (10:53 -0700)
committerAndrew DeFaria <Andrew@DeFaria.com>
Wed, 5 May 2021 17:53:19 +0000 (10:53 -0700)
maps/php/MAPS.php
maps/php/Space.php

index 0def4ba..9b94c17 100755 (executable)
@@ -57,6 +57,14 @@ function OpenDB() {
     or DBError("OpenDB: Unable to select MAPS database", "adefaria_maps");
 } // OpenDB
 
+function CloseDB() {
+  global $db;
+
+  if (isset ($db)) {
+    mysqli_close($db);
+  } // if
+} // CloseDB
+
 function SetContext($new_userid) {
   global $userid;
 
@@ -524,9 +532,11 @@ function Space() {
       strlen($row["subject"])   +
       strlen($row["timestamp"]) +
       strlen($row["data"]);
-    $space = $space + $msg_space;
+    $space += $msg_space;
   } // while
 
+  mysqli_free_result($result);
+
   return $space;
 } // Space
 ?>
index 9c4bd02..2e1f822 100755 (executable)
@@ -1,55 +1,59 @@
-<?php \r
-////////////////////////////////////////////////////////////////////////////////\r
-//\r
-// File:       $RCSFile$\r
-// Revision:   $Revision: 1.1 $\r
-// Description:        Reports user's database space usage\r
-// Author:     Andrew@DeFaria.com\r
-// Created:    Fri Nov 29 14:17:21  2002\r
-// Modified:   $Date: 2013/06/12 14:05:48 $\r
-// Language:   PHP\r
-//\r
-// (c) Copyright 2000-2006, Andrew@DeFaria.com, all rights reserved.\r
-//\r
-////////////////////////////////////////////////////////////////////////////////\r
-include "site-functions.php";\r
-include "MAPS.php";\r
-?>\r
-\r
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
-<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">\r
-<head>\r
-  <title>MAPS: Space Usage</title>\r
-  <?php \r
-    MAPSHeader ();\r
-    $Userid = ucfirst ($userid);\r
-  ?>\r
-</head>\r
-<body>\r
-<div class="heading">\r
-<h2 class="header" align="center"><font class="standout">MAPS</font>\r
-Space Usage for <?php echo $Userid?></h2>\r
-</div>\r
-<div class="content">\r
-  <?php\r
-    OpenDB ();\r
-    SetContext ($userid);\r
-    NavigationBar ($userid);\r
-    $space = Space ();\r
-    $one_meg = 1024 * 1024;\r
-\r
-    if ($space > $one_meg) {\r
-      $space = number_format ($space / $one_meg, 1);\r
-      print "$Userid is using up $space Megabytes of space in the database";\r
-    } elseif ($space > 0) {\r
-      $space = number_format ($space / 1024, 0);\r
-      print "$Userid is using up $space Kbytes of space in the database";\r
-    } else {\r
-      print "$Userid is using up no space in the database";\r
-    } // if\r
-\r
-    copyright (2001);\r
-  ?>\r
-</div>\r
-</body>\r
-</html>\r
+<?php 
+////////////////////////////////////////////////////////////////////////////////
+//
+// File:       $RCSFile$
+// Revision:   $Revision: 1.1 $
+// Description:        Reports user's database space usage
+// Author:     Andrew@DeFaria.com
+// Created:    Fri Nov 29 14:17:21  2002
+// Modified:   $Date: 2013/06/12 14:05:48 $
+// Language:   PHP
+//
+// (c) Copyright 2000-2006, Andrew@DeFaria.com, all rights reserved.
+//
+////////////////////////////////////////////////////////////////////////////////
+include "site-functions.php";
+include "MAPS.php";
+?>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
+<head>
+  <title>MAPS: Space Usage</title>
+  <?php 
+    MAPSHeader ();
+    $Userid = ucfirst ($userid);
+  ?>
+</head>
+<body>
+<div class="heading">
+<h2 class="header" align="center"><font class="standout">MAPS</font>
+Space Usage for <?php echo $Userid?></h2>
+</div>
+<div class="content">
+  <?php
+    OpenDB();
+    SetContext ($userid);
+    NavigationBar ($userid);
+
+    $space = Space();
+    
+    $one_meg = 1024 * 1024;
+
+    if ($space > $one_meg) {
+      $space = number_format ($space / $one_meg, 1);
+      print "$Userid is using up $space Megabytes of space in the database";
+    } elseif ($space > 0) {
+      $space = number_format ($space / 1024, 0);
+      print "$Userid is using up $space Kbytes of space in the database";
+    } else {
+      print "$Userid is using up no space in the database";
+    } // if
+
+    CloseDB();
+
+    copyright (2001);
+  ?>
+</div>
+</body>
+</html>