Esempio n. 1
0
 /**
  * Alias for perfmon_parent_ADOConnection::table()
  *
  * @access public
  * @param string $newtable The name for the table to use; optional.
  * @return string
  */
 static function table($newtable = false)
 {
     $rt = perfmon_parent_ADOConnection::table($newtable);
     return $rt;
 }
 function UI($pollsecs = 5)
 {
     $perf_table = perfmon_parent_ADOConnection::table();
     $app = $this->host;
     if ($this->host && $this->database) {
         $app .= ', db=';
     }
     $app .= $this->database;
     if ($app) {
         $app .= ', ';
     }
     $savelog = $this->LogSQL(false);
     $info = $this->ServerInfo();
     if (isset($_GET['clearsql'])) {
         $this->Execute("delete from {$perf_table}");
     }
     $this->LogSQL($savelog);
     // magic quotes
     if (isset($_GET['sql']) && get_magic_quotes_gpc()) {
         $_GET['sql'] = $_GET['sql'] = str_replace(array("\\'", '\\"'), array("'", '"'), $_GET['sql']);
     }
     if (!isset($_SESSION['ADODB_PERF_SQL'])) {
         $nsql = $_SESSION['ADODB_PERF_SQL'] = 10;
     } else {
         $nsql = $_SESSION['ADODB_PERF_SQL'];
     }
     $app .= $info['description'];
     if (isset($_GET['do'])) {
         $do = $_GET['do'];
     } else {
         if (isset($_POST['do'])) {
             $do = $_POST['do'];
         } else {
             if (isset($_GET['sql'])) {
                 $do = 'viewsql';
             } else {
                 $do = 'stats';
             }
         }
     }
     if (isset($_GET['nsql'])) {
         if ($_GET['nsql'] > 0) {
             $nsql = $_SESSION['ADODB_PERF_SQL'] = (int) $_GET['nsql'];
         }
     }
     // page header
     echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n\t\t\t<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\">\n\t\t\t<head>\n\t\t\t<title>ADOdb-Lite Performance Monitor on {$app}</title>\n\t\t\t<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\" />\n\t\t\t<style type=\"text/css\">\n\t\t\t\t/*<![CDATA[*/\n\t\t\t\tbody { background-color: #FFFFFF; font-size: 10pt; color: #000000; }\n\t\t\t\ttd { padding: 0px 3px 0px 3px; }\n\t\t\t\ttable { border: 2px groove #000000; }\n\t\t\t\t/*]]>*/\n\t\t\t</style>\n\t\t\t</head>\n\t\t\t<body>\n\t\t";
     if ($do == 'viewsql') {
         $form = "\n<form method=\"post\" action=\"" . $_SERVER['PHP_SELF'] . "\"># SQL:<input type=\"hidden\" value=\"viewsql\" name=\"do\" /> <input type=\"text\" size=\"4\" name=\"nsql\" value=\"{$nsql}\" /><input type=\"submit\" value=\"Go\" /></form>";
     } else {
         $form = "&nbsp;";
     }
     $allowsql = !defined('ADODB_PERF_NO_RUN_SQL');
     if (empty($_GET['hidem'])) {
         echo "\n<table style=\"width: 100%; background-color: lightyellow;\">\n<tr>\n<td colspan='2'>\n<strong><a href=\"http://adodb.sourceforge.net/?perf=1\">ADOdb-Lite</a> Performance Monitor</strong> <span style=\"font-size: 8pt;\">for {$app}</span>\n</td>\n</tr>\n<tr>\n<td>\n<a href=\"?do=stats\"><strong>Performance Stats</strong></a> &nbsp; <a href=\"?do=viewsql\"><strong>View SQL</strong></a>&nbsp; <a href=\"?do=tables\"><strong>View Tables</strong></a> &nbsp; <a href=\"?do=poll\"><strong>Poll Stats</strong></a>", $allowsql ? ' &nbsp; <a href="?do=dosql"><strong>Run SQL</strong></a></td>' : '</td>', "\n<td>{$form}\n</td>", "\n</tr>\n</table>\n";
     }
     switch ($do) {
         case 'stats':
             echo $this->HealthCheck();
             echo $this->CheckMemory();
             break;
         case 'poll':
             echo "<iframe width=\"720\" height=\"80%\" \n\t\t\t\t\tsrc=\"{$_SERVER['PHP_SELF']}?do=poll2&hidem=1\"></iframe>";
             break;
         case 'poll2':
             echo "<pre>";
             $this->Poll($pollsecs);
             echo "</pre>";
             break;
         case 'dosql':
             if (!$allowsql) {
                 break;
             }
             $this->DoSQLForm();
             break;
         case 'viewsql':
             if (empty($_GET['hidem'])) {
                 echo "&nbsp; <a href=\"?do=viewsql&amp;clearsql=1\">Clear SQL Log</a><br />";
             }
             echo $this->SuspiciousSQL($nsql);
             echo $this->ExpensiveSQL($nsql);
             echo $this->InvalidSQL($nsql);
             break;
         case 'tables':
             echo $this->Tables();
             break;
         default:
             echo $this->HealthCheck();
             echo $this->CheckMemory();
             break;
     }
     global $ADODB_vers;
     echo "<div align=\"center\"><span style=\"font-size: 8pt;\">{$ADODB_vers}</span></div>";
 }