$server) { if (array_key_exists("description", $server) && array_key_exists("connstr", $server)) { // Get the image if there is one if (array_key_exists("icon", $server) && $server["icon"] != "") $icon = ""; // Connect the database $db = @pg_connect($server["connstr"]); // Can we connect? if ($db === false) { $svrlist .= "
  • " . $icon . "" . $server["description"] . "
    " . html_entity_decode($php_errormsg, ENT_QUOTES) . "
  • "; } else { // Valid server version? $res = @pg_query($db, "SHOW server_version_num;"); if (@pg_fetch_result($res, 0, 0) < 80200) { $svrlist .= "
  • " . $icon . "" . $server["description"] . "
    Server version is less than 8.2
  • "; } else { // Have we got superuser privs? @pg_free_result($res); $res = @pg_query($db, "SELECT usesuper FROM pg_shadow WHERE usename = current_user;"); if (pg_fetch_result($res, 0, 0) != "t") { $svrlist .= "
  • " . $icon . "" . $server["description"] . "
    The connecting user is not a superuser
  • "; } else { // Looks good - let's go! $svrlist .= "
  • " . $icon . "" . $server["description"] . "
  • "; } } pg_free_result($res); } $svrcount++; } } if ($svrlist == "") www_error("No servers configured", "No configured servers could be found. Please edit the config.php file."); // Set the message for the top of the page $message = "Servers: $svrcount configured"; // Echo the main HTML body. Everything else is loaded a snippet at a time, via AJAX $text = << $APP_NAME v$APP_VERSION

    $APP_NAME v$APP_VERSION

    $APP_NAME is a remote monitoring interface for your Postgres and Postgres Plus servers.

    For support, please visit the EnterpriseDB forums.

    $APP_NAME is released under the GNU General Public Licence.

    $APP_COPYRIGHT

     

    EnterpriseDB Logo
    EOT; echo $text; exit(); ?>