if ($_REQUEST['phpinfo']) { ob_start(); phpinfo(); $sqldr = ob_get_clean(); } else { if ($DB['db']) { if ($_REQUEST['shex']) { print_export(); } elseif ($_REQUEST['doex']) { do_export(); } elseif ($_REQUEST['shim']) { print_import(); } elseif ($_REQUEST['doim']) { do_import(); } elseif ($_REQUEST['dosht']) { do_sht(); } elseif (!$_REQUEST['refresh'] || preg_match('/^select|show|explain/', $SQLq)) { do_sql($SQLq); } #perform non-selet SQL only if not refresh (to avoid dangerous delete/drop) } else { $err_msg = "Select DB first"; } } $time_all = ceil((microtime_float() - $time_start) * 10000) / 10000; print_screen(); } else { print_cfg(); } function do_sql($q) {
$time_start=microtime_float(); if ($_REQUEST['phpinfo']){ ob_start();phpinfo();$sqldr='<div style="font-size:130%">'.ob_get_clean().'</div>'; }else{ if ($DB['db']){ if ($_REQUEST['shex']){ print_export(); }elseif ($_REQUEST['doex']){ check_xss();do_export(); }elseif ($_REQUEST['shim']){ print_import(); }elseif ($_REQUEST['doim']){ check_xss();do_import(); }elseif ($_REQUEST['dosht']){ check_xss();do_sht(); }elseif (!$_REQUEST['refresh'] || preg_match('/^select|show|explain|desc/i',$SQLq) ){ if ($SQLq)check_xss(); do_sql($SQLq);#perform non-select SQL only if not refresh (to avoid dangerous delete/drop) } }else{ if ( $_REQUEST['refresh'] ){ check_xss();do_sql($SHOW_D); }elseif ($_REQUEST['crdb']){ check_xss();do_sql('CREATE DATABASE `'.$_REQUEST['new_db'].'`');do_sql($SHOW_D); }elseif ( preg_match('/^(?:show\s+(?:databases|status|variables|process)|create\s+database|grant\s+)/i',$SQLq) ){ check_xss();do_sql($SQLq); }else{ $err_msg="Select Database first"; if (!$SQLq) do_sql($SHOW_D); }