Jump to:
Screenshot
Attributes
Encoding
Version: 3.1.0beta2
File format: 4
TRACE START [2023-02-12 23:22:00.872549]
1 0 1 0.000136 393576
1 3 0 0.005255 1466168 {main} 1 /var/www/html/uploads/phpMinAdmin.php 0 0
2 4 0 0.005278 1466168 error_reporting 0 /var/www/html/uploads/phpMinAdmin.php 7 1 32759
2 4 1 0.005295 1466240
2 4 R 22527
2 5 0 0.005309 1466200 ini_get 0 /var/www/html/uploads/phpMinAdmin.php 14 1 'session.auto_start'
2 5 1 0.005324 1466232
2 5 R '0'
2 6 0 0.005338 1466200 session_name 0 /var/www/html/uploads/phpMinAdmin.php 14 1 'phpMinAdmin_SID'
2 6 1 0.005352 1466272
2 6 R 'PHPSESSID'
2 7 0 0.005367 1466200 preg_replace 0 /var/www/html/uploads/phpMinAdmin.php 14 3 '~\\?.*~' '' '/uploads/phpMinAdmin.php'
2 7 1 0.005407 1466296
2 7 R '/uploads/phpMinAdmin.php'
2 8 0 0.005424 1466200 session_set_cookie_params 0 /var/www/html/uploads/phpMinAdmin.php 14 2 0 '/uploads/phpMinAdmin.php'
2 8 1 0.005441 1466272
2 8 R TRUE
2 9 0 0.005454 1466200 session_start 0 /var/www/html/uploads/phpMinAdmin.php 14 0
2 9 1 0.005511 1466984
2 9 R TRUE
2 10 0 0.005525 1466984 get_magic_quotes_gpc 0 /var/www/html/uploads/phpMinAdmin.php 14 0
2 10 1 0.005538 1466984
2 10 R FALSE
1 3 1 0.005559 1467344
1 11 0 0.005568 1467376 Error->__toString 0 Unknown 0 0
2 12 0 0.005580 1467456 Error->getTraceAsString 0 Unknown 0 0
2 12 1 0.005592 1467712
2 12 R '#0 {main}'
1 11 1 0.005608 1468008
1 11 R 'Error: Call to undefined function set_magic_quotes_runtime() in /var/www/html/uploads/phpMinAdmin.php:15\nStack trace:\n#0 {main}'
0.005667 1388608
TRACE END [2023-02-12 23:22:00.878107]
<html><head></head><body></body></html>
<?php
/** phpMinAdmin - Compact MySQL management
* @link http://phpminadmin.sourceforge.net
* @author Jakub Vrana, http://php.vrana.cz
* @copyright 2007 Jakub Vrana
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
*/error_reporting(E_ALL&~E_NOTICE);if(isset($_GET["file"])){header("Expires: ".gmdate("D, d M Y H:i:s",filemtime(__FILE__)+365*24*60*60)." GMT");if($_GET["file"]=="favicon.ico"){header("Content-Type: image/x-icon");echo
base64_decode("AAABAAEAEBAQAAEABAAoAQAAFgAAACgAAAAQAAAAIAAAAAEABAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////AAAA/wBhTgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABEQAAAAAAERExAAAAARERExEAABERMREzMQABExMRERMRAAExMRETMRAAATERERMRAAABExERExAAAAETERExEAAAATERETERERARMRETESESEBMTETESEREQExEzESEREhETMxEREhERIREREAARISIRAAAAAAERERD/4z8A/wM/APgDAADAAwAAgAMAAIAHAACADwAAgB8AAIAfAACAAQAAAAEAAAABAAAAAAAAAAAAAAcAAAD/gQAA");}elseif($_GET["file"]=="default.css"){header("Content-Type: text/css");?>body{color:#000;background-color:#fff;line-height:1.25em;font-family:Verdana,Arial,Helvetica,sans-serif;margin:0;font-size:90%;}a{color:blue;}a:visited{color:navy;}a:hover{color:red;}h1{font-size:150%;margin:0;padding:.8em 1em;border-bottom:1px solid #999;font-weight:normal;background:#eee;font-style:italic;}h1 a:link,h1 a:visited{color:#777;text-decoration:none;}h2{font-size:150%;margin:0 0 20px -18px;padding:.8em 1em;border-bottom:1px solid #000;color:#000;font-weight:normal;background:#ddf;}h3{font-weight:normal;font-size:130%;margin:.8em 0;}table{margin:0 20px .8em 0;border:0;border-top:1px solid #999;border-left:1px solid #999;font-size:90%;}td,th{margin-bottom:1em;border:0;border-right:1px solid #999;border-bottom:1px solid #999;padding:.2em .3em;}th{background:#eee;}fieldset{display:inline;vertical-align:top;padding:.5em .8em;margin:0 .5em .5em 0;border:1px solid #999;}p{margin:0 20px 1em 0;}img{vertical-align:middle;}code{background-color:#eee;}.js .hidden{display:none;}.nowrap{white-space:nowrap;}.error{color:red;background:#fee;padding:.5em .8em;}.message{color:green;background:#efe;padding:.5em .8em;}.char{color:#007F00;}.date{color:#7F007F;}.enum{color:#007F7F;}.binary{color:red;}#menu{position:absolute;margin:10px 0 0;padding:0 0 30px 0;top:2em;left:0;width:19em;overflow:auto;overflow-y:hidden;white-space:nowrap;}#menu p{padding:.8em 1em;margin:0;border-bottom:1px solid #ccc;}#menu form{margin:0;}#content{margin:2em 0 0 21em;padding:10px 20px 20px 0;}#lang{position:absolute;top:0;left:0;line-height:1.8em;padding:.3em 1em;}#breadcrumb{position:absolute;top:0;left:21em;background:#eee;height:2em;line-height:1.8em;padding:0 1em;margin:0 0 0 -18px;}#schema{margin-left:60px;position:relative;}#schema .table{border:1px solid Silver;padding:0 2px;cursor:move;position:absolute;}#schema .references{position:absolute;}<?php
}else{header("Content-Type: image/gif");switch($_GET["file"]){case"arrow.gif":echo
base64_decode("R0lGODlhCAAKAIAAAICAgP///yH5BAEAAAEALAAAAAAIAAoAAAIPBIJplrGLnpQRqtOy3rsAADs=");break;case"up.gif":echo
base64_decode("R0lGODdhEgASAKEAAO7u7gAAAJmZmQAAACwAAAAAEgASAAACIISPqcvtD00IUU4K730T9J5hFTiKEXmaYcW2rgDH8hwXADs=");break;case"down.gif":echo
base64_decode("R0lGODdhEgASAKEAAO7u7gAAAJmZmQAAACwAAAAAEgASAAACIISPqcvtD00I8cwqKb5bV/5cosdMJtmcHca2lQDH8hwXADs=");break;case"plus.gif":echo
base64_decode("R0lGODdhEgASAKEAAO7u7gAAAJmZmQAAACwAAAAAEgASAAACIYSPqcvtD00I8cwqKb5v+q8pIAhxlRmhZYi17iPE8kzLBQA7");break;case"minus.gif":echo
base64_decode("R0lGODdhEgASAKEAAO7u7gAAAJmZmQAAACwAAAAAEgASAAACGYSPqcvtD6OcFIaLM8s81A+G4hgJ5ommZwEAOw==");break;}}exit;}if(!ini_get("session.auto_start")){session_name("phpMinAdmin_SID");session_set_cookie_params(0,preg_replace('~\\?.*~','',$_SERVER["REQUEST_URI"]));session_start();}if(get_magic_quotes_gpc()){$Y=array(&$_GET,&$_POST);while(list($f,$b)=each($Y)){foreach($b
as$la=>$Q){unset($Y[$f][$la]);if(is_array($Q)){$Y[$f][stripslashes($la)]=$Q;$Y[]=&$Y[$f][stripslashes($la)];}else{$Y[$f][stripslashes($la)]=stripslashes($Q);}}}unset($Y);}set_magic_quotes_runtime(false);$i=preg_replace('~^[^?]*/([^?]*).*~','\\1?',$_SERVER["REQUEST_URI"]).(strlen($_GET["server"])?'server='.urlencode($_GET["server"]).'&':'').(strlen($_GET["db"])?'db='.urlencode($_GET["db"]).'&':'');$TOKENS=&$_SESSION["tokens"][$_GET["server"]][$_SERVER["REQUEST_URI"]];function
a($N){return"`".str_replace("`","``",$N)."`";}function
ja($N){return
str_replace("``","`",$N);}function
j($N,$Oc=false){static$Vb=array(':'=>':1',']'=>':2','['=>':3');return
strtr($N,($Oc?array_flip($Vb):$Vb));}function
f($za,$Jc=null){$n="";foreach($za
as$la=>$Q){if(is_array($Q)){$n.='<optgroup label="'.htmlspecialchars($la).'">';}foreach((is_array($Q)?$Q:array($Q))as$b){$n.='<option'.($b===$Jc?' selected="selected"':'').'>'.htmlspecialchars($b).'</option>';}if(is_array($Q)){$n.='</optgroup>';}}return$n;}function
y($m){global$d;$n=array();$c=$d->b($m);if($c){while($a=$c->l()){$n[]=$a[0];}$c->d();}return$n;}function
o(){$n=&$_SESSION["databases"][$_GET["server"]];if(!isset($n)){flush();$n=y("SHOW DATABASES");}return$n;}function
ia($q){global$d;$c=$d->b("SHOW TABLE STATUS LIKE '".$d->c(addcslashes($q,"%_"))."'");$n=$c->e();$c->d();return$n;}function
n($q){global$d;$n=array();$c=$d->b("SHOW FULL COLUMNS FROM ".a($q));if($c){while($a=$c->e()){preg_match('~^([^( ]+)(?:\\((.+)\\))?( unsigned)?( zerofill)?$~',$a["Type"],$g);$n[$a["Field"]]=array("field"=>$a["Field"],"type"=>$g[1],"length"=>$g[2],"unsigned"=>ltrim($g[3].$g[4]),"default"=>(strlen($a["Default"])||ereg("char",$g[1])?$a["Default"]:null),"null"=>($a["Null"]=="YES"),"auto_increment"=>($a["Extra"]=="auto_increment"),"collation"=>$a["Collation"],"privileges"=>array_flip(explode(",",$a["Privileges"])),"comment"=>$a["Comment"],"primary"=>($a["Key"]=="PRI"),);}$c->d();}return$n;}function
w($q){global$d;$n=array();$c=$d->b("SHOW INDEX FROM ".a($q));if($c){while($a=$c->e()){$n[$a["Key_name"]]["type"]=($a["Key_name"]=="PRIMARY"?"PRIMARY":($a["Index_type"]=="FULLTEXT"?"FULLTEXT":($a["Non_unique"]?"INDEX":"UNIQUE")));$n[$a["Key_name"]]["columns"][$a["Seq_in_index"]]=$a["Column_name"];$n[$a["Key_name"]]["lengths"][$a["Seq_in_index"]]=$a["Sub_part"];}$c->d();}return$n;}function
x($q){global$d,$va;static$M='(?:[^`]+|``)+';$n=array();$c=$d->b("SHOW CREATE TABLE ".a($q));if($c){$Lc=$d->i($c,1);$c->d();preg_match_all("~CONSTRAINT `($M)` FOREIGN KEY \\(((?:`$M`,? ?)+)\\) REFERENCES `($M)`(?:\\.`($M)`)? \\(((?:`$M`,? ?)+)\\)(?: ON DELETE (".implode("|",$va)."))?(?: ON UPDATE (".implode("|",$va)."))?~",$Lc,$B,PREG_SET_ORDER);foreach($B
as$g){preg_match_all("~`($M)`~",$g[2],$I);preg_match_all("~`($M)`~",$g[5],$ga);$n[$g[1]]=array("db"=>ja(strlen($g[4])?$g[3]:$g[4]),"table"=>ja(strlen($g[4])?$g[4]:$g[3]),"source"=>array_map('ja',$I[1]),"target"=>array_map('ja',$ga[1]),"on_delete"=>$g[6],"on_update"=>$g[7],);}}return$n;}function
pa($j){global$d;return
array("select"=>preg_replace('~^(?:[^`]+|`[^`]*`)* AS ~U','',$d->i($d->b("SHOW CREATE VIEW ".a($j)),1)));}function
bb($a,$u){foreach($u
as$o){if($o["type"]=="PRIMARY"||$o["type"]=="UNIQUE"){$n=array();foreach($o["columns"]as$f){if(!isset($a[$f])){continue
2;}$n[]=urlencode("where[".j($f)."]")."=".urlencode($a[$f]);}return$n;}}$n=array();foreach($a
as$f=>$b){$n[]=(isset($b)?urlencode("where[".j($f)."]")."=".urlencode($b):"null%5B%5D=".urlencode($f));}return$n;}function
aa($s){global$d;$n=array();foreach((array)$s["where"]as$f=>$b){$f=j($f,"back");$n[]=(preg_match('~^[A-Z0-9_]+\\(`(?:[^`]+|``)+`\\)$~',$f)?$f:a($f))." = BINARY '".$d->c($b)."'";}foreach((array)$s["null"]as$f){$f=j($f,"back");$n[]=(preg_match('~^[A-Z0-9_]+\\(`(?:[^`]+|``)+`\\)$~',$f)?$f:a($f))." IS NULL";}return$n;}function
ma($z){global$ka;return(preg_match("~^\\s*(?:$ka)(?:\\s*,\\s*(?:$ka))*\\s*\$~",$z)&&preg_match_all("~$ka~",$z,$B)?implode(",",$B[0]):preg_replace('~[^0-9,]~','',$z));}function
oa(){global$d;$n=array();$c=$d->b("SHOW COLLATION");while($a=$c->e()){if($a["Default"]&&$n[$a["Charset"]]){array_unshift($n[$a["Charset"]],$a["Collation"]);}else{$n[$a["Charset"]][]=$a["Collation"];}}$c->d();return$n;}function
va(){return($GLOBALS["TOKENS"][]=rand(1,1e6));}function
ab(){if($_POST["token"]&&($Z=array_search($_POST["token"],(array)$GLOBALS["TOKENS"]))!==false){unset($GLOBALS["TOKENS"][$Z]);return
true;}return
false;}function
p($v,$X=null){if(isset($X)){$_SESSION["messages"][]=$X;}ab();if(strlen(SID)){$v.=(strpos($v,"?")===false?"?":"&").SID;}header("Location: ".(strlen($v)?$v:"."));exit;}function
g($m,$v,$X,$Kc=true,$Mc=true,$kc=false){global$d,$k,$i;$Qb="sql-".count($_SESSION["messages"]);$gc=($m?" <a href='#$Qb' onclick=\"return !toggle('$Qb');\">".'SQL command'."</a><span id='$Qb' class='hidden'><br /><code class='jush-sql'>".htmlspecialchars($m).'</code> <a href="'.htmlspecialchars($i).'sql='.urlencode($m).'">'.'Edit'.'</a></span>':"");if($Mc){$kc=!$d->b($m);}if($kc){$k=htmlspecialchars($d->error).$gc;return
false;}if($Kc){p($v,$X.$gc);}return
true;}function
k($m=null){global$d;static$jc=array();if(!isset($m)){return
implode(";\n",$jc);}$jc[]=$m;return$d->b($m);}function
t($H=""){$H="($H|".session_name().")";return
preg_replace("~\\?$H=[^&]*&~",'?',preg_replace("~\\?$H=[^&]*\$|&$H=[^&]*~",'',$_SERVER["REQUEST_URI"]));}function
ka($Va){echo" ".($Va==$_GET["page"]?$Va+1:'<a href="'.htmlspecialchars(t("page").($Va?"&page=$Va":"")).'">'.($Va+1)."</a>");}function
la($f){if(isset($_POST["files"][$f])){$z=strlen($_POST["files"][$f]);return($z&&$z<4?intval($_POST["files"][$f]):base64_decode($_POST["files"][$f]));}return(!$_FILES[$f]||$_FILES[$f]["error"]?$_FILES[$f]["error"]:file_get_contents($_FILES[$f]["tmp_name"]));}function
ha($c){global$i;if(!$c->num_rows){echo"<p class='message'>".'No rows.'."</p>\n";}else{echo"<table border='1' cellspacing='0' cellpadding='2'>\n";$Ua=array();$u=array();$r=array();$fc=array();$W=array();for($h=0;$a=$c->l();$h++){if(!$h){echo"<thead><tr>";for($w=0;$w<count($a);$w++){$e=$c->_();if(strlen($e->orgtable)){if(!isset($u[$e->orgtable])){$u[$e->orgtable]=array();foreach(w($e->orgtable)as$o){if($o["type"]=="PRIMARY"){$u[$e->orgtable]=array_flip($o["columns"]);break;}}$r[$e->orgtable]=$u[$e->orgtable];}if(isset($r[$e->orgtable][$e->orgname])){unset($r[$e->orgtable][$e->orgname]);$u[$e->orgtable][$e->orgname]=$w;$Ua[$w]=$e->orgtable;}}if($e->charsetnr==63){$fc[$w]=true;}$W[$w]=$e->type;echo"<th>".htmlspecialchars($e->name)."</th>";}echo"</tr></thead>\n";}echo"<tr>";foreach($a
as$f=>$b){if(!isset($b)){$b="<i>NULL</i>";}else{if($fc[$f]&&preg_match('~[\\x80-\\xFF]~',$b)){$b="<i>".m(array('%d byte','%d bytes'),strlen($b))."</i>";}else{$b=(strlen(trim($b))?nl2br(htmlspecialchars($b)):" ");if($W[$f]==254){$b="<code>$b</code>";}}if(isset($Ua[$f])&&!$r[$Ua[$f]]){$ea="edit=".urlencode($Ua[$f]);foreach($u[$Ua[$f]]as$bb=>$w){$ea.="&where".urlencode("[".j($bb)."]")."=".urlencode($a[$w]);}$b='<a href="'.htmlspecialchars($i).$ea.'">'.$b.'</a>';}}echo"<td>$b</td>";}echo"</tr>\n";}echo"</table>\n";}$c->d();}function
za($xa,$z){preg_match("~^(.{0,$z})(.?)~su",$xa,$g);return
nl2br(htmlspecialchars($g[1])).($g[2]?"<em>...</em>":"");}function
ta(&$a){if($a["Engine"]=="InnoDB"){$a["Comment"]=preg_replace('~(?:(.+); )?InnoDB free: .*~','\\1',$a["Comment"]);}}function
ga($Y,$Ka=array()){while(list($f,$b)=each($Y)){if(is_array($b)){foreach($b
as$la=>$Q){$Y[$f."[$la]"]=$Q;}}elseif(!in_array($f,$Ka)){echo'<input type="hidden" name="'.htmlspecialchars($f).'" value="'.htmlspecialchars($b).'" />';}}}$La=array('en'=>'English','cs'=>'Čeština','sk'=>'Slovenčina','nl'=>'Nederlands','es'=>'Español','de'=>'Deutsch','zh'=>'简体中文','fr'=>'Français','it'=>'Italiano','et'=>'Eesti','ru'=>'Русский язык',);function
m($N,$ra=null){global$ba,$Tc;$Ha=$Tc[$N];if(is_array($Ha)&&$Ha){$Z=($ra==1?0:1);switch($ba){case'cs':$Z=($ra==1?0:(!$ra||$ra>=5?2:1));break;case'sk':$Z=($ra==1?0:(!$ra||$ra>=5?2:1));break;}$Ha=$Ha[$Z];}$ec=func_get_args();array_shift($ec);return
vsprintf((isset($Ha)?$Ha:$N),$ec);}function
eb(){global$ba,$La;echo"<form action=''>\n<div id='lang'>";ga($_GET,array('lang'));echo'Language'.": <select name='lang' onchange='this.form.submit();'>";foreach($La
as$hc=>$b){echo"<option value='$hc'".($ba==$hc?" selected='selected'":"").">$b</option>";}echo"</select>\n<noscript><div style='display: inline;'><input type='submit' value='".'Use'."' /></div></noscript>\n</div>\n</form>\n";}if(isset($_GET["lang"])){$_COOKIE["lang"]=$_GET["lang"];$_SESSION["lang"]=$_GET["lang"];}$ba="en";if(isset($La[$_COOKIE["lang"]])){setcookie("lang",$_GET["lang"],strtotime("+1 month"),preg_replace('~\\?.*~','',$_SERVER["REQUEST_URI"]));$ba=$_COOKIE["lang"];}elseif(isset($La[$_SESSION["lang"]])){$ba=$_SESSION["lang"];}else{$fb=array();preg_match_all('~([-a-z_]+)(;q=([0-9.]+))?~',strtolower($_SERVER["HTTP_ACCEPT_LANGUAGE"]),$B,PREG_SET_ORDER);foreach($B
as$g){$fb[str_replace("_","-",$g[1])]=(isset($g[3])?$g[3]:1);}arsort($fb);foreach($fb
as$f=>$ad){if(isset($La[$f])){$ba=$f;break;}$f=preg_replace('~-.*~','',$f);if(!isset($fb[$f])&&isset($La[$f])){$ba=$f;break;}}}function
h($Jb,$k="",$Ib=array(),$Ya=""){global$i,$ba;header("Content-Type: text/html; charset=utf-8");?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<meta name="robots" content="noindex" />
<title><?php echo$Jb.(strlen($Ya)?": ".htmlspecialchars($Ya):"")." - ".'phpMinAdmin'." 1.10.0";?></title>
<link rel="shortcut icon" type="image/x-icon" href="<?php echo
preg_replace("~\\?.*~","",$_SERVER["REQUEST_URI"])."?file=favicon.ico";?>" />
<link rel="stylesheet" type="text/css" href="<?php echo(file_exists("phpMinAdmin.css")?"phpMinAdmin.css":"".preg_replace("~\\?.*~","",$_SERVER["REQUEST_URI"])."?file=default.css");?>" />
</head>
<body>
<script type="text/javascript">
document.body.className = 'js';
function toggle(id) {
var el = document.getElementById(id);
el.className = (el.className == 'hidden' ? '' : 'hidden');
return true;
}
</script>
<div id="content">
<?php
if(isset($Ib)){$ea=substr(preg_replace('~db=[^&]*&~','',$i),0,-1);echo'<p id="breadcrumb"><a href="'.(strlen($ea)?htmlspecialchars($ea):".").'">'.(isset($_GET["server"])?htmlspecialchars($_GET["server"]):'Server').'</a> » ';if(is_array($Ib)){if(strlen($_GET["db"])){echo'<a href="'.htmlspecialchars(substr($i,0,-1)).'">'.htmlspecialchars($_GET["db"]).'</a> » ';}foreach($Ib
as$f=>$b){if(strlen($b)){echo'<a href="'.htmlspecialchars("$i$f=").($f!="privileges"?urlencode($b):"").'">'.htmlspecialchars($b).'</a> » ';}}}echo"$Jb</p>\n";}echo"<h2>$Jb".(strlen($Ya)?": ".htmlspecialchars($Ya):"")."</h2>\n";if($_SESSION["messages"]){echo"<p class='message'>".implode("</p>\n<p class='message'>",$_SESSION["messages"])."</p>\n";$_SESSION["messages"]=array();}if(!$_SESSION["tokens"][$_GET["server"]]["?logout"]){$_SESSION["tokens"][$_GET["server"]]["?logout"]=rand(1,1e6);}$gb=&$_SESSION["databases"][$_GET["server"]];if(strlen($_GET["db"])&&$gb&&!in_array($_GET["db"],$gb,true)){$gb=null;}if(isset($gb)&&!isset($_GET["sql"])){session_write_close();}if($k){echo"<p class='error'>$k</p>\n";}}function
s($cc=false){global$i,$d;?>
</div>
<div id="menu">
<h1><a href="http://phpminadmin.sourceforge.net">phpMinAdmin</a></h1>
<?php if($cc!="auth"){?>
<form action="" method="post">
<p>
<a href="<?php echo
htmlspecialchars($i);?>sql=">SQL command</a>
<a href="<?php echo
htmlspecialchars($i);?>dump=<?php echo
urlencode(isset($_GET["table"])?$_GET["table"]:$_GET["select"]);?>">Dump</a>
<input type="hidden" name="token" value="<?php echo$_SESSION["tokens"][$_GET["server"]]["?logout"];?>" />
<input type="submit" name="logout" value="Logout" />
</p>
</form>
<form action="">
<p><?php if(strlen($_GET["server"])){?><input type="hidden" name="server" value="<?php echo
htmlspecialchars($_GET["server"]);?>" /><?php }?>
<?php if(o()){?>
<select name="db" onchange="this.form.submit();"><option value="">(database)</option><?php echo
f(o(),$_GET["db"]);?></select>
<?php }else{?>
<input name="db" value="<?php echo
htmlspecialchars($_GET["db"]);?>" /> <input type="submit" value="Use" />
<?php }?>
<?php if(isset($_GET["sql"])){?><input type="hidden" name="sql" value="" /><?php }?>
<?php if(isset($_GET["schema"])){?><input type="hidden" name="schema" value="" /><?php }?>
<?php if(isset($_GET["dump"])){?><input type="hidden" name="dump" value="" /><?php }?>
</p>
<?php if(o()){?>
<noscript><p><input type="submit" value="Use" /></p></noscript>
<?php }?>
</form>
<?php
if($cc!="db"&&strlen($_GET["db"])){$c=$d->b("SHOW TABLE STATUS");if(!$c->num_rows){echo"<p class='message'>".'No tables.'."</p>\n";}else{echo"<p>\n";while($a=$c->e()){echo'<a href="'.htmlspecialchars($i).'select='.urlencode($a["Name"]).'">'.'select'.'</a> ';echo'<a href="'.htmlspecialchars($i).(isset($a["Rows"])?'table':'view').'='.urlencode($a["Name"]).'">'.htmlspecialchars($a["Name"])."</a><br />\n";}echo"</p>\n";}echo'<p><a href="'.htmlspecialchars($i).'create=">'.'Create new table'."</a></p>\n";$c->d();}}?>
</div>
<?php if($_COOKIE["highlight"]=="jush"){?>
<script type="text/javascript" src="http://jush.sourceforge.net/jush.js"></script>
<script type="text/javascript">
if (typeof jush != 'undefined') {
jush.style('http://jush.sourceforge.net/jush.css');
jush.highlight_tag('pre');
jush.highlight_tag('code');
}
</script>
<?php }?>
</body>
</html>
<?php
}if(extension_loaded("mysqli")){class
Min_MySQLi
extends
MySQLi{var$extension="MySQLi";function
Min_MySQLi(){$this->init();}function
da($P,$_,$sa){list($Uc,$Ub)=explode(":",$P,2);return@$this->real_connect((strlen($P)?$Uc:ini_get("mysqli.default_host")),(strlen("$P$_")?$_:ini_get("mysqli.default_user")),(strlen("$P$_$sa")?$sa:ini_get("mysqli.default_pw")),null,(strlen($Ub)?$Ub:ini_get("mysqli.default_port")));}function
i($c,$e=0){if(!$c){return
false;}$a=$c->_result->fetch_array();return$a[$e];}function
u($Sa){return
parent::select_db($Sa);}function
b($m){$c=parent::query($m);return(is_object($c)?new
Min_MySQLiResult($c):$c);}function
q($m){return
parent::multi_query($m);}function
r(){$c=parent::store_result();return(is_object($c)?new
Min_MySQLiResult($c):$c);}function
v(){return
parent::next_result();}function
c($xa){return
parent::escape_string($xa);}}class
Min_MySQLiResult{var$_result,$num_rows;function
__construct($c){$this->_result=$c;$this->num_rows=$c->num_rows;}function
e(){return$this->_result->fetch_assoc();}function
l(){return$this->_result->fetch_row();}function
_(){return$this->_result->fetch_field();}function
d(){return$this->_result->free();}}$d=new
Min_MySQLi;}elseif(extension_loaded("mysql")){class
Min_MySQL{var$extension="MySQL",$_link,$_result,$server_info,$affected_rows,$error;function
da($P,$_,$sa){$this->_link=@mysql_connect((strlen($P)?$P:ini_get("mysql.default_host")),(strlen("$P$_")?$_:ini_get("mysql.default_user")),(strlen("$P$_$sa")?$sa:ini_get("mysql.default_password")),131072);if($this->_link){$this->server_info=mysql_get_server_info($this->_link);}return(bool)$this->_link;}function
u($Sa){return
mysql_select_db($Sa,$this->_link);}function
b($m){$c=mysql_query($m,$this->_link);if(!$c){$this->error=mysql_error($this->_link);return
false;}elseif($c===true){$this->affected_rows=mysql_affected_rows($this->_link);return
true;}return
new
Min_MySQLResult($c);}function
q($m){return$this->_result=$this->b($m);}function
r(){return$this->_result;}function
v(){return
false;}function
i($c,$e=0){if(!$c){return
false;}return
mysql_result($c->_result,0,$e);}function
c($xa){return
mysql_real_escape_string($xa,$this->_link);}}class
Min_MySQLResult{var$_result,$_offset=0,$num_rows;function
Min_MySQLResult($c){$this->_result=$c;$this->num_rows=mysql_num_rows($c);}function
e(){return
mysql_fetch_assoc($this->_result);}function
l(){return
mysql_fetch_row($this->_result);}function
_(){$a=mysql_fetch_field($this->_result,$this->_offset++);$a->orgtable=$a->table;$a->orgname=$a->name;$a->charsetnr=($a->blob?63:0);return$a;}function
d(){return
mysql_free_result($this->_result);}}$d=new
Min_MySQL;}elseif(extension_loaded("pdo_mysql")){class
Min_PDO_MySQL
extends
PDO{var$extension="PDO_MySQL",$_result,$server_info,$affected_rows,$error;function
__construct(){}function
da($P,$_,$sa){set_exception_handler('_a');parent::__construct("mysql:host=".str_replace(":",";port=",$P),$_,$sa);restore_exception_handler();$this->setAttribute(13,array('Min_PDOStatement'));$this->server_info=$this->i($this->b("SELECT VERSION()"));return
true;}function
u($Sa){return$this->b("USE ".a($Sa));}function
b($m){$c=parent::query($m);if(!$c){$Yc=$this->errorInfo();$this->error=$Yc[2];return
false;}$this->_result=$c;if(!$c->columnCount()){$this->affected_rows=$c->rowCount();return
true;}$c->num_rows=$c->rowCount();return$c;}function
q($m){return$this->b($m);}function
r(){return($this->_result->columnCount()?$this->_result:true);}function
v(){return$this->_result->nextRowset();}function
i($c,$e=0){if(!$c){return
false;}$a=$c->fetch();return$a[$e];}function
c($xa){return
substr($this->quote($xa),1,-1);}}class
Min_PDOStatement
extends
PDOStatement{var$_offset=0,$num_rows;function
e(){return$this->fetch(2);}function
l(){return$this->fetch(3);}function
_(){$a=(object)$this->getColumnMeta($this->_offset++);$a->orgtable=$a->table;$a->orgname=$a->name;$a->charsetnr=(in_array("blob",$a->flags)?63:0);return$a;}function
d(){}}$d=new
Min_PDO_MySQL;}else{h('No MySQL extension',sprintf('None of supported PHP extensions (%s) are available.','MySQLi, MySQL, PDO_MySQL'),null);s("auth");exit;}$Ka=array("server","username","password");if(ini_get("session.use_trans_sid")&&isset($_POST[session_name()])){$Ka[]=session_name();}if(isset($_POST["server"])){if(isset($_COOKIE[session_name()])||isset($_POST[session_name()])){session_regenerate_id();$_SESSION["usernames"][$_POST["server"]]=$_POST["username"];$_SESSION["passwords"][$_POST["server"]]=$_POST["password"];if(count($_POST)==count($Ka)){$v=((string)$_GET["server"]===$_POST["server"]?t():preg_replace('~^[^?]*/([^?]*).*~','\\1',$_SERVER["REQUEST_URI"]).(strlen($_POST["server"])?'?server='.urlencode($_POST["server"]):''));if(!isset($_COOKIE[session_name()])){$v.=(strpos($v,"?")===false?"?":"&").SID;}header("Location: ".(strlen($v)?$v:"."));exit;}}$_GET["server"]=$_POST["server"];}elseif(isset($_POST["logout"])){if($_POST["token"]!=$_SESSION["tokens"][$_GET["server"]]["?logout"]){h('Logout','Invalid CSRF token. Send the form again.');s("db");exit;}else{unset($_SESSION["usernames"][$_GET["server"]]);unset($_SESSION["passwords"][$_GET["server"]]);unset($_SESSION["databases"][$_GET["server"]]);$_SESSION["tokens"][$_GET["server"]]=array();p(substr($i,0,-1),'Logout successful.');}}function
_a(){global$Ka;$_=$_SESSION["usernames"][$_GET["server"]];if($_POST["token"]&&!isset($_)){$_POST["token"]=va();}unset($_SESSION["usernames"][$_GET["server"]]);h('Login',(isset($_)?'Invalid credentials.':(isset($_POST["server"])?'Sessions must be enabled.':($_POST?'Session expired, please login again.':""))),null);?>
<form action="" method="post">
<table border="0" cellspacing="0" cellpadding="2">
<tr><th>Server</th><td><input name="server" value="<?php echo
htmlspecialchars($_GET["server"]);?>" /></td></tr>
<tr><th>Username</th><td><input name="username" value="<?php echo
htmlspecialchars($_);?>" /></td></tr>
<tr><th>Password</th><td><input type="password" name="password" /></td></tr>
</table>
<p>
<?php
ga($_POST,$Ka);foreach($_FILES
as$f=>$b){echo'<input type="hidden" name="files['.htmlspecialchars($f).']" value="'.($b["error"]?$b["error"]:base64_encode(file_get_contents($b["tmp_name"]))).'" />';}?>
<input type="submit" value="Login" />
</p>
</form>
<?php
s("auth");}$_=&$_SESSION["usernames"][$_GET["server"]];if(!isset($_)){$_=$_GET["username"];}if(!isset($_)||!$d->da($_GET["server"],$_,$_SESSION["passwords"][$_GET["server"]])){_a();exit;}unset($_);$d->b("SET SQL_QUOTE_SHOW_CREATE=1");if(!(strlen($_GET["db"])?$d->u($_GET["db"]):isset($_GET["sql"])||isset($_GET["dump"])||isset($_GET["database"])||isset($_GET["processlist"])||isset($_GET["privileges"])||isset($_GET["user"]))){if(strlen($_GET["db"])){unset($_SESSION["databases"][$_GET["server"]]);}if(strlen($_GET["db"])){h('Database'.": ".htmlspecialchars($_GET["db"]),'Invalid database.',false);}else{h('Select database',"",null);echo'<p><a href="'.htmlspecialchars($i).'database=">'.'Create new database'."</a></p>\n";echo'<p><a href="'.htmlspecialchars($i).'privileges=">'.'Privileges'."</a></p>\n";echo'<p><a href="'.htmlspecialchars($i).'processlist=">'.'Process list'."</a></p>\n";echo"<p>".sprintf('MySQL version: %s through PHP extension %s',"<b>$d->server_info</b>","<b>$d->extension</b>")."</p>\n";echo"<p>".sprintf('Logged as: %s',"<b>".htmlspecialchars($d->i($d->b("SELECT USER()")))."</b>")."</p>\n";}s("db");exit;}$d->b("SET CHARACTER SET utf8");function
xa($j,$e,$p){global$W;$j=htmlspecialchars(j($j));if($e["type"]=="enum"){if(isset($_GET["select"])){echo' <label><input type="radio" name="fields['.$j.']" value="-1" checked="checked" /><em>'.'original'.'</em></label>';}if($e["null"]||isset($_GET["default"])){echo' <label><input type="radio" name="fields['.$j.']" value=""'.(($e["null"]?isset($p):strlen($p))||isset($_GET["select"])?'':' checked="checked"').' />'.($e["null"]?'<em>NULL</em>':'').'</label>';}if(!isset($_GET["default"])){echo'<input type="radio" name="fields['.$j.']" value="0"'.($p===0?' checked="checked"':'').' />';}preg_match_all("~'((?:[^']+|'')*)'~",$e["length"],$B);foreach($B[1]as$h=>$b){$b=stripcslashes(str_replace("''","'",$b));$Qa=(is_int($p)?$p==$h+1:$p===$b);echo' <label><input type="radio" name="fields['.$j.']" value="'.(isset($_GET["default"])?(strlen($b)?htmlspecialchars($b):" "):$h+1).'"'.($Qa?' checked="checked"':'').' />'.htmlspecialchars($b).'</label>';}}else{$Nb=($e["null"]||isset($_GET["default"]))+isset($_GET["select"]);$mb=($Nb?' onchange="var f = this.form[\'function['.addcslashes($j,"\r\n'\\").']\']; if ('.$Nb.' > f.selectedIndex) f.selectedIndex = '.$Nb.';"':'');$za=array("");if(!isset($_GET["default"])){if(preg_match('~char|date|time~',$e["type"])){$za=(preg_match('~char~',$e["type"])?array("","md5","sha1","password","uuid"):array("","now"));}if(!isset($_GET["clone"])&&!isset($_GET["call"])&&preg_match('~int|float|double|decimal~',$e["type"])){$za=array("","+","-");}}if($e["null"]||isset($_GET["default"])){array_unshift($za,"NULL");}if(count($za)>1||isset($_GET["select"])){echo'<select name="function['.$j.']">'.(isset($_GET["select"])?'<option value="orig">'.'original'.'</option>':'').f($za,(isset($p)?(string)$_POST["function"][$j]:null)).'</select>';}if($e["type"]=="set"){preg_match_all("~'((?:[^']+|'')*)'~",$e["length"],$B);foreach($B[1]as$h=>$b){$b=stripcslashes(str_replace("''","'",$b));$Qa=(is_int($p)?($p>>$h)&1:in_array($b,explode(",",$p),true));echo' <label><input type="checkbox" name="fields['.$j.']['.$h.']" value="'.(isset($_GET["default"])?htmlspecialchars($b):1<<$h).'"'.($Qa?' checked="checked"':'').$mb.' />'.htmlspecialchars($b).'</label>';}}elseif(strpos($e["type"],"text")!==false){echo'<textarea name="fields['.$j.']" cols="50" rows="12"'.$mb.'>'.htmlspecialchars($p).'</textarea>';}elseif(preg_match('~binary|blob~',$e["type"])){echo(ini_get("file_uploads")?'<input type="file" name="'.$j.'"'.$mb.' />':'File uploads are disabled.'.' ');}else{echo'<input name="fields['.$j.']" value="'.htmlspecialchars($p).'"'.(preg_match('~^([0-9]+)(,([0-9]+))?$~',$e["length"],$g)?" maxlength='".($g[1]+($g[3]?1:0)+($g[2]&&!$e["unsigned"]?1:0))."'":($W[$e["type"]]?" maxlength='".$W[$e["type"]]."'":'')).$mb.' />';}}}function
ba($j,$e){global$d;$N=j($j);$ha=$_POST["function"][$N];$p=$_POST["fields"][$N];if($e["type"]=="enum"?$p==-1:$ha=="orig"){return
false;}elseif($e["type"]=="enum"||$e["auto_increment"]?!strlen($p):$ha=="NULL"){return"NULL";}elseif($e["type"]=="enum"){return(isset($_GET["default"])?"'".$d->c($p)."'":intval($p));}elseif($e["type"]=="set"){return(isset($_GET["default"])?"'".implode(",",array_map(array($d,'escape_string'),(array)$p))."'":array_sum((array)$p));}elseif(preg_match('~binary|blob~',$e["type"])){$ua=la($N);if(!is_string($ua)){return
false;}return"_binary'".(is_string($ua)?$d->c($ua):"")."'";}elseif($e["type"]=="timestamp"&&$p=="CURRENT_TIMESTAMP"){return$p;}elseif(preg_match('~^(now|uuid)$~',$ha)){return"$ha()";}elseif(preg_match('~^(\\+|-)$~',$ha)){return
a($j)." $ha '".$d->c($p)."'";}elseif(preg_match('~^(md5|sha1|password)$~',$ha)){return"$ha('".$d->c($p)."')";}else{return"'".$d->c($p)."'";}}function
wa($f,$e,$O){global$W,$jb,$_a;?>
<td><select name="<?php echo$f;?>[type]" onchange="type_change(this);"><?php echo
f(array_keys($W),$e["type"]);?></select></td>
<td><input name="<?php echo$f;?>[length]" value="<?php echo
htmlspecialchars($e["length"]);?>" size="3" /></td>
<td><select name="<?php echo$f;?>[collation]"<?php echo(preg_match('~char|text|enum|set~',$e["type"])?"":" class='hidden'");?>><option value="">(collation)</option><?php echo
f($O,$e["collation"]);?></select> <select name="<?php echo$f;?>[unsigned]"<?php echo(!$e["type"]||preg_match('~int|float|double|decimal~',$e["type"])?"":" class='hidden'");?>><?php echo
f($jb,$e["unsigned"]);?></select></td>
<?php
}function
ca($e,$Ca="COLLATE"){global$d,$ka,$jb;return" $e[type]".($e["length"]&&!preg_match('~^date|time$~',$e["type"])?"(".ma($e["length"]).")":"").(preg_match('~int|float|double|decimal~',$e["type"])&&in_array($e["unsigned"],$jb)?" $e[unsigned]":"").(preg_match('~char|text|enum|set~',$e["type"])&&$e["collation"]?" $Ca '".$d->c($e["collation"])."'":"");}function
ya($l,$O,$U="TABLE"){global$_a;?>
<tr>
<?php if($U=="PROCEDURE"){?><td>IN-OUT</td><?php }?>
<th><?php echo($U=="TABLE"?'Column name':'Parameter name');?></th>
<td>Type</td>
<td>Length</td>
<td>Options</td>
<?php if($U=="TABLE"){?>
<td>NULL</td>
<td><input type="radio" name="auto_increment_col" value="" />Auto Increment</td>
<td>Comment</td>
<?php }?>
<td><input type="image" name="add[0]" src="<?php echo
preg_replace("~\\?.*~","",$_SERVER["REQUEST_URI"])."?file=plus.gif";?>" title="Add next" /></td>
</tr>
<?php
$Wa=false;foreach($l
as$h=>$e){$h++;$Xb=(isset($_POST["add"][$h-1])||(isset($e["field"])&&!$_POST["drop_col"][$h]));?>
<tr<?php echo($Xb?"":" style='display: none;'");?>>
<?php if($U=="PROCEDURE"){?><td><select name="fields[<?php echo$h;?>][inout]"><?php echo
f($_a,$e["inout"]);?></select></td><?php }?>
<th><?php if($Xb){?><input name="fields[<?php echo$h;?>][field]" value="<?php echo
htmlspecialchars($e["field"]);?>" maxlength="64" /><?php }?><input type="hidden" name="fields[<?php echo$h;?>][orig]" value="<?php echo
htmlspecialchars($e[($_POST?"orig":"field")]);?>" /></th>
<?php wa("fields[$h]",$e,$O);?>
<?php if($U=="TABLE"){?>
<td><input type="checkbox" name="fields[<?php echo$h;?>][null]" value="1"<?php if($e["null"]){?> checked="checked"<?php }?> /></td>
<td><input type="radio" name="auto_increment_col" value="<?php echo$h;?>"<?php if($e["auto_increment"]){?> checked="checked"<?php }?> /></td>
<td><input name="fields[<?php echo$h;?>][comment]" value="<?php echo
htmlspecialchars($e["comment"]);?>" maxlength="255" /></td>
<?php }?>
<td class="nowrap">
<input type="image" name="add[<?php echo$h;?>]" src="<?php echo
preg_replace("~\\?.*~","",$_SERVER["REQUEST_URI"])."?file=plus.gif";?>" title="Add next" onclick="return !add_row(this);" />
<input type="image" name="drop_col[<?php echo$h;?>]" src="<?php echo
preg_replace("~\\?.*~","",$_SERVER["REQUEST_URI"])."?file=minus.gif";?>" title="Remove" onclick="return !remove_row(this);" />
<input type="image" name="up[<?php echo$h;?>]" src="<?php echo
preg_replace("~\\?.*~","",$_SERVER["REQUEST_URI"])."?file=up.gif";?>" title="Move up" />
<input type="image" name="down[<?php echo$h;?>]" src="<?php echo
preg_replace("~\\?.*~","",$_SERVER["REQUEST_URI"])."?file=down.gif";?>" title="Move down" />
</td>
</tr>
<?php
if(strlen($e["comment"])){$Wa=true;}}return$Wa;}function
ua(&$l){ksort($l);$aa=0;if($_POST["up"]){$qc=0;foreach($l
as$f=>$e){if(key($_POST["up"])==$f){unset($l[$f]);array_splice($l,$qc,0,array($e));break;}if(isset($e["field"])){$qc=$aa;}$aa++;}}if($_POST["down"]){$Mb=false;foreach($l
as$f=>$e){if(isset($e["field"])&&$Mb){unset($l[key($_POST["down"])]);array_splice($l,$aa,0,array($Mb));break;}if(key($_POST["down"])==$f){$Mb=$e;}$aa++;}}$l=array_values($l);if($_POST["add"]){array_splice($l,key($_POST["add"]),0,array(array()));}}function
sa($Vc,$Bc=0){?>
<script type="text/javascript">// <![CDATA[
var added = '.';
var row_count = <?php echo$Vc;?>;
function add_row(button) {
if (<?php echo$Bc;?> && row_count >= <?php echo$Bc;?>) {
return false;
}
var match = /([0-9]+)(\.[0-9]+)?/.exec(button.name)
var x = match[0] + (match[2] ? added.substr(match[2].length) : added) + '1';
var row = button.parentNode.parentNode;
var row2 = row.cloneNode(true);
var tags = row.getElementsByTagName('select');
var tags2 = row2.getElementsByTagName('select');
for (var i=0; tags.length > i; i++) {
tags[i].name = tags[i].name.replace(/([0-9.]+)/, x);
tags2[i].selectedIndex = tags[i].selectedIndex;
}
tags = row.getElementsByTagName('input');
for (var i=0; tags.length > i; i++) {
if (tags[i].name == 'auto_increment_col') {
tags[i].value = x;
tags[i].checked = false;
}
tags[i].name = tags[i].name.replace(/([0-9.]+)/, x);
if (/\[(orig|field|comment)/.test(tags[i].name)) {
tags[i].value = '';
}
}
row.parentNode.insertBefore(row2, row);
tags[0].focus();
added += '0';
row_count++;
return true;
}
function remove_row(button) {
var field = button.form[button.name.replace(/drop_col(.+)/, 'fields$1[field]')];
field.parentNode.removeChild(field);
button.parentNode.parentNode.style.display = 'none';
return true;
}
function type_change(type) {
var name = type.name.substr(0, type.name.length - 6);
for (var i=0; i < type.form.elements.length; i++) {
var el = type.form.elements[i];
if (el.name == name + '[collation]') {
el.className = (/char|text|enum|set/.test(type.options[type.selectedIndex].text) ? '' : 'hidden');
}
if (el.name == name + '[unsigned]') {
el.className = (/int|float|double|decimal/.test(type.options[type.selectedIndex].text) ? '' : 'hidden');
}
}
}
// ]]></script>
<?php
}function
db($g){return"'".str_replace("'","''",addcslashes(stripcslashes(str_replace($g[0]{0}.$g[0]{0},$g[0]{0},substr($g[0],1,-1))),'\\'))."'";}function
qa($j,$U){global$d,$ka,$_a;$Ic=array("bit"=>"tinyint","bool"=>"tinyint","boolean"=>"tinyint","integer"=>"int","double precision"=>"float","real"=>"float","dec"=>"decimal","numeric"=>"decimal","fixed"=>"decimal","national char"=>"char","national varchar"=>"varchar");$Fc="([a-z]+)(?:\\s*\\(((?:[^'\")]*|$ka)+)\\))?\\s*(zerofill\\s*)?(unsigned(?:\\s+zerofill)?)?(?:\\s*(?:CHARSET|CHARACTER\\s+SET)\\s*['\"]?([^'\"\\s]+)['\"]?)?";$M="\\s*(".($U=="FUNCTION"?"":implode("|",$_a)).")?\\s*(?:`((?:[^`]+|``)*)`\\s*|\\b(\\S+)\\s+)$Fc";$E=$d->i($d->b("SHOW CREATE $U ".a($j)),2);preg_match("~\\(((?:$M\\s*,?)*)\\)".($U=="FUNCTION"?"\\s*RETURNS\\s+$Fc":"")."\\s*(.*)~is",$E,$g);$l=array();preg_match_all("~$M\\s*,?~is",$g[1],$B,PREG_SET_ORDER);foreach($B
as$h=>$H){$Kb=strtolower($H[4]);$l[$h]=array("field"=>str_replace("``","`",$H[2]).$H[3],"type"=>(isset($Ic[$Kb])?$Ic[$Kb]:$Kb),"length"=>preg_replace_callback("~$ka~s",'db',$H[5]),"unsigned"=>strtolower(preg_replace('~\\s+~',' ',trim("$H[7] $H[6]"))),"inout"=>strtoupper($H[1]),"collation"=>strtolower($H[8]),);}if($U!="FUNCTION"){return
array("fields"=>$l,"definition"=>$g[10]);}$Xc=array("type"=>$g[10],"length"=>$g[11],"unsigned"=>$g[13],"collation"=>$g[14]);return
array("fields"=>$l,"returns"=>$Xc,"definition"=>$g[15]);}function
na($a){foreach($a
as$f=>$b){if(preg_match("~[\"\n,]~",$b)||(isset($b)&&!strlen($b))){$a[$f]='"'.str_replace('"','""',$b).'"';}}echo
implode(",",$a)."\n";}function
fa($q,$A,$Gb=false){global$d,$W;if($_POST["format"]=="csv"){echo"\xef\xbb\xbf";if($A){na(array_keys(n($q)));}}elseif($A){$c=$d->b("SHOW CREATE TABLE ".a($q));if($c){if($A=="DROP, CREATE"){echo"DROP ".($Gb?"VIEW":"TABLE")." IF EXISTS ".a($q).";\n";}$E=$d->i($c,1);$c->d();echo($A!="CREATE, ALTER"?$E:($Gb?substr_replace($E," OR REPLACE",6,0):substr_replace($E," IF NOT EXISTS",12,0))).";\n\n";}if($d->server_info>=5){if($A=="CREATE, ALTER"&&!$Gb){$m="SELECT COLUMN_NAME, COLUMN_DEFAULT, IS_NULLABLE, COLLATION_NAME, COLUMN_TYPE, EXTRA, COLUMN_COMMENT FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = '".$d->c($q)."' ORDER BY ORDINAL_POSITION";?>
DELIMITER ;;
CREATE PROCEDURE phpminadmin_alter () BEGIN
DECLARE _column_name, _collation_name, _column_type, after varchar(64) DEFAULT '';
DECLARE _column_default longtext;
DECLARE _is_nullable char(3);
DECLARE _extra varchar(20);
DECLARE _column_comment varchar(255);
DECLARE done, set_after bool DEFAULT 0;
DECLARE add_columns text DEFAULT '<?php
$l=array();$c=$d->b($m);$na="";while($a=$c->e()){$a["default"]=(isset($a["COLUMN_DEFAULT"])?"'".$d->c($a["COLUMN_DEFAULT"])."'":"NULL");$a["after"]=$d->c($na);$a["alter"]=$d->c(a($a["COLUMN_NAME"])." $a[COLUMN_TYPE]".($a["COLLATION_NAME"]?" COLLATE $a[COLLATION_NAME]":"").(isset($a["COLUMN_DEFAULT"])?" DEFAULT $a[default]":"").($a["IS_NULLABLE"]=="YES"?"":" NOT NULL").($a["EXTRA"]?" $a[EXTRA]":"").($a["COLUMN_COMMENT"]?" COMMENT '".$d->c($a["COLUMN_COMMENT"])."'":"").($na?" AFTER ".a($na):" FIRST"));echo", ADD $a[alter]";$l[]=$a;$na=$a["COLUMN_NAME"];}$c->d();?>';
DECLARE columns CURSOR FOR <?php echo$m;?>;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
SET @alter_table = '';
OPEN columns;
REPEAT
FETCH columns INTO _column_name, _column_default, _is_nullable, _collation_name, _column_type, _extra, _column_comment;
IF NOT done THEN
SET set_after = 1;
CASE _column_name<?php
foreach($l
as$a){echo"
WHEN '".$d->c($a["COLUMN_NAME"])."' THEN
SET add_columns = REPLACE(add_columns, ', ADD $a[alter]', '');
IF NOT (_column_default <=> $a[default]) OR _is_nullable != '$a[IS_NULLABLE]' OR _collation_name != '$a[COLLATION_NAME]' OR _column_type != '$a[COLUMN_TYPE]' OR _extra != '$a[EXTRA]' OR _column_comment != '".$d->c($a["COLUMN_COMMENT"])."' OR after != '$a[after]' THEN
SET @alter_table = CONCAT(@alter_table, ', MODIFY $a[alter]');
END IF;";}?>
ELSE
SET @alter_table = CONCAT(@alter_table, ', DROP ', _column_name);
SET set_after = 0;
END CASE;
IF set_after THEN
SET after = _column_name;
END IF;
END IF;
UNTIL done END REPEAT;
CLOSE columns;
IF @alter_table != '' OR add_columns != '' THEN
SET @alter_table = CONCAT('ALTER TABLE <?php echo
a($q);?>', SUBSTR(CONCAT(add_columns, @alter_table), 2));
PREPARE alter_command FROM @alter_table;
EXECUTE alter_command;
DROP PREPARE alter_command;
END IF;
END;;
DELIMITER ;
CALL phpminadmin_alter;
DROP PROCEDURE phpminadmin_alter;
<?php
}$c=$d->b("SHOW TRIGGERS LIKE '".$d->c(addcslashes($q,"%_"))."'");if($c->num_rows){echo"DELIMITER ;;\n\n";while($a=$c->e()){echo"CREATE TRIGGER ".a($a["Trigger"])." $a[Timing] $a[Event] ON ".a($a["Table"])." FOR EACH ROW $a[Statement];;\n\n";}echo"DELIMITER ;\n\n";}$c->d();}}}function
ea($q,$A,$ma=""){global$d,$Hb;if($A){if($_POST["format"]!="csv"&&$A=="TRUNCATE, INSERT"){echo"TRUNCATE ".a($q).";\n";}$c=$d->b("SELECT * ".($ma?$ma:"FROM ".a($q)));if($c){$lb="INSERT INTO ".a($q)." VALUES ";$z=0;while($a=$c->e()){if($_POST["format"]=="csv"){na($a);}elseif($A=="UPDATE"){$t=array();foreach($a
as$f=>$b){$a[$f]=(isset($b)?"'".$d->c($b)."'":"NULL");$t[]=a($f)." = ".(isset($b)?"'".$d->c($b)."'":"NULL");}echo"INSERT INTO ".a($q)." (".implode(", ",array_map('a',array_keys($a))).") VALUES (".implode(", ",$a).") ON DUPLICATE KEY UPDATE ".implode(", ",$t).";\n";}else{foreach($a
as$f=>$b){$a[$f]=(isset($b)?"'".$d->c($b)."'":"NULL");}$Ia="(".implode(", ",$a).")";if(!$z){echo$lb,$Ia;$z=strlen($lb)+strlen($Ia);}else{$z+=2+strlen($Ia);if($z<$Hb){echo", ",$Ia;}else{echo";\n",$lb,$Ia;$z=strlen($lb)+strlen($Ia);}}}}if($_POST["format"]!="csv"&&$A!="UPDATE"&&$c->num_rows){echo";\n";}$c->d();}}}function
ra($rc,$Pc=false){$Pb=(strlen($rc)?preg_replace('~[^a-z0-9_]~i','-',$rc):"dump");$ya=($_POST["format"]=="sql"?"sql":($Pc?"tar":"csv"));header("Content-Type: ".($ya=="tar"?"application/x-tar":($ya=="sql"||$_POST["output"]!="file"?"text/plain":"text/csv"))."; charset=utf-8");header("Content-Disposition: ".($_POST["output"]=="file"?"attachment":"inline")."; filename=$Pb.$ya");return$ya;}$tc="<select name='output'><option value='text'>".'open'."</option><option value='file'>".'save'."</option></select>";$wc="<select name='format'><option value='sql'>".'SQL'."</option><option value='csv'>".'CSV'."</option></select>";$Hb=0;if(isset($_GET["download"])){header("Content-Type: application/octet-stream");echo$d->i($d->b("SELECT ".a($_GET["field"])." FROM ".a($_GET["download"])." WHERE ".implode(" AND ",aa($_GET))." LIMIT 1"));}else{$va=array("RESTRICT","CASCADE","SET NULL","NO ACTION");$W=array("tinyint"=>3,"smallint"=>5,"mediumint"=>8,"int"=>10,"bigint"=>20,"float"=>12,"double"=>21,"decimal"=>66,"date"=>10,"datetime"=>19,"timestamp"=>19,"time"=>10,"year"=>4,"char"=>255,"varchar"=>65535,"binary"=>255,"varbinary"=>65535,"tinytext"=>255,"text"=>65535,"mediumtext"=>16777215,"longtext"=>4294967295,"tinyblob"=>255,"blob"=>65535,"mediumblob"=>16777215,"longblob"=>4294967295,"enum"=>65535,"set"=>64,);$jb=array("","unsigned","zerofill","unsigned zerofill");$ka='\'(?:\'\'|[^\'\\\\]+|\\\\.)*\'|"(?:""|[^"\\\\]+|\\\\.)*"';$_a=array("IN","OUT","INOUT");$L=" onclick=\"return confirm('".'Are you sure?'."');\"";$k="";if(isset($_GET["table"])){$c=$d->b("SHOW COLUMNS FROM ".a($_GET["table"]));if(!$c){$k=htmlspecialchars($d->error);}h('Table'.": ".htmlspecialchars($_GET["table"]),$k);if($c){$Ob=ia($_GET["table"]);$vc=true;echo"<table border='1' cellspacing='0' cellpadding='2'>\n";while($a=$c->e()){if(!$a["auto_increment"]){$vc=false;}echo"<tr><th>".htmlspecialchars($a["Field"])."</th><td>$a[Type]".($a["Null"]=="YES"?" <i>NULL</i>":"")."</td></tr>\n";}echo"</table>\n";$c->d();echo"<p>";echo'<a href="'.htmlspecialchars($i).'create='.urlencode($_GET["table"]).'">'.'Alter table'.'</a>';echo($vc?'':' <a href="'.htmlspecialchars($i).'default='.urlencode($_GET["table"]).'">'.'Default values'.'</a>');echo' <a href="'.htmlspecialchars($i).'select='.urlencode($_GET["table"]).'">'.'Select table'.'</a>';echo' <a href="'.htmlspecialchars($i).'edit='.urlencode($_GET["table"]).'">'.'New item'.'</a>';echo"</p>\n";echo"<h3>".'Indexes'."</h3>\n";$u=w($_GET["table"]);if($u){echo"<table border='1' cellspacing='0' cellpadding='2'>\n";foreach($u
as$o){ksort($o["columns"]);$qa=array();foreach($o["columns"]as$f=>$b){$qa[]="<i>".htmlspecialchars($b)."</i>".($o["lengths"][$f]?"(".$o["lengths"][$f].")":"");}echo"<tr><td>$o[type]</td><td>".implode(", ",$qa)."</td></tr>\n";}echo"</table>\n";}echo'<p><a href="'.htmlspecialchars($i).'indexes='.urlencode($_GET["table"]).'">'.'Alter indexes'."</a></p>\n";if($Ob["Engine"]=="InnoDB"){echo"<h3>".'Foreign keys'."</h3>\n";$ia=x($_GET["table"]);if($ia){echo"<table border='1' cellspacing='0' cellpadding='2'>\n";foreach($ia
as$j=>$x){echo"<tr>";echo"<td><i>".implode("</i>, <i>",array_map('htmlspecialchars',$x["source"]))."</i></td>";$ea=(strlen($x["db"])?"<strong>".htmlspecialchars($x["db"])."</strong>.":"").htmlspecialchars($x["table"]);echo'<td><a href="'.htmlspecialchars(strlen($x["db"])?preg_replace('~db=[^&]*~',"db=".urlencode($x["db"]),$i):$i)."table=".urlencode($x["table"])."\">$ea</a>";echo"(<em>".implode("</em>, <em>",array_map('htmlspecialchars',$x["target"]))."</em>)</td>";echo'<td>'.(!strlen($x["db"])?'<a href="'.htmlspecialchars($i).'foreign='.urlencode($_GET["table"]).'&name='.urlencode($j).'">'.'Alter'.'</a>':' ').'</td>';echo"</tr>\n";}echo"</table>\n";}echo'<p><a href="'.htmlspecialchars($i).'foreign='.urlencode($_GET["table"]).'">'.'Add foreign key'."</a></p>\n";}}if($d->server_info>=5){echo"<h3>".'Triggers'."</h3>\n";$c=$d->b("SHOW TRIGGERS LIKE '".$d->c(addcslashes($_GET["table"],"%_"))."'");if($c->num_rows){echo"<table border='0' cellspacing='0' cellpadding='2'>\n";while($a=$c->e()){echo"<tr valign='top'><td>$a[Timing]</td><td>$a[Event]</td><th>".htmlspecialchars($a["Trigger"])."</th><td><a href=\"".htmlspecialchars($i).'trigger='.urlencode($_GET["table"]).'&name='.urlencode($a["Trigger"]).'">'.'Alter'."</a></td></tr>\n";}echo"</table>\n";}$c->d();echo'<p><a href="'.htmlspecialchars($i).'trigger='.urlencode($_GET["table"]).'">'.'Add trigger'."</a></p>\n";}}elseif(isset($_GET["view"])){h('View'.": ".htmlspecialchars($_GET["view"]));$Rb=pa($_GET["view"]);echo"<pre class='jush-sql'>".htmlspecialchars($Rb["select"])."</pre>\n";echo'<p><a href="'.htmlspecialchars($i).'createv='.urlencode($_GET["view"]).'">'.'Alter view'."</a></p>\n";}elseif(isset($_GET["schema"])){h('Database schema',"",array(),$_GET["db"]);$ca=array();$xc=array();preg_match_all('~([^:]+):([-0-9.]+)x([-0-9.]+)(_|$)~',$_COOKIE["schema"],$B,PREG_SET_ORDER);foreach($B
as$h=>$g){$ca[$g[1]]=array($g[2],$g[3]);$xc[]="\n\t'".addcslashes($g[1],"\r\n'\\")."': [ $g[2], $g[3] ]";}$Ga=0;$pc=-1;$da=array();$zc=array();$Cc=array();$c=$d->b("SHOW TABLE STATUS");while($a=$c->e()){if(!isset($a["Engine"])){continue;}$Z=0;$da[$a["Name"]]["fields"]=array();foreach(n($a["Name"])as$j=>$e){$Z+=1.25;$e["pos"]=$Z;$da[$a["Name"]]["fields"][$j]=$e;}$da[$a["Name"]]["pos"]=($ca[$a["Name"]]?$ca[$a["Name"]]:array($Ga,0));if($a["Engine"]=="InnoDB"){foreach(x($a["Name"])as$b){if(!$b["db"]){$F=$pc;if($ca[$a["Name"]][1]||$ca[$a["Name"]][1]){$F=min($ca[$a["Name"]][1],$ca[$b["table"]][1])-1;}else{$pc-=.1;}while($Cc[(string)$F]){$F-=.0001;}$da[$a["Name"]]["references"][$b["table"]][(string)$F]=array($b["source"],$b["target"]);$zc[$b["table"]][$a["Name"]][(string)$F]=$b["target"];$Cc[(string)$F]=true;}}}$Ga=max($Ga,$da[$a["Name"]]["pos"][0]+2.5+$Z);}$c->d();?>
<script type="text/javascript">
var that, x, y, em;
var table_pos = {<?php echo
implode(",",$xc)."\n";?>};
function mousedown(el, event) {
that = el;
em = document.getElementById('schema').offsetHeight / <?php echo$Ga;?>;
x = event.clientX - el.offsetLeft;
y = event.clientY - el.offsetTop;
}
document.onmousemove = function (ev) {
if (that !== undefined) {
ev = ev || event;
var left = (ev.clientX - x) / em;
var top = (ev.clientY - y) / em;
var divs = that.getElementsByTagName('div');
var line_set = { };
for (var i=0; divs.length > i; i++) {
if (divs[i].className == 'references') {
var div2 = document.getElementById((divs[i].id.substr(0, 4) == 'refs' ? 'refd' : 'refs') + divs[i].id.substr(4));
var ref = (table_pos[divs[i].title] ? table_pos[divs[i].title] : [ div2.parentNode.offsetTop / em, 0 ]);
var left1 = -1;
var is_top = true;
var id = divs[i].id.replace(/^ref.(.+)-.+/, '$1');
if (divs[i].parentNode != div2.parentNode) {
left1 = Math.min(0, ref[1] - left) - 1;
divs[i].style.left = left1 + 'em';
divs[i].getElementsByTagName('div')[0].style.width = -left1 + 'em';
var left2 = Math.min(0, left - ref[1]) - 1;
div2.style.left = left2 + 'em';
div2.getElementsByTagName('div')[0].style.width = -left2 + 'em';
is_top = (div2.offsetTop + ref[0] * em > divs[i].offsetTop + top * em);
}
if (!line_set[id]) {
var line = document.getElementById(divs[i].id.replace(/^....(.+)-[0-9]+$/, 'refl$1'));
var shift = ev.clientY - y - that.offsetTop;
line.style.left = (left + left1) + 'em';
if (is_top) {
line.style.top = (line.offsetTop + shift) / em + 'em';
}
if (divs[i].parentNode != div2.parentNode) {
line = line.getElementsByTagName('div')[0];
line.style.height = (line.offsetHeight + (is_top ? -1 : 1) * shift) / em + 'em';
}
line_set[id] = true;
}
}
}
that.style.left = left + 'em';
that.style.top = top + 'em';
}
}
document.onmouseup = function (ev) {
if (that !== undefined) {
ev = ev || event;
table_pos[that.firstChild.firstChild.firstChild.data] = [ (ev.clientY - y) / em, (ev.clientX - x) / em ];
that = undefined;
var date = new Date();
date.setMonth(date.getMonth() + 1);
var s = '';
for (var key in table_pos) {
s += '_' + key + ':' + Math.round(table_pos[key][0] * 10000) / 10000 + 'x' + Math.round(table_pos[key][1] * 10000) / 10000;
}
document.cookie = 'schema=' + encodeURIComponent(s.substr(1)) + '; expires=' + date + '; path=' + location.pathname + location.search;
}
}
</script>
<div id="schema" style="height: <?php echo$Ga;?>em;">
<?php
foreach($da
as$j=>$q){echo"<div class='table' style='top: ".$q["pos"][0]."em; left: ".$q["pos"][1]."em;' onmousedown='mousedown(this, event);'>";echo'<a href="'.htmlspecialchars($i).'table='.urlencode($j).'"><strong>'.htmlspecialchars($j)."</strong></a><br />\n";foreach($q["fields"]as$e){$b=htmlspecialchars($e["field"]);if(preg_match('~char|text~',$e["type"])){$b="<span class='char'>$b</span>";}elseif(preg_match('~date|time|year~',$e["type"])){$b="<span class='date'>$b</span>";}elseif(preg_match('~binary|blob~',$e["type"])){$b="<span class='binary'>$b</span>";}elseif(preg_match('~enum|set~',$e["type"])){$b="<span class='enum'>$b</span>";}echo($e["primary"]?"<em>$b</em>":$b)."<br />\n";}foreach((array)$q["references"]as$Ea=>$Pa){foreach($Pa
as$F=>$db){$Oa=$F-$ca[$j][1];$h=0;foreach($db[0]as$I){echo'<div class="references" title="'.htmlspecialchars($Ea)."\" id='refs$F-".($h++)."' style='left: $Oa"."em; top: ".$q["fields"][$I]["pos"]."em; padding-top: .5em;'><div style='border-top: 1px solid Gray; width: ".(-$Oa)."em;'></div></div>\n";}}}foreach((array)$zc[$j]as$Ea=>$Pa){foreach($Pa
as$F=>$r){$Oa=$F-$ca[$j][1];$h=0;foreach($r
as$ga){echo'<div class="references" title="'.htmlspecialchars($Ea)."\" id='refd$F-".($h++)."' style='left: $Oa"."em; top: ".$q["fields"][$ga]["pos"]."em; height: 1.25em; background: url(".preg_replace("~\\?.*~","",$_SERVER["REQUEST_URI"])."?file=arrow.gif) no-repeat right center;'><div style='height: .5em; border-bottom: 1px solid Gray; width: ".(-$Oa)."em;'></div></div>\n";}}}echo"</div>\n";}foreach($da
as$j=>$q){foreach((array)$q["references"]as$Ea=>$Pa){foreach($Pa
as$F=>$db){$cb=$Ga;$Db=-10;foreach($db[0]as$f=>$I){$ac=$q["pos"][0]+$q["fields"][$I]["pos"];$Dc=$da[$Ea]["pos"][0]+$da[$Ea]["fields"][$db[1][$f]]["pos"];$cb=min($cb,$ac,$Dc);$Db=max($Db,$ac,$Dc);}echo"<div class='references' id='refl$F' style='left: $F"."em; top: $cb"."em; padding: .5em 0;' /><div style='border-right: 1px solid Gray; margin-top: 1px; height: ".($Db-$cb)."em;'></div></div>\n";}}}?>
</div>
<?php
}elseif(isset($_GET["dump"])){function
cb($Pb,$ob){$n=pack("a100a8a8a8a12a12",$Pb,644,0,0,decoct(strlen($ob)),decoct(time()));$Ac=8*32;for($h=0;$h<strlen($n);$h++){$Ac+=ord($n{$h});}$n.=sprintf("%06o",$Ac)."\0 ";return$n.str_repeat("\0",512-strlen($n)).$ob.str_repeat("\0",511-(strlen($ob)+511)%
512);}if($_POST){$ya=ra((strlen($_GET["dump"])?$_GET["dump"]:$_GET["db"]),(!strlen($_GET["db"])||count(array_filter((array)$_POST["tables"])+array_filter((array)$_POST["data"]))>1));if($_POST["format"]!="csv"){$Hb=1048576;echo"SET NAMES utf8;\n";echo"SET foreign_key_checks = 0;\n";echo"SET time_zone = '".$d->c($d->i($d->b("SELECT @@time_zone")))."';\n";echo"\n";}foreach($_POST["databases"]as$G=>$A){$G=j($G,"back");if($d->u($G)){if($_POST["format"]!="csv"&&ereg('CREATE',$A)&&($c=$d->b("SHOW CREATE DATABASE ".a($G)))){if($A=="DROP, CREATE"){echo"DROP DATABASE IF EXISTS ".a($G).";\n";}$E=$d->i($c,1);echo($A=="CREATE, ALTER"?preg_replace('~^CREATE DATABASE ~','\\0IF NOT EXISTS ',$E):$E).";\n";$c->d();}if($A&&$_POST["format"]!="csv"){echo"USE ".a($G).";\n\n";$V="";if($d->server_info>=5){foreach(array("FUNCTION","PROCEDURE")as$T){$c=$d->b("SHOW $T STATUS WHERE Db = '".$d->c($G)."'");while($a=$c->e()){$V.=$d->i($d->b("SHOW CREATE $T ".a($a["Name"])),2).";;\n\n";}$c->d();}}if($d->server_info>=5.1){$c=$d->b("SHOW EVENTS");while($a=$c->e()){$V.=$d->i($d->b("SHOW CREATE EVENT ".a($a["Name"])),3).";;\n\n";}$c->d();}echo($V?"DELIMITER ;;\n\n$V"."DELIMITER ;\n\n":"");}if(($A||strlen($_GET["db"]))&&(array_filter((array)$_POST["tables"])||array_filter((array)$_POST["data"]))){$Ma=array();$c=$d->b("SHOW TABLE STATUS");while($a=$c->e()){$f=(strlen($_GET["db"])?j($a["Name"]):0);if($_POST["tables"][$f]||$_POST["data"][$f]){if(isset($a["Engine"])){if($ya=="tar"){ob_start();}fa($a["Name"],$_POST["tables"][$f]);ea($a["Name"],$_POST["data"][$f]);if($ya=="tar"){echo
cb((strlen($_GET["db"])?"":"$G/")."$a[Name].csv",ob_get_clean());}elseif($_POST["format"]!="csv"){echo"\n";}}elseif($_POST["format"]!="csv"){$Ma[$a["Name"]]=$_POST["tables"][$f];}}}$c->d();foreach($Ma
as$Rb=>$Nc){fa($Rb,$Nc,true);}}if($d->server_info>=5&&$A=="CREATE, ALTER"&&$_POST["format"]!="csv"){$m="SELECT TABLE_NAME, ENGINE, TABLE_COLLATION, TABLE_COMMENT FROM information_schema.TABLES WHERE TABLE_SCHEMA = DATABASE()";?>
DELIMITER ;;
CREATE PROCEDURE phpminadmin_drop () BEGIN
DECLARE _table_name, _engine, _table_collation varchar(64);
DECLARE _table_comment varchar(64);
DECLARE done bool DEFAULT 0;
DECLARE tables CURSOR FOR <?php echo$m;?>;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
OPEN tables;
REPEAT
FETCH tables INTO _table_name, _engine, _table_collation, _table_comment;
IF NOT done THEN
CASE _table_name<?php
$c=$d->b($m);while($a=$c->e()){$Xa=$d->c($a["ENGINE"]=="InnoDB"?preg_replace('~(?:(.+); )?InnoDB free: .*~','\\1',$a["TABLE_COMMENT"]):$a["TABLE_COMMENT"]);echo"
WHEN '".$d->c($a["TABLE_NAME"])."' THEN
".(isset($a["ENGINE"])?"IF _engine != '$a[ENGINE]' OR _table_collation != '$a[TABLE_COLLATION]' OR _table_comment != '$Xa' THEN
ALTER TABLE ".a($a["TABLE_NAME"])." ENGINE=$a[ENGINE] COLLATE=$a[TABLE_COLLATION] COMMENT='$Xa';
END IF":"BEGIN END").";";}$c->d();?>
ELSE
SET @alter_table = CONCAT('DROP TABLE `', REPLACE(_table_name, '`', '``'), '`');
PREPARE alter_command FROM @alter_table;
EXECUTE alter_command; -- returns "can't return a result set in the given context" with MySQL extension
DROP PREPARE alter_command;
END CASE;
END IF;
UNTIL done END REPEAT;
CLOSE tables;
END;;
DELIMITER ;
CALL phpminadmin_drop;
DROP PROCEDURE phpminadmin_drop;
<?php
}}}exit;}h('Export',"",(strlen($_GET["export"])?array("table"=>$_GET["export"]):array()),$_GET["db"]);?>
<script type="text/javascript">
function check(td, name, value) {
var inputs = td.parentNode.parentNode.parentNode.getElementsByTagName('input');
for (var i=0; inputs.length > i; i++) {
if (name.test(inputs[i].name)) {
inputs[i].checked = (inputs[i].value == value);
}
}
}
</script>
<form action="" method="post">
<p><?php echo'Output'.": $tc ".'Format'.": $wc";?> <input type="submit" value="Export" /></p>
<?php
echo"<table border='1' cellspacing='0' cellpadding='2'>\n<thead><tr><th>".'Database'."</th>";foreach(array('','USE','DROP, CREATE','CREATE','CREATE, ALTER')as$b){echo"<th onclick=\"check(this, /^databases/, '$b');\" style='cursor: pointer;'>".($b?$b:'skip')."</th>";}echo"</tr></thead>\n";foreach((strlen($_GET["db"])?array($_GET["db"]):o())as$G){if($G!="information_schema"||$d->server_info<5){echo"<tr><td>".htmlspecialchars($G)."</td>";foreach(array('','USE','DROP, CREATE','CREATE','CREATE, ALTER')as$b){echo'<td><input type="radio" name="databases['.htmlspecialchars(j($G)).']"'.($b==(strlen($_GET["db"])?'':'CREATE')?" checked='checked'":"")." value='$b' /></td>";}echo"</tr>\n";}}echo"</table>\n";echo"<table border='1' cellspacing='0' cellpadding='2'>\n<thead><tr><th rowspan='2'>".'Tables'."</th><th colspan='4'>".'Structure'."</th><th colspan='4'>".'Data'."</th></tr><tr>";foreach(array('','DROP, CREATE','CREATE','CREATE, ALTER')as$b){echo"<th onclick=\"check(this, /^tables/, '$b');\" style='cursor: pointer;'>".($b?$b:'skip')."</th>";}foreach(array('','TRUNCATE, INSERT','INSERT','UPDATE')as$b){echo"<th onclick=\"check(this, /^data/, '$b');\" style='cursor: pointer;'".($b=='UPDATE'?" title='INSERT INTO ... ON DUPLICATE KEY UPDATE'":"").">".($b?$b:'skip')."</th>";}echo"</tr></thead>\n";$Ma="";$c=$d->b(strlen($_GET["db"])?"SHOW TABLE STATUS":"SELECT 'Engine'");while($a=$c->e()){$qa="<tr><td>".htmlspecialchars($a["Name"])."</td>";foreach(array('','DROP, CREATE','CREATE','CREATE, ALTER')as$b){$qa.='<td><input type="radio" name="tables['.htmlspecialchars(j($a["Name"])).']"'.($b==(strlen($_GET["dump"])&&$a["Name"]!=$_GET["dump"]?'':'DROP, CREATE')?" checked='checked'":"")." value='$b' /></td>";}if(!$a["Engine"]){$Ma.="$qa</tr>\n";}else{foreach(array('','TRUNCATE, INSERT','INSERT','UPDATE')as$b){$qa.='<td><input type="radio" name="data['.htmlspecialchars(j($a["Name"])).']"'.($b==((strlen($_GET["dump"])&&$a["Name"]!=$_GET["dump"])||!$a["Engine"]?'':'INSERT')?" checked='checked'":"")." value='$b' /></td>";}echo"$qa</tr>\n";}}echo"$Ma</table>\n";?>
</form>
<?php
}elseif(isset($_GET["privileges"])){h('Privileges');echo'<p><a href="'.htmlspecialchars($i).'user=">'.'Create user'."</a></p>";$c=$d->b("SELECT User, Host FROM mysql.user ORDER BY Host, User");if(!$c){?>
<form action=""><p>
<?php if(strlen($_GET["server"])){?><input type="hidden" name="server" value="<?php echo
htmlspecialchars($_GET["server"]);?>" /><?php }?>
Username: <input name="user" />
Server: <input name="host" value="localhost" />
<input type="hidden" name="grant" value="" />
<input type="submit" value="Edit" />
</p></form>
<?php
$c=$d->b("SELECT SUBSTRING_INDEX(CURRENT_USER, '@', 1) AS User, SUBSTRING_INDEX(CURRENT_USER, '@', -1) AS Host");}echo"<table border='1' cellspacing='0' cellpadding='2'>\n";echo"<thead><tr><th> </th><th>".'Username'."</th><th>".'Server'."</th></tr></thead>\n";while($a=$c->e()){echo'<tr><td><a href="'.htmlspecialchars($i).'user='.urlencode($a["User"]).'&host='.urlencode($a["Host"]).'">'.'edit'.'</a></td><td>'.htmlspecialchars($a["User"])."</td><td>".htmlspecialchars($a["Host"])."</td></tr>\n";}echo"</table>\n";$c->d();}else{if($_POST){if(!in_array($_POST["token"],(array)$TOKENS)){$k='Invalid CSRF token. Send the form again.';}}elseif($_SERVER["REQUEST_METHOD"]=="POST"){$k='Too big POST data. Reduce the data or increase the "post_max_size" configuration directive.';}$C=($_POST&&!$k?$_POST["token"]:va());if(isset($_GET["default"])){$_GET["edit"]=$_GET["default"];}if(isset($_GET["select"])&&$_POST&&(!$_POST["delete"]&&!$_POST["export"]&&!$_POST["import"]&&!$_POST["save"])){$_GET["edit"]=$_GET["select"];}if(isset($_GET["callf"])){$_GET["call"]=$_GET["callf"];}if(isset($_GET["function"])){$_GET["procedure"]=$_GET["function"];}if(isset($_GET["clone"])){$_GET["edit"]=$_GET["clone"];}if(isset($_GET["sql"])){if(isset($_POST["query"])){setcookie("highlight",$_POST["highlight"],strtotime("+1 month"),preg_replace('~\\?.*~','',$_SERVER["REQUEST_URI"]));$_COOKIE["highlight"]=$_POST["highlight"];}h('SQL command',$k);if(!$k&&$_POST){if(is_string($m=(isset($_POST["query"])?$_POST["query"]:la("sql_file")))){@set_time_limit(0);$m=str_replace("\r","",$m);$_b=";";$aa=0;$yc=true;$uc="(\\s+|/\\*.*\\*/|(#|-- )[^\n]*\n|--\n)";while(rtrim($m)){if(!$aa&&preg_match('~^\\s*DELIMITER\\s+(.+)~i',$m,$g)){$_b=$g[1];$m=substr($m,strlen($g[0]));}elseif(preg_match('('.preg_quote($_b).'|[\'`"]|/\\*|-- |#|$)',$m,$g,PREG_OFFSET_CAPTURE,$aa)){if($g[0][0]&&$g[0][0]!=$_b){$M=($g[0][0]=="-- "||$g[0][0]=="#"?'~.*~':($g[0][0]=="/*"?'~.*\\*/~sU':'~\\G([^\\\\'.$g[0][0].']+|\\\\.)*('.$g[0][0].'|$)~s'));preg_match($M,$m,$g,PREG_OFFSET_CAPTURE,$g[0][1]+1);$aa=$g[0][1]+strlen($g[0][0]);}else{$yc=false;echo"<pre class='jush-sql'>".htmlspecialchars(substr($m,0,$g[0][1]))."</pre>\n";flush();if(!$d->q(substr($m,0,$g[0][1]))){echo"<p class='error'>".'Error in query'.": ".htmlspecialchars($d->error)."</p>\n";if($_POST["error_stops"]){break;}}else{do{$c=$d->r();if(is_object($c)){ha($c);}else{if(preg_match("~^$uc*(CREATE|DROP)$uc+(DATABASE|SCHEMA)\\b~isU",$m)){unset($_SESSION["databases"][$_GET["server"]]);}echo"<p class='message'>".m(array('Query executed OK, %d row affected.','Query executed OK, %d rows affected.'),$d->affected_rows)."</p>\n";}}while($d->v());}$m=substr($m,$g[0][1]+strlen($g[0][0]));$aa=0;}}}if($yc){echo"<p class='message'>".'No commands to execute.'."</p>\n";}}else{echo"<p class='error'>".'Unable to upload a file.'."</p>\n";}}?>
<form action="" method="post">
<p><textarea name="query" rows="20" cols="80" style="width: 98%;"><?php echo
htmlspecialchars($_POST?$_POST["query"]:$_GET["sql"]);?></textarea></p>
<p>
<input type="hidden" name="token" value="<?php echo$C;?>" />
<input type="submit" value="Execute" />
<script type="text/javascript">// <![CDATA[
document.write('<label><input type="checkbox" name="highlight" value="jush"<?php echo($_COOKIE["highlight"]=="jush"?' checked="checked"':'');?> /><?php echo
addcslashes('Syntax highlighting',"\r\n'\\");?></label>');
// ]]></script>
<label><input type="checkbox" name="error_stops" value="1"<?php echo($_POST["error_stops"]?" checked='checked'":"");?> />Stop on error</label>
</p>
</form>
<?php
if(!ini_get("file_uploads")){echo"<p>".'File uploads are disabled.'."</p>\n";}else{?>
<form action="" method="post" enctype="multipart/form-data">
<p>
File upload: <input type="file" name="sql_file" />
<input type="hidden" name="token" value="<?php echo$C;?>" />
<input type="submit" value="Execute" />
</p>
</form>
<?php }}elseif(isset($_GET["edit"])){$s=(isset($_GET["select"])?array():aa($_GET));$Na=($s&&!$_GET["clone"]);$l=n($_GET["edit"]);foreach($l
as$j=>$e){if(isset($_GET["default"])?$e["auto_increment"]||preg_match('~text|blob~',$e["type"]):!isset($e["privileges"][$Na?"update":"insert"])){unset($l[$j]);}}if($_POST&&!$k&&!isset($_GET["select"])){$v=($_POST["insert"]?$_SERVER["REQUEST_URI"]:$i.(isset($_GET["default"])?"table=":"select=").urlencode($_GET["edit"]));if(isset($_POST["delete"])){g("DELETE FROM ".a($_GET["edit"])." WHERE ".implode(" AND ",$s)." LIMIT 1",$v,'Item has been deleted.');}else{$t=array();foreach($l
as$j=>$e){$b=ba($j,$e);if(!isset($_GET["default"])){if($b!==false||!$Na){$t[]=a($j)." = ".($b!==false?$b:"''");}}elseif($b!==false){if($e["type"]=="timestamp"&&$b!="NULL"){$t[]=" MODIFY ".a($j)." timestamp".($e["null"]?" NULL":"")." DEFAULT $b".($_POST["on_update"][j($j)]?" ON UPDATE CURRENT_TIMESTAMP":"");}else{$t[]=" ALTER ".a($j).($b=="NULL"?" DROP DEFAULT":" SET DEFAULT $b");}}}if(!$t){p($v);}if(isset($_GET["default"])){g("ALTER TABLE ".a($_GET["edit"]).implode(",",$t),$v,'Default values has been set.');}elseif($Na){g("UPDATE ".a($_GET["edit"])." SET ".implode(", ",$t)." WHERE ".implode(" AND ",$s)." LIMIT 1",$v,'Item has been updated.');}else{g("INSERT INTO ".a($_GET["edit"])." SET ".implode(", ",$t),$v,'Item has been inserted.');}}}h((isset($_GET["default"])?'Default values':($_GET["where"]||isset($_GET["select"])?'Edit':'Insert')),$k,array((isset($_GET["default"])?"table":"select")=>$_GET["edit"]),$_GET["edit"]);unset($a);if($_POST){$a=(array)$_POST["fields"];}elseif($s){$K=array();foreach($l
as$j=>$e){if(isset($e["privileges"]["select"])&&(!$_GET["clone"]||!$e["auto_increment"])){$K[]=($e["type"]=="enum"||$e["type"]=="set"?"1*".a($j)." AS ":"").a($j);}}$a=array();if($K){$c=$d->b("SELECT ".implode(", ",$K)." FROM ".a($_GET["edit"])." WHERE ".implode(" AND ",$s)." LIMIT 1");$a=$c->e();$c->d();}}?>
<form action="" method="post" enctype="multipart/form-data">
<?php
if($l){unset($E);echo"<table border='0' cellspacing='0' cellpadding='2'>\n";foreach($l
as$j=>$e){echo"<tr><th>".htmlspecialchars($j)."</th><td>";$p=(!isset($a)?$e["default"]:(strlen($a[$j])&&($e["type"]=="enum"||$e["type"]=="set")?intval($a[$j]):($_POST["clone"]&&$e["auto_increment"]?"":$a[$j])));xa($j,$e,$p);if(isset($_GET["default"])&&$e["type"]=="timestamp"){if(!isset($E)&&!$_POST){$E=$d->i($d->b("SHOW CREATE TABLE ".a($_GET["edit"])),1);}$Qa=($_POST?$_POST["on_update"][j($j)]:preg_match("~\n\\s*".preg_quote(a($j),'~')." timestamp.* on update CURRENT_TIMESTAMP~i",$E));echo'<label><input type="checkbox" name="on_update['.htmlspecialchars(j($j)).']" value="1"'.($Qa?' checked="checked"':'').' />'.'ON UPDATE CURRENT_TIMESTAMP'.'</label>';}echo"</td></tr>\n";}echo"</table>\n";}?>
<p>
<input type="hidden" name="token" value="<?php echo$C;?>" />
<?php
if(isset($_GET["select"])){ga(array("check"=>(array)$_POST["check"],"clone"=>$_POST["clone"],"all"=>$_POST["all"]));echo"<input type='hidden' name='save' value='1' />\n";}if($l){?>
<input type="submit" value="Save" />
<?php if(!isset($_GET["default"])&&!isset($_GET["select"])){?><input type="submit" name="insert" value="<?php echo($Na?'Save and continue edit':'Save and insert next');?>" /><?php }?>
<?php }?>
<?php if($Na){?> <input type="submit" name="delete" value="Delete"<?php echo$L;?> /><?php }?>
</p>
</form>
<?php
}elseif(isset($_GET["create"])){$oc=array('HASH','LINEAR HASH','KEY','LINEAR KEY','RANGE','LIST');if(strlen($_GET["create"])){$vb=n($_GET["create"]);}if($_POST&&!$k&&!$_POST["add"]&&!$_POST["drop_col"]&&!$_POST["up"]&&!$_POST["down"]){if($_POST["drop"]){g("DROP TABLE ".a($_GET["create"]),substr($i,0,-1),'Table has been dropped.');}else{$Eb=" PRIMARY KEY";if(strlen($_GET["create"])&&strlen($_POST["fields"][$_POST["auto_increment_col"]]["orig"])){foreach(w($_GET["create"])as$o){foreach($o["columns"]as$pa){if($pa===$_POST["fields"][$_POST["auto_increment_col"]]["orig"]){$Eb="";break
2;}}if($o["type"]=="PRIMARY"){$Eb=" UNIQUE";}}}$l=array();ksort($_POST["fields"]);$na="FIRST";foreach($_POST["fields"]as$f=>$e){if(strlen($e["field"])&&isset($W[$e["type"]])){$l[]=(!strlen($_GET["create"])?"":(strlen($e["orig"])?"CHANGE ".a($e["orig"])." ":"ADD ")).a($e["field"]).ca($e).($e["null"]?" NULL":" NOT NULL").(strlen($_GET["create"])&&strlen($e["orig"])&&isset($vb[$e["orig"]]["default"])&&$e["type"]!="timestamp"?" DEFAULT '".$d->c($vb[$e["orig"]]["default"])."'":"").($f==$_POST["auto_increment_col"]?" AUTO_INCREMENT$Eb":"")." COMMENT '".$d->c($e["comment"])."'".(strlen($_GET["create"])?" $na":"");$na="AFTER ".a($e["field"]);}elseif(strlen($e["orig"])){$l[]="DROP ".a($e["orig"]);}}$ib=($_POST["Engine"]?" ENGINE='".$d->c($_POST["Engine"])."'":"").($_POST["Collation"]?" COLLATE '".$d->c($_POST["Collation"])."'":"").(strlen($_POST["Auto_increment"])?" AUTO_INCREMENT=".intval($_POST["Auto_increment"]):"")." COMMENT='".$d->c($_POST["Comment"])."'";if(in_array($_POST["partition_by"],$oc)){$Cb=array();if($_POST["partition_by"]=='RANGE'||$_POST["partition_by"]=='LIST'){foreach(array_filter($_POST["partition_names"])as$f=>$b){$p=$_POST["partition_values"][$f];$Cb[]="PARTITION $b VALUES ".($_POST["partition_by"]=='RANGE'?"LESS THAN":"IN").(strlen($p)?" ($p)":" MAXVALUE");}}$ib.=" PARTITION BY $_POST[partition_by]($_POST[partition])".($Cb?" (".implode(", ",$Cb).")":($_POST["partitions"]?" PARTITIONS ".intval($_POST["partitions"]):""));}elseif($d->server_info>=5.1&&strlen($_GET["create"])){$ib.=" REMOVE PARTITIONING";}$v=$i."table=".urlencode($_POST["name"]);if(strlen($_GET["create"])){g("ALTER TABLE ".a($_GET["create"])." ".implode(", ",$l).", RENAME TO ".a($_POST["name"]).", $ib",$v,'Table has been altered.');}else{g("CREATE TABLE ".a($_POST["name"])." (".implode(", ",$l).")$ib",$v,'Table has been created.');}}}h((strlen($_GET["create"])?'Alter table':'Create table'),$k,array("table"=>$_GET["create"]),$_GET["create"]);$sc=array();$c=$d->b("SHOW ENGINES");while($a=$c->e()){if($a["Support"]=="YES"||$a["Support"]=="DEFAULT"){$sc[]=$a["Engine"];}}$c->d();if($_POST){$a=$_POST;if($a["auto_increment_col"]){$a["fields"][$a["auto_increment_col"]]["auto_increment"]=true;}ua($a["fields"]);}elseif(strlen($_GET["create"])){$a=ia($_GET["create"]);ta($a);$a["name"]=$_GET["create"];$a["fields"]=array_values($vb);if($d->server_info>=5.1){$ma="FROM information_schema.PARTITIONS WHERE TABLE_SCHEMA = '".$d->c($_GET["db"])."' AND TABLE_NAME = '".$d->c($_GET["create"])."'";$c=$d->b("SELECT PARTITION_METHOD, PARTITION_ORDINAL_POSITION, PARTITION_EXPRESSION $ma ORDER BY PARTITION_ORDINAL_POSITION DESC LIMIT 1");list($a["partition_by"],$a["partitions"],$a["partition"])=$c->l();$c->d();$a["partition_names"]=array();$a["partition_values"]=array();$c=$d->b("SELECT PARTITION_NAME, PARTITION_DESCRIPTION $ma AND PARTITION_NAME != '' ORDER BY PARTITION_ORDINAL_POSITION");while($_c=$c->e()){$a["partition_names"][]=$_c["PARTITION_NAME"];$a["partition_values"][]=$_c["PARTITION_DESCRIPTION"];}$c->d();}}else{$a=array("fields"=>array(array("field"=>"")),"partition_names"=>array());}$O=oa();$qb=floor(extension_loaded("suhosin")?(min(ini_get("suhosin.request.max_vars"),ini_get("suhosin.post.max_vars"))-13)/8:0);if($qb&&count($a["fields"])>$qb){echo"<p class='error'>".htmlspecialchars(sprintf('Maximum number of allowed fields exceeded. Please increase %s and %s.','suhosin.post.max_vars','suhosin.request.max_vars'))."</p>\n";}?>
<form action="" method="post" id="form">
<p>
Table name: <input name="name" maxlength="64" value="<?php echo
htmlspecialchars($a["name"]);?>" />
<select name="Engine"><option value="">(engine)</option><?php echo
f($sc,$a["Engine"]);?></select>
<select name="Collation"><option value="">(collation)</option><?php echo
f($O,$a["Collation"]);?></select>
<input type="submit" value="Save" />
</p>
<table border="0" cellspacing="0" cellpadding="2">
<?php $Wa=ya($a["fields"],$O);?>
</table>
<?php echo
sa(count($a["fields"]),$qb);?>
<p>
Auto Increment: <input name="Auto_increment" size="4" value="<?php echo
intval($a["Auto_increment"]);?>" />
Comment: <input name="Comment" value="<?php echo
htmlspecialchars($a["Comment"]);?>" maxlength="60" />
<script type="text/javascript">// <![CDATA[
document.write('<label><input type="checkbox"<?php if($Wa){?> checked="checked"<?php }?> onclick="column_comments_click(this.checked);" />Show column comments</label>');
function column_comments_click(checked) {
var trs = document.getElementsByTagName('tr');
for (var i=0; i < trs.length; i++) {
trs[i].getElementsByTagName('td')[5].style.display = (checked ? '' : 'none');
}
}
<?php if(!$Wa){?>column_comments_click(false);<?php }?>
// ]]></script>
</p>
<p>
<input type="hidden" name="token" value="<?php echo$C;?>" />
<input type="submit" value="Save" />
<?php if(strlen($_GET["create"])){?><input type="submit" name="drop" value="Drop"<?php echo$L;?> /><?php }?>
</p>
<?php if($d->server_info>=5.1){?>
<fieldset><legend>Partition by</legend>
<p>
<select name="partition_by"><option></option><?php echo
f($oc,$a["partition_by"]);?></select>
(<input name="partition" value="<?php echo
htmlspecialchars($a["partition"]);?>" />)
Partitions: <input name="partitions" size="2" value="<?php echo
htmlspecialchars($a["partitions"]);?>" />
</p>
<table border="0" cellspacing="0" cellpadding="2">
<thead><tr><th>Partition name</th><th>Values</th></tr></thead>
<?php
foreach($a["partition_names"]as$f=>$b){echo'<tr><td><input name="partition_names['.intval($f).']" value="'.htmlspecialchars($b).'" /></td><td><input name="partition_values['.intval($f).']" value="'.htmlspecialchars($a["partition_values"][$f])."\" /></td></tr>\n";}?>
<tr><td><input name="partition_names[<?php echo$f+1;?>]" value="" /></td><td><input name="partition_values[<?php echo$f+1;?>]" value="" /></td></tr>
</table>
</fieldset>
<?php }?>
</form>
<?php
}elseif(isset($_GET["indexes"])){$Gc=array("PRIMARY","UNIQUE","INDEX","FULLTEXT");$u=w($_GET["indexes"]);if($_POST&&!$k&&!$_POST["add"]){$kb=array();foreach($_POST["indexes"]as$o){if(in_array($o["type"],$Gc)){$r=array();$tb=array();$t=array();ksort($o["columns"]);foreach($o["columns"]as$f=>$pa){if(strlen($pa)){$z=$o["lengths"][$f];$t[]=a($pa).($z?"(".intval($z).")":"");$r[count($r)+1]=$pa;$tb[count($tb)+1]=($z?$z:null);}}if($r){foreach($u
as$j=>$Ba){ksort($Ba["columns"]);ksort($Ba["lengths"]);if($o["type"]==$Ba["type"]&&$Ba["columns"]===$r&&$Ba["lengths"]===$tb){unset($u[$j]);continue
2;}}$kb[]="ADD $o[type]".($o["type"]=="PRIMARY"?" KEY":"")." (".implode(", ",$t).")";}}}foreach($u
as$j=>$Ba){$kb[]="DROP INDEX ".a($j);}if(!$kb){p($i."table=".urlencode($_GET["indexes"]));}g("ALTER TABLE ".a($_GET["indexes"])." ".implode(", ",$kb),$i."table=".urlencode($_GET["indexes"]),'Indexes has been altered.');}h('Indexes',$k,array("table"=>$_GET["indexes"]),$_GET["indexes"]);$l=array_keys(n($_GET["indexes"]));$a=array("indexes"=>$u);if($_POST){$a=$_POST;if($_POST["add"]){foreach($a["indexes"]as$f=>$o){if(strlen($o["columns"][count($o["columns"])])){$a["indexes"][$f]["columns"][]="";}}$o=end($a["indexes"]);if($o["type"]||array_filter($o["columns"],'strlen')||array_filter($o["lengths"],'strlen')){$a["indexes"][]=array("columns"=>array(1=>""));}}}else{foreach($a["indexes"]as$f=>$o){$a["indexes"][$f]["columns"][]="";}$a["indexes"][]=array("columns"=>array(1=>""));}?>
<script type="text/javascript">// <![CDATA[
function add_row(field) {
var row = field.parentNode.parentNode.cloneNode(true);
var spans = row.getElementsByTagName('span');
row.getElementsByTagName('td')[1].innerHTML = '<span>' + spans[spans.length - 1].innerHTML + '</span>';
var selects = row.getElementsByTagName('select');
for (var i=0; i < selects.length; i++) {
selects[i].name = selects[i].name.replace(/indexes\[[0-9]+/, '$&1');
selects[i].selectedIndex = 0;
}
var input = row.getElementsByTagName('input')[0];
input.name = input.name.replace(/indexes\[[0-9]+/, '$&1');
input.value = '';
field.parentNode.parentNode.parentNode.appendChild(row);
field.onchange = function () { };
}
function add_column(field) {
var column = field.parentNode.cloneNode(true);
var select = column.getElementsByTagName('select')[0];
select.name = select.name.replace(/\]\[[0-9]+/, '$&1');
select.selectedIndex = 0;
var input = column.getElementsByTagName('input')[0];
input.name = input.name.replace(/\]\[[0-9]+/, '$&1');
input.value = '';
field.parentNode.parentNode.appendChild(column);
field.onchange = function () { };
}
// ]]></script>
<form action="" method="post">
<table border="0" cellspacing="0" cellpadding="2">
<thead><tr><th>Index Type</th><td>Column (length)</td></tr></thead>
<?php
$w=0;foreach($a["indexes"]as$o){echo"<tr><td><select name='indexes[$w][type]'".($w==count($a["indexes"])-1?" onchange='add_row(this);'":"")."><option></option>".f($Gc,$o["type"])."</select></td><td>\n";ksort($o["columns"]);foreach($o["columns"]as$h=>$pa){echo"<span><select name='indexes[$w][columns][$h]'".($h==count($o["columns"])?" onchange='add_column(this);'":"")."><option></option>".f($l,$pa)."</select>";echo"<input name='indexes[$w][lengths][$h]' size='2' value=\"".htmlspecialchars($o["lengths"][$h])."\" /></span>\n";}echo"</td></tr>\n";$w++;}?>
</table>
<p>
<input type="hidden" name="token" value="<?php echo$C;?>" />
<input type="submit" value="Alter indexes" />
</p>
<noscript><p><input type="submit" name="add" value="Add next" /></p></noscript>
</form>
<?php
}elseif(isset($_GET["database"])){if($_POST&&!$k){if($_POST["drop"]){unset($_SESSION["databases"][$_GET["server"]]);g("DROP DATABASE ".a($_GET["db"]),substr(preg_replace('~db=[^&]*&~','',$i),0,-1),'Database has been dropped.');}elseif($_GET["db"]!==$_POST["name"]){unset($_SESSION["databases"][$_GET["server"]]);if(g("CREATE DATABASE ".a($_POST["name"]).($_POST["collation"]?" COLLATE '".$d->c($_POST["collation"])."'":""),$i."db=".urlencode($_POST["name"]),'Database has been created.',!strlen($_GET["db"]))){$c=$d->b("SHOW TABLES");while($a=$c->l()){if(!k("RENAME TABLE ".a($a[0])." TO ".a($_POST["name"]).".".a($a[0]))){break;}}$c->d();if(!$a){$d->b("DROP DATABASE ".a($_GET["db"]));}g(k(),preg_replace('~db=[^&]*&~','',$i)."db=".urlencode($_POST["name"]),'Database has been renamed.',!$a,false,$a);}}else{if(!$_POST["collation"]){p(substr($i,0,-1));}g("ALTER DATABASE ".a($_POST["name"])." COLLATE '".$d->c($_POST["collation"])."'",substr($i,0,-1),'Database has been altered.');}}h(strlen($_GET["db"])?'Alter database':'Create database',$k,array(),$_GET["db"]);$O=oa();$j=$_GET["db"];$Ca=array();if($_POST){$j=$_POST["name"];$Ca=$_POST["collation"];}else{if(!strlen($_GET["db"])){$c=$d->b("SHOW GRANTS");while($a=$c->l()){if(preg_match('~ ON (`(([^\\\\`]+|``|\\\\.)*)%`\\.\\*)?~',$a[0],$g)&&$g[1]){$j=stripcslashes(ja($g[2]));break;}}$c->d();}elseif(($c=$d->b("SHOW CREATE DATABASE ".a($_GET["db"])))){$E=$d->i($c,1);if(preg_match('~ COLLATE ([^ ]+)~',$E,$g)){$Ca=$g[1];}elseif(preg_match('~ CHARACTER SET ([^ ]+)~',$E,$g)){$Ca=$O[$g[1]][0];}$c->d();}}?>
<form action="" method="post">
<p>
<input name="name" value="<?php echo
htmlspecialchars($j);?>" maxlength="64" />
<select name="collation"><option value="">(collation)</option><?php echo
f($O,$Ca);?></select>
<input type="hidden" name="token" value="<?php echo$C;?>" />
<input type="submit" value="Save" />
<?php if(strlen($_GET["db"])){?><input type="submit" name="drop" value="Drop"<?php echo$L;?> /><?php }?>
</p>
</form>
<?php
}elseif(isset($_GET["call"])){h('Call'.": ".htmlspecialchars($_GET["call"]),$k);$T=qa($_GET["call"],(isset($_GET["callf"])?"FUNCTION":"PROCEDURE"));$Aa=array();$V=array();foreach($T["fields"]as$h=>$e){if(substr($e["inout"],-3)=="OUT"){$V[$h]="@".a($e["field"])." AS ".a($e["field"]);}if(!$e["inout"]||substr($e["inout"],0,2)=="IN"){$Aa[]=$h;}}if(!$k&&$_POST){$Ec=array();foreach($T["fields"]as$f=>$e){if(in_array($f,$Aa)){$b=ba($f,$e);if($b===false){$b="''";}if(isset($V[$f])){$d->b("SET @".a($e["field"])." = ".$b);}}$Ec[]=(isset($V[$f])?"@".a($e["field"]):$b);}$c=$d->q((isset($_GET["callf"])?"SELECT":"CALL")." ".a($_GET["call"])."(".implode(", ",$Ec).")");if(!$c){echo"<p class='error'>".htmlspecialchars($d->error)."</p>\n";}else{do{$c=$d->r();if(is_object($c)){ha($c);}else{echo"<p class='message'>".m(array('Routine has been called, %d row affected.','Routine has been called, %d rows affected.'),$d->affected_rows)."</p>\n";}}while($d->v());if($V){ha($d->b("SELECT ".implode(", ",$V)));}}}?>
<form action="" method="post">
<?php
if($Aa){echo"<table border='0' cellspacing='0' cellpadding='2'>\n";foreach($Aa
as$f){$e=$T["fields"][$f];echo"<tr><th>".htmlspecialchars($e["field"])."</th><td>";$p=$_POST["fields"][$f];if(strlen($p)&&($e["type"]=="enum"||$e["type"]=="set")){$p=intval($p);}xa($f,$e,$p);echo"</td></tr>\n";}echo"</table>\n";}?>
<p>
<input type="hidden" name="token" value="<?php echo$C;?>" />
<input type="submit" value="Call" />
</p>
</form>
<?php
}elseif(isset($_GET["foreign"])){if($_POST&&!$k&&!$_POST["add"]&&!$_POST["change"]&&!$_POST["change-js"]){if($_POST["drop"]){g("ALTER TABLE ".a($_GET["foreign"])." DROP FOREIGN KEY ".a($_GET["name"]),$i."table=".urlencode($_GET["foreign"]),'Foreign key has been dropped.');}else{$I=array_filter($_POST["source"],'strlen');ksort($I);$ga=array();foreach($I
as$f=>$b){$ga[$f]=$_POST["target"][$f];}g("ALTER TABLE ".a($_GET["foreign"]).(strlen($_GET["name"])?" DROP FOREIGN KEY ".a($_GET["name"]).",":"")." ADD FOREIGN KEY (".implode(", ",array_map('a',$I)).") REFERENCES ".a($_POST["table"])." (".implode(", ",array_map('a',$ga)).")".(in_array($_POST["on_delete"],$va)?" ON DELETE $_POST[on_delete]":"").(in_array($_POST["on_update"],$va)?" ON UPDATE $_POST[on_update]":""),$i."table=".urlencode($_GET["foreign"]),(strlen($_GET["name"])?'Foreign key has been altered.':'Foreign key has been created.'));}}h('Foreign key',$k,array("table"=>$_GET["foreign"]),$_GET["foreign"]);$Hc=array();$c=$d->b("SHOW TABLE STATUS");while($a=$c->e()){if($a["Engine"]=="InnoDB"){$Hc[]=$a["Name"];}}$c->d();if($_POST){$a=$_POST;ksort($a["source"]);if($_POST["add"]){$a["source"][]="";}elseif($_POST["change"]||$_POST["change-js"]){$a["target"]=array();}}elseif(strlen($_GET["name"])){$ia=x($_GET["foreign"]);$a=$ia[$_GET["name"]];$a["source"][]="";}else{$a=array("table"=>$_GET["foreign"],"source"=>array(""));}$I=y("SHOW COLUMNS FROM ".a($_GET["foreign"]));$ga=($_GET["foreign"]===$a["table"]?$I:y("SHOW COLUMNS FROM ".a($a["table"])));?>
<script type="text/javascript">// <![CDATA[
function add_row(field) {
var row = field.parentNode.parentNode.cloneNode(true);
var selects = row.getElementsByTagName('select');
for (var i=0; i < selects.length; i++) {
selects[i].name = selects[i].name.replace(/\]/, '1$&');
selects[i].selectedIndex = 0;
}
field.parentNode.parentNode.parentNode.appendChild(row);
field.onchange = function () { };
}
// ]]></script>
<form action="" method="post">
<p>
Target table:
<select name="table" onchange="this.form['change-js'].value = '1'; this.form.submit();"><?php echo
f($Hc,$a["table"]);?></select>
<input type="hidden" name="change-js" value="" />
</p>
<noscript><p><input type="submit" name="change" value="Change" /></p></noscript>
<table border="0" cellspacing="0" cellpadding="2">
<thead><tr><th>Source</th><th>Target</th></tr></thead>
<?php
$w=0;foreach($a["source"]as$f=>$b){echo"<tr>";echo"<td><select name='source[".intval($f)."]'".($w==count($a["source"])-1?" onchange='add_row(this);'":"")."><option></option>".f($I,$b)."</select></td>";echo"<td><select name='target[".intval($f)."]'>".f($ga,$a["target"][$f])."</select></td>";echo"</tr>\n";$w++;}?>
</table>
<p>
ON DELETE: <select name="on_delete"><option></option><?php echo
f($va,$a["on_delete"]);?></select>
ON UPDATE: <select name="on_update"><option></option><?php echo
f($va,$a["on_update"]);?></select>
</p>
<p>
<input type="hidden" name="token" value="<?php echo$C;?>" />
<input type="submit" value="Save" />
<?php if(strlen($_GET["name"])){?><input type="submit" name="drop" value="Drop"<?php echo$L;?> /><?php }?>
</p>
<noscript><p><input type="submit" name="add" value="Add column" /></p></noscript>
</form>
<?php
}elseif(isset($_GET["createv"])){$fa=false;if($_POST&&!$k){if(strlen($_GET["createv"])){$fa=g("DROP VIEW ".a($_GET["createv"]),substr($i,0,-1),'View has been dropped.',$_POST["drop"],!$_POST["dropped"]);}if(!$_POST["drop"]){g("CREATE VIEW ".a($_POST["name"])." AS ".$_POST["select"],$i."view=".urlencode($_POST["name"]),(strlen($_GET["createv"])?'View has been altered.':'View has been created.'));}}h((strlen($_GET["createv"])?'Alter view':'Create view'),$k,array("view"=>$_GET["createv"]),$_GET["createv"]);$a=array();if($_POST){$a=$_POST;}elseif(strlen($_GET["createv"])){$a=pa($_GET["createv"]);$a["name"]=$_GET["createv"];}?>
<form action="" method="post">
<p><textarea name="select" rows="10" cols="80" style="width: 98%;"><?php echo
htmlspecialchars($a["select"]);?></textarea></p>
<p>
<input type="hidden" name="token" value="<?php echo$C;?>" />
<?php if($fa){?><input type="hidden" name="dropped" value="1" /><?php }?>
Name: <input name="name" value="<?php echo
htmlspecialchars($a["name"]);?>" maxlength="64" />
<input type="submit" value="Save" />
<?php if(strlen($_GET["createv"])){?><input type="submit" name="drop" value="Drop"<?php echo$L;?> /><?php }?>
</p>
</form>
<?php
}elseif(isset($_GET["event"])){$ic=array("YEAR","QUARTER","MONTH","DAY","HOUR","MINUTE","WEEK","SECOND","YEAR_MONTH","DAY_HOUR","DAY_MINUTE","DAY_SECOND","HOUR_MINUTE","HOUR_SECOND","MINUTE_SECOND");$zb=array("ENABLED"=>"ENABLE","DISABLED"=>"DISABLE","SLAVESIDE_DISABLED"=>"DISABLE ON SLAVE");if($_POST&&!$k){if($_POST["drop"]){g("DROP EVENT ".a($_GET["event"]),substr($i,0,-1),'Event has been dropped.');}elseif(in_array($_POST["INTERVAL_FIELD"],$ic)&&in_array($_POST["STATUS"],$zb)){$Yb=" ON SCHEDULE ".($_POST["INTERVAL_VALUE"]?"EVERY '".$d->c($_POST["INTERVAL_VALUE"])."' $_POST[INTERVAL_FIELD]".($_POST["STARTS"]?" STARTS '".$d->c($_POST["STARTS"])."'":"").($_POST["ENDS"]?" ENDS '".$d->c($_POST["ENDS"])."'":""):"AT '".$d->c($_POST["STARTS"])."'")." ON COMPLETION".($_POST["ON_COMPLETION"]?"":" NOT")." PRESERVE";g((strlen($_GET["event"])?"ALTER EVENT ".a($_GET["event"]).$Yb.($_GET["event"]!=$_POST["EVENT_NAME"]?" RENAME TO ".a($_POST["EVENT_NAME"]):""):"CREATE EVENT ".a($_POST["EVENT_NAME"]).$Yb)." $_POST[STATUS] COMMENT '".$d->c($_POST["EVENT_COMMENT"])."' DO $_POST[EVENT_DEFINITION]",substr($i,0,-1),(strlen($_GET["event"])?'Event has been altered.':'Event has been created.'));}}h((strlen($_GET["event"])?'Alter event'.": ".htmlspecialchars($_GET["event"]):'Create event'),$k);$a=array();if($_POST){$a=$_POST;}elseif(strlen($_GET["event"])){$c=$d->b("SELECT * FROM information_schema.EVENTS WHERE EVENT_SCHEMA = '".$d->c($_GET["db"])."' AND EVENT_NAME = '".$d->c($_GET["event"])."'");$a=$c->e();$a["STATUS"]=$zb[$a["STATUS"]];$c->d();}?>
<form action="" method="post">
<table border="0" cellspacing="0" cellpadding="2">
<tr><th>Name</th><td><input name="EVENT_NAME" value="<?php echo
htmlspecialchars($a["EVENT_NAME"]);?>" maxlength="64" /></td></tr>
<tr><th>Start</th><td><input name="STARTS" value="<?php echo
htmlspecialchars("$a[EXECUTE_AT]$a[STARTS]");?>" /></td></tr>
<tr><th>End</th><td><input name="ENDS" value="<?php echo
htmlspecialchars($a["ENDS"]);?>" /></td></tr>
<tr><th>Every</th><td><input name="INTERVAL_VALUE" value="<?php echo
htmlspecialchars($a["INTERVAL_VALUE"]);?>" size="6" /> <select name="INTERVAL_FIELD"><?php echo
f($ic,$a["INTERVAL_FIELD"]);?></select></td></tr>
<tr><th>Status</th><td><select name="STATUS"><?php echo
f($zb,$a["STATUS"]);?></select></td></tr>
<tr><th>Comment</th><td><input name="EVENT_COMMENT" value="<?php echo
htmlspecialchars($a["EVENT_COMMENT"]);?>" maxlength="64" /></td></tr>
<tr><th> </th><td><label><input type="checkbox" name="ON_COMPLETION" value="PRESERVE"<?php echo($a["ON_COMPLETION"]=="PRESERVE"?" checked='checked'":"");?> />On completion preserve</label></td></tr>
</table>
<p><textarea name="EVENT_DEFINITION" rows="10" cols="80" style="width: 98%;"><?php echo
htmlspecialchars($a["EVENT_DEFINITION"]);?></textarea></p>
<p>
<input type="hidden" name="token" value="<?php echo$C;?>" />
<input type="submit" value="Save" />
<?php if(strlen($_GET["event"])){?><input type="submit" name="drop" value="Drop"<?php echo$L;?> /><?php }?>
</p>
</form>
<?php
}elseif(isset($_GET["procedure"])){$T=(isset($_GET["function"])?"FUNCTION":"PROCEDURE");$fa=false;if($_POST&&!$k&&!$_POST["add"]&&!$_POST["drop_col"]&&!$_POST["up"]&&!$_POST["down"]){if(strlen($_GET["procedure"])){$fa=g("DROP $T ".a($_GET["procedure"]),substr($i,0,-1),'Routine has been dropped.',$_POST["drop"],!$_POST["dropped"]);}if(!$_POST["drop"]){$t=array();$l=array_filter((array)$_POST["fields"],'strlen');ksort($l);foreach($l
as$e){if(strlen($e["field"])){$t[]=(in_array($e["inout"],$_a)?"$e[inout] ":"").a($e["field"]).ca($e,"CHARACTER SET");}}g("CREATE $T ".a($_POST["name"])." (".implode(", ",$t).")".(isset($_GET["function"])?" RETURNS".ca($_POST["returns"],"CHARACTER SET"):"")." $_POST[definition]",substr($i,0,-1),(strlen($_GET["procedure"])?'Routine has been altered.':'Routine has been created.'));}}h((strlen($_GET["procedure"])?(isset($_GET["function"])?'Alter function':'Alter procedure').": ".htmlspecialchars($_GET["procedure"]):(isset($_GET["function"])?'Create function':'Create procedure')),$k);$O=y("SHOW CHARACTER SET");$a=array("fields"=>array());if($_POST){$a=$_POST;$a["fields"]=(array)$a["fields"];ua($a["fields"]);}elseif(strlen($_GET["procedure"])){$a=qa($_GET["procedure"],$T);$a["name"]=$_GET["procedure"];}?>
<form action="" method="post" id="form">
<table border="0" cellspacing="0" cellpadding="2">
<?php ya($a["fields"],$O,$T);?>
<?php if(isset($_GET["function"])){?><tr><td>Return type</td><?php echo
wa("returns",$a["returns"],$O);?></tr><?php }?>
</table>
<?php echo
sa(count($a["fields"]));?>
<?php if(isset($_GET["function"])){?>
<script type="text/javascript">
document.getElementById('form')['returns[type]'].onchange();
</script>
<?php }?>
<p><textarea name="definition" rows="10" cols="80" style="width: 98%;"><?php echo
htmlspecialchars($a["definition"]);?></textarea></p>
<p>
<input type="hidden" name="token" value="<?php echo$C;?>" />
<?php if($fa){?><input type="hidden" name="dropped" value="1" /><?php }?>
Name: <input name="name" value="<?php echo
htmlspecialchars($a["name"]);?>" maxlength="64" />
<input type="submit" value="Save" />
<?php if(strlen($_GET["procedure"])){?><input type="submit" name="drop" value="Drop"<?php echo$L;?> /><?php }?>
</p>
</form>
<?php
}elseif(isset($_GET["trigger"])){$nc=array("BEFORE","AFTER");$Wb=array("INSERT","UPDATE","DELETE");$fa=false;if($_POST&&!$k){if(strlen($_GET["name"])){$fa=g("DROP TRIGGER ".a($_GET["name"]),$i."table=".urlencode($_GET["trigger"]),'Trigger has been dropped.',$_POST["drop"],!$_POST["dropped"]);}if(!$_POST["drop"]){if(in_array($_POST["Timing"],$nc)&&in_array($_POST["Event"],$Wb)){g("CREATE TRIGGER ".a($_POST["Trigger"])." $_POST[Timing] $_POST[Event] ON ".a($_GET["trigger"])." FOR EACH ROW $_POST[Statement]",$i."table=".urlencode($_GET["trigger"]),(strlen($_GET["name"])?'Trigger has been altered.':'Trigger has been created.'));}}}h((strlen($_GET["name"])?'Alter trigger'.": ".htmlspecialchars($_GET["name"]):'Create trigger'),$k,array("table"=>$_GET["trigger"]));$a=array("Trigger"=>"$_GET[trigger]_bi");if($_POST){$a=$_POST;}elseif(strlen($_GET["name"])){$c=$d->b("SHOW TRIGGERS LIKE '".$d->c(addcslashes($_GET["trigger"],"%_"))."'");while($a=$c->e()){if($a["Trigger"]===$_GET["name"]){break;}}$c->d();}?>
<form action="" method="post" id="form">
<table border="0" cellspacing="0" cellpadding="2">
<tr><th>Time</th><td><select name="Timing" onchange="if (/^<?php echo
htmlspecialchars(preg_quote($_GET["trigger"],"/"));?>_[ba][iud]$/.test(this.form['Trigger'].value)) this.form['Trigger'].value = '<?php echo
htmlspecialchars(addcslashes($_GET["trigger"],"\r\n'\\"));?>_' + this.value.charAt(0).toLowerCase() + this.form['Event'].value.charAt(0).toLowerCase();"><?php echo
f($nc,$a["Timing"]);?></select></td></tr>
<tr><th>Event</th><td><select name="Event" onchange="this.form['Timing'].onchange();"><?php echo
f($Wb,$a["Event"]);?></select></td></tr>
<tr><th>Name</th><td><input name="Trigger" value="<?php echo
htmlspecialchars($a["Trigger"]);?>" maxlength="64" /></td></tr>
</table>
<p><textarea name="Statement" rows="10" cols="80" style="width: 98%;"><?php echo
htmlspecialchars($a["Statement"]);?></textarea></p>
<p>
<input type="hidden" name="token" value="<?php echo$C;?>" />
<?php if($fa){?><input type="hidden" name="dropped" value="1" /><?php }?>
<input type="submit" value="Save" />
<?php if(strlen($_GET["name"])){?><input type="submit" name="drop" value="Drop"<?php echo$L;?> /><?php }?>
</p>
</form>
<?php
}elseif(isset($_GET["user"])){$y=array();$c=$d->b("SHOW PRIVILEGES");while($a=$c->e()){foreach(explode(",",$a["Context"])as$hb){$y[$hb][$a["Privilege"]]=$a["Comment"];}}$c->d();$y["Server Admin"]+=$y["File access on server"];$y["Databases"]["Create routine"]=$y["Procedures"]["Create routine"];$y["Columns"]=array();foreach(array("Select","Insert","Update","References")as$b){$y["Columns"][$b]=$y["Tables"][$b];}unset($y["Server Admin"]["Usage"]);unset($y["Procedures"]["Create routine"]);foreach($y["Tables"]as$f=>$b){unset($y["Databases"][$f]);}function
z(&$D,$y){foreach($y
as$Fa=>$b){if($Fa!="Grant option"){$D[strtoupper($Fa)]=true;}}}$Ra=array();if($_POST){foreach($_POST["objects"]as$f=>$b){$Ra[$b]=((array)$Ra[$b])+((array)$_POST["grants"][$f]);}}$D=array();$Fb="";if(isset($_GET["host"])&&($c=$d->b("SHOW GRANTS FOR '".$d->c($_GET["user"])."'@'".$d->c($_GET["host"])."'"))){while($a=$c->l()){if(preg_match('~GRANT (.*) ON (.*) TO ~',$a[0],$g)){if($g[1]=="ALL PRIVILEGES"){if($g[2]=="*.*"){z($D[$g[2]],$y["Server Admin"]);}if(substr($g[2],-1)=="*"){z($D[$g[2]],$y["Databases"]);z($D[$g[2]],(array)$y["Procedures"]);}z($D[$g[2]],$y["Tables"]);}elseif(preg_match_all('~ *([^(,]*[^ ,(])( *\\([^)]+\\))?~',$g[1],$B,PREG_SET_ORDER)){foreach($B
as$b){$D["$g[2]$b[2]"][$b[1]]=true;}}}if(preg_match('~ WITH GRANT OPTION~',$a[0])){$D[$g[2]]["GRANT OPTION"]=true;}if(preg_match("~ IDENTIFIED BY PASSWORD '([^']+)~",$a[0],$g)){$Fb=$g[1];}}$c->d();}if($_POST&&!$k){$oa=(isset($_GET["host"])?$d->c($_GET["user"])."'@'".$d->c($_GET["host"]):"");$R=$d->c($_POST["user"])."'@'".$d->c($_POST["host"]);$wb=$d->c($_POST["pass"]);if($_POST["drop"]){g("DROP USER '$oa'",$i."privileges=",'User has been dropped.');}elseif($oa==$R||$d->b(($d->server_info<5?"GRANT USAGE ON *.* TO":"CREATE USER")." '$R' IDENTIFIED BY".($_POST["hashed"]?" PASSWORD":"")." '$wb'")){if($oa==$R){$d->b("SET PASSWORD FOR '$R' = ".($_POST["hashed"]?"'$wb'":"PASSWORD('$wb')"));}$Ja=array();foreach($Ra
as$S=>$J){if(isset($_GET["grant"])){$J=array_filter($J);}$J=array_keys($J);if(isset($_GET["grant"])){$Ja=array_diff(array_keys(array_filter($Ra[$S],'strlen')),$J);}elseif($oa==$R){$lc=array_keys((array)$D[$S]);$Ja=array_diff($lc,$J);$J=array_diff($J,$lc);unset($D[$S]);}if(preg_match('~^(.+)(\\(.*\\))?$~U',$S,$g)&&(($J&&!$d->b("GRANT ".implode("$g[2], ",$J)."$g[2] ON $g[1] TO '$R'"))||($Ja&&!$d->b("REVOKE ".implode("$g[2], ",$Ja)."$g[2] ON $g[1] FROM '$R'")))){$k=htmlspecialchars($d->error);if($oa!=$R){$d->b("DROP USER '$R'");}break;}}if(!$k){if(isset($_GET["host"])&&$oa!=$R){$d->b("DROP USER '$oa'");}elseif(!isset($_GET["grant"])){foreach($D
as$S=>$Ja){if(preg_match('~^(.+)(\\(.*\\))?$~U',$S,$g)){$d->b("REVOKE ".implode("$g[2], ",array_keys($Ja))."$g[2] ON $g[1] FROM '$R'");}}}p($i."privileges=",(isset($_GET["host"])?'User has been altered.':'User has been created.'));}}if(!$k){$k=htmlspecialchars($d->error);}}h((isset($_GET["host"])?'Username'.": ".htmlspecialchars("$_GET[user]@$_GET[host]"):'Create user'),$k,array("privileges"=>'Privileges'));if($_POST){$a=$_POST;$D=$Ra;}else{$a=$_GET+array("host"=>"localhost");$a["pass"]=$Fb;if(strlen($Fb)){$a["hashed"]=true;}$D[""]=true;}?>
<form action="" method="post">
<table border="0" cellspacing="0" cellpadding="2">
<tr><th>Username</th><td><input name="user" maxlength="16" value="<?php echo
htmlspecialchars($a["user"]);?>" /></td></tr>
<tr><th>Server</th><td><input name="host" maxlength="60" value="<?php echo
htmlspecialchars($a["host"]);?>" /></td></tr>
<tr><th>Password</th><td><input id="pass" name="pass" value="<?php echo
htmlspecialchars($a["pass"]);?>" /><?php if(!$a["hashed"]){?><script type="text/javascript">document.getElementById('pass').type = 'password';</script><?php }?> <label><input type="checkbox" name="hashed" value="1"<?php if($a["hashed"]){?> checked="checked"<?php }?> onclick="this.form['pass'].type = (this.checked ? 'text' : 'password');" />Hashed</label></td></tr>
</table>
<?php
echo"<table border='0' cellspacing='0' cellpadding='2'>\n";echo"<thead><tr><th colspan='2'>".'Privileges'."</th>";$h=0;foreach($D
as$S=>$J){echo'<th>'.($S!="*.*"?'<input name="objects['.$h.']" value="'.htmlspecialchars($S).'" size="10" />':'<input type="hidden" name="objects['.$h.']" value="*.*" size="10" />*.*').'</th>';$h++;}echo"</tr></thead>\n";foreach(array("Server Admin"=>'Server',"Databases"=>'Database',"Tables"=>'Table',"Columns"=>'Column',"Procedures"=>'Routine',)as$hb=>$Wc){foreach((array)$y[$hb]as$Fa=>$Xa){echo'<tr><td>'.$Wc.'</td><td title="'.htmlspecialchars($Xa).'"><i>'.htmlspecialchars($Fa).'</i></td>';$h=0;foreach($D
as$S=>$J){$j='"grants['.$h.']['.htmlspecialchars(strtoupper($Fa)).']"';$p=$J[strtoupper($Fa)];if($hb=="Server Admin"&&$S!=(isset($D["*.*"])?"*.*":"")){echo"<td> </td>";}elseif(isset($_GET["grant"])){echo"<td><select name=$j><option></option><option value='1'".($p?" selected='selected'":"").">".'Grant'."</option><option value='0'".($p=="0"?" selected='selected'":"").">".'Revoke'."</option></select></td>";}else{echo"<td align='center'><input type='checkbox' name=$j value='1'".($p?" checked='checked'":"")." /></td>";}$h++;}echo"</tr>\n";}}echo"</table>\n";?>
<p>
<input type="hidden" name="token" value="<?php echo$C;?>" />
<input type="submit" value="Save" />
<?php if(isset($_GET["host"])){?><input type="submit" name="drop" value="Drop"<?php echo$L;?> /><?php }?>
</p>
</form>
<?php
}elseif(isset($_GET["processlist"])){if($_POST&&!$k){$Za=0;foreach((array)$_POST["kill"]as$b){if(k("KILL ".intval($b))){$Za++;}}g(k(),$i."processlist=",m(array('%d process has been killed.','%d processes have been killed.'),$Za),$Za||!$_POST["kill"],false,!$Za&&$_POST["kill"]);}h('Process list',$k);?>
<form action="" method="post">
<table border="1" cellspacing="0" cellpadding="2">
<?php
$c=$d->b("SHOW PROCESSLIST");for($h=0;$a=$c->e();$h++){if(!$h){echo"<thead><tr lang='en'><th> </th><th>".implode("</th><th>",array_keys($a))."</th></tr></thead>\n";}echo"<tr><td><input type='checkbox' name='kill[]' value='$a[Id]' /></td><td>".implode("</td><td>",$a)."</td></tr>\n";}$c->d();?>
</table>
<p>
<input type="hidden" name="token" value="<?php echo$C;?>" />
<input type="submit" value="Kill" />
</p>
</form>
<?php
}elseif(isset($_GET["select"])){$yb=array("char_length","from_unixtime","hex","lower","round","sec_to_time","time_to_sec","unix_timestamp","upper");$ab=array("avg","count","distinct","group_concat","max","min","sum");$Ob=ia($_GET["select"]);$u=w($_GET["select"]);$Ta=array("=","<",">","<=",">=","!=","LIKE","REGEXP","IN","IS NULL","NOT LIKE","NOT REGEXP","NOT IN","IS NOT NULL");if(eregi('^(MyISAM|Maria)$',$Ob["Engine"])){$Ta[]="AGAINST";}$l=n($_GET["select"]);$dc=array();$r=array();unset($ta);foreach($l
as$f=>$e){if(isset($e["privileges"]["select"])){$r[]=$f;if(preg_match('~text|blob~',$e["type"])){$ta=(isset($_GET["text_length"])?$_GET["text_length"]:"100");}}$dc+=$e["privileges"];}$K=array();$wa=array();foreach((array)$_GET["columns"]as$f=>$b){if($b["fun"]=="count"||(in_array($b["col"],$r,true)&&(!$b["fun"]||in_array($b["fun"],$yb)||in_array($b["fun"],$ab)))){$K[$f]=(in_array($b["col"],$r,true)?(!$b["fun"]?a($b["col"]):($b["fun"]=="distinct"?"COUNT(DISTINCT ":strtoupper("$b[fun](")).a($b["col"]).")"):"COUNT(*)");if(!in_array($b["fun"],$ab)){$wa[]=$K[$f];}}}$s=array();foreach($u
as$h=>$o){if($o["type"]=="FULLTEXT"&&strlen($_GET["fulltext"][$h])){$s[]="MATCH (".implode(", ",array_map('a',$o["columns"])).") AGAINST ('".$d->c($_GET["fulltext"][$h])."'".(isset($_GET["boolean"][$h])?" IN BOOLEAN MODE":"").")";}}foreach((array)$_GET["where"]as$b){if(strlen("$b[col]$b[val]")&&in_array($b["op"],$Ta)){if($b["op"]=="AGAINST"){$s[]="MATCH (".a($b["col"]).") AGAINST ('".$d->c($b["val"])."' IN BOOLEAN MODE)";}elseif(ereg('IN$',$b["op"])&&!strlen($Aa=ma($b["val"]))){$s[]="0";}else{$xb=" $b[op]".(ereg('NULL$',$b["op"])?"":(ereg('IN$',$b["op"])?" ($Aa)":" '".$d->c($b["val"])."'"));if(strlen($b["col"])){$s[]=a($b["col"]).$xb;}else{$Da=array();foreach($l
as$j=>$e){if(is_numeric($b["val"])||!ereg('int|float|double|decimal',$e["type"])){$Da[]=$j;}}$s[]=($Da?"(".implode("$xb OR ",array_map('a',$Da))."$xb)":"0");}}}}$pb=array();foreach((array)$_GET["order"]as$f=>$b){if(in_array($b,$r,true)||preg_match('(^(COUNT\\(\\*\\)|('.strtoupper(implode('|',$yb).'|'.implode('|',$ab)).')\\(('.implode('|',array_map('preg_quote',array_map('a',$r))).')\\))$)',$b)){$pb[]=a($b).(isset($_GET["desc"][$f])?" DESC":"");}}$ja=(isset($_GET["limit"])?$_GET["limit"]:"30");$ma="FROM ".a($_GET["select"]).($s?" WHERE ".implode(" AND ",$s):"").($wa&&count($wa)<count($K)?" GROUP BY ".implode(", ",$wa):"").($pb?" ORDER BY ".implode(", ",$pb):"").(strlen($ja)?" LIMIT ".intval($ja).(intval($_GET["page"])?" OFFSET ".($ja*$_GET["page"]):""):"");if($_POST&&!$k){if($_POST["export"]){ra($_GET["select"]);fa($_GET["select"],"");if(is_array($_POST["check"])){foreach($_POST["check"]as$b){parse_str($b,$rb);ea($_GET["select"],"INSERT","FROM ".a($_GET["select"])." WHERE ".implode(" AND ",aa($rb))." LIMIT 1");}}else{ea($_GET["select"],"INSERT",($s?"FROM ".a($_GET["select"])." WHERE ".implode(" AND ",$s):""));}exit;}if(!$_POST["import"]){$c=true;$sb=0;$ub=($_POST["delete"]?($_POST["all"]&&!$s?"TRUNCATE ":"DELETE FROM "):($_POST["clone"]?"INSERT INTO ":"UPDATE ")).a($_GET["select"]);if(!$_POST["delete"]){$t=array();foreach($l
as$j=>$e){$b=ba($j,$e);if($_POST["clone"]){$t[]=($b!==false?$b:a($j));}elseif($b!==false){$t[]=a($j)." = $b";}}$ub.=($_POST["clone"]?" SELECT ".implode(", ",$t)." FROM ".a($_GET["select"]):" SET ".implode(", ",$t));}if(!$_POST["delete"]&&!$t){}elseif($_POST["all"]){$c=k($ub.($s?" WHERE ".implode(" AND ",$s):""));$sb=$d->affected_rows;}else{foreach((array)$_POST["check"]as$b){parse_str($b,$rb);$c=k($ub." WHERE ".implode(" AND ",aa($rb))." LIMIT 1");if(!$c){break;}$sb+=$d->affected_rows;}}g(k(),t("page"),m(array('%d item have been affected.','%d items have been affected.'),$sb),$c,false,!$c);}elseif(is_string($ua=la("csv_file"))){$ua=preg_replace("~^\xEF\xBB\xBF~",'',$ua);$Da="";$mc=array();preg_match_all('~("[^"]*"|[^"\\n]+)+~',$ua,$B);foreach($B[0]as$f=>$b){$a=array();preg_match_all('~(("[^"]*")+|[^,]*),~',"$b,",$nb);if(!$f&&!array_diff($nb[1],array_keys($l))){$Da=" (".implode(", ",array_map('a',$nb[1])).")";}else{foreach($nb[1]as$bb){$a[]=(!strlen($bb)?"NULL":"'".$d->c(str_replace('""','"',preg_replace('~^".*"$~s','',$bb)))."'");}$mc[]="(".implode(", ",$a).")";}}$c=k("INSERT INTO ".a($_GET["select"])."$Da VALUES ".implode(", ",$mc));g(k(),t("page"),m(array('%d row has been imported.','%d rows has been imported.'),$d->affected_rows),$c,false,!$c);}else{$k='Unable to upload a file.';}}h('Select'.": ".htmlspecialchars($_GET["select"]),$k);echo"<p>";if(isset($dc["insert"])){echo'<a href="'.htmlspecialchars($i).'edit='.urlencode($_GET['select']).'">'.'New item'.'</a> ';}echo'<a href="'.htmlspecialchars($i).'table='.urlencode($_GET['select']).'">'.'Table structure'.'</a>';echo"</p>\n";if(!$r){echo"<p class='error'>".'Unable to select the table'.($l?"":": ".htmlspecialchars($d->error)).".</p>\n";}else{echo"<form action='' id='form'>\n";?>
<script type="text/javascript">// <![CDATA[
function add_row(field) {
var row = field.parentNode.cloneNode(true);
var selects = row.getElementsByTagName('select');
for (var i=0; i < selects.length; i++) {
selects[i].name = selects[i].name.replace(/[a-z]\[[0-9]+/, '$&1');
selects[i].selectedIndex = 0;
}
var inputs = row.getElementsByTagName('input');
if (inputs.length) {
inputs[0].name = inputs[0].name.replace(/[a-z]\[[0-9]+/, '$&1');
inputs[0].value = '';
}
field.parentNode.parentNode.appendChild(row);
field.onchange = function () { };
}
// ]]></script>
<?php
echo"<fieldset><legend>".'Select'."</legend>\n";if(strlen($_GET["server"])){echo'<input type="hidden" name="server" value="'.htmlspecialchars($_GET["server"]).'" />';}echo'<input type="hidden" name="db" value="'.htmlspecialchars($_GET["db"]).'" />';echo'<input type="hidden" name="select" value="'.htmlspecialchars($_GET["select"]).'" />';echo"\n";$h=0;$Tb=array('Functions'=>$yb,'Aggregation'=>$ab);foreach($K
as$f=>$b){$b=$_GET["columns"][$f];echo"<div><select name='columns[$h][fun]'><option></option>".f($Tb,$b["fun"])."</select>";echo"<select name='columns[$h][col]'><option></option>".f($r,$b["col"])."</select></div>\n";$h++;}echo"<div><select name='columns[$h][fun]' onchange='this.nextSibling.onchange();'><option></option>".f($Tb)."</select>";echo"<select name='columns[$h][col]' onchange='add_row(this);'><option></option>".f($r)."</select></div>\n";echo"</fieldset>\n";echo"<fieldset><legend>".'Search'."</legend>\n";foreach($u
as$h=>$o){if($o["type"]=="FULLTEXT"){echo"(<i>".implode("</i>, <i>",array_map('htmlspecialchars',$o["columns"]))."</i>) AGAINST";echo' <input name="fulltext['.$h.']" value="'.htmlspecialchars($_GET["fulltext"][$h]).'" />';echo"<label><input type='checkbox' name='boolean[$h]' value='1'".(isset($_GET["boolean"][$h])?" checked='checked'":"")." />".'BOOL'."</label>";echo"<br />\n";}}$h=0;foreach((array)$_GET["where"]as$b){if(strlen("$b[col]$b[val]")&&in_array($b["op"],$Ta)){echo"<div><select name='where[$h][col]'><option value=''>".'(anywhere)'."</option>".f($r,$b["col"])."</select>";echo"<select name='where[$h][op]' onchange='where_change(this);'>".f($Ta,$b["op"])."</select>";echo"<input name='where[$h][val]' value=\"".htmlspecialchars($b["val"])."\" /></div>\n";$h++;}}?>
<script type="text/javascript">
function where_change(op) {
for (var i=0; i < op.form.elements.length; i++) {
var el = op.form.elements[i];
if (el.name == op.name.substr(0, op.name.length - 4) + '[val]') {
el.style.display = (/NULL$/.test(op.options[op.selectedIndex].text) ? 'none' : '');
}
}
}
<?php if($h){?>
for (var i=0; <?php echo$h;?> > i; i++) {
document.getElementById('form')['where[' + i + '][op]'].onchange();
}
<?php }?>
</script>
<?php
echo"<div><select name='where[$h][col]' onchange='add_row(this);'><option value=''>".'(anywhere)'."</option>".f($r)."</select>";echo"<select name='where[$h][op]' onchange='where_change(this);'>".f($Ta)."</select>";echo"<input name='where[$h][val]' /></div>\n";echo"</fieldset>\n";echo"<fieldset><legend>".'Sort'."</legend>\n";$h=0;foreach((array)$_GET["order"]as$f=>$b){if(in_array($b,$r,true)){echo"<div><select name='order[$h]'><option></option>".f($r,$b)."</select>";echo"<label><input type='checkbox' name='desc[$h]' value='1'".(isset($_GET["desc"][$f])?" checked='checked'":"")." />".'DESC'."</label></div>\n";$h++;}}echo"<div><select name='order[$h]' onchange='add_row(this);'><option></option>".f($r)."</select>";echo"<label><input type='checkbox' name='desc[$h]' value='1' />".'DESC'."</label></div>\n";echo"</fieldset>\n";echo"<fieldset><legend>".'Limit'."</legend><div><input name='limit' size='3' value=\"".htmlspecialchars($ja)."\" /></div></fieldset>\n";if(isset($ta)){echo"<fieldset><legend>".'Text length'."</legend><div><input name='text_length' size='3' value=\"".htmlspecialchars($ta)."\" /></div></fieldset>\n";}echo"<fieldset><legend>".'Action'."</legend><div><input type='submit' value='".'Select'."' /></div></fieldset>\n";echo"</form>\n";$m="SELECT ".($K?(count($wa)<count($K)?"SQL_CALC_FOUND_ROWS ":"").implode(", ",$K):"*")." $ma";echo"<p><code class='jush-sql'>".htmlspecialchars($m)."</code> <a href='".htmlspecialchars($i)."sql=".urlencode($m)."'>".'Edit'."</a></p>\n";$c=$d->b($m);if(!$c){echo"<p class='error'>".htmlspecialchars($d->error)."</p>\n";}else{echo"<form action='' method='post' enctype='multipart/form-data'>\n";if(!$c->num_rows){echo"<p class='message'>".'No rows.'."</p>\n";}else{$ia=array();foreach(x($_GET["select"])as$x){foreach($x["source"]as$b){$ia[$b][]=$x;}}echo"<table border='1' cellspacing='0' cellpadding='2' class='nowrap'>\n";for($w=0;$a=$c->e();$w++){if(!$w){echo'<thead><tr><td><label><input type="checkbox" name="all" value="1" />'.'whole result'.'</label></td>';foreach($a
as$f=>$b){echo'<th><a href="'.htmlspecialchars(t('(order|desc)[^=]*')).'&order%5B0%5D='.htmlspecialchars($f).($_GET["order"][0]===$f&&!$_GET["desc"][0]?'&desc%5B0%5D=1':'').'">'.htmlspecialchars($f)."</a></th>";}echo"</tr></thead>\n";}$eb=implode('&',bb($a,$u));echo'<tr><td><input type="checkbox" name="check[]" value="'.$eb.'" onclick="this.form[\'all\'].checked = false;" />'.(count($K)==count($wa)&&$_GET["db"]!="information_schema"?' <a href="'.htmlspecialchars($i).'edit='.urlencode($_GET['select']).'&'.$eb.'">'.'edit'.'</a> <a href="'.htmlspecialchars($i).'clone='.urlencode($_GET['select']).'&'.$eb.'">'.'clone'.'</a></td>':'');foreach($a
as$f=>$b){if(!isset($b)){$b="<i>NULL</i>";}elseif(preg_match('~blob|binary~',$l[$f]["type"])&&preg_match('~[\\0-\\x8\\xb\\xc\\xe-\\x1F\\x80-\\xFF]~',$b)){$b='<a href="'.htmlspecialchars($i).'download='.urlencode($_GET["select"]).'&field='.urlencode($f).'&'.$eb.'">'.m(array('%d byte','%d bytes'),strlen($b)).'</a>';}else{if(!strlen(trim($b))){$b=" ";}elseif(intval($ta)>0&&preg_match('~blob|text~',$l[$f]["type"])&&strlen($b)>intval($ta)){$b=(preg_match('~blob~',$l[$f]["type"])?nl2br(htmlspecialchars(substr($b,0,intval($ta))))."<em>...</em>":za($b,intval($ta)));}else{$b=nl2br(htmlspecialchars($b));if($l[$f]["type"]=="char"){$b="<code>$b</code>";}}foreach((array)$ia[$f]as$x){if(count($ia[$f])==1||count($x["source"])==1){$b="\">$b</a>";foreach($x["source"]as$h=>$I){$b="&where%5B$h%5D%5Bcol%5D=".urlencode($x["target"][$h])."&where%5B$h%5D%5Bop%5D=%3D&where%5B$h%5D%5Bval%5D=".urlencode($a[$I]).$b;}$b='<a href="'.htmlspecialchars(strlen($x["db"])?preg_replace('~([?&]db=)[^&]+~','\\1'.urlencode($x["db"]),$i):$i).'select='.htmlspecialchars($x["table"]).$b;break;}}}echo"<td>$b</td>";}echo"</tr>\n";}echo"</table>\n";echo"<p>";$Ab=(intval($ja)?$d->i($d->b(count($wa)<count($K)?" SELECT FOUND_ROWS()":"SELECT COUNT(*) FROM ".a($_GET["select"]).($s?" WHERE ".implode(" AND ",$s):""))):$c->num_rows);if(intval($ja)&&$Ab>$ja){$Bb=floor(($Ab-1)/$ja);echo'Page'.":";ka(0);if($_GET["page"]>3){echo" ...";}for($h=max(1,$_GET["page"]-2);$h<min($Bb,$_GET["page"]+3);$h++){ka($h);}if($_GET["page"]+3<$Bb){echo" ...";}ka($Bb);}echo" (".m(array('%d row','%d rows'),$Ab).")</p>\n";echo($_GET["db"]!="information_schema"?"<fieldset><legend>".'Edit'."</legend><div><input type='submit' value='".'Edit'."' /> <input type='submit' name='clone' value='".'Clone'."' /> <input type='submit' name='delete' value='".'Delete'."'$L /></div></fieldset>\n":"");echo"<fieldset><legend>".'Export'."</legend><div>$tc $wc <input type='submit' name='export' value='".'Export'."' /></div></fieldset>\n";}$c->d();echo"<fieldset><legend>".'CSV Import'."</legend><div><input type='hidden' name='token' value='$C' /><input type='file' name='csv_file' /> <input type='submit' name='import' value='".'Import'."' /></div></fieldset>\n";echo"</form>\n";}}}else{if($_POST["tables"]&&!$k){$c=true;$X="";if(isset($_POST["truncate"])){foreach($_POST["tables"]as$q){if(!k("TRUNCATE ".a($q))){$c=false;break;}}$X='Tables have been truncated.';}elseif(isset($_POST["move"])){$Zb=array();foreach($_POST["tables"]as$q){$Zb[]=a($q)." TO ".a($_POST["target"]).".".a($q);}$c=k("RENAME TABLE ".implode(", ",$Zb));$X='Tables have been moved.';}elseif($c=k((isset($_POST["optimize"])?"OPTIMIZE":(isset($_POST["check"])?"CHECK":(isset($_POST["repair"])?"REPAIR":(isset($_POST["drop"])?"DROP":"ANALYZE"))))." TABLE ".implode(", ",array_map('a',$_POST["tables"])))){if(isset($_POST["drop"])){$X='Tables have been dropped.';}else{while($a=$c->e()){$X.=htmlspecialchars("$a[Table]: $a[Msg_text]")."<br />";}}}g(k(),substr($i,0,-1),$X,$c,false,!$c);}h('Database'.": ".htmlspecialchars($_GET["db"]),$k,false);echo'<p><a href="'.htmlspecialchars($i).'database=">'.'Alter database'."</a></p>\n";echo'<p><a href="'.htmlspecialchars($i).'schema=">'.'Database schema'."</a></p>\n";echo"<h3>".'Tables and views'."</h3>\n";$c=$d->b("SHOW TABLE STATUS");if(!$c->num_rows){echo"<p class='message'>".'No tables.'."</p>\n";}else{echo"<form action='' method='post'>\n";echo"<table border='1' cellspacing='0' cellpadding='2'>\n";echo'<thead><tr><td><input type="checkbox" onclick="var elems = this.form.elements; for (var i=0; elems.length > i; i++) if (elems[i].name == \'tables[]\') elems[i].checked = this.checked;" /></td><th>'.'Table'.'</th><td>'.'Engine'.'</td><td>'.'Comment'.'</td><td>'.'Collation'.'</td><td>'.'Data Length'.'</td><td>'.'Index Length'.'</td><td>'.'Data Free'.'</td><td>'.'Auto Increment'.'</td><td>'.'Rows'."</td></tr></thead>\n";while($a=$c->e()){ta($a);echo'<tr class="nowrap"><td>'.(isset($a["Rows"])?'<input type="checkbox" name="tables[]" value="'.htmlspecialchars($a["Name"]).'"'.(in_array($a["Name"],(array)$_POST["tables"],true)?' checked="checked"':'').' /></td><th><a href="'.htmlspecialchars($i).'table='.urlencode($a["Name"]).'">'.htmlspecialchars($a["Name"])."</a></th><td>$a[Engine]</td><td>".(strlen(trim($a["Comment"]))?htmlspecialchars($a["Comment"]):" ")."</td><td>$a[Collation]":' </td><th><a href="'.htmlspecialchars($i).'view='.urlencode($a["Name"]).'">'.htmlspecialchars($a["Name"]).'</a></th><td colspan="8"><a href="'.htmlspecialchars($i)."select=".urlencode($a["Name"]).'">'.'View'.'</a>');foreach((isset($a["Rows"])?array("Data_length"=>"create","Index_length"=>"indexes","Data_free"=>"edit","Auto_increment"=>"create","Rows"=>"select"):array())as$f=>$ea){$b=number_format($a[$f],0,'.',',');echo'</td><td align="right">'.(strlen($a[$f])?'<a href="'.htmlspecialchars("$i$ea=").urlencode($a["Name"]).'">'.($f=="Rows"&&$a["Engine"]=="InnoDB"&&$b?sprintf('around %s',$b):$b).'</a>':' ');}echo"</td></tr>\n";}echo"</table>\n";echo"<p><input type='hidden' name='token' value='$C' /><input type='submit' value='".'Analyze'."' /> <input type='submit' name='optimize' value='".'Optimize'."' /> <input type='submit' name='check' value='".'Check'."' /> <input type='submit' name='repair' value='".'Repair'."' /> <input type='submit' name='truncate' value='".'Truncate'."'$L /> <input type='submit' name='drop' value='".'Drop'."'$L /></p>\n";$G=(isset($_POST["target"])?$_POST["target"]:$_GET["db"]);echo"<p>".'Move to other database'.(o()?": <select name='target'>".f(o(),$G)."</select>":': <input name="target" value="'.htmlspecialchars($G).'" />')." <input type='submit' name='move' value='".'Move'."' /></p>\n";echo"</form>\n";}$c->d();if($d->server_info>=5){echo'<p><a href="'.htmlspecialchars($i).'createv=">'.'Create view'."</a></p>\n";echo"<h3>".'Routines'."</h3>\n";$c=$d->b("SELECT * FROM information_schema.ROUTINES WHERE ROUTINE_SCHEMA = '".$d->c($_GET["db"])."'");if($c->num_rows){echo"<table border='0' cellspacing='0' cellpadding='2'>\n";while($a=$c->e()){echo"<tr>";echo"<td>".htmlspecialchars($a["ROUTINE_TYPE"])."</td>";echo'<th><a href="'.htmlspecialchars($i).($a["ROUTINE_TYPE"]=="FUNCTION"?'callf=':'call=').urlencode($a["ROUTINE_NAME"]).'">'.htmlspecialchars($a["ROUTINE_NAME"]).'</a></th>';echo'<td><a href="'.htmlspecialchars($i).($a["ROUTINE_TYPE"]=="FUNCTION"?'function=':'procedure=').urlencode($a["ROUTINE_NAME"]).'">'.'Alter'."</a></td>";echo"</tr>\n";}echo"</table>\n";}$c->d();echo'<p><a href="'.htmlspecialchars($i).'procedure=">'.'Create procedure'.'</a> <a href="'.htmlspecialchars($i).'function=">'.'Create function'."</a></p>\n";}if($d->server_info>=5.1&&($c=$d->b("SHOW EVENTS"))){echo"<h3>".'Events'."</h3>\n";if($c->num_rows){echo"<table border='0' cellspacing='0' cellpadding='2'>\n";echo"<thead><tr><th>".'Name'."</th><td>".'Schedule'."</td><td>".'Start'."</td><td>".'End'."</td></tr></thead>\n";while($a=$c->e()){echo"<tr>";echo'<th><a href="'.htmlspecialchars($i).'event='.urlencode($a["Name"]).'">'.htmlspecialchars($a["Name"])."</a></th>";echo"<td>".($a["Execute at"]?'At given time'."</td><td>".$a["Execute at"]:'Every'." ".$a["Interval value"]." ".$a["Interval field"]."</td><td>$a[Starts]")."</td>";echo"<td>$a[Ends]</td>";echo"</tr>\n";}echo"</table>\n";}$c->d();echo'<p><a href="'.htmlspecialchars($i).'event=">'.'Create event'."</a></p>\n";}}}s();}