Index: /trunk/ippMonitor/INSTALL
===================================================================
--- /trunk/ippMonitor/INSTALL	(revision 42383)
+++ /trunk/ippMonitor/INSTALL	(revision 42384)
@@ -28,9 +28,16 @@
 psconfig ipp-20210708-gentoo
 
+# Copy these files and modify them.
+# config.dat is used to generate the site.php file installed in the htdocs location
+cp config.dat.in config.dat
+
+# czarconfig.xml is used by czarpool.pl
+cp czartool/czarconfig.xml.in czartool/czarconfig.xml
+
 # run psconfigure to generate Makefile and raw/site.php 
 # DO NOT check site.php into the svn tree 
 # $CZARPLOTDIR and $METRICSPLOTDIR will be generated as links in the same folder as ippMonitor  
-# the structure of the names for these two directories are defined in Makefile.in 
-psconfigure --htdocs /var/www/localhost/htdocs --wwwbin /var/www/localhost/wwwbin --site ~/ippconfig/ippmonitor.config 
+# the structure of the names for these two directories are defined in Makefile.in a
+psconfigure --htdocs /var/www/localhost/htdocs --wwwbin /var/www/localhost/wwwbin --pltdir /some/path --site ~/ippconfig/ippmonitor.config 
 
 ## NOTES:
@@ -41,11 +48,4 @@
 ## For an initial installation, you may need to create /var/www/localhost/wwwbin
 
-# Copy these files and modify them.
-# config.dat is used to generate the site.php file installed in the htdocs location
-cp config.dat.in config.dat
-
-# czarconfig.xml is used by czarpool.pl
-cp czartool/czarconfig.xml.in czartool/czarconfig.xml
-
 # install the php code:
 # czartool_plots and ippMetrics will be linked to different path in different hostnames 
Index: /trunk/ippMonitor/Makefile.in
===================================================================
--- /trunk/ippMonitor/Makefile.in	(revision 42383)
+++ /trunk/ippMonitor/Makefile.in	(revision 42384)
@@ -9,6 +9,7 @@
 DESTBIN = @WWWBIN@
 DESTWWW = @HTDOCS@/ippMonitor
-CZARPLOTDIR = /export/@HOST2@.0/ipp/czartool_plots
-METRICSPLOTDIR = /export/@HOST2@.0/ipp/ippMetrics
+
+CZARPLOTDIR = @PLTDIR@/czartool_plots
+METRICSPLOTDIR = @PLTDIR@/ippMetrics
 
 GENERATE = $(SCRIPTS)/generate
Index: /trunk/ippMonitor/config.dat.in
===================================================================
--- /trunk/ippMonitor/config.dat.in	(revision 42383)
+++ /trunk/ippMonitor/config.dat.in	(revision 42384)
@@ -98,9 +98,9 @@
 $LABEL_APACHE6  = "";
 
-$HOST_APACHE_BACKUP1  = ";"
-$LABEL_APACHE_BACKUP1  = ";"
+$HOST_APACHE_BACKUP1  = "";
+$LABEL_APACHE_BACKUP1  = "";
 
-$HOST_APACHE_BACKUP2  = ";"
-$LABEL_APACHE_BACKUP2  = ";"
+$HOST_APACHE_BACKUP2  = "";
+$LABEL_APACHE_BACKUP2  = "";
 
 $HOST_HOME  = "";
Index: /trunk/ippMonitor/configure.tcsh
===================================================================
--- /trunk/ippMonitor/configure.tcsh	(revision 42383)
+++ /trunk/ippMonitor/configure.tcsh	(revision 42384)
@@ -18,4 +18,5 @@
 set wwwbin  = ""
 set libdir  = ""
+set pltdir  = ""
 set datadir = ""
 set site = ""
@@ -109,4 +110,12 @@
    endif
    breaksw;
+  case --pltdir*
+   if ("$1" == "--pltdir") then
+     shift
+     set pltdir = $1
+   else
+     set pltdir = `echo $1 | tr = ' ' | awk '{print $2}'`
+   endif
+   breaksw;
   case --datadir*
    if ("$1" == "--datadir") then
@@ -127,4 +136,7 @@
   case --useMDB2
    set DBI = "MDB2"
+   breaksw;
+  case --usePDO
+   set DBI = "PDO"
    breaksw;
   case --help:
@@ -150,4 +162,5 @@
 echo "wwwbin: $wwwbin"
 echo "libdir: $libdir"
+echo "pltdir: $pltdir"
 echo "datadir:$datadir"
 echo "site:   $site"
@@ -182,4 +195,10 @@
 endif
 
+# LIBDIR set the install lib directory
+if ("$pltdir" == "") then
+  if ("$prefix" == "") goto usage
+  set pltdir = $prefix/plots
+endif
+
 # DATADIR holds the general non-binary files
 if ("$datadir" == "") then
@@ -198,8 +217,8 @@
 # convert Makefile.in to Makefile:
 if (-e Makefile) mv -f Makefile Makefile~
-cat Makefile.in | sed "s|@HTDOCS@|$htdocs|"    > tmp.1
-cat tmp.1       | sed "s|@HOST2@|$hostname2|"  > tmp.2
-cat tmp.2       | sed "s|@BINDIR@|$bindir|"    > tmp.1
-cat tmp.1       | sed "s|@WWWBIN@|$wwwbin|"    > Makefile
+cat Makefile.in | sed "s|@HTDOCS@|$htdocs|"  > tmp.1
+cat tmp.1       | sed "s|@PLTDIR@|$pltdir|"  > tmp.2
+cat tmp.2       | sed "s|@BINDIR@|$bindir|"  > tmp.1
+cat tmp.1       | sed "s|@WWWBIN@|$wwwbin|"  > Makefile
 rm -f tmp.1 tmp.2 
 
Index: /trunk/ippMonitor/def/fpcamPendingExp.d
===================================================================
--- /trunk/ippMonitor/def/fpcamPendingExp.d	(revision 42384)
+++ /trunk/ippMonitor/def/fpcamPendingExp.d	(revision 42384)
@@ -0,0 +1,41 @@
+TABLE fpcamRun JOIN camRun using (cam_id) JOIN chipRun ON (fpcamRun.chip_id = chipRun.chip_id) JOIN rawExp using (exp_id)
+TITLE Forced Photometry on Camera Stage Exposures (Pending)
+FILE  fpcamPendingExp.php
+MENU  ipp.ffs.dat
+
+WHERE fpcamRun.state = 'new'
+
+RESTRICT_COUNT AND rawExp.dateobs >= CURDATE()
+UNRESTRICTED AND rawExp.dateobs >= CURDATE()
+
+ARGS  ARG1  rawImfile.exp_id=$rawExp.exp_id
+ARGS  ARG2  chipRun.chip_id=$chipRun.chip_id
+ARGS  ARG3  camRun.cam_id=$camRun.cam_id
+
+OP   OP1  $rawExp.ra * 57.295783
+OP   OP2  $rawExp.decl * 57.295783
+
+#     field                     size  format  name          show   link to                  extras
+FIELD rawExp.exp_name,     	10,   %s,     Exp Name
+FIELD rawExp.exp_id,	         5,   %d,     Exp ID,       value,  rawImfile.php,           ARG1
+FIELD chipRun.chip_id,           5,   %d,     Chip ID,      value,  chipProcessedImfile.php, ARG2
+FIELD camRun.cam_id,             5,   %d,     Cam ID,       value,  camProcessedExp.php,     ARG3
+FIELD fpcamRun.cam_id,           5,   %d,     Cam ID
+FIELD fpcamRun.state,            5,   %s,     State
+FIELD fpcamRun.label,            5,   %s,     Label
+FIELD fpcamRun.data_group,       5,   %s,     data grp
+FIELD fpcamRun.dist_group,       5,   %s,     dist grp
+FIELD rawExp.telescope,      	10,   %s,     Telescope
+FIELD rawExp.camera,         	10,   %s,     Camera
+FIELD rawExp.dateobs,        	19,   %T,     Date/Time
+FIELD rawExp.ra,                 8,   %C, RA,           op=OP1      
+FIELD rawExp.decl,               8,   %C, DEC,          op=OP2
+FIELD rawExp.object,         	10,   %s,     Object
+FIELD rawExp.filter,         	10,   %s,     FILTER
+FIELD rawExp.exp_time,       	 5,   %.2f,   exp_time    
+FIELD rawExp.airmass,        	 5,   %.4f,   airmass     
+FIELD rawExp.bg,             	 5,   %.2f,   backgnd
+FIELD rawExp.bg_stdev,       	 5,   %.2f,   stdev    
+FIELD rawExp.comment,  	        65,   %s,     Comment
+
+# FIELD rawExp.bg_mean_stdev,  	 5,   %.2f,   &lt;backgnd&gt;
Index: /trunk/ippMonitor/def/fpcamProcessedExp.d
===================================================================
--- /trunk/ippMonitor/def/fpcamProcessedExp.d	(revision 42384)
+++ /trunk/ippMonitor/def/fpcamProcessedExp.d	(revision 42384)
@@ -0,0 +1,58 @@
+TABLE fpcamRun JOIN fpcamProcessedExp using (fpcam_id) JOIN camRun using (cam_id) JOIN chipRun ON (fpcamRun.chip_id = chipRun.chip_id) JOIN rawExp using (exp_id)
+TITLE Forced Photometry on Camera Stage Exposures (Processed)
+FILE  fpcamProcessedExp.php
+MENU  ipp.ffs.dat
+
+# the following WHERE clauses are added to all queries joined by AND
+WHERE fpcamRun.state = 'full'
+WHERE fpcamProcessedExp.fault = 0
+
+RESTRICT_COUNT AND rawExp.dateobs >= CURDATE()
+UNRESTRICTED AND rawExp.dateobs >= CURDATE()
+
+# define the arguments supplied to the links below (if any)
+ARGS  ARG1  rawImfile.exp_id=$rawExp.exp_id
+ARGS  ARG2  chipRun.chip_id=$chipRun.chip_id
+ARGS  ARG3  camRun.cam_id=$camRun.cam_id
+ARGS  ARG4  fpcamRun.fpcam_id=$fpcamRun.fpcam_id
+
+#ARGS  ARG5 camRun.cam_id=$camRun.cam_id
+#ARGS  ARG5 camera=$rawExp.camera
+#ARGS  ARG5 basename=$camProcessedExp.path_base
+
+OP   OP1  $rawExp.ra * 57.295783
+OP   OP2  $rawExp.decl * 57.295783
+
+#     field                     	size  format  name          show   	 link to                  extras
+FIELD rawExp.exp_name,     	 	10,   %s,     Exp Name
+FIELD rawExp.exp_id,	         	 5,   %d,     Exp ID,       value,  	 rawImfile.php,           ARG1
+FIELD chipRun.chip_id,           	 5,   %d,     Chip ID,      value,  	 chipProcessedImfile.php, ARG2
+FIELD camRun.cam_id,             	 5,   %d,     Cam ID,       value,  	 camProcessedExp.php,     ARG3
+FIELD fpcamRun.fpcam_id,                 5,   %d,     FPCam ID,     value,       fpcamProcessedExp.php,   ARG4
+FIELD fpcamRun.state,                    5,   %s,     state
+FIELD fpcamRun.label,             	 5,   %s,     Label
+FIELD fpcamRun.data_group,             	 5,   %s,     data grp
+FIELD fpcamRun.dist_group,             	 5,   %s,     dist grp
+FIELD rawExp.telescope,      		10,   %s,     Telescope
+FIELD rawExp.camera,         		10,   %s,     Camera
+FIELD rawExp.dateobs,        		19,   %T,     Date/Time
+FIELD rawExp.ra,           		 8,   %C, RA,           op=OP1      
+FIELD rawExp.decl,         		 8,   %C, DEC,          op=OP2
+FIELD rawExp.object,         		10,   %s,     Object
+FIELD rawExp.filter,         		10,   %s,     FILTER
+FIELD rawExp.exp_time,       		 5,   %.2f,     exp_time    
+FIELD rawExp.airmass,        		 5,   %.4f,     airmass     
+# FIELD camProcessedExp.bg,             	 5,   %.2f,     backgnd
+# FIELD camProcessedExp.bg_stdev,       	 5,   %.2f,     stdev    
+# FIELD camProcessedExp.n_stars,  	 5,   %d,     Nstars
+# FIELD camProcessedExp.n_astrom, 	 5,   %d,     Nastrom
+# FIELD camProcessedExp.sigma_ra, 	 5,   %f,     sigma ra
+# FIELD camProcessedExp.fwhm_major,     	 5,   %f,     FHWM (major)
+FIELD rawExp.comment,  	                65, %s,     Comment
+
+#FIELD camProcessedExp.path_base,     	 5,   %s,     path_base,    none
+#FIELD rawExp.exp_id,     		 5,   %s,     Exp ID,       none
+
+# the last two are used as arguments elsewhere, thus needed in the list, even if not displayed
+# FIELD camRun.reduction,       	         5,   %s,     reduction
+# FIELD camProcessedExp.bg_mean_stdev,  	 5,   %.2f,     &lt;backgnd&gt;
Index: /trunk/ippMonitor/def/fpcamStageExp.d
===================================================================
--- /trunk/ippMonitor/def/fpcamStageExp.d	(revision 42384)
+++ /trunk/ippMonitor/def/fpcamStageExp.d	(revision 42384)
@@ -0,0 +1,40 @@
+TABLE fpcamRun JOIN camRun using (cam_id) JOIN chipRun ON (fpcamRun.chip_id = chipRun.chip_id) JOIN rawExp using (exp_id)
+TITLE Forced Photometry on Camera Stage Exposures
+FILE  fpcamStageExp.php
+MENU  ipp.ffs.dat
+
+RESTRICT_COUNT WHERE rawExp.dateobs >= CURDATE()
+UNRESTRICTED WHERE rawExp.dateobs >= CURDATE()
+
+ARGS  ARG1  rawImfile.exp_id=$rawExp.exp_id
+ARGS  ARG2  chipRun.chip_id=$chipRun.chip_id
+ARGS  ARG3  camRun.cam_id=$camRun.cam_id
+ARGS  ARG4  fpcamRun.fpcam_id=$fpcamRun.fpcam_id
+
+OP   OP1  $rawExp.ra * 57.295783
+OP   OP2  $rawExp.decl * 57.295783
+
+#     field                     size  format  name          show   link to                  extras
+FIELD rawExp.exp_name,     	10,   %s,     Exp Name
+FIELD rawExp.exp_id,	         5,   %d,     Exp ID,       value,  rawImfile.php,           ARG1
+FIELD chipRun.chip_id,           5,   %d,     Chip ID,      value,  chipProcessedImfile.php, ARG2
+FIELD camRun.cam_id,             5,   %d,     Cam ID,       value,  camProcessedExp.php,     ARG3
+FIELD fpcamRun.fpcam_id,         5,   %d,     FPCam ID,     value,  fpcamProcessedExp.php,   ARG4
+FIELD fpcamRun.state,            5,   %s,     state
+FIELD fpcamRun.label,            5,   %s,     label
+FIELD fpcamRun.data_group,       5,   %s,     data grp
+FIELD fpcamRun.dist_group,       5,   %s,     dist grp
+FIELD rawExp.telescope,      	10,   %s,     Telescope
+FIELD rawExp.camera,         	10,   %s,     Camera
+FIELD rawExp.dateobs,        	19,   %T,     Date/Time
+FIELD rawExp.ra,                 8,   %C, RA,           op=OP1      
+FIELD rawExp.decl,               8,   %C, DEC,          op=OP2
+FIELD rawExp.object,         	10,   %s,     Object
+FIELD rawExp.filter,         	10,   %s,     FILTER
+FIELD rawExp.exp_time,       	 5,   %.2f,   exp_time    
+FIELD rawExp.airmass,        	 5,   %.4f,   airmass     
+FIELD rawExp.bg,             	 5,   %.2f,   backgnd
+FIELD rawExp.bg_stdev,       	 5,   %.2f,   stdev    
+FIELD rawExp.comment,  	        65,   %s,     Comment
+
+# FIELD rawExp.bg_mean_stdev,  	 5,   %.2f,   &lt;backgnd&gt;
Index: /trunk/ippMonitor/raw/Login.php
===================================================================
--- /trunk/ippMonitor/raw/Login.php	(revision 42383)
+++ /trunk/ippMonitor/raw/Login.php	(revision 42384)
@@ -3,5 +3,5 @@
 include 'ipp.php';
 
-if (($_SERVER[REQUEST_METHOD] != 'POST') && ($_SERVER[REQUEST_METHOD] != 'GET')) {
+if (($_SERVER['REQUEST_METHOD'] != 'POST') && ($_SERVER['REQUEST_METHOD'] != 'GET')) {
   menu ('ipp.menu.dat', 'Login', 'ipp.css', '', '');
   echo "Invalid Client Request<br>\n";
@@ -10,5 +10,5 @@
 }
 
-if ($_SERVER[REQUEST_METHOD] == 'GET') { 
+if ($_SERVER['REQUEST_METHOD'] == 'GET') { 
 
   $ID = checkID ();
@@ -29,6 +29,6 @@
 } 
 
-if ($_SERVER[REQUEST_METHOD] == 'POST') { 
-  if (key_exists (login, $_POST)) {
+if ($_SERVER['REQUEST_METHOD'] == 'POST') { 
+  if (key_exists ('login', $_POST)) {
 
     $ID = checkLogin ();
@@ -40,5 +40,5 @@
   }
 
-  if (key_exists (logout, $_POST)) {
+  if (key_exists ('logout', $_POST)) {
     menu ('ipp.menu.dat', 'Login', 'ipp.css', '', '');
     echo "You are now logged out<br>\n";
Index: /trunk/ippMonitor/raw/SelectProject.php
===================================================================
--- /trunk/ippMonitor/raw/SelectProject.php	(revision 42383)
+++ /trunk/ippMonitor/raw/SelectProject.php	(revision 42384)
@@ -3,5 +3,5 @@
 include 'ipp.php';
 
-if (($_SERVER[REQUEST_METHOD] != 'POST') && ($_SERVER[REQUEST_METHOD] != 'GET')) {
+if (($_SERVER['REQUEST_METHOD'] != 'POST') && ($_SERVER['REQUEST_METHOD'] != 'GET')) {
   menu ('ipp.menu.dat', 'Select Project', 'ipp.css', '', '');
   echo "Invalid Client Request<br>\n";
@@ -12,12 +12,12 @@
 $ID = checkID ();
 
-if ($_SERVER[REQUEST_METHOD] == 'GET') { 
+if ($_SERVER['REQUEST_METHOD'] == 'GET') { 
   projectform ($ID);
 }
 
-if ($_SERVER[REQUEST_METHOD] == 'POST') { 
+if ($_SERVER['REQUEST_METHOD'] == 'POST') { 
 
   if (key_exists (project, $_POST)) {
-    $myProj = $_POST[proj];
+    $myProj = $_POST['proj'];
     $ID['proj'] = $myProj;
     // validate the existence of the project
Index: /trunk/ippMonitor/raw/czartool_getplot.php
===================================================================
--- /trunk/ippMonitor/raw/czartool_getplot.php	(revision 42383)
+++ /trunk/ippMonitor/raw/czartool_getplot.php	(revision 42384)
@@ -8,15 +8,15 @@
 
 ### we must have been past arguments with GET:
-if ($_SERVER[REQUEST_METHOD] != 'GET') {
+if ($_SERVER['REQUEST_METHOD'] != 'GET') {
     exit ();
 }
 
-$mode = $_GET[mode];
-$type = $_GET[type];
-$label = $_GET[label];
-$stage = $_GET[stage];
-$plottype = $_GET[plottype];
+$mode = $_GET['mode'];
+$type = $_GET['type'];
+$label = $_GET['label'];
+$stage = $_GET['stage'];
+$plottype = $_GET['plottype'];
 
-$proj = $_GET[proj];
+$proj = $_GET['proj'];
 
 $path = $CZARPLOTDIR;
Index: /trunk/ippMonitor/raw/getlog.php
===================================================================
--- /trunk/ippMonitor/raw/getlog.php	(revision 42383)
+++ /trunk/ippMonitor/raw/getlog.php	(revision 42384)
@@ -9,5 +9,5 @@
 // load an image file from the image directory
 // validate request
-if ($_SERVER[REQUEST_METHOD] != 'GET') { 
+if ($_SERVER['REQUEST_METHOD'] != 'GET') { 
   exit ();
 }
@@ -20,5 +20,5 @@
 
 # $basename may contain filename@filerule
-$basename = strtok($_GET[name],"@");
+$basename = strtok($_GET['name'],"@");
 $filerule = strtok("@");
 
Index: /trunk/ippMonitor/raw/ipp.ffs.dat
===================================================================
--- /trunk/ippMonitor/raw/ipp.ffs.dat	(revision 42383)
+++ /trunk/ippMonitor/raw/ipp.ffs.dat	(revision 42384)
@@ -9,3 +9,6 @@
 menulink  | menuselect   | link    | Full Force Failed            | failedFullforce.php
 
-
+menutop   | menutop      | plain   | &nbsp;                       | 
+menulink  | menuselect 	 | link    | Forced Phot Camera Exp               | fpcamStageExp.php            
+menulink  | menuselect 	 | link    | Forced Phot Camera Pending           | fpcamPendingExp.php              
+menulink  | menuselect 	 | link    | Forced Phot Camera Processed Exp     | fpcamProcessedExp.php            
Index: /trunk/ippMonitor/raw/ipp.ffs.php
===================================================================
--- /trunk/ippMonitor/raw/ipp.ffs.php	(revision 42383)
+++ /trunk/ippMonitor/raw/ipp.ffs.php	(revision 42384)
@@ -8,5 +8,5 @@
 if (! $ID['proj']) { projectform ($ID); }
 
-menu('ipp.ffs.dat', 'Full Force Steps', 'ipp.css', $ID['link'], $ID['proj']);
+menu('ipp.ffs.dat', 'Forced Photometry Steps', 'ipp.css', $ID['link'], $ID['proj']);
 
 // document body
Index: /trunk/ippMonitor/raw/ipp.php
===================================================================
--- /trunk/ippMonitor/raw/ipp.php	(revision 42383)
+++ /trunk/ippMonitor/raw/ipp.php	(revision 42384)
@@ -26,5 +26,5 @@
 
   menu ('ipp.menu.dat', 'Select Project', 'ipp.css', $ID['link'], $ID['proj']);
-  if ($_GET['new'] && $_GET['proj']) {
+  if (isset($_GET['new']) && isset($_GET['proj'])) {
     echo "<p> Project is now <b>" . $_GET['proj'] . "</b></p>\n";
   }
@@ -66,4 +66,12 @@
   global $DBI;
 
+  if ($DBI == "PDO") {
+    $result = $qry->fetch();
+    if ($result == NULL) {
+      $success = 0;
+    } else {
+      $success = 1;
+    }
+  }
   if ($DBI == "MDB2") {
     $result = $qry->fetchRow();
@@ -90,4 +98,27 @@
   global $CZARDBHOST;
 
+  // define the DSN strings. NOTE: PDO uses a different format from DB or MDB2
+  if ($database == $CZARDBNAME) {
+    $dsn_pdo = "mysql:host=$DBHOST;dbname=$database";
+    $dsn = "mysql://$DBUSER:$DBPASS@$CZARDBHOST/$database";
+    $dsnerr = "mysql://$DBUSER:XXX@$CZARDBHOST/$database"; // only used to report the error
+  } else {
+    $dsn_pdo = "mysql:host=$CZARDBHOST;dbname=$database"; // note this is case sensitive
+    $dsn = "mysql://$DBUSER:$DBPASS@$DBHOST/$database";
+    $dsnerr = "mysql://$DBUSER:XXX@$DBHOST/$database"; // only used to report the error
+  }
+
+  // PDO has a different error handling method initially (throw exception)
+  // but after construction can be set to match DB & MDB2
+  if ($DBI == "PDO") {
+    try {
+      $db = new PDO($dsn_pdo, $DBUSER, $DBPASS);
+      $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
+    } catch (PDOException $dberr) {
+      dbconnectFailure($dberr, $dsnerr);
+    }
+    return $db;
+  }
+
   $success = 0;
   if ($DBI == "MDB2") {
@@ -104,12 +135,4 @@
   }
 
-  // connect to the database
-  if ($database == $CZARDBNAME) {
-    $dsn = "mysql://$DBUSER:$DBPASS@$CZARDBHOST/$database";
-    $dsnerr = "mysql://$DBUSER:XXX@$CZARDBHOST/$database"; // only used to report the error
-  } else {
-    $dsn = "mysql://$DBUSER:$DBPASS@$DBHOST/$database";
-    $dsnerr = "mysql://$DBUSER:XXX@$DBHOST/$database"; // only used to report the error
-  }
   if ($DBI == "DB") {
     $db = DB::connect($dsn);
@@ -118,15 +141,19 @@
     $db = MDB2::connect($dsn);
   }
-
   if (dberror($db)) {
-    echo "<b>error accessing database</b><br>\n";
-    echo "<b>tried $dsnerr</b><br>\n";
-    $result = $db->getMessage();
-    echo "$result<br>";
-    menu_end();
+    dbconnectFailure($db, $dsnerr);
   }
   return $db;
 }
 
+function dbconnectFailure($db, $dsnerr) {
+  echo "<b>error accessing database</b><br>\n";
+  echo "<b>tried $dsnerr</b><br>\n";
+  $result = $db->getMessage();
+  echo "$result<br>";
+  menu_end();
+}
+
+# return true/false for an error
 function dberror ($db) {
   global $DBI;
@@ -137,4 +164,11 @@
   if ($DBI == "DB") {
     $dberr = DB::isError($db);
+  }
+  if ($DBI == "PDO") {
+    if ($db == null) {
+      $dberr = 1;
+    } else {
+      $dberr = 0;
+    }
   }
 
Index: /trunk/ippMonitor/raw/plotHistogram.php
===================================================================
--- /trunk/ippMonitor/raw/plotHistogram.php	(revision 42383)
+++ /trunk/ippMonitor/raw/plotHistogram.php	(revision 42384)
@@ -12,5 +12,5 @@
 
 ### we must have been past arguments with GET:
-if ($_SERVER[REQUEST_METHOD] != 'GET') { 
+if ($_SERVER['REQUEST_METHOD'] != 'GET') { 
   exit ();
 }
@@ -43,7 +43,7 @@
 }
 
-$infile  = $_GET[input];
-$outfile = $_GET[output];
-$title = $_GET[title];
+$infile  = $_GET['input'];
+$outfile = $_GET['output'];
+$title = $_GET['title'];
 
 if ($debug) {
Index: /trunk/ippMonitor/raw/scatterPlot.php
===================================================================
--- /trunk/ippMonitor/raw/scatterPlot.php	(revision 42383)
+++ /trunk/ippMonitor/raw/scatterPlot.php	(revision 42384)
@@ -12,5 +12,5 @@
 
 ### we must have been past arguments with GET:
-if ($_SERVER[REQUEST_METHOD] != 'GET') { 
+if ($_SERVER['REQUEST_METHOD'] != 'GET') { 
   exit ();
 }
@@ -43,7 +43,7 @@
 }
 
-$infile  = $_GET[input];
-$outfile = $_GET[output];
-$title = $_GET[title];
+$infile  = $_GET['input'];
+$outfile = $_GET['output'];
+$title = $_GET['title'];
 
 $title = preg_replace("/'/", "", $title);
Index: /trunk/ippMonitor/raw/show_and_delete_image.php
===================================================================
--- /trunk/ippMonitor/raw/show_and_delete_image.php	(revision 42383)
+++ /trunk/ippMonitor/raw/show_and_delete_image.php	(revision 42384)
@@ -2,9 +2,9 @@
 
 ### we must have been past arguments with GET:
-if ($_SERVER[REQUEST_METHOD] != 'GET') { 
+if ($_SERVER['REQUEST_METHOD'] != 'GET') { 
   exit ();
 }
 
-$filename = $_GET[file];
+$filename = $_GET['file'];
 
 $file = fopen ($filename, "r");
Index: /trunk/ippMonitor/raw/show_log.php
===================================================================
--- /trunk/ippMonitor/raw/show_log.php	(revision 42383)
+++ /trunk/ippMonitor/raw/show_log.php	(revision 42384)
@@ -5,5 +5,5 @@
 include 'site.php';
 
-if ($_SERVER[REQUEST_METHOD] != 'GET') { 
+if ($_SERVER['REQUEST_METHOD'] != 'GET') { 
   exit ();
 }
@@ -13,8 +13,8 @@
 putenv("PATH=$WWWBIN:$BINDIR:$PATH");
 
-$basename = $_GET[basename];
+$basename = $_GET['basename'];
 $basename = escapeshellarg($basename);
 
-$state = $_GET[state];
+$state = $_GET['state'];
 $state = escapeshellarg($state);
 if (!$state) $state = 'new';
Index: /trunk/ippMonitor/raw/showimage.php
===================================================================
--- /trunk/ippMonitor/raw/showimage.php	(revision 42383)
+++ /trunk/ippMonitor/raw/showimage.php	(revision 42384)
@@ -11,5 +11,5 @@
 // load an image file from the image directory
 // validate request
-if ($_SERVER[REQUEST_METHOD] != 'GET') { 
+if ($_SERVER['REQUEST_METHOD'] != 'GET') { 
   exit ();
 }
@@ -20,8 +20,8 @@
 
 # $basename may contain filename@filerule
-$basename = $_GET[name];
-$filerule = $_GET[rule];
-$camera   = $_GET[camera];
-$class_id = $_GET[class_id];
+$basename = $_GET['name'];
+$filerule = $_GET['rule'];
+$camera   = $_GET['camera'];
+$class_id = $_GET['class_id'];
 
 $title = $basename;
Index: /trunk/ippMonitor/raw/skycellplot.php
===================================================================
--- /trunk/ippMonitor/raw/skycellplot.php	(revision 42383)
+++ /trunk/ippMonitor/raw/skycellplot.php	(revision 42384)
@@ -13,5 +13,5 @@
 
 ### we must have been past arguments with GET:
-if ($_SERVER[REQUEST_METHOD] != 'GET') { 
+if ($_SERVER['REQUEST_METHOD'] != 'GET') { 
   exit ();
 }
@@ -44,6 +44,6 @@
 }
 
-$infile  = $_GET[input];
-$outfile = $_GET[output];
+$infile  = $_GET['input'];
+$outfile = $_GET['output'];
 
 $output = shell_exec("skycellplot.dvo $infile $outfile");//, $output, $status);
Index: /trunk/ippMonitor/raw/skyplot.php
===================================================================
--- /trunk/ippMonitor/raw/skyplot.php	(revision 42383)
+++ /trunk/ippMonitor/raw/skyplot.php	(revision 42384)
@@ -23,5 +23,5 @@
 
 ### we must have been passed arguments with GET:
-if ($_SERVER[REQUEST_METHOD] != 'GET') { 
+if ($_SERVER['REQUEST_METHOD'] != 'GET') { 
   exit ();
 }
@@ -54,6 +54,6 @@
 }
 
-$infile  = $_GET[input];
-$outfile = $_GET[output];
+$infile  = $_GET['input'];
+$outfile = $_GET['output'];
 
 // $output = shell_exec("skyplot.dvo $infile $outfile");//, $output, $status);
