/** 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");echobase64_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;}}else{header("Content-Type: image/gif");switch($_GET["file"]){case"arrow.gif":echobase64_decode("R0lGODlhCAAKAIAAAICAgP///yH5BAEAAAEALAAAAAAIAAoAAAIPBIJplrGLnpQRqtOy3rsAADs=");break;case"up.gif":echobase64_decode("R0lGODdhEgASAKEAAO7u7gAAAJmZmQAAACwAAAAAEgASAAACIISPqcvtD00IUU4K730T9J5hFTiKEXmaYcW2rgDH8hwXADs=");break;case"down.gif":echobase64_decode("R0lGODdhEgASAKEAAO7u7gAAAJmZmQAAACwAAAAAEgASAAACIISPqcvtD00I8cwqKb5bV/5cosdMJtmcHca2lQDH8hwXADs=");break;case"plus.gif":echobase64_decode("R0lGODdhEgASAKEAAO7u7gAAAJmZmQAAACwAAAAAEgASAAACIYSPqcvtD00I8cwqKb5v+q8pIAhxlRmhZYi17iPE8kzLBQA7");break;case"minus.gif":echobase64_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($bas$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"]];functiona($N){return"`".str_replace("`","``",$N)."`";}functionja($N){returnstr_replace("``","`",$N);}functionj($N,$Oc=false){static$Vb=array(':'=>':1',']'=>':2','['=>':3');returnstrtr($N,($Oc?array_flip($Vb):$Vb));}functionf($za,$Jc=null){$n="";foreach($zaas$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;}functiony($m){global$d;$n=array();$c=$d->b($m);if($c){while($a=$c->l()){$n[]=$a[0];}$c->d();}return$n;}functiono(){$n=&$_SESSION["databases"][$_GET["server"]];if(!isset($n)){flush();$n=y("SHOW DATABASES");}return$n;}functionia($q){global$d;$c=$d->b("SHOW TABLE STATUS LIKE '".$d->c(addcslashes($q,"%_"))."'");$n=$c->e();$c->d();return$n;}functionn($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;}functionw($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;}functionx($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($Bas$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;}functionpa($j){global$d;returnarray("select"=>preg_replace('~^(?:[^`]+|`[^`]*`)* AS ~U','',$d->i($d->b("SHOW CREATE VIEW ".a($j)),1)));}functionbb($a,$u){foreach($uas$o){if($o["type"]=="PRIMARY"||$o["type"]=="UNIQUE"){$n=array();foreach($o["columns"]as$f){if(!isset($a[$f])){continue2;}$n[]=urlencode("where[".j($f)."]")."=".urlencode($a[$f]);}return$n;}}$n=array();foreach($aas$f=>$b){$n[]=(isset($b)?urlencode("where[".j($f)."]")."=".urlencode($b):"null%5B%5D=".urlencode($f));}return$n;}functionaa($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;}functionma($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));}functionoa(){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;}functionva(){return($GLOBALS["TOKENS"][]=rand(1,1e6));}functionab(){if($_POST["token"]&&($Z=array_search($_POST["token"],(array)$GLOBALS["TOKENS"]))!==false){unset($GLOBALS["TOKENS"][$Z]);returntrue;}returnfalse;}functionp($v,$X=null){if(isset($X)){$_SESSION["messages"][]=$X;}ab();if(strlen(SID)){$v.=(strpos($v,"?")===false?"?":"&").SID;}header("Location: ".(strlen($v)?$v:"."));exit;}functiong($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;returnfalse;}if($Kc){p($v,$X.$gc);}returntrue;}functionk($m=null){global$d;static$jc=array();if(!isset($m)){returnimplode(";\n",$jc);}$jc[]=$m;return$d->b($m);}functiont($H=""){$H="($H|".session_name().")";returnpreg_replace("~\\?$H=[^&]*&~",'?',preg_replace("~\\?$H=[^&]*\$|&$H=[^&]*~",'',$_SERVER["REQUEST_URI"]));}functionka($Va){echo" ".($Va==$_GET["page"]?$Va+1:'<a href="'.htmlspecialchars(t("page").($Va?"&page=$Va":"")).'">'.($Va+1)."</a>");}functionla($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"]));}functionha($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>";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"</thead>\n";}echo"";foreach($aas$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)):"&nbsp;");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.="&amp;where".urlencode("[".j($bb)."]")."=".urlencode($a[$w]);}$b='<a href="'.htmlspecialchars($i).$ea.'">'.$b.'</a>';}}echo"$b";}echo"\n";}echo"\n";}$c->d();}functionza($xa,$z){preg_match("~^(.{0,$z})(.?)~su",$xa,$g);returnnl2br(htmlspecialchars($g[1])).($g[2]?"<em>...</em>":"");}functionta(&$a){if($a["Engine"]=="InnoDB"){$a["Comment"]=preg_replace('~(?:(.+); )?InnoDB free: .*~','\\1',$a["Comment"]);}}functionga($Y,$Ka=array()){while(list($f,$b)=each($Y)){if(is_array($b)){foreach($bas$la=>$Q){$Y[$f."[$la]"]=$Q;}}elseif(!in_array($f,$Ka)){echo'';}}}$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'=>'Русский язык',);functionm($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);returnvsprintf((isset($Ha)?$Ha:$N),$ec);}functioneb(){global$ba,$La;echo"
\n<div id='lang'>";ga($_GET,array('lang'));echo'Language'.": <select name='lang' onchange='this.form.submit();'>";foreach($Laas$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
\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($Bas$g){$fb[str_replace("_","-",$g[1])]=(isset($g[3])?$g[3]:1);}arsort($fb);foreach($fbas$f=>$ad){if(isset($La[$f])){$ba=$f;break;}$f=preg_replace('~-.*~','',$f);if(!isset($fb[$f])&&isset($La[$f])){$ba=$f;break;}}}functionh($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"><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" /><?php echo$Jb.(strlen($Ya)?": ".htmlspecialchars($Ya):"")." - ".'phpMinAdmin'." 1.10.0";?><title> echo$Jb.(strlen($Ya)?": ".htmlspecialchars($Ya):"")." - ".'phpMinAdmin'." 1.10.0";</title><link rel="shortcut icon" type="image/x-icon" href=" echopreg_replace("~\\?.*~","",$_SERVER["REQUEST_URI"])."?file=favicon.ico";" /><link rel="stylesheet" type="text/css" href=" echo(file_exists("phpMinAdmin.css")?"phpMinAdmin.css":"".preg_replace("~\\?.*~","",$_SERVER["REQUEST_URI"])."?file=default.css");" /><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">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> &raquo; ';if(is_array($Ib)){if(strlen($_GET["db"])){echo'<a href="'.htmlspecialchars(substr($i,0,-1)).'">'.htmlspecialchars($_GET["db"]).'</a> &raquo; ';}foreach($Ibas$f=>$b){if(strlen($b)){echo'<a href="'.htmlspecialchars("$i$f=").($f!="privileges"?urlencode($b):"").'">'.htmlspecialchars($b).'</a> &raquo; ';}}}echo"$Jb</p>\n";}echo"

$Jb".(strlen($Ya)?": ".htmlspecialchars($Ya):"")."

\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";}}functions($cc=false){global$i,$d;</div><div id="menu">

<a href="http://phpminadmin.sourceforge.net">phpMinAdmin</a>

if($cc!="auth"){
<p><a href=" echohtmlspecialchars($i);sql=">SQL command</a><a href=" echohtmlspecialchars($i);dump= echourlencode(isset($_GET["table"])?$_GET["table"]:$_GET["select"]);">Dump</a></p>
<p> if(strlen($_GET["server"])){<input type="hidden" name="server" value=" echohtmlspecialchars($_GET["server"]);" /> } if(o()){<select name="db" onchange="this.form.submit();"><option value="">(database)</option> echof(o(),$_GET["db"]);</select> }else{<input name="db" value=" echohtmlspecialchars($_GET["db"]);" /> } if(isset($_GET["sql"])){ } if(isset($_GET["schema"])){ } if(isset($_GET["dump"])){ }</p> if(o()){<noscript><p></p></noscript> }
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> 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> }}if(extension_loaded("mysqli")){classMin_MySQLiextendsMySQLi{var$extension="MySQLi";functionMin_MySQLi(){$this->init();}functionda($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")));}functioni($c,$e=0){if(!$c){returnfalse;}$a=$c->_result->fetch_array();return$a[$e];}functionu($Sa){returnparent::select_db($Sa);}functionb($m){$c=parent::query($m);return(is_object($c)?newMin_MySQLiResult($c):$c);}functionq($m){returnparent::multi_query($m);}functionr(){$c=parent::store_result();return(is_object($c)?newMin_MySQLiResult($c):$c);}functionv(){returnparent::next_result();}functionc($xa){returnparent::escape_string($xa);}}classMin_MySQLiResult{var$_result,$num_rows;function__construct($c){$this->_result=$c;$this->num_rows=$c->num_rows;}functione(){return$this->_result->fetch_assoc();}functionl(){return$this->_result->fetch_row();}function_(){return$this->_result->fetch_field();}functiond(){return$this->_result->free();}}$d=newMin_MySQLi;}elseif(extension_loaded("mysql")){classMin_MySQL{var$extension="MySQL",$_link,$_result,$server_info,$affected_rows,$error;functionda($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;}functionu($Sa){returnmysql_select_db($Sa,$this->_link);}functionb($m){$c=mysql_query($m,$this->_link);if(!$c){$this->error=mysql_error($this->_link);returnfalse;}elseif($c===true){$this->affected_rows=mysql_affected_rows($this->_link);returntrue;}returnnewMin_MySQLResult($c);}functionq($m){return$this->_result=$this->b($m);}functionr(){return$this->_result;}functionv(){returnfalse;}functioni($c,$e=0){if(!$c){returnfalse;}returnmysql_result($c->_result,0,$e);}functionc($xa){returnmysql_real_escape_string($xa,$this->_link);}}classMin_MySQLResult{var$_result,$_offset=0,$num_rows;functionMin_MySQLResult($c){$this->_result=$c;$this->num_rows=mysql_num_rows($c);}functione(){returnmysql_fetch_assoc($this->_result);}functionl(){returnmysql_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;}functiond(){returnmysql_free_result($this->_result);}}$d=newMin_MySQL;}elseif(extension_loaded("pdo_mysql")){classMin_PDO_MySQLextendsPDO{var$extension="PDO_MySQL",$_result,$server_info,$affected_rows,$error;function__construct(){}functionda($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()"));returntrue;}functionu($Sa){return$this->b("USE ".a($Sa));}functionb($m){$c=parent::query($m);if(!$c){$Yc=$this->errorInfo();$this->error=$Yc[2];returnfalse;}$this->_result=$c;if(!$c->columnCount()){$this->affected_rows=$c->rowCount();returntrue;}$c->num_rows=$c->rowCount();return$c;}functionq($m){return$this->b($m);}functionr(){return($this->_result->columnCount()?$this->_result:true);}functionv(){return$this->_result->nextRowset();}functioni($c,$e=0){if(!$c){returnfalse;}$a=$c->fetch();return$a[$e];}functionc($xa){returnsubstr($this->quote($xa),1,-1);}}classMin_PDOStatementextendsPDOStatement{var$_offset=0,$num_rows;functione(){return$this->fetch(2);}functionl(){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;}functiond(){}}$d=newMin_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);
<table border="0" cellspacing="0" cellpadding="2"> <th>Server</th><input name="server" value=" echohtmlspecialchars($_GET["server"]);" /> <th>Username</th><input name="username" value=" echohtmlspecialchars($_);" /> <th>Password</th> <p>ga($_POST,$Ka);foreach($_FILESas$f=>$b){echo'';} </p>
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',"$d->server_info","$d->extension")."</p>\n";echo"<p>".sprintf('Logged as: %s',"".htmlspecialchars($d->i($d->b("SELECT USER()")))."")."</p>\n";}s("db");exit;}$d->b("SET CHARACTER SET utf8");functionxa($j,$e,$p){global$W;$j=htmlspecialchars(j($j));if($e["type"]=="enum"){if(isset($_GET["select"])){echo' <label><em>'.'original'.'</em></label>';}if($e["null"]||isset($_GET["default"])){echo' <label>'.($e["null"]?'<em>NULL</em>':'').'</label>';}if(!isset($_GET["default"])){echo'';}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>'.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>'.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")?'':'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.' />';}}}functionba($j,$e){global$d;$N=j($j);$ha=$_POST["function"][$N];$p=$_POST["fields"][$N];if($e["type"]=="enum"?$p==-1:$ha=="orig"){returnfalse;}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)){returnfalse;}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)){returna($j)." $ha '".$d->c($p)."'";}elseif(preg_match('~^(md5|sha1|password)$~',$ha)){return"$ha('".$d->c($p)."')";}else{return"'".$d->c($p)."'";}}functionwa($f,$e,$O){global$W,$jb,$_a;<select name=" echo$f;[type]" onchange="type_change(this);"> echof(array_keys($W),$e["type"]);</select><input name=" echo$f;[length]" value=" echohtmlspecialchars($e["length"]);" size="3" /><select name=" echo$f;[collation]" echo(preg_match('~char|text|enum|set~',$e["type"])?"":" class='hidden'");><option value="">(collation)</option> echof($O,$e["collation"]);</select> <select name=" echo$f;[unsigned]" echo(!$e["type"]||preg_match('~int|float|double|decimal~',$e["type"])?"":" class='hidden'");> echof($jb,$e["unsigned"]);</select>}functionca($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"])."'":"");}functionya($l,$O,$U="TABLE"){global$_a; if($U=="PROCEDURE"){IN-OUT }<th> echo($U=="TABLE"?'Column name':'Parameter name');</th>TypeLengthOptions if($U=="TABLE"){NULLAuto IncrementComment }<input type="image" name="add[0]" src=" echopreg_replace("~\\?.*~","",$_SERVER["REQUEST_URI"])."?file=plus.gif";" title="Add next" />$Wa=false;foreach($las$h=>$e){$h++;$Xb=(isset($_POST["add"][$h-1])||(isset($e["field"])&&!$_POST["drop_col"][$h]));<tr echo($Xb?"":" style='display: none;'");> if($U=="PROCEDURE"){<select name="fields[ echo$h;][inout]"> echof($_a,$e["inout"]);</select> }<th> if($Xb){<input name="fields[ echo$h;][field]" value=" echohtmlspecialchars($e["field"]);" maxlength="64" /> }<input type="hidden" name="fields[ echo$h;][orig]" value=" echohtmlspecialchars($e[($_POST?"orig":"field")]);" /></th> wa("fields[$h]",$e,$O); if($U=="TABLE"){<input name="fields[ echo$h;][comment]" value=" echohtmlspecialchars($e["comment"]);" maxlength="255" /> }<td class="nowrap"><input type="image" name="add[ echo$h;]" src=" echopreg_replace("~\\?.*~","",$_SERVER["REQUEST_URI"])."?file=plus.gif";" title="Add next" onclick="return !add_row(this);" /><input type="image" name="drop_col[ echo$h;]" src=" echopreg_replace("~\\?.*~","",$_SERVER["REQUEST_URI"])."?file=minus.gif";" title="Remove" onclick="return !remove_row(this);" /><input type="image" name="up[ echo$h;]" src=" echopreg_replace("~\\?.*~","",$_SERVER["REQUEST_URI"])."?file=up.gif";" title="Move up" /><input type="image" name="down[ echo$h;]" src=" echopreg_replace("~\\?.*~","",$_SERVER["REQUEST_URI"])."?file=down.gif";" title="Move down" />if(strlen($e["comment"])){$Wa=true;}}return$Wa;}functionua(&$l){ksort($l);$aa=0;if($_POST["up"]){$qc=0;foreach($las$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($las$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()));}}functionsa($Vc,$Bc=0){<script type="text/javascript">// <![CDATA[var added = '.';var row_count = echo$Vc;;function add_row(button) { if ( echo$Bc; && row_count >= 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>}functiondb($g){return"'".str_replace("'","''",addcslashes(stripcslashes(str_replace($g[0]{0}.$g[0]{0},$g[0]{0},substr($g[0],1,-1))),'\\'))."'";}functionqa($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($Bas$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"){returnarray("fields"=>$l,"definition"=>$g[10]);}$Xc=array("type"=>$g[10],"length"=>$g[11],"unsigned"=>$g[13],"collation"=>$g[14]);returnarray("fields"=>$l,"returns"=>$Xc,"definition"=>$g[15]);}functionna($a){foreach($aas$f=>$b){if(preg_match("~[\"\n,]~",$b)||(isset($b)&&!strlen($b))){$a[$f]='"'.str_replace('"','""',$b).'"';}}echoimplode(",",$a)."\n";}functionfa($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 '$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 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_nameforeach($las$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 echoa($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;}$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();}}}functionea($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($aas$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($aas$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();}}}functionra($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"<th>".htmlspecialchars($a["Field"])."</th>$a[Type]".($a["Null"]=="YES"?" <i>NULL</i>":"")."\n";}echo"\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"

".'Indexes'."

\n";$u=w($_GET["table"]);if($u){echo"<table border='1' cellspacing='0' cellpadding='2'>\n";foreach($uas$o){ksort($o["columns"]);$qa=array();foreach($o["columns"]as$f=>$b){$qa[]="<i>".htmlspecialchars($b)."</i>".($o["lengths"][$f]?"(".$o["lengths"][$f].")":"");}echo"$o[type]".implode(", ",$qa)."\n";}echo"\n";}echo'<p><a href="'.htmlspecialchars($i).'indexes='.urlencode($_GET["table"]).'">'.'Alter indexes'."</a></p>\n";if($Ob["Engine"]=="InnoDB"){echo"

".'Foreign keys'."

\n";$ia=x($_GET["table"]);if($ia){echo"<table border='1' cellspacing='0' cellpadding='2'>\n";foreach($iaas$j=>$x){echo"";echo"<i>".implode("</i>, <i>",array_map('htmlspecialchars',$x["source"]))."</i>";$ea=(strlen($x["db"])?"<strong>".htmlspecialchars($x["db"])."</strong>.":"").htmlspecialchars($x["table"]);echo'<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>)";echo''.(!strlen($x["db"])?'<a href="'.htmlspecialchars($i).'foreign='.urlencode($_GET["table"]).'&amp;name='.urlencode($j).'">'.'Alter'.'</a>':'&nbsp;').'';echo"\n";}echo"\n";}echo'<p><a href="'.htmlspecialchars($i).'foreign='.urlencode($_GET["table"]).'">'.'Add foreign key'."</a></p>\n";}}if($d->server_info>=5){echo"

".'Triggers'."

\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'>$a[Timing]$a[Event]<th>".htmlspecialchars($a["Trigger"])."</th><a href=\"".htmlspecialchars($i).'trigger='.urlencode($_GET["table"]).'&amp;name='.urlencode($a["Trigger"]).'">'.'Alter'."</a>\n";}echo"\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($Bas$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 = { echoimplode(",",$xc)."\n";};function mousedown(el, event) { that = el; em = document.getElementById('schema').offsetHeight / 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: echo$Ga;em;">foreach($daas$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($Paas$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($Paas$F=>$r){$Oa=$F-$ca[$j][1];$h=0;foreach($ras$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($daas$j=>$q){foreach((array)$q["references"]as$Ea=>$Pa){foreach($Paas$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>}elseif(isset($_GET["dump"])){functioncb($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"){echocb((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($Maas$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 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$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;}}}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>
<p> echo'Output'.": $tc ".'Format'.": $wc"; </p>echo"<table border='1' cellspacing='0' cellpadding='2'>\n<thead><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"</thead>\n";foreach((strlen($_GET["db"])?array($_GET["db"]):o())as$G){if($G!="information_schema"||$d->server_info<5){echo"".htmlspecialchars($G)."";foreach(array('','USE','DROP, CREATE','CREATE','CREATE, ALTER')as$b){echo'";}echo"\n";}}echo"\n";echo"<table border='1' cellspacing='0' cellpadding='2'>\n<thead><th rowspan='2'>".'Tables'."</th><th colspan='4'>".'Structure'."</th><th colspan='4'>".'Data'."</th>";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"</thead>\n";$Ma="";$c=$d->b(strlen($_GET["db"])?"SHOW TABLE STATUS":"SELECT 'Engine'");while($a=$c->e()){$qa="".htmlspecialchars($a["Name"])."";foreach(array('','DROP, CREATE','CREATE','CREATE, ALTER')as$b){$qa.='";}if(!$a["Engine"]){$Ma.="$qa\n";}else{foreach(array('','TRUNCATE, INSERT','INSERT','UPDATE')as$b){$qa.='";}echo"$qa\n";}}echo"$Ma\n";
}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){
<p> if(strlen($_GET["server"])){<input type="hidden" name="server" value=" echohtmlspecialchars($_GET["server"]);" /> } Username: <input name="user" /> Server: <input name="host" value="localhost" /> </p>
$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><th>&nbsp;</th><th>".'Username'."</th><th>".'Server'."</th></thead>\n";while($a=$c->e()){echo'<a href="'.htmlspecialchars($i).'user='.urlencode($a["User"]).'&amp;host='.urlencode($a["Host"]).'">'.'edit'.'</a>'.htmlspecialchars($a["User"])."".htmlspecialchars($a["Host"])."\n";}echo"\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";}}
<p><textarea name="query" rows="20" cols="80" style="width: 98%;"> echohtmlspecialchars($_POST?$_POST["query"]:$_GET["sql"]);</textarea></p><p><script type="text/javascript">// <![CDATA[document.write('<label> echoaddcslashes('Syntax highlighting',"\r\n'\\");</label>');// ]]></script><label>Stop on error</label></p>
if(!ini_get("file_uploads")){echo"<p>".'File uploads are disabled.'."</p>\n";}else{
<p>File upload: </p>
}}elseif(isset($_GET["edit"])){$s=(isset($_GET["select"])?array():aa($_GET));$Na=($s&&!$_GET["clone"]);$l=n($_GET["edit"]);foreach($las$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($las$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($las$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();}}
if($l){unset($E);echo"<table border='0' cellspacing='0' cellpadding='2'>\n";foreach($las$j=>$e){echo"<th>".htmlspecialchars($j)."</th>";$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>'.'ON UPDATE CURRENT_TIMESTAMP'.'</label>';}echo"\n";}echo"\n";}<p>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){ if(!isset($_GET["default"])&&!isset($_GET["select"])){ } } if($Na){ }</p>
}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="";break2;}}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";}
<p>Table name: <input name="name" maxlength="64" value=" echohtmlspecialchars($a["name"]);" /><select name="Engine"><option value="">(engine)</option> echof($sc,$a["Engine"]);</select><select name="Collation"><option value="">(collation)</option> echof($O,$a["Collation"]);</select></p><table border="0" cellspacing="0" cellpadding="2"> $Wa=ya($a["fields"],$O); echosa(count($a["fields"]),$qb);<p>Auto Increment: <input name="Auto_increment" size="4" value=" echointval($a["Auto_increment"]);" />Comment: <input name="Comment" value=" echohtmlspecialchars($a["Comment"]);" maxlength="60" /><script type="text/javascript">// <![CDATA[document.write('<label>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'); }} if(!$Wa){column_comments_click(false); }// ]]></script></p><p> if(strlen($_GET["create"])){ }</p> if($d->server_info>=5.1){<fieldset><legend>Partition by</legend><p><select name="partition_by"><option></option> echof($oc,$a["partition_by"]);</select>(<input name="partition" value=" echohtmlspecialchars($a["partition"]);" />)Partitions: <input name="partitions" size="2" value=" echohtmlspecialchars($a["partitions"]);" /></p><table border="0" cellspacing="0" cellpadding="2"><thead><th>Partition name</th><th>Values</th></thead>foreach($a["partition_names"]as$f=>$b){echo'<input name="partition_names['.intval($f).']" value="'.htmlspecialchars($b).'" /><input name="partition_values['.intval($f).']" value="'.htmlspecialchars($a["partition_values"][$f])."\" />\n";}<input name="partition_names[ echo$f+1;]" value="" /><input name="partition_values[ echo$f+1;]" value="" /></fieldset> }
}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($uas$j=>$Ba){ksort($Ba["columns"]);ksort($Ba["lengths"]);if($o["type"]==$Ba["type"]&&$Ba["columns"]===$r&&$Ba["lengths"]===$tb){unset($u[$j]);continue2;}}$kb[]="ADD $o[type]".($o["type"]=="PRIMARY"?" KEY":"")." (".implode(", ",$t).")";}}}foreach($uas$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>
<table border="0" cellspacing="0" cellpadding="2"><thead><th>Index Type</th>Column (length)</thead>$w=0;foreach($a["indexes"]as$o){echo"<select name='indexes[$w][type]'".($w==count($a["indexes"])-1?" onchange='add_row(this);'":"")."><option></option>".f($Gc,$o["type"])."</select>\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"\n";$w++;}<p></p><noscript><p></p></noscript>
}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();}}
<p><input name="name" value=" echohtmlspecialchars($j);" maxlength="64" /><select name="collation"><option value="">(collation)</option> echof($O,$Ca);</select> if(strlen($_GET["db"])){ }</p>
}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)));}}}
if($Aa){echo"<table border='0' cellspacing='0' cellpadding='2'>\n";foreach($Aaas$f){$e=$T["fields"][$f];echo"<th>".htmlspecialchars($e["field"])."</th>";$p=$_POST["fields"][$f];if(strlen($p)&&($e["type"]=="enum"||$e["type"]=="set")){$p=intval($p);}xa($f,$e,$p);echo"\n";}echo"\n";}<p></p>
}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($Ias$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>
<p>Target table:<select name="table" onchange="this.form['change-js'].value = '1'; this.form.submit();"> echof($Hc,$a["table"]);</select></p><noscript><p></p></noscript><table border="0" cellspacing="0" cellpadding="2"><thead><th>Source</th><th>Target</th></thead>$w=0;foreach($a["source"]as$f=>$b){echo"";echo"<select name='source[".intval($f)."]'".($w==count($a["source"])-1?" onchange='add_row(this);'":"")."><option></option>".f($I,$b)."</select>";echo"<select name='target[".intval($f)."]'>".f($ga,$a["target"][$f])."</select>";echo"\n";$w++;}<p>ON DELETE: <select name="on_delete"><option></option> echof($va,$a["on_delete"]);</select>ON UPDATE: <select name="on_update"><option></option> echof($va,$a["on_update"]);</select></p><p> if(strlen($_GET["name"])){ }</p><noscript><p></p></noscript>
}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"];}
<p><textarea name="select" rows="10" cols="80" style="width: 98%;"> echohtmlspecialchars($a["select"]);</textarea></p><p> if($fa){ }Name: <input name="name" value=" echohtmlspecialchars($a["name"]);" maxlength="64" /> if(strlen($_GET["createv"])){ }</p>
}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();}
<table border="0" cellspacing="0" cellpadding="2"><th>Name</th><input name="EVENT_NAME" value=" echohtmlspecialchars($a["EVENT_NAME"]);" maxlength="64" /><th>Start</th><input name="STARTS" value=" echohtmlspecialchars("$a[EXECUTE_AT]$a[STARTS]");" /><th>End</th><input name="ENDS" value=" echohtmlspecialchars($a["ENDS"]);" /><th>Every</th><input name="INTERVAL_VALUE" value=" echohtmlspecialchars($a["INTERVAL_VALUE"]);" size="6" /> <select name="INTERVAL_FIELD"> echof($ic,$a["INTERVAL_FIELD"]);</select><th>Status</th><select name="STATUS"> echof($zb,$a["STATUS"]);</select><th>Comment</th><input name="EVENT_COMMENT" value=" echohtmlspecialchars($a["EVENT_COMMENT"]);" maxlength="64" /><th>&nbsp;</th><label>On completion preserve</label><p><textarea name="EVENT_DEFINITION" rows="10" cols="80" style="width: 98%;"> echohtmlspecialchars($a["EVENT_DEFINITION"]);</textarea></p><p> if(strlen($_GET["event"])){ }</p>
}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($las$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"];}
<table border="0" cellspacing="0" cellpadding="2"> ya($a["fields"],$O,$T); if(isset($_GET["function"])){Return type echowa("returns",$a["returns"],$O); } echosa(count($a["fields"])); if(isset($_GET["function"])){<script type="text/javascript">document.getElementById('form')['returns[type]'].onchange();</script> }<p><textarea name="definition" rows="10" cols="80" style="width: 98%;"> echohtmlspecialchars($a["definition"]);</textarea></p><p> if($fa){ }Name: <input name="name" value=" echohtmlspecialchars($a["name"]);" maxlength="64" /> if(strlen($_GET["procedure"])){ }</p>
}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();}
<table border="0" cellspacing="0" cellpadding="2"><th>Time</th><select name="Timing" onchange="if (/^ echohtmlspecialchars(preg_quote($_GET["trigger"],"/"));_[ba][iud]$/.test(this.form['Trigger'].value)) this.form['Trigger'].value = ' echohtmlspecialchars(addcslashes($_GET["trigger"],"\r\n'\\"));_' + this.value.charAt(0).toLowerCase() + this.form['Event'].value.charAt(0).toLowerCase();"> echof($nc,$a["Timing"]);</select><th>Event</th><select name="Event" onchange="this.form['Timing'].onchange();"> echof($Wb,$a["Event"]);</select><th>Name</th><input name="Trigger" value=" echohtmlspecialchars($a["Trigger"]);" maxlength="64" /><p><textarea name="Statement" rows="10" cols="80" style="width: 98%;"> echohtmlspecialchars($a["Statement"]);</textarea></p><p> if($fa){ } if(strlen($_GET["name"])){ }</p>
}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]);}functionz(&$D,$y){foreach($yas$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($Bas$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($Raas$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($Das$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;}
<table border="0" cellspacing="0" cellpadding="2"><th>Username</th><input name="user" maxlength="16" value=" echohtmlspecialchars($a["user"]);" /><th>Server</th><input name="host" maxlength="60" value=" echohtmlspecialchars($a["host"]);" /><th>Password</th><input id="pass" name="pass" value=" echohtmlspecialchars($a["pass"]);" /> if(!$a["hashed"]){<script type="text/javascript">document.getElementById('pass').type = 'password';</script> } <label>Hashed</label>echo"<table border='0' cellspacing='0' cellpadding='2'>\n";echo"<thead><th colspan='2'>".'Privileges'."</th>";$h=0;foreach($Das$S=>$J){echo'<th>'.($S!="*.*"?'*.*').'</th>';$h++;}echo"</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''.$Wc.'<td title="'.htmlspecialchars($Xa).'"><i>'.htmlspecialchars($Fa).'</i>';$h=0;foreach($Das$S=>$J){$j='"grants['.$h.']['.htmlspecialchars(strtoupper($Fa)).']"';$p=$J[strtoupper($Fa)];if($hb=="Server Admin"&&$S!=(isset($D["*.*"])?"*.*":"")){echo"&nbsp;";}elseif(isset($_GET["grant"])){echo"<select name=$j><option></option><option value='1'".($p?" selected='selected'":"").">".'Grant'."</option><option value='0'".($p=="0"?" selected='selected'":"").">".'Revoke'."</option></select>";}else{echo"<td align='center'><input type='checkbox' name=$j value='1'".($p?" checked='checked'":"")." />";}$h++;}echo"\n";}}echo"\n";<p> if(isset($_GET["host"])){ }</p>
}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);
<table border="1" cellspacing="0" cellpadding="2">$c=$d->b("SHOW PROCESSLIST");for($h=0;$a=$c->e();$h++){if(!$h){echo"<thead><tr lang='en'><th>&nbsp;</th><th>".implode("</th><th>",array_keys($a))."</th></thead>\n";}echo"<input type='checkbox' name='kill[]' value='$a[Id]' />".implode("",$a)."\n";}$c->d();<p></p>
}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($las$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($uas$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($las$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($las$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"
\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>echo"<fieldset><legend>".'Select'."</legend>\n";if(strlen($_GET["server"])){echo'';}echo'';echo'';echo"\n";$h=0;$Tb=array('Functions'=>$yb,'Aggregation'=>$ab);foreach($Kas$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($uas$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' : ''); } }} if($h){for (var i=0; echo$h; > i; i++) { document.getElementById('form')['where[' + i + '][op]'].onchange();} }</script>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"'.'whole result'.'</label>';foreach($aas$f=>$b){echo'<th><a href="'.htmlspecialchars(t('(order|desc)[^=]*')).'&amp;order%5B0%5D='.htmlspecialchars($f).($_GET["order"][0]===$f&&!$_GET["desc"][0]?'&amp;desc%5B0%5D=1':'').'">'.htmlspecialchars($f)."</a></th>";}echo"</thead>\n";}$eb=implode('&amp;',bb($a,$u));echo''.(count($K)==count($wa)&&$_GET["db"]!="information_schema"?' <a href="'.htmlspecialchars($i).'edit='.urlencode($_GET['select']).'&amp;'.$eb.'">'.'edit'.'</a> <a href="'.htmlspecialchars($i).'clone='.urlencode($_GET['select']).'&amp;'.$eb.'">'.'clone'.'</a>':'');foreach($aas$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"]).'&amp;field='.urlencode($f).'&amp;'.$eb.'">'.m(array('%d byte','%d bytes'),strlen($b)).'</a>';}else{if(!strlen(trim($b))){$b="&nbsp;";}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="&amp;where%5B$h%5D%5Bcol%5D=".urlencode($x["target"][$h])."&amp;where%5B$h%5D%5Bop%5D=%3D&amp;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"$b";}echo"\n";}echo"\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> i; i++) if (elems[i].name == \'tables[]\') elems[i].checked = this.checked;" /><th>'.'Table'.'</th>'.'Engine'.''.'Comment'.''.'Collation'.''.'Data Length'.''.'Index Length'.''.'Data Free'.''.'Auto Increment'.''.'Rows'."</thead>\n";while($a=$c->e()){ta($a);echo'<tr class="nowrap">'.(isset($a["Rows"])?'<th><a href="'.htmlspecialchars($i).'table='.urlencode($a["Name"]).'">'.htmlspecialchars($a["Name"])."</a></th>$a[Engine]".(strlen(trim($a["Comment"]))?htmlspecialchars($a["Comment"]):"&nbsp;")."$a[Collation]":'&nbsp;<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 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>':'&nbsp;');}echo"\n";}echo"\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"
\n";}$c->d();if($d->server_info>=5){echo'<p><a href="'.htmlspecialchars($i).'createv=">'.'Create view'."</a></p>\n";echo"

".'Routines'."

\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"";echo"".htmlspecialchars($a["ROUTINE_TYPE"])."";echo'<th><a href="'.htmlspecialchars($i).($a["ROUTINE_TYPE"]=="FUNCTION"?'callf=':'call=').urlencode($a["ROUTINE_NAME"]).'">'.htmlspecialchars($a["ROUTINE_NAME"]).'</a></th>';echo'<a href="'.htmlspecialchars($i).($a["ROUTINE_TYPE"]=="FUNCTION"?'function=':'procedure=').urlencode($a["ROUTINE_NAME"]).'">'.'Alter'."</a>";echo"\n";}echo"\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"

".'Events'."

\n";if($c->num_rows){echo"<table border='0' cellspacing='0' cellpadding='2'>\n";echo"<thead><th>".'Name'."</th>".'Schedule'."".'Start'."".'End'."</thead>\n";while($a=$c->e()){echo"";echo'<th><a href="'.htmlspecialchars($i).'event='.urlencode($a["Name"]).'">'.htmlspecialchars($a["Name"])."</a></th>";echo"".($a["Execute at"]?'At given time'."".$a["Execute at"]:'Every'." ".$a["Interval value"]." ".$a["Interval field"]."$a[Starts]")."";echo"$a[Ends]";echo"\n";}echo"\n";}$c->d();echo'<p><a href="'.htmlspecialchars($i).'event=">'.'Create event'."</a></p>\n";}}}s();}