| Current Path : /var/www/html/mmishra/indem/ |
| Current File : /var/www/html/mmishra/indem/serverStatus.php |
<form name='serverStatus' method='post' enctype='multipart/form-data'>
<?php
$no = 0;
$host=$_REQUEST["host"];
switch ($host) {
case 'www':
$no=1;
$lo=34;
$ex1=214;
$ex2=244;
break;
case 'websites':
$no=1;
$lo=35;
$ex1=213;
$ex2=246;
break;
case 'wwx':
$no=1;
$lo=36;
$ex1=0;
$ex2=0;
break;
case 'profile':
$no=1;
$lo=45;
$ex1=215;
$ex2=245;
break;
case 'mail':
$no=1;
$lo=27;
$ex1=218;
$ex2=248;
break;
/*case 'mx0':
$no=1;
$lo=17;
$ex1=217;
$ex2=247;
break;*/
case 'pdns':
$no=1;
$lo=21;
$ex1=221;
$ex2=251;
break;
case 'sdns':
$no=1;
$lo=22;
$ex1=222;
$ex2=252;
break;
case 'proxy3':
$no=1;
$lo=3;
$ex1=220;
$ex2=0;
break;
case 'proxy4':
$no=1;
$lo=4;
$ex1=0;
$ex2=0;
break;
case 'proxy6':
$no=1;
$lo=6;
$ex1=220;
$ex2=0;
break;
case 'proxy7':
$no=1;
$lo=7;
$ex1=0;
$ex2=254;
break;
case 'iws44':
$no=1;
$lo=44;
$ex1=212;
$ex2=0;
break;
case 'library':
$no=1;
$lo=40;
$ex1=0;
$ex2=0;
break;
case 'ldap':
$no=1;
$lo=42;
$ex1=0;
$ex2=0;
break;
default:
$no=0;
}
$ipaddress = '172.31.1.'.$lo;
if ($ex1==0) {
$nkn='';
} else {
$nkn = '14.139.236.'.$ex1;
}
if ($ex2==0) {
$bsnl='';
} else {
$bsnl = '117.239.94.'.$ex2;
}
$output1 = shell_exec('ping 172.31.1.34 -c 1');
$output2 = shell_exec('ping 172.31.1.35 -c 1');
$output3 = shell_exec('ping 172.31.1.36 -c 1');
$output4 = shell_exec('ping 172.31.1.45 -c 1');
$output5 = shell_exec('ping 172.31.1.27 -c 1');
//$output6 = shell_exec('ping 172.31.1.17 -c 1');
$output7 = shell_exec('ping 172.31.1.21 -c 1');
$output8 = shell_exec('ping 172.31.1.22 -c 1');
$output9 = shell_exec('ping 172.31.1.3 -c 1');
$output10 = shell_exec('ping 172.31.1.4 -c 1');
$output11 = shell_exec('ping 172.31.1.6 -c 1');
$output12 = shell_exec('ping 172.31.1.7 -c 1');
$output13 = shell_exec('ping 172.31.1.44 -c 1');
$output14 = shell_exec('ping 172.31.1.40 -c 1');
$output15 = shell_exec('ping 172.31.1.42 -c 1');
echo "<center>
<h2>IIIT-Allahabad DMZ Server Status</h2>
<table width='100%' border='1' style='border-collapse:collapse'>
<tr align='center'>
<td><h3>WWW</h3></td>
<td><h3>Websites</h3></td>
<td><h3>WWX</h3></td>
<td><h3>Profile</h3></td>
<td><h3>Mail</h3></td>
<!--td><h3>MX0</h3></td -->
<td><h3>PDNS</h3></td>
<td><h3>SDNS</h3></td>
<td><h3>Proxy-3</h3></td>
<td><h3>Proxy-4</h3></td>
<td><h3>Proxy-6</h3></td>
<td><h3>Proxy-7</h3></td>
<td><h3>IWS-44</h3></td>
<td><h3>Library</h3></td>
<td><h3>LDAP</h3></td>
</tr>
<tr align='center'>
<td>";
if (preg_match("/\bttl=\b/i", $output1)) {
echo "<a href='$_PHPSELF?host=www'><img src='up.jpg' height='50' width='50' /></a>";
} else {
echo "<img src='down.jpg' height='50' width='50' />";
}
echo "</td><td>";
if (preg_match("/\bttl=\b/i", $output2)) {
echo "<a href='$_PHPSELF?host=websites'><img src='up.jpg' height='50' width='50' /></a>";
} else {
echo "<img src='down.jpg' height='50' width='50' />";
}
echo "</td><td>";
if (preg_match("/\bttl=\b/i", $output3)) {
echo "<a href='$_PHPSELF?host=wwx'><img src='up.jpg' height='50' width='50' /></a>";
} else {
echo "<img src='down.jpg' height='50' width='50' />";
}
echo "</td><td>";
if (preg_match("/\bttl=\b/i", $output4)) {
echo "<a href='$_PHPSELF?host=profile'><img src='up.jpg' height='50' width='50' /></a>";
} else {
echo "<img src='down.jpg' height='50' width='50' />";
}
echo "</td><td>";
if (preg_match("/\bttl=\b/i", $output5)) {
echo "<a href='$_PHPSELF?host=mail'><img src='up.jpg' height='50' width='50' /></a>";
} else {
echo "<img src='down.jpg' height='50' width='50' />";
}
/*echo "</td><td>";
if (preg_match("/\bttl=\b/i", $output6)) {
echo "<a href='$_PHPSELF?host=mx0'><img src='up.jpg' height='50' width='50' /></a>";
} else {
echo "<img src='down.jpg' height='50' width='50' />";
}*/
echo "</td><td>";
if (preg_match("/\bttl=\b/i", $output7)) {
echo "<a href='$_PHPSELF?host=pdns'><img src='up.jpg' height='50' width='50' /></a>";
} else {
echo "<img src='down.jpg' height='50' width='50' />";
}
echo "</td><td>";
if (preg_match("/\bttl=\b/i", $output8)) {
echo "<a href='$_PHPSELF?host=sdns'><img src='up.jpg' height='50' width='50' /></a>";
} else {
echo "<img src='down.jpg' height='50' width='50' />";
}
echo "</td><td>";
if (preg_match("/\bttl=\b/i", $output9)) {
echo "<a href='$_PHPSELF?host=proxy3'><img src='up.jpg' height='50' width='50' /></a>";
} else {
echo "<img src='down.jpg' height='50' width='50' />";
}
echo "</td><td>";
if (preg_match("/\bttl=\b/i", $output10)) {
echo "<a href='$_PHPSELF?host=proxy4'><img src='up.jpg' height='50' width='50' /></a>";
} else {
echo "<img src='down.jpg' height='50' width='50' />";
}
echo "</td><td>";
if (preg_match("/\bttl=\b/i", $output11)) {
echo "<a href='$_PHPSELF?host=proxy6'><img src='up.jpg' height='50' width='50' /></a>";
} else {
echo "<img src='down.jpg' height='50' width='50' />";
}
echo "</td><td>";
if (preg_match("/\bttl=\b/i", $output12)) {
echo "<a href='$_PHPSELF?host=proxy7'><img src='up.jpg' height='50' width='50' /></a>";
} else {
echo "<img src='down.jpg' height='50' width='50' />";
}
echo "</td><td>";
if (preg_match("/\bttl=\b/i", $output13)) {
echo "<a href='$_PHPSELF?host=iws44'><img src='up.jpg' height='50' width='50' /></a>";
} else {
echo "<img src='down.jpg' height='50' width='50' />";
}
echo "</td><td>";
if (preg_match("/\bttl=\b/i", $output14)) {
echo "<a href='$_PHPSELF?host=library'><img src='up.jpg' height='50' width='50' /></a>";
} else {
echo "<img src='down.jpg' height='50' width='50' />";
}
echo "</td><td>";
if (preg_match("/\bttl=\b/i", $output15)) {
echo "<a href='$_PHPSELF?host=ldap'><img src='up.jpg' height='50' width='50' /></a>";
} else {
echo "<img src='down.jpg' height='50' width='50' />";
}
echo "</td>
</tr>
</table>
<br><br>";
if ($no > 0){
echo "<table border='1'>
<tr><th><h2>$host</h2>
Server Status<br><br><b>LO=</b> $ipaddress<br><b>EX=</b> $nkn<br><b>EX=</b> $bsnl<br></td><td>";
$outputd1 = shell_exec('ping '.$ipaddress.' -c 5');
if ($outputd1) echo "<pre>$outputd1</pre>";
echo "<hr>";
$outputd2 = shell_exec('nmap '.$ipaddress);
if ($outputd2) echo "<pre>$outputd2</pre>";
echo "</td><td align='center'>";
if (preg_match("/\bttl=\b/i", $outputd1)) {
echo "<img src='up.jpg' height='50' width='50' />";
}else{
echo "<img src='down.jpg' height='50' width='50' />";}
echo "</td></tr>
</table>";
}
echo "</center>";
?>
</form>