PABX da Simples IP
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

536 lines
25 KiB

<?php
$acao = $_GET['acao'];
if ($acao == 'sair') {
echo "<script language=\"JavaScript\">
window.close();
</script>";
/*
$_SESSION["SSinSession"] = "";
$_SESSION["SSlogin"] = '';
$_SESSION["SSnomeUser"] = '';
$_SESSION["SSidUser"] = '';
$_SESSION["SSmatriculaUser"] = '';
$_SESSION["SSsuper"] = '';
$_SESSION["SSadmin"] = '';
$_SESSION["SSagente"] = '';
$_SESSION["SSaut"] = '';
*/
}
ob_end_flush();
//include dos arquivos padrões do sistema
include('admin/menu2.php');
//echo "Valores -> " . vai_comando('echo $SSH_CONNECTION', $dbcon);
//VERIFICAÇÃO DE ATUALIZAÇÃO DE BANCO DE DADOS
$sql_conta = pg_query($dbcon, "SELECT * FROM pbx_urls where tipo='RELOAD'");
$quantreg = pg_num_rows($sql_conta);
if ($quantreg == 0) {
pg_query($dbcon, "insert into pbx_urls (tipo,endereco)values('RELOAD','?action=command&command=reload&actionid=1000000000')");
?>
<SCRIPT>alert('FOI EXECUTADO UMA ATUALIZAÇÃO NO BANCO DE DADOS!');</SCRIPT>
<?php
}
$frei = disk_free_space("./");
$insgesamt = disk_total_space("./");
$belegt = $insgesamt - $frei;
$prozent_belegt = 100 * $belegt / $insgesamt;
flush();
function lowermemory($Wertq) {
if ($Wertq > 1073741824) {
$Wertq = number_format($Wertq / 1073741824, 2, ".", ",") . " Tb";
} elseif ($Wertq > 1048576) {
$Wertq = number_format($Wertq / 1048576, 2, ".", ",") . " Gb";
} elseif ($Wertq > 1024) {
$Wertq = number_format($Wertq / 1024, 2, ".", ",") . " Mb";
} else {
$Wertq = number_format($Wertq, 2, ".", ",") . " Kb";
}
return $Wertq;
}
function getStat($_statPath) {
if (trim($_statPath) == '') {
$_statPath = '/proc/stat';
}
ob_start();
passthru('cat ' . $_statPath);
$stat = ob_get_contents();
ob_end_clean();
if (substr($stat, 0, 3) == 'cpu') {
$parts = explode(" ", preg_replace("!cpu +!", "", $stat));
} else {
return false;
}
$return = array();
$return['user'] = $parts[0];
$return['nice'] = $parts[1];
$return['system'] = $parts[2];
$return['idle'] = $parts[3];
return $return;
}
function ZahlenFormatieren($Wert) {
if ($Wert > 1099511627776) {
$Wert = number_format($Wert / 1099511627776, 2, ".", ",") . " TB";
} elseif ($Wert > 1073741824) {
$Wert = number_format($Wert / 1073741824, 2, ".", ",") . " GB";
} elseif ($Wert > 1048576) {
$Wert = number_format($Wert / 1048576, 2, ".", ",") . " MB";
} elseif ($Wert > 1024) {
$Wert = number_format($Wert / 1024, 2, ".", ",") . " kB";
} else {
$Wert = number_format($Wert, 2, ".", ",") . " Bytes";
}
return $Wert;
}
function checkos() {
if (substr(PHP_OS, 0, 3) == "WIN") {
$osType = winosname();
$osbuild = php_uname('v');
$os = "windows";
} elseif (PHP_OS == "FreeBSD") {
$os = "nocpu";
$osType = "FreeBSD";
$osbuild = php_uname('r');
} elseif (PHP_OS == "Darwin") {
$os = "nocpu";
$osType = "Apple OS X";
$osbuild = php_uname('r');
} elseif (PHP_OS == "Linux") {
$os = "linux";
$osType = "Linux";
$osbuild = php_uname('r');
} else {
$os = "nocpu";
$osType = "Unknown OS";
$osbuild = php_uname('r');
}
return $osType;
}
function winosname() {
$wUnameB = php_uname("v");
$wUnameBM = php_uname("r");
$wUnameB = eregi_replace("build ", "", $wUnameB);
if ($wUnameBM == "5.0" && ($wUnameB == "2195")) {
$wVer = "Windows 2000";
}
if ($wUnameBM == "5.1" && ($wUnameB == "2600")) {
$wVer = "Windows XP";
}
if ($wUnameBM == "5.2" && ($wUnameB == "3790")) {
$wVer = "Windows Server 2003";
}
if ($wUnameBM == "6.0" && (php_uname("v") == "build 6000")) {
$wVer = "Windows Vista";
}
if ($wUnameBM == "6.0" && (php_uname("v") == "build 6001")) {
$wVer = "Windows Vista SP1";
}
return $wVer;
}
?>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
<?php
$title = "Monitor do Sistema";
$portcheck = ".1";
$copyright = "";
$servername = "127.0.0.1";
// Leave Blank For Automatic OS Detection, Or Put
// In The Name You Want To Show Up For You'r Server OS.
$customos = "";
if ($servername == "") {
$theservername = $_SERVER['SERVER_NAME'];
} else {
$theservername = $servername;
}
if ($customos == "") {
$osname = checkos();
} else {
$os = "nocpu";
$osname = $customos;
}
if (php_sapi_name() == "apache2handler") {
$httpapp = "Apache";
} else {
$httpapp = php_sapi_name();
}
if (PHP_OS == "WINNT") {
$os = "windows";
$osbuild = php_uname('v');
} elseif (PHP_OS == "Linux") {
$os = "linux";
$osbuild = php_uname('r');
} else {
$os = "nocpu";
$osbuild = php_uname('r');
}
if (isset($_GET['info']) && $_GET['info'] == "php") {
echo "<title>";
echo $title;
echo " | By ddggttff3</title></title>";
echo '<p><center><a href="./index.php">Click Here To Go Back...</a></center></p>';
phpinfo();
echo '<p><center><a href="./index.php">Click Here To Go Back...</a></center></p>';
exit();
}
?>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
<form name="form1" method="post" action="index.php?idProg=10034&pbxRequest=1">
<center>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr class="date">
<td colspan="3" align="center" background="admin/img/button03.gif" bgcolor="#C0C0C0">Servi&ccedil;os do Sistema </td>
</tr>
<tr class="date">
<td width="50%" align="center" background="admin/img/button03.gif" bgcolor="#C0C0C0"><strong>Servi&ccedil;o:</strong></td>
<td width="25%" align="center" background="admin/img/button03.gif" bgcolor="#C0C0C0"><strong>Status:</strong></td>
<td width="25%" align="center" background="admin/img/button03.gif" bgcolor="#C0C0C0"><strong>Porta:</strong></td>
</tr>
<?php
$query = "SELECT * FROM pbx_servicos_sistema order by id asc";
$result = pg_query($dbcon, $query);
while ($dados = pg_fetch_array($result)) {
if (@fsockopen($theservername, $dados['porta'], $errno, $errstr, $portcheck)) {
$img = "admin/img/up.png";
} else {
$img = "admin/img/down.png";
}
?>
<tr class="info">
<td bgcolor="#EAEAEA" align="left"><div align="center"><strong><?php echo $dados['servico']; ?></strong></div></td>
<td align="center" bgcolor="#FFFFFF"><img src="<?php echo $img; ?>" alt="" name="img<?php echo $dados['id']; ?>" width="14" height="14" border="0" class="style6" id="img<?php echo $dados['id']; ?>"/></td>
<td bgcolor="#EAEAEA" align="center"><strong><?php echo $dados['porta']; ?></strong></td>
</tr>
<?php
flush();
}
?>
</table>
<br />
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr class="date" background="admin/img/button03.gif">
<td colspan="2" bgcolor="#F4F4F4" class="date" background="admin/img/button03.gif"><div align="center">Discos</div></td>
</tr>
<tr class="info">
<td width="50%" bgcolor="#F4F4F4"><strong>Espa&ccedil;o em Disco:</strong></td>
<td width="50%" bgcolor="#F4F4F4" ><strong>
<?= ZahlenFormatieren($insgesamt); ?></strong>
</td>
</tr>
<tr class="info">
<td width="50%" bgcolor="#F4F4F4"><strong>Em Uso:</strong></td>
<td width="50%" bgcolor="#F4F4F4"><strong>
<?= ZahlenFormatieren($belegt); ?>
(
<?= round($prozent_belegt, "2"); ?>
%)</strong></td>
</tr>
<tr class="info">
<td width="50%" bgcolor="#F4F4F4" ><strong>Espa&ccedil;o Livre:</strong></td>
<td width="50%" bgcolor="#F4F4F4" ><strong>
<?= ZahlenFormatieren($frei); ?>
</strong></td>
</tr>
<!-- <tr>
<td colspan="2" bgcolor="#F4F4F4" align="center" ><img src="bar.php?rating=<?= round($prozent_belegt, "2"); ?>" border="0" align="absmiddle" /></td>
</tr> -->
</table>
<br />
<hr class="hidden" />
<div id="cpu" class="item mainItem">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<?php
$arq = file('/proc/cpuinfo');
for ($i = 0; $i < sizeof($arq); $i++) {
if (substr($arq[$i], 0, 9) == 'vendor_id') {
$fabricante = trim(substr($arq[$i], 12, 1000));
}
if (substr($arq[$i], 0, 10) == 'model name') {
$modelo = (substr($arq[$i], 12, 1000));
}
if (substr($arq[$i], 0, 7) == 'cpu MHz') {
$mhz = (substr($arq[$i], 11, 1000)) . 'Mhz';
}
if (substr($arq[$i], 0, 10) == 'cache size') {
$cache = trim(substr($arq[$i], 12, 1000));
}
} {
if ($os == "linux") {
?>
<tr background="admin/img/button03.gif"><th colspan=2 background="admin/img/button03.gif" class="date"><div align="center">Dados do Processador</div></th></tr>
<tr class="info">
<td width="47%" bgcolor=#F4F4F4><strong>Fabricante:</strong></td><td width="53%" bgcolor=#F4F4F4><strong><?php echo $fabricante; ?></strong></td></tr>
<tr class="info">
<td bgcolor=#F4F4F4><strong>Modelo:</strong></td><td bgcolor=#F4F4F4><strong><?php echo $modelo; ?></strong></td></tr>
<tr class="info"><td bgcolor=#F4F4F4><strong>MHz:</strong></td><td bgcolor=#F4F4F4><strong><?php echo $mhz; ?></strong></td></tr>
<tr class="info"><td bgcolor=#F4F4F4><strong>CACHE:</strong></td><td bgcolor=#F4F4F4><strong><?php echo $cache; ?></strong></td></tr>
<!--<tr background="admin/img/button03.gif"><th colspan=2 background="admin/img/button03.gif" class="date" ><div align="center">Uso do Processador</div></th></tr>-->
<?php
//$arq = file('/proc/stat');
for ($i = 0; $i < sizeof($arq); $i++) {
break;
if (substr($arq[$i], 0, 4) == 'cpu ') {
?>
<!-- <tr bgcolor="#f4f4f4">
<td width="50%">
<div align="center">
<input name="nmcpu<?php echo $i; ?>" type="text" class="monitoracao" id="nmcpu<?php echo $i; ?>" size="20" maxlength="60">
</div></td><td width="50%"><div align="center"><img src="bar.php?rating=0" border="0" name="img<?php echo $i; ?>"></div></td>
</tr> -->
<?php
}
}
}
} {
?>
</table>
<br />
<!-- <table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr background="admin/img/button03.gif"><th background="admin/img/button03.gif" ><div align="center" class="date">Mem&oacute;ria</div></th>
</tr>
<tr class="info"><td bgcolor=#F4F4F4><strong>Mem&oacute;ria em uso: </strong> <input name=memoria type=text class=monitoracao value="<?php echo lowermemory($Used) . " de " . lowermemory($insgesamtq); ?>" size=40 readonly></td></tr>
<tr><th align=center bgcolor="#F4F4F4"><iframe frameborder="0" src="monitor/barra_memoria.php" name="barra_memoria" frameborder=0 scroling="no" width="100%" height="20"></iframe></th></tr> -->
<?php }
?>
<!--</TABLE> -->
</div>
<div id="informacoes" class="item mainItem">
<table width="100%" cellpadding="0" cellspacing="0">
<tr >
<th colspan=3 background="admin/img/button03.gif"><div align="center" class="date">Informa&ccedil;&atilde;o do Sistema </div></th>
</tr>
<tr class="info">
<td bgcolor=#F4F4F4><strong>Sist:ema Operacional:</strong></td>
<td bgcolor=#F4F4F4 ><strong><?php echo $osname; ?></strong></td></tr>
<tr class="info">
<td bgcolor=#F4F4F4><strong>Vers&atilde;o:</strong></td>
<td bgcolor=#F4F4F4 ><strong><?php echo $osbuild; ?></strong></td></tr>
<tr class="info">
<td bgcolor=#F4F4F4><strong>Tipo de OS:</strong></td>
<td bgcolor=#F4F4F4><strong><?php echo php_uname('m'); ?></strong></td></tr>
<?php {
if ($os == "windows") {
$pagefile = 'c:\pagefile.sys';
function ifif($value, $true, $false) {
if ($value == 0) {
return $false;
} else {
return $true;
}
}
$upsince = filemtime($pagefile);
$gettime = (time() - filemtime($pagefile));
$days = floor($gettime / (24 * 3600));
$gettime = $gettime - ($days * (24 * 3600));
$hours = floor($gettime / (3600));
$gettime = $gettime - ($hours * (3600));
$minutes = floor($gettime / (60));
$gettime = $gettime - ($minutes * 60);
$seconds = $gettime;
$days = ifif($days != 1, $days . ' Dias', $days . ' Dia');
$hours = ifif($hours != 1, $hours . ' Horas', $hours . ' Hora');
$minutes = ifif($minutes != 1, $minutes . ' Minutos', $minutes . ' Minuto');
$seconds = ifif($seconds != 1, $seconds . ' Segundos', $seconds . ' Segundo');
if ($days == 0) {
$days = "";
}
if ($hours == 0) {
$hours = "";
}
if ($minutes == 0) {
$minutes = "";
}
if ($seconds == 0) {
$seconds = "";
}
echo '<tr><th colspan=3 class=cabecalho2>Tempo de Operação</th></tr>';
echo '<tr><td colspan=3 class=dados align=center>';
echo '' . $days . ' ' . $hours . ' ' . $minutes . ' ' . $seconds;
echo '</td></tr>';
echo '<tr><td colspan=3 class=dados align=center>';
echo 'Ligado desde: ' . date('F jS, Y. h:i A', $upsince);
echo '</td></tr>';
} elseif ($os == "linux") {
function format_uptime($seconds) {
$secs = intval($seconds % 60);
$mins = intval($seconds / 60 % 60);
$hours = intval($seconds / 3600 % 24);
$days = intval($seconds / 86400);
if ($days > 0) {
$uptimeString .= $days;
$uptimeString .= (($days == 1) ? " Dia" : " Dias");
}
if ($hours > 0) {
$uptimeString .= (($days > 0) ? " " : "") . $hours;
$uptimeString .= (($hours == 1) ? " Hora" : " Horas");
}
if ($mins > 0) {
$uptimeString .= (($days > 0 || $hours > 0) ? " " : "") . $mins;
$uptimeString .= (($mins == 1) ? " Minuto" : " Minutos");
}
if ($secs > 0) {
$uptimeString .= (($days > 0 || $hours > 0 || $mins > 0) ? " " : "") . $secs;
$uptimeString .= (($secs == 1) ? " Segundo" : " Segundos");
}
return $uptimeString;
}
$uptime = exec("cat /proc/uptime");
$uptime = explode(" ", $uptime);
$uptimeSecs = $uptime[0];
$staticUptime = format_uptime($uptimeSecs);
echo '<tr><th colspan=3 background="admin/img/button03.gif" class=date align=center><DIV ALIGN=CENTER>Tempo de Operação</DIV</th></tr>';
echo '<tr><td colspan=3 align=center class=info bgcolor=#F4F4F4>';
echo $staticUptime;
echo '</td></tr>';
} else {
echo "";
}
}
flush();
?>
</table>
</div>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr background="admin/img/button03.gif" >
<td colspan="5" background="admin/img/button03.gif"><div align="center"><span class="date">Conex&otilde;es Ativas </span></div></td>
</tr>
<tr>
<td width="10%" class="info" bgcolor=#F4F4F4><div align="center"><strong>DISPOSITIVO:</strong></div></td>
<td width="21%" class="info" bgcolor=#F4F4F4><div align="center"><strong>RX Bytes </strong></div></td>
<td width="22%" class="info" bgcolor=#F4F4F4><div align="center"><strong>RX Pacotes </strong></div></td>
<td class="info" bgcolor=#F4F4F4><div align="center"><strong>TX Bytes </strong></div></td>
<td class="info" bgcolor=#F4F4F4 ><div align="center"><strong>TX Pacotes</strong></div></td>
</tr>
<?php
$lines = file('/proc/net/dev');
for ($i = 0; $i < sizeof($lines); $i++) {
?>
<?php if ((substr(trim($lines[$i]), 0, 3) != '')and ( substr($lines[$i], 0, 3) != 'Int')and ( substr(trim($lines[$i]), 0, 4) != 'face')) { ?>
<tr bgcolor=#F4F4F4>
<td class="info" bgcolor=#F4F4F4><div align="center"><strong>
<?php echo substr($lines[$i], 0, 6); ?>
</strong></div></td>
<td ><div align="center">
<input type="text" name="rx<?php echo $i; ?>" value="<?php echo ZahlenFormatieren(substr($lines[$i], 8, 9)); ?>" size="20" class="monitoracao" readonly>
</div></td>
<td ><div align="center">
<input type="text" name="rxp<?php echo $i; ?>" value="<?php echo ZahlenFormatieren(substr($lines[$i], 18, 7)); ?>" size="20" class="monitoracao" readonly>
</div></td>
<td width="20%" ><div align="center">
<input type="text" name="tx<?php echo $i; ?>" value="<?php echo ZahlenFormatieren(substr($lines[$i], 68, 9)); ?>" size="20" class="monitoracao" readonly>
</div></td>
<td width="7%" ><input type="text" name="txp<?php echo $i; ?>" value="<?php echo ZahlenFormatieren(substr($lines[$i], 78, 7)); ?>" size="20" class="monitoracao" readonly></td>
</tr>
<?php
}
}
?>
<!-- </table> -->
<table border="0" cellpadding="0" cellspacing="0">
<tr background="admin/img/button03.gif">
<th colspan=3 bgcolor=#C0C0C0 class=date background="admin/img/button03.gif"><div align="center">Outras Informa&ccedil;&otilde;es </div></th>
</tr>
<tr class="info"><td width="50%" bgcolor=#F4F4F4 ><strong>PHP Ver:</strong></td><td width="50%" bgcolor=#F4F4F4 ><strong><?php echo phpversion(); ?></strong></td></tr>
<tr class="info"><td width="50%" bgcolor=#F4F4F4 ><strong>HTTP App:</strong></td><td width="50%" bgcolor=#F4F4F4 ><strong><?php echo $httpapp; ?></strong></td></tr>
<tr class="info"><td width="50%" bgcolor=#F4F4F4 ><strong> IP:</strong></td>
<td width="50%" bgcolor=#F4F4F4 ><strong><?php echo $_SERVER['REMOTE_ADDR']; ?></strong></td></tr>
</table>
</center>
</form>
<!--
<iframe src="monitor/cpu2.php" frameborder="0" scrolling="no" width="0" height="0" name=1></iframe>
<iframe src="monitor/memoria.php" frameborder="0" scrolling="no" width="0" height="0" name=2></iframe>
<iframe src="monitor/rede.php" frameborder="0" scrolling="no" width="0" height="0" name=2></iframe>
<iframe src="monitor/servicos.php" frameborder="0" scrolling="no" width="0" height="0" name=3></iframe>
-->
<div id="campos" style="display:none" align="center">
<iframe src="" frameborder="0" scrolling="no" name="geral" id="geral" align="middle"></iframe>
</div>
<div id="mensagem" style="display:none;width:300;height:auto">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr bordercolor="#FFFFFF" bgcolor="#FFFFFF" style="border-color:#FFFFFF">
<td width="5%" align="center" style="border: none;font-family: Arial, Helvetica, sans-serif;font-size: 16px;color: #990000;background-color: #FFFFFF;">
</td>
<td width="95%" align="center" bgcolor="#FFFFFF" style="border: none;font-family: Arial, Helvetica, sans-serif;font-size: 16px;color: #990000;background-color: #FFFFFF;"><div align="center">
<input name="mens" type="button" value="mens" style="border: none;font-family: Arial, Helvetica, sans-serif;font-size: 14px;color: #990000;background-color: #FFFFFF;" id="mens">
</div></td>
</tr>
<tr bordercolor="#FFFFFF" bgcolor="#FFFFFF" style="border-color:#FFFFFF">
<td colspan="2" align="center" bordercolor="#FFFFFF" bgcolor="#FFFFFF" style="border-color:#FFFFFF"><span style="color: #FFFFFF"> _
</span></td>
</tr>
<tr bordercolor="#FFFFFF" bgcolor="#FFFFFF" style="border-color:#FFFFFF">
<td colspan="2" bordercolor="#FFFFFF" bgcolor="#FFFFFF" style="border-color:#FFFFFF">
<table width="100%" border="0" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" style="border-color:#FFFFFF">
<tr>
<td width="50%" align="center" bordercolor="#FFFFFF" bgcolor="#FFFFFF" style="border-color:#FFFFFF">
<div align="center">
<button id="todos" class="">Sim</button>
</div>
</td>
<td width="50%" align="center" bordercolor="#FFFFFF" bgcolor="#FFFFFF" style="border-color:#FFFFFF">
<div align="center">
<button id="cancela" class="button">N&atilde;o</button>
</div>
</td>
</tr>
</table></td>
</tr>
</table></div>
</div>
</div>
</body>
</html>
<?php exit; ?>