Index: /branches/eam_branches/ipp-20220316/ippMonitor/raw/Login.php
===================================================================
--- /branches/eam_branches/ipp-20220316/ippMonitor/raw/Login.php	(revision 42201)
+++ /branches/eam_branches/ipp-20220316/ippMonitor/raw/Login.php	(revision 42202)
@@ -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: /branches/eam_branches/ipp-20220316/ippMonitor/raw/SelectProject.php
===================================================================
--- /branches/eam_branches/ipp-20220316/ippMonitor/raw/SelectProject.php	(revision 42201)
+++ /branches/eam_branches/ipp-20220316/ippMonitor/raw/SelectProject.php	(revision 42202)
@@ -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: /branches/eam_branches/ipp-20220316/ippMonitor/raw/czartool_getplot.php
===================================================================
--- /branches/eam_branches/ipp-20220316/ippMonitor/raw/czartool_getplot.php	(revision 42201)
+++ /branches/eam_branches/ipp-20220316/ippMonitor/raw/czartool_getplot.php	(revision 42202)
@@ -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: /branches/eam_branches/ipp-20220316/ippMonitor/raw/getlog.php
===================================================================
--- /branches/eam_branches/ipp-20220316/ippMonitor/raw/getlog.php	(revision 42201)
+++ /branches/eam_branches/ipp-20220316/ippMonitor/raw/getlog.php	(revision 42202)
@@ -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: /branches/eam_branches/ipp-20220316/ippMonitor/raw/ipp.php
===================================================================
--- /branches/eam_branches/ipp-20220316/ippMonitor/raw/ipp.php	(revision 42201)
+++ /branches/eam_branches/ipp-20220316/ippMonitor/raw/ipp.php	(revision 42202)
@@ -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: /branches/eam_branches/ipp-20220316/ippMonitor/raw/plotHistogram.php
===================================================================
--- /branches/eam_branches/ipp-20220316/ippMonitor/raw/plotHistogram.php	(revision 42201)
+++ /branches/eam_branches/ipp-20220316/ippMonitor/raw/plotHistogram.php	(revision 42202)
@@ -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: /branches/eam_branches/ipp-20220316/ippMonitor/raw/scatterPlot.php
===================================================================
--- /branches/eam_branches/ipp-20220316/ippMonitor/raw/scatterPlot.php	(revision 42201)
+++ /branches/eam_branches/ipp-20220316/ippMonitor/raw/scatterPlot.php	(revision 42202)
@@ -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: /branches/eam_branches/ipp-20220316/ippMonitor/raw/show_and_delete_image.php
===================================================================
--- /branches/eam_branches/ipp-20220316/ippMonitor/raw/show_and_delete_image.php	(revision 42201)
+++ /branches/eam_branches/ipp-20220316/ippMonitor/raw/show_and_delete_image.php	(revision 42202)
@@ -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: /branches/eam_branches/ipp-20220316/ippMonitor/raw/show_log.php
===================================================================
--- /branches/eam_branches/ipp-20220316/ippMonitor/raw/show_log.php	(revision 42201)
+++ /branches/eam_branches/ipp-20220316/ippMonitor/raw/show_log.php	(revision 42202)
@@ -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: /branches/eam_branches/ipp-20220316/ippMonitor/raw/showimage.php
===================================================================
--- /branches/eam_branches/ipp-20220316/ippMonitor/raw/showimage.php	(revision 42201)
+++ /branches/eam_branches/ipp-20220316/ippMonitor/raw/showimage.php	(revision 42202)
@@ -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: /branches/eam_branches/ipp-20220316/ippMonitor/raw/skycellplot.php
===================================================================
--- /branches/eam_branches/ipp-20220316/ippMonitor/raw/skycellplot.php	(revision 42201)
+++ /branches/eam_branches/ipp-20220316/ippMonitor/raw/skycellplot.php	(revision 42202)
@@ -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: /branches/eam_branches/ipp-20220316/ippMonitor/raw/skyplot.php
===================================================================
--- /branches/eam_branches/ipp-20220316/ippMonitor/raw/skyplot.php	(revision 42201)
+++ /branches/eam_branches/ipp-20220316/ippMonitor/raw/skyplot.php	(revision 42202)
@@ -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);
