<?php
//设定错误讯息回报的等级
error_reporting(7);
//打开输出缓冲区
ob_start();
//使用一个字符串分割另一个字符串
//microtime当前 Unix 时间戳以及微秒数
$mtime = explode(' ', microtime());
$starttime = $mtime[1] + $mtime[0];
// 允许程序在 register_globals = off 的环境下工作
$onoff = (function_exists('ini_get')) ? ini_get('register_globals') : get_cfg_var('register_globals');
if ($onoff != 1)
{
@extract($_POST, EXTR_SKIP);
@extract($_GET, EXTR_SKIP);
}
$self = $_SERVER['PHP_SELF'];
$dis_func = get_cfg_var("disable_functions");
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>File operation</title>
</head>
<body>
<?
$win = strtolower(substr(PHP_OS,0,3)) == "win";
//CONFIGURATION AND SETTINGS
if (!empty($unset_surl)) {setcookie("c99sh_surl"); $surl = "";}
elseif (!empty($set_surl)) {$surl = $set_surl; setcookie("c99sh_surl",$surl);}
else {$surl = $_REQUEST["c99sh_surl"]; //Set this cookie for manual SURL
}
$surl_autofill_include = TRUE; //If TRUE then search variables with descriptors (URLs) and save it in SURL.
if ($surl_autofill_include and !$_REQUEST["c99sh_surl"]) {$include = "&"; foreach (explode("&",getenv("QUERY_STRING")) as $v) {$v = explode("=",$v); $name = urldecode($v[0]); $value = urldecode($v[1]); foreach (array("http://","https://","ssl://","ftp://","\\\\") as $needle) {if (strpos($value,$needle) === 0) {$includestr .= urlencode($name)."=".urlencode($value)."&";}}} if ($_REQUEST["surl_autofill_include"]) {$includestr .= "surl_autofill_include=1&";}}
if (empty($surl))
{
$surl = "?".$includestr; //Self url
}
$surl = htmlspecialchars($surl);
$timelimit = 0; //time limit of execution this script over server quote (seconds), 0 = unlimited.
//$surl="process.php?"
?>
<?
if (!function_exists("myshellexec"))
{
function myshellexec($cmd)
{
global $disablefunc;
$result = "";
if (!empty($cmd))
{
if (is_callable("exec") and !in_array("exec",$disablefunc)) {exec($cmd,$result); $result = join("\n",$result);}
elseif (($result = `$cmd`) !== FALSE) {}
elseif (is_callable("system") and !in_array("system",$disablefunc)) {$v = @ob_get_contents(); @ob_clean(); system($cmd); $result = @ob_get_contents(); @ob_clean(); echo $v;}
elseif (is_callable("passthru") and !in_array("passthru",$disablefunc)) {$v = @ob_get_contents(); @ob_clean(); passthru($cmd); $result = @ob_get_contents(); @ob_clean(); echo $v;}
elseif (is_resource($fp = popen($cmd,"r")))
{
$result = "";
while(!feof($fp)) {$result .= fread($fp,1024);}
pclose($fp);
}
}
return $result;
}
}
if (!function_exists("parsesort"))
{
function parsesort($sort)
{
$one = intval($sort);
$second = substr($sort,-1);
if ($second != "d") {$second = "a";}
return array($one,$second);
}
}
if (!function_exists("posix_kill") and !in_array("posix_kill",$disablefunc)) {function posix_kill($gid) {return FALSE;}}
if ($_GET['action'] == "process")
{
echo "<b>Processes:</b><br>";
echo "<hr width=\"995\" noshade>";
if (!$win) {$handler = "ps -aux".($grep?" | grep '".addslashes($grep)."'":"");}
else {$handler = "tasklist";}
$ret = myshellexec($handler);
if (!$ret) {echo "Can't execute \"".$handler."\"!";}
else
{
if (empty($processes_sort)) {$processes_sort = $sort_default;}
$parsesort = parsesort($processes_sort);
if (!is_numeric($parsesort[0])) {$parsesort[0] = 0;}
$k = $parsesort[0];
if ($parsesort[1] != "a") {$y = "<a href=\"".$surl."action=".$dspact."&d=".urlencode($d)."&processes_sort=".$k."a\"><img src=\"".$surl."action=img&img=sort_desc\" height=\"9\" width=\"14\" border=\"0\"></a>";}
else {$y = "<a href=\"".$surl."action=".$dspact."&d=".urlencode($d)."&processes_sort=".$k."d\"><img src=\"".$surl."action=img&img=sort_asc\" height=\"9\" width=\"14\" border=\"0\"></a>";}
$ret = htmlspecialchars($ret);
if (!$win)
{
if ($pid)
{
if (is_null($sig)) {$sig = 9;}
echo "Sending signal ".$sig." to #".$pid."... ";
if (posix_kill($pid,$sig)) {echo "OK.";}
else {echo "ERROR.";}
}
while (ereg(" ",$ret)) {$ret = str_replace(" "," ",$ret);}
$stack = explode("\n",$ret);
$head = explode(" ",$stack[0]);
unset($stack[0]);
for($i=0;$i<count($head);$i++)
{
if ($i != $k) {$head[$i] = "<a href=\"".$surl."action=".$dspact."&d=".urlencode($d)."&processes_sort=".$i.$parsesort[1]."\"><b>".$head[$i]."</b></a>";}
}
$prcs = array();
foreach ($stack as $line)
{
if (!empty($line))
{
echo "<tr>";
$line = explode(" ",$line);
$line[10] = join(" ",array_slice($line,10));
$line = array_slice($line,0,11);
if ($line[0] == get_current_user()) {$line[0] = "<font color=green>".$line[0]."</font>";}
$line[] = "<a href=\"".$surl."action=processes&d=".urlencode($d)."&pid=".$line[1]."&sig=9\"><u>KILL</u></a>";
$prcs[] = $line;
echo "</tr>";
}
}
}
else
{
while (ereg(" ",$ret)) {$ret = str_replace(" ","",$ret);}
while (ereg(" ",$ret)) {$ret = str_replace(" ","",$ret);}
while (ereg(" ",$ret)) {$ret = str_replace(" ","",$ret);}
while (ereg(" ",$ret)) {$ret = str_replace(" ","",$ret);}
while (ereg(" ",$ret)) {$ret = str_replace(" ","",$ret);}
while (ereg(" ",$ret)) {$ret = str_replace(" ","",$ret);}
while (ereg(" ",$ret)) {$ret = str_replace(" ","",$ret);}
while (ereg(" ",$ret)) {$ret = str_replace(" ","",$ret);}
while (ereg(" ",$ret)) {$ret = str_replace(" ","",$ret);}
while (ereg("",$ret)) {$ret = str_replace("","",$ret);}
while (ereg(" ",$ret)) {$ret = str_replace(" ","",$ret);}
$ret = convert_cyr_string($ret,"d","w");
$stack = explode("\n",$ret);
unset($stack[0],$stack[2]);
$stack = array_values($stack);
$head = explode("",$stack[0]);
$head[1] = explode(" ",$head[1]);
$head[1] = $head[1][0];
$stack = array_slice($stack,1);
unset($head[2]);
$head = array_values($head);
if ($parsesort[1] != "a") {$y = "<a href=\"".$surl."action=".$dspact."&d=".urlencode($d)."&processes_sort=".$k."a\"><img src=\"".$surl."action=img&img=sort_desc\" height=\"9\" width=\"14\" border=\"0\"></a>";}
else {$y = "<a href=\"".$surl."action=".$dspact."&d=".urlencode($d)."&processes_sort=".$k."d\"><img src=\"".$surl."action=img&img=sort_asc\" height=\"9\" width=\"14\" border=\"0\"></a>";}
if ($k > count($head)) {$k = count($head)-1;}
for($i=0;$i<count($head);$i++)
{
if ($i != $k) {$head[$i] = "<a href=\"".$surl."action=".$dspact."&d=".urlencode($d)."&processes_sort=".$i.$parsesort[1]."\"><b>".trim($head[$i])."</b></a>";}
}
$prcs = array();
foreach ($stack as $line)
{
if (!empty($line))
{
echo "<tr>";
$line = explode("",$line);
$line[1] = intval($line[1]); $line[2] = $line[3]; unset($line[3]);
$line[2] = intval(str_replace(" ","",$line[2]))*1024;
$prcs[] = $line;
echo "</tr>";
}
}
}
$head[$k] = "<b>".$head[$k]."</b>".$y;
$v = $processes_sort[0];
usort($prcs,"tabsort");
if ($processes_sort[1] == "d") {$prcs = array_reverse($prcs);}
$tab = array();
$tab[] = $head;
$tab = array_merge($tab,$prcs);
echo "<TABLE height=1 cellSpacing=0 borderColorDark=#666666 cellPadding=5 width=\"100%\" bgColor=#ffffff borderColorLight=#c0c0c0 border=1 bordercolor=\"#C0C0C0\">";
foreach($tab as $i=>$k)
{
echo "<tr>";
foreach($k as $j=>$v) {if ($win and $i > 0 and $j == 2) {$v = view_size($v);} echo "<td>".$v."</td>";}
echo "</tr>";
}
echo "</table>";
}
}
?>
<?php
/*======================================================
函数库
======================================================*/
?>
<?php
// 页面调试信息
function debuginfo() {
global $starttime;
$mtime = explode(' ', microtime());
$totaltime = number_format(($mtime[1] + $mtime[0] - $starttime), 6);
没有合适的资源?快使用搜索试试~ 我知道了~
基于Linux的远程管理系统客户端(PHP).zip
共26个文件
php:19个
gif:3个
html:2个
需积分: 0 0 下载量 81 浏览量
2024-05-06
23:26:28
上传
评论
收藏 29KB ZIP 举报
温馨提示
利用PHP语言来构建了一个远程管理系统 —— PHP Webmin,以Web的形式来实现Linux服务器的远程管理,简化了管理难度,并使管理方式更为灵活,从而达到了减轻系统管理员压力,方便系统管理员管理服务器的目的。
资源推荐
资源详情
资源评论
收起资源包目录
基于Linux的远程管理系统客户端(PHP).zip (26个子文件)
phpwebmin
left.php 5KB
php_server.php 10KB
ssh.php 1009B
configphp.php 722B
netconfig.php 4KB
process.php 18KB
mysql.php 15KB
.htaccess 129B
apache.php 956B
main.php 378B
img
closedbg.gif 387B
gohome.gif 391B
openbg.gif 826B
login_or_logout.php 3KB
package
uninstall.php 632B
head.php 574B
index.php 497B
configapache.php 749B
.phpwebminpasswd 20B
useradmin
edit_user.html 1KB
save_user.php 789B
edit_group.html 670B
right.php 143B
dhcp.php 1024B
init
index.php 942B
init.php 867B
共 26 条
- 1
资源评论
城仕
- 粉丝: 635
- 资源: 55
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功