100
100
$ time_start =microtime_float ();
101
101
102
102
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> ' ;
104
108
}else {
105
109
if ($ DB ['db ' ]){
106
110
if ($ _REQUEST ['shex ' ]){
@@ -177,25 +181,28 @@ function display_select($sth,$q){
177
181
$ w ='' ;
178
182
if ($ is_sht || $ is_shd ) {$ w ='wa ' ;
179
183
$ url ='? ' .$ xurl ."&db= $ dbn " ;
180
- $ sqldr .="<div >
181
- MySQL Server:
182
- & #183;<a href='$ url&q= " .b64e ("show variables " )."'>Show Configuration Variables</a>
183
- & #183;<a href='$ url&q= " .b64e ("show status " )."'>Show Statistics</a>
184
- & #183;<a href='$ url&q= " .b64e ("show processlist " )."'>Show Processlist</a> " ;
185
- 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'> " ;
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 .="·<label>Create new database: <input type='text' name='new_db' placeholder='type db name here'></label> <input type='submit' name='crdb' value='Create'> " ;
186
190
$ sqldr .="<br> " ;
187
- if ($ is_sht ) $ sqldr .=" Database: & #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> " ;
188
192
$ sqldr .="</div> " ;
189
193
}
190
194
if ($ is_sht ){
191
- $ abtn =" <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> " ;
196
202
$ sqldr .=$ abtn ."<input type='hidden' name='dosht' value=''> " ;
197
203
}
198
204
205
+ $ sqldr .="<div> " ;
199
206
$ sqldr .="<table class='res $ w'> " ;
200
207
$ headers ="<tr class='h'> " ;
201
208
if ($ is_sht ) $ headers .="<td><input type='checkbox' name='cball' value='' onclick='chkall(this)'></td> " ;
@@ -255,7 +262,9 @@ function display_select($sth,$q){
255
262
}
256
263
$ sqldr .="</tr> \n" ;
257
264
}
258
- $ sqldr .="</table> \n" .$ abtn ;
265
+ $ sqldr .="</table> \n" ;
266
+ $ sqldr .="</div> \n" ;
267
+ $ sqldr .=$ abtn ;
259
268
}
260
269
261
270
function print_header (){
@@ -267,17 +276,19 @@ function print_header(){
267
276
<head><title>phpMiniAdmin</title>
268
277
<meta charset="utf-8">
269
278
<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}
272
281
div{padding:3px}
273
282
pre{font-size:125%}
283
+ textarea {width:100%;}
274
284
.nav{text-align:center}
275
285
.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}
277
287
.inv a{color:#FFF}
278
- table.res{width:100%;border-collapse:collapse;}
288
+ table{border-collapse:collapse;}
289
+ table.res{width:100%;}
279
290
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}
281
292
table.restr{vertical-align:top}
282
293
tr.e{background-color:#CCC}
283
294
tr.o{background-color:#EEE}
@@ -288,8 +299,17 @@ function print_header(){
288
299
.frm{width:400px;border:1px solid #999;background-color:#eee;text-align:left}
289
300
.frm label .l{width:100px;float:left}
290
301
.dot{border-bottom:1px dotted #000}
291
- .ajax{text-decoration:none;border-bottom: 1px dashed;}
302
+ .ajax{text-decoration:none;border-bottom: 1px dashed;}
292
303
.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;}
293
313
</style>
294
314
295
315
<script type="text/javascript">
@@ -445,20 +465,25 @@ function print_screen(){
445
465
print_header ();
446
466
?>
447
467
448
- <div class="dot" style="padding:0 0 5px 20px" >
468
+ <div class="dot">
449
469
<label for="qraw">SQL-query (or multiple queries separated by ";"):</label> <button type="button" class="qnav" onclick="q_prev()"><</button><button type="button" class="qnav" onclick="q_next()">></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>
451
471
<input type="hidden" name="q" id="q" value="<?php b64e ($ SQLq );?> ">
452
- <input type="submit" name="GoSQL" value="Go" style="width:100px">
472
+ <input type="submit" name="GoSQL" value="Go" style="width:100px">
453
473
<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 } ?>
454
481
</div>
455
- <div class="dot" style="padding:5px 0 5px 20px ">
482
+ <div class="dot"">
456
483
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>
457
484
<b><?php eo ($ out_message )?> </b>
458
485
</div>
459
- <div class="sqldr">
460
486
<?php echo $ nav .$ sqldr .$ nav ; ?>
461
- </div>
462
487
<?php
463
488
print_footer ();
464
489
}
0 commit comments