Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c2f95c9

Browse files
committed
cleanup and adjustments after merge
1 parent 841b48c commit c2f95c9

File tree

1 file changed

+54
-54
lines changed

1 file changed

+54
-54
lines changed

‎phpminiadmin.php‎

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -92,19 +92,16 @@
9292
}
9393

9494
//get initial values
95-
$SQLq=trim(base64_decode($_REQUEST['q']));
95+
$SQLq=trim(b64d($_REQUEST['q']));
9696
$page=$_REQUEST['p']+0;
9797
if ($_REQUEST['refresh'] && $DB['db'] && preg_match('/^show/',$SQLq) ) $SQLq=$SHOW_T;
9898

9999
if (db_connect('nodie')){
100100
$time_start=microtime_float();
101101

102102
if ($_REQUEST['phpinfo']){
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>';
103+
ob_start();phpinfo();$html=ob_get_clean();preg_match("/<body[^>]*>(.*?)<\/body>/is",$html,$m);
104+
$sqldr='<div class="pi">'.$m[1].'</div>';
108105
}else{
109106
if ($DB['db']){
110107
if ($_REQUEST['shex']){
@@ -181,29 +178,26 @@ function display_select($sth,$q){
181178
$w='';
182179
if ($is_sht || $is_shd) {$w='wa';
183180
$url='?'.$xurl."&db=$dbn";
184-
$sqldr.="<div >";
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> ";
181+
$sqldr.="<div class='dot'>
182+
MySQL Server:
183+
&#183; <a href='$url&q=".b64e("show variables")."'>Show Configuration Variables</a>
184+
&#183; <a href='$url&q=".b64e("show status")."'>Show Statistics</a>
185+
&#183; <a href='$url&q=".b64e("show processlist")."'>Show Processlist</a> ";
189186
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'>";
190187
$sqldr.="<br>";
191188
if ($is_sht) $sqldr.="Database: &#183; <a href='$url&q=".b64e("show table status")."'>Show Table Status</a>";
192189
$sqldr.="</div>";
193190
}
194191
if ($is_sht){
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>";
192+
$abtn="<div><input type='submit' value='Export' onclick=\"sht('exp')\">
193+
<input type='submit' value='Drop' onclick=\"if(ays()){sht('drop')}else{return false}\">
194+
<input type='submit' value='Truncate' onclick=\"if(ays()){sht('trunc')}else{return false}\">
195+
<input type='submit' value='Optimize' onclick=\"sht('opt')\">
196+
<b>selected tables</b></div>";
202197
$sqldr.=$abtn."<input type='hidden' name='dosht' value=''>";
203198
}
204199

205-
$sqldr.="<div>";
206-
$sqldr.="<table class='res $w'>";
200+
$sqldr.="<div><table class='res $w'>";
207201
$headers="<tr class='h'>";
208202
if ($is_sht) $headers.="<td><input type='checkbox' name='cball' value='' onclick='chkall(this)'></td>";
209203
for($i=0;$i<$fields_num;$i++){
@@ -221,7 +215,7 @@ function display_select($sth,$q){
221215
$v=$row[0];
222216
if ($is_sht){
223217
$vq='`'.$v.'`';
224-
$url='?'.$xurl."&db=$dbn";
218+
$url='?'.$xurl."&db=$dbn&t=".b64e($v);
225219
$v="<input type='checkbox' name='cb[]' value=\"$vq\"></td>"
226220
."<td><a href=\"$url&q=".b64e("select * from $vq")."\">$v</a></td>"
227221
."<td>".$row[1]."</td>"
@@ -231,7 +225,7 @@ function display_select($sth,$q){
231225
."<td>&#183;<a href=\"$url&q=".b64e("show create table $vq")."\">sct</a></td>"
232226
."<td>&#183;<a href=\"$url&q=".b64e("explain $vq")."\">exp</a></td>"
233227
."<td>&#183;<a href=\"$url&q=".b64e("show index from $vq")."\">ind</a></td>"
234-
."<td>&#183;<a href=\"$url&shex=1&t=$vq\">export</a></td>"
228+
."<td>&#183;<a href=\"$url&shex=1&rt=$vq\">export</a></td>"
235229
."<td>&#183;<a href=\"$url&q=".b64e("drop table $vq")."\" onclick='return ays()'>dr</a></td>"
236230
."<td>&#183;<a href=\"$url&q=".b64e("truncate table $vq")."\" onclick='return ays()'>tr</a></td>"
237231
."<td>&#183;<a href=\"$url&q=".b64e("optimize table $vq")."\" onclick='return ays()'>opt</a></td>"
@@ -262,9 +256,7 @@ function display_select($sth,$q){
262256
}
263257
$sqldr.="</tr>\n";
264258
}
265-
$sqldr.="</table>\n";
266-
$sqldr.="</div>\n";
267-
$sqldr.=$abtn;
259+
$sqldr.="</table></div>\n".$abtn;
268260
}
269261

270262
function print_header(){
@@ -276,40 +268,41 @@ function print_header(){
276268
<head><title>phpMiniAdmin</title>
277269
<meta charset="utf-8">
278270
<style type="text/css">
279-
*{box-sizing:border-box;}
280-
body{font-family:Arial,sans-serif;font-size:80%;padding:0 1em;margin:0}
271+
*{box-sizing:border-box;}
272+
body{font-family:Arial,sans-serif;font-size:80%;padding:0;margin:0}
281273
div{padding:3px}
282274
pre{font-size:125%}
283-
textarea{width:100%;}
275+
textarea{width:100%}
284276
.nav{text-align:center}
285277
.ft{text-align:right;margin-top:20px;font-size:smaller}
286-
.inv{margin:0 -1em;background-color:#069;color:#FFF}
278+
.inv{background-color:#069;color:#FFF}
287279
.inv a{color:#FFF}
288-
table{border-collapse:collapse;}
289-
table.res{width:100%;}
280+
table{border-collapse:collapse}
281+
table.res{width:100%}
290282
table.wa{width:auto}
291283
table.res th,table.res td{padding:2px;border:1px solid #fff;vertical-align:top}
292284
table.restr{vertical-align:top}
293285
tr.e{background-color:#CCC}
294286
tr.o{background-color:#EEE}
295-
tr.e:hover, tr.o:hover{background-color:#FF9}
287+
tr.e:hover, tr.o:hover{background-color:#FF9}
296288
tr.h{background-color:#99C}
297289
tr.s{background-color:#FF9}
298290
.err{color:#F33;font-weight:bold;text-align:center}
299291
.frm{width:400px;border:1px solid #999;background-color:#eee;text-align:left}
300292
.frm label .l{width:100px;float:left}
301293
.dot{border-bottom:1px dotted #000}
302-
.ajax{text-decoration:none;border-bottom: 1px dashed;}
294+
.ajax{text-decoration:none;border-bottom: 1px dashed}
303295
.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;}
296+
.sbtn{width:100px}
297+
.clear{clear:both;height:0;display:block}
298+
.pi a{text-decoration:none}
299+
.pi hr{display:none}
300+
.pi img{float:right}
301+
.pi .center{text-align:center}
302+
.pi table{margin:0 auto}
303+
.pi table td, .pi table th{border:1px solid #000000;text-align:left;vertical-align:baseline}
304+
.pi table .e{background-color:#ccccff;font-weight:bold}
305+
.pi table .v{background-color:#cccccc}
313306
</style>
314307

315308
<script type="text/javascript">
@@ -412,6 +405,9 @@ function cfg_toggle(){
412405
var e=$('cfg-adv');
413406
e.style.display=e.style.display=='none'?'':'none';
414407
}
408+
function qtpl(s){
409+
$('qraw').value=s.replace(/%T/g,'`<?php echo $_REQUEST['t']?b64d($_REQUEST['t']):'tablename'?>`');
410+
}
415411
<?php if($is_sht){?>
416412
function chkall(cab){
417413
var e=document.DF.elements;
@@ -465,21 +461,22 @@ function print_screen(){
465461
print_header();
466462
?>
467463

468-
<div class="dot">
464+
<div class="dot" style="padding:3px 20px">
469465
<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>
470466
<textarea id="qraw" cols="70" rows="10"><?php eo($SQLq)?></textarea><br>
471467
<input type="hidden" name="q" id="q" value="<?php b64e($SQLq);?>">
472-
<input type="submit" name="GoSQL" value="Go" style="width:100px">
468+
<input type="submit" name="GoSQL" value="Go" class="sbtn">
473469
<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">
470+
<?php if(!empty($_REQUEST['db'])){ ?>
471+
<div style="float:right">
472+
<input type="button" value="Select" class="sbtn" onclick="qtpl('SELECT *\nFROM %T\nWHERE 1')">
473+
<input type="button" value="Insert" class="sbtn" onclick="qtpl('INSERT INTO %T (`column`, `column`)\nVALUES (\'value\', \'value\')')">
474+
<input type="button" value="Update" class="sbtn" onclick="qtpl('UPDATE %T\nSET `column`=\'value\'\nWHERE 1=0')">
475+
<input type="button" value="Delete" class="sbtn" onclick="qtpl('DELETE FROM %T\nWHERE 1=0')">
476+
</div><br class="clear">
480477
<?php } ?>
481478
</div>
482-
<div class="dot"">
479+
<div class="dot">
483480
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>
484481
<b><?php eo($out_message)?></b>
485482
</div>
@@ -791,7 +788,7 @@ function loadsess(){
791788

792789
function print_export(){
793790
global $self,$xurl,$DB;
794-
$t=$_REQUEST['t'];
791+
$t=$_REQUEST['rt'];
795792
$l=($t)?"Table $t":"whole DB";
796793
print_header();
797794
?>
@@ -813,7 +810,7 @@ function print_export(){
813810
<div><label><input type="checkbox" name="gz" value="1"> compress as .gz</label></div>
814811
<br>
815812
<input type="hidden" name="doex" value="1">
816-
<input type="hidden" name="t" value="<?php eo($t)?>">
813+
<input type="hidden" name="rt" value="<?php eo($t)?>">
817814
<input type="submit" value=" Download "><input type="button" value=" Cancel " onclick="window.location='<?php eo($self.'?'.$xurl.'&db='.$DB['db'])?>'">
818815
</div>
819816
</center>
@@ -824,7 +821,7 @@ function print_export(){
824821

825822
function do_export(){
826823
global $DB,$VERSION,$D,$BOM,$ex_isgz,$dbh;
827-
$rt=str_replace('`','',$_REQUEST['t']);
824+
$rt=str_replace('`','',$_REQUEST['rt']);
828825
$t=explode(",",$rt);
829826
$th=array_flip($t);
830827
$ct=count($t);
@@ -1209,4 +1206,7 @@ function eo($s){//echo+escape
12091206
function b64e($s){
12101207
return base64_encode($s);
12111208
}
1209+
function b64d($s){
1210+
return base64_decode($s);
1211+
}
12121212
?>

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /