";
$db_list=mysql_list_dbs($connect);
echo " |
";
if(!empty($_POST['db'])){
$tb_list=mysql_list_tables($_POST['db']);
echo " |
";
if(isset($_POST['table_sel'])){
$c=array('Browse','SQL','Insert','Export');$i=-1;
while($i++<3){echo "".$c[$i];}}
echo " ".((isset($_POST['table_sel']))?$_POST['table_sel']:null)." |
";}
if(isset($_POST['push']) && isset($_POST['querysql']) && preg_match('/^\s*select /i',$_POST['querysql']))$_POST['go']=0;
elseif(isset($_POST['push']))$_POST['go']=1;
if(isset($_POST['back']))$_POST['go']=3;
if(isset($_POST['brow']))$_POST['go']=0;
if(isset($_POST['editr']) && isset($_POST['edit']))$_POST['go']=4;
if(isset($_POST['ed_save']))$_POST['go']=5;
if(isset($_POST['editr']) && !isset($_POST['edit']))$_POST['go']=0;
if(isset($_POST['go'])){switch($_POST['go']){
case 0:
if(isset($_POST['querysql']) && preg_match('/^\s*select /i',$_POST['querysql']) && isset($_POST['push'])){
$n=mysql_fetch_array(mysql_query(preg_replace('/^\s*select\s+.+\s+from\s+/i','select count(*) from',$_POST['querysql'])));
$result=mysql_query($_POST['querysql'],$connect);}
else{$n=mysql_fetch_array(mysql_query('select count(*) from '.$_POST['table_sel']));$sort='';
if(!empty($_POST['sort']))$sort='ORDER BY `'.trim($_POST['sort']).'` ASC ';$co='0,20';
if(isset($_POST['br_st']) && isset($_POST['br_en'])){
$co=$_POST['br_en'].','.$_POST['br_st'];}
$result = mysql_query("SELECT * FROM `".$_POST['table_sel']."` $sort limit $co",$connect);}
for($i=0;$iSort by
Show row(s) starting from
";
mysql_free_result($result);
break;
case 1:
echo "
";
if(!empty($_POST['querysql'])){
$result = mysql_query($_POST['querysql'],$connect) or print("".mysql_error($connect)." ");
echo "".mysql_info($connect)." ";}
break;
case 2:
echo "";
break;
case 3:
if(!isset($_POST['back']))echo '';
if(isset($_POST['back']) && isset($_POST['table_sel'])){
if($_POST['save']==0){echo "";}}
break;
case 4:
if(isset($_POST['edit'])){
$up_e=$_POST['edit'];
echo "";
$up_e=urldecode($_POST['edit']);
echo "";}
break;
case 5:
$ted='';
$_POST2=$_POST;
while(list($key1,$val1)=each($_POST2)){
if(preg_match('/ed_key:(.+)/',$key1,$m))
{$ted.="`".$m[1]."`= '".addslashes($val1)."', ";}}
$ted=substr($ted,0,-2);
$query=((isset($_POST['insert']))?"INSERT":"UPDATE")." `".$_POST['table_sel']."` SET $ted ".((isset($_POST['insert']))?'':"WHERE ".urldecode($_POST['edit'])." LIMIT 1 ");
echo "".htmlspecialchars($query,ENT_QUOTES)." ";
$result = mysql_query($query,$connect) or print("".mysql_error($connect)." ");
echo "".mysql_info($connect)." ";
break;}}
echo " |
|