ping_req attribute added to User class
[brisk.git] / web / admin.php
index 7c87e1d..55674ba 100644 (file)
@@ -2,7 +2,7 @@
   /*
    *  brisk - admin.php
    *
-   *  Copyright (C) 2011      Matteo Nastasi
+   *  Copyright (C) 2011-2012 Matteo Nastasi
    *                          mailto: nastasi@alternativeoutput.it 
    *                                  matteo.nastasi@milug.org
    *                          web: http://www.alternativeoutput.it
@@ -46,12 +46,9 @@ class ImpPoints
     
     function ImpPoints($s)
     {
-        // error_log($s, 0);
         $arr = explode('|', $s);
-        // error_log("TTOK: ".count($arr), 0);
 
         if (count($arr) != 20) {
-            error_log("COUNT: ".count($arr));
             return FALSE;
         }
 
@@ -102,8 +99,10 @@ function main()
                 break;
             }
 
-            // FIXME: now create can return FALSE
-            $newdb = BriskDB::create();
+            if (($newdb = BriskDB::create()) == FALSE) {
+                $cont .= sprintf("Database connection failed.<br>\n"); 
+                break;
+            }
             $newdb->users_load();
             if ($newdb->addusers_from_olddb($olddb, $cont) == FALSE) {
                 $cont .= sprintf("Insert failed.<br>\n"); 
@@ -125,8 +124,11 @@ function main()
                 break;
             }
 
-            // FIXME: now create can return FALSE
-            $newdb = BriskDB::create();
+            if (($newdb = BriskDB::create()) == FALSE) {
+                $cont .= sprintf("Database connection failed.<br>\n"); 
+                break;
+            }
+
             $newdb->users_load();
             $dbconn = $newdb->getdbconn();
             for ($pts_n = 0 ;  !feof($fp) ; $pts_n++) {
@@ -266,4 +268,4 @@ echo "$cont";
 
 
 </body>
-</html>
\ No newline at end of file
+</html>