]> git.nbdom.net Git - nb.git/commitdiff
www/dbq/dbq.php
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Mon, 18 Nov 2024 23:19:57 +0000 (00:19 +0100)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Mon, 18 Nov 2024 23:19:57 +0000 (00:19 +0100)
www/dbq/dbq.php

index 0e8dc26a6e15521c9a3cc443f10f65fd8306e12f..18ea666292528f3161a38d3946a6323a72253b55 100644 (file)
@@ -1317,11 +1317,45 @@ EOF;
                } elseif ($action == 'phpinfo') {
                        $this->deniedUnless($this->perm >= self::ADMIN);
                        #phpinfo();
-                       $this->rows_table($action,$this->phpinfo_rows());
-                       #$this->page(['phpinfo'=>$this->page->phpinfo(true)]);
-                       #$this->page($this->page->phpinfo());
+                       #$this->rows_table($action,$this->phpinfo_rows());
+       ob_start();
+       system("php -r 'phpinfo();'");
+       $phpinfo = ob_get_contents();
+       ob_end_clean();
+
+       $lines = explode("\n",$phpinfo);
+
+                       $section = 'Root';
+                       $rows = [];
+
+                       while (true) {
+                               $line = next($lines);
+                               if ($line === false) break;
+
+               if (strpos($line, '_______') === 1) {
+               #bye($line);
+                       $section = '';
+          while (empty($section)) {
+               $section = next($lines);
+          }
+          #bye($section);
+          if ($section == 'PHP Credits') break; # No more interrested
+                       continue;
+               }
+
+               if (preg_match('/(.*) => (.*)/',$line,$m)) {
+                       $rows[] = [
+                               'section' => $section,
+                               'key' => $m[1],
+                               'val' => $m[2],
+                       ];
+               }
+
+               #substr(trim($line_buffer), -1) === ','
+
+                       }
+                       $this->page($rows);
                        #$this->page($this,'phpinfo_rows');
-                       #$this->phpinfo_rows();
 
                } elseif ($action == '_POST') { $this->page($_POST);
                } elseif ($action == '_GET') { $this->page($_GET);