Skip to content

Commit 841b48c

Browse files
authored
Merge pull request #26 from sbruemmer/master
fix display error with phpinfo
2 parents e4f1a6a + 3d8a78c commit 841b48c

File tree

1 file changed

+51
-26
lines changed

1 file changed

+51
-26
lines changed

phpminiadmin.php

Lines changed: 51 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,11 @@
100100
$time_start=microtime_float();
101101

102102
if ($_REQUEST['phpinfo']){
103-
ob_start();phpinfo();$sqldr='<div style="font-size:130%">'.ob_get_clean().'</div>';
103+
ob_start();
104+
phpinfo();
105+
$html = ob_get_clean();
106+
preg_match("/<body[^>]*>(.*?)<\/body>/is", $html, $matches); // show only <body>-content
107+
$sqldr='<div class="phpinfo">'.$matches[1].'</div>';
104108
}else{
105109
if ($DB['db']){
106110
if ($_REQUEST['shex']){
@@ -177,25 +181,28 @@ function display_select($sth,$q){
177181
$w='';
178182
if ($is_sht || $is_shd) {$w='wa';
179183
$url='?'.$xurl."&db=$dbn";
180-
$sqldr.="<div class='dot'>
181-
&nbsp;MySQL Server:
182-
&nbsp;&#183;<a href='$url&q=".b64e("show variables")."'>Show Configuration Variables</a>
183-
&nbsp;&#183;<a href='$url&q=".b64e("show status")."'>Show Statistics</a>
184-
&nbsp;&#183;<a href='$url&q=".b64e("show processlist")."'>Show Processlist</a>";
185-
if ($is_shd) $sqldr.="&nbsp;&#183;<label>Create new database: <input type='text' name='new_db' placeholder='type db name here'></label> <input type='submit' name='crdb' value='Create'>";
184+
$sqldr.="<div class='dot'>";
185+
$sqldr.=" MySQL Server: ";
186+
$sqldr.=" &#183; <a href='$url&q=".b64e("show variables")."'>Show Configuration Variables</a> ";
187+
$sqldr.=" &#183; <a href='$url&q=".b64e("show status")."'>Show Statistics</a> ";
188+
$sqldr.=" &#183; <a href='$url&q=".b64e("show processlist")."'>Show Processlist</a> ";
189+
if ($is_shd) $sqldr.="&#183; <label>Create new database: <input type='text' name='new_db' placeholder='type db name here'></label> <input type='submit' name='crdb' value='Create'>";
186190
$sqldr.="<br>";
187-
if ($is_sht) $sqldr.="&nbsp;Database:&nbsp;&#183;<a href='$url&q=".b64e("show table status")."'>Show Table Status</a>";
191+
if ($is_sht) $sqldr.="Database: &#183; <a href='$url&q=".b64e("show table status")."'>Show Table Status</a>";
188192
$sqldr.="</div>";
189193
}
190194
if ($is_sht){
191-
$abtn="&nbsp;<input type='submit' value='Export' onclick=\"sht('exp')\">
192-
<input type='submit' value='Drop' onclick=\"if(ays()){sht('drop')}else{return false}\">
193-
<input type='submit' value='Truncate' onclick=\"if(ays()){sht('trunc')}else{return false}\">
194-
<input type='submit' value='Optimize' onclick=\"sht('opt')\">
195-
<b>selected tables</b>";
195+
$abtn="<div>";
196+
$abtn.=" <input type='submit' value='Export' onclick=\"sht('exp')\"> ";
197+
$abtn.=" <input type='submit' value='Drop' onclick=\"if(ays()){sht('drop')}else{return false}\"> ";
198+
$abtn.=" <input type='submit' value='Truncate' onclick=\"if(ays()){sht('trunc')}else{return false}\"> ";
199+
$abtn.=" <input type='submit' value='Optimize' onclick=\"sht('opt')\"> ";
200+
$abtn.=" <b>selected tables</b> ";
201+
$abtn.="</div>";
196202
$sqldr.=$abtn."<input type='hidden' name='dosht' value=''>";
197203
}
198204

205+
$sqldr.="<div>";
199206
$sqldr.="<table class='res $w'>";
200207
$headers="<tr class='h'>";
201208
if ($is_sht) $headers.="<td><input type='checkbox' name='cball' value='' onclick='chkall(this)'></td>";
@@ -255,7 +262,9 @@ function display_select($sth,$q){
255262
}
256263
$sqldr.="</tr>\n";
257264
}
258-
$sqldr.="</table>\n".$abtn;
265+
$sqldr.="</table>\n";
266+
$sqldr.="</div>\n";
267+
$sqldr.=$abtn;
259268
}
260269

261270
function print_header(){
@@ -267,17 +276,19 @@ function print_header(){
267276
<head><title>phpMiniAdmin</title>
268277
<meta charset="utf-8">
269278
<style type="text/css">
270-
body{font-family:Arial,sans-serif;font-size:80%;padding:0;margin:0}
271-
th,td{padding:0;margin:0}
279+
* {box-sizing:border-box;}
280+
body{font-family:Arial,sans-serif;font-size:80%;padding:0 1em;margin:0}
272281
div{padding:3px}
273282
pre{font-size:125%}
283+
textarea {width:100%;}
274284
.nav{text-align:center}
275285
.ft{text-align:right;margin-top:20px;font-size:smaller}
276-
.inv{background-color:#069;color:#FFF}
286+
.inv{margin:0 -1em;background-color:#069;color:#FFF}
277287
.inv a{color:#FFF}
278-
table.res{width:100%;border-collapse:collapse;}
288+
table{border-collapse:collapse;}
289+
table.res{width:100%;}
279290
table.wa{width:auto}
280-
table.res th,table.res td{padding:2px;border:1px solid #fff;vertical-align: top}
291+
table.res th,table.res td{padding:2px;border:1px solid #fff;vertical-align:top}
281292
table.restr{vertical-align:top}
282293
tr.e{background-color:#CCC}
283294
tr.o{background-color:#EEE}
@@ -288,8 +299,17 @@ function print_header(){
288299
.frm{width:400px;border:1px solid #999;background-color:#eee;text-align:left}
289300
.frm label .l{width:100px;float:left}
290301
.dot{border-bottom:1px dotted #000}
291-
.ajax{text-decoration: none;border-bottom: 1px dashed;}
302+
.ajax{text-decoration:none;border-bottom: 1px dashed;}
292303
.qnav{width:30px}
304+
.clear {clear:both; height:0; display:block;}
305+
.phpinfo a {text-decoration:none;}
306+
.phpinfo hr {display:none;}
307+
.phpinfo img {float:right;}
308+
.phpinfo .center {text-align:center;}
309+
.phpinfo table {margin:0 auto;}
310+
.phpinfo table td, .phpinfo table th {border:1px solid #000000;text-align:left;vertical-align:baseline;}
311+
.phpinfo table .e {background-color:#ccccff;font-weight:bold;}
312+
.phpinfo table .v {background-color:#cccccc;}
293313
</style>
294314

295315
<script type="text/javascript">
@@ -445,20 +465,25 @@ function print_screen(){
445465
print_header();
446466
?>
447467

448-
<div class="dot" style="padding:0 0 5px 20px">
468+
<div class="dot">
449469
<label for="qraw">SQL-query (or multiple queries separated by ";"):</label>&nbsp;<button type="button" class="qnav" onclick="q_prev()">&lt;</button><button type="button" class="qnav" onclick="q_next()">&gt;</button><br>
450-
<textarea id="qraw" cols="70" rows="10" style="width:98%"><?php eo($SQLq)?></textarea><br>
470+
<textarea id="qraw" cols="70" rows="10"><?php eo($SQLq)?></textarea><br>
451471
<input type="hidden" name="q" id="q" value="<?php b64e($SQLq);?>">
452-
<input type="submit" name="GoSQL" value="Go" style="width:100px">&nbsp;&nbsp;
472+
<input type="submit" name="GoSQL" value="Go" style="width:100px">
453473
<input type="button" name="Clear" value=" Clear " onclick="$('qraw').value='';" style="width:100px">
474+
<?php if (!empty($_REQUEST['db'])) { ?>
475+
<input type="button" name="Delete" value=" Delete " onclick="$('qraw').value='DELETE FROM `<?php echo $_REQUEST['db']; ?>` WHERE 1';" style="float:right; width:100px">
476+
<input type="button" name="Update" value=" Update " onclick="$('qraw').value='UPDATE `<?php echo $_REQUEST['db']; ?>` SET `column`=\'value\' WHERE 1';" style="float:right; width:100px">
477+
<input type="button" name="Insert" value=" Insert " onclick="$('qraw').value='INSERT INTO `<?php echo $_REQUEST['db']; ?>` (`column`, `column`) VALUES (\'value\', \'value\')';" style="float:right; width:100px">
478+
<input type="button" name="Select" value=" Select " onclick="$('qraw').value='SELECT * FROM `<?php echo $_REQUEST['db']; ?>` WHERE 1';" style="float:right; width:100px">
479+
<br class="clear">
480+
<?php } ?>
454481
</div>
455-
<div class="dot" style="padding:5px 0 5px 20px">
482+
<div class="dot"">
456483
Records: <b><?php eo($reccount); if(!is_null($last_count) && $reccount<$last_count){eo(' out of '.$last_count);}?></b> in <b><?php eo($time_all)?></b> sec<br>
457484
<b><?php eo($out_message)?></b>
458485
</div>
459-
<div class="sqldr">
460486
<?php echo $nav.$sqldr.$nav; ?>
461-
</div>
462487
<?php
463488
print_footer();
464489
}

0 commit comments

Comments
 (0)