Leon432 schreef:Ja man vet cool mag ik het script

oké dan, ik ben niet zo heel goed met PHP

en gebruik dus ook af en toe nog html.
Dit is het script zonder het schiltje wat je zien in de folder status.
Ik heb het zo gebouwd dat het alleen een e-mail stuurt als er een fout/niet response in zit.
Verder zittten er wat dingen ingebouwd tegen "over"belasten van je systeem......
Je moet wel zelf de icoontjes en urls aanpassen
Code: Selecteer alles
<html>
<head>
<title>Het duurt minimaal 10 seconde voor de status</title>
<link href="../style_dam.css" type="text/css" rel="STYLESHEET">
</head>
<p><i>Info DAMnet services, all requests are logged</i></p>
<body>
<font face="Arial, Helvetica, sans-serif" size="3"><b>DAMnet server status</b> </font><img width=500 src=redline.gif><p>
</body>
<table border="0" cellspacing="0" cellpadding="3">
<tr>
<td width="200"><font face="Arial, Helvetica, sans-serif" size="4" color="#00ff00"><?php echo "PHP is online"; ?></font></td>
<td width="60" align="center"><font face="Arial, Helvetica, sans-serif" size="1"><b>SMTP</b></font></td>
<td width="60" align="center"><font face="Arial, Helvetica, sans-serif" size="1"><b>POP3</b></font></td>
<td width="60" align="center"><font face="Arial, Helvetica, sans-serif" size="1"><b>WEBmail</b></font></td>
<td width="60" align="center"><font face="Arial, Helvetica, sans-serif" size="1"><b>WEBsite</b></font></td>
<td width="60" align="center"><font face="Arial, Helvetica, sans-serif" size="1"><b>DNS</b></font></td>
<td width="60" align="center"><font face="Arial, Helvetica, sans-serif" size="1"><b>MYSQL</b></font></td>
</tr>
</table>
</html>
<?php
// port check and e-mail status only if one offline
// created by DAMnet 28-09-2004
// only the gifs are ripped
// http://damnet.nl/forum/
/// timer 10 seconds
$ip = "damnet.nl";
$port = "19";
$timeouttimer = "10";
if ($ip and $port and $timeouttimer) {
$connection = @fsockopen("$ip", $port, $errno, $errstr, $timeouttimer);
}
if(!$connection)
{
}
else
{
}
/// end timer
$time = microtime();
# <powered by DAMnet>
// print out the time and date
$getdate = date( "l d F Y" );
$gettime = date( "H:i:s" );
# ascertain the user's ip address #
$a = getenv("HTTP_X_FORWARDED_FOR");
$b = getenv("REMOTE_ADDR");
$ip3 = getenv('LOCAL_REMOTE_ADDR');
$ip4 = getenv('REMOTE_ADDR_LOCAL');
if ($a <> "") {
$posn=0;
do {
$posn++;
if ($a{$posn} == ',') {
break;
}
} while ($posn < strlen($a));
$login_ip = substr($a,0,$posn);
} else {
$login_ip = $b;
}
$login_ip = $login_ip;
$login_host = gethostbyaddr($login_ip);
?>
<?php
$smtp = "DAMnet mail (SMTP) running";
$pop = "DAMnet mail (POP) running";
$webmail = "DAMnet webmail (html) running";
$website = "DAMnet website (html) running";
$dns = "Naamserver(dns) running";
$sql = "DAMnet dBase (SQL) running";
$ip = "damnet.nl";
$port = "25";
$timeout = "1";
if ($ip and $port and $timeout) {
$connection1 = @fsockopen("$ip", $port, $errno, $errstr, $timeout);
}
if(!$connection1)
{
$smtp = "DAMnet mail (SMTP) offline";
$smtp1 = "1";
echo "<div align='left'>";
echo "<table border='0' cellspacing='0' cellpadding='3'>";
echo "<tr>";
echo "<td width='200'><font face='Arial, Helvetica, sans-serif' size='2'>Online=<img border='0' src='on.gif' align='center'> Offline=<img border='0' src='off.gif' align='center'> </td>";
echo "<td width='60' align='center'><img border='0' src='off.gif'></td>";
// echo "<h3><p align=center ><font color=#ff0000><img src=off.gif>DAMnet mail (SMTP) offline</p></h3>";
}
else
{
echo "<div align='left'>";
echo "<table border='0' cellspacing='0' cellpadding='3'>";
echo "<tr>";
echo "<td width='200'><font face='Arial, Helvetica, sans-serif' size='2'>Online=<img border='0' src='on.gif' align='center'> Offline=<img border='0' src='off.gif' align='center'> </td>";
echo "<td width='60' align='center'><img border='0' src='on.gif'></td>";
// echo "</tr>";
// echo "</table>";
// echo "</div>";
$smtp1 = "0";
}
$port = "110";
if ($ip and $port and $timeout) {
$connection2 = @fsockopen("$ip", $port, $errno, $errstr, $timeout);
}
if(!$connection2)
{
$pop = "DAMnet mail (POP) offline";
$pop1 = "1";
echo "<td width='60' align='center'><img border='0' src='off.gif'></td>";
}
else
{
echo "<td width='60' align='center'><img border='0' src='on.gif'></td>";
$pop1 = "0";
}
$port = "81";
if ($ip and $port and $timeout) {
$connection3 = @fsockopen("$ip", $port, $errno, $errstr, $timeout);
}
if(!$connection3)
{
$webmail = "DAMnet WEBmail (html) offline";
echo "<td width='60' align='center'><img border='0' src='off.gif'></td>";
$webmail1 = "1";
}
else
{
echo "<td width='60' align='center'><img border='0' src='on.gif'></td>";
$webmail1 = "0";
}
$port = "80";
if ($ip and $port and $timeout) {
$connection4 = @fsockopen("$ip", $port, $errno, $errstr, $timeout);
}
if(!$connection4)
{
$website = "DAMnet WEBsite (html) offline";
echo "<td width='60' align='center'><img border='0' src='off.gif'></td>";
$website1 = "1";
}
else
{
echo "<td width='60' align='center'><img border='0' src='on.gif'></td>";
// echo "<img src=on.gif>";
$website1 = "0";
}
$port = "53";
if ($ip and $port and $timeout) {
$connection5 = @fsockopen("$ip", $port, $errno, $errstr, $timeout);
}
if(!$connection5)
{
$dns = "Naam server (dns) offline";
$dns1 = "1";
echo "<td width='60' align='center'><img border='0' src='off.gif'></td>";
}
else
{
echo "<td width='60' align='center'><img border='0' src='on.gif'></td>";
$dns1 = "0";
}
$port = "3306";
if ($ip and $port and $timeout) {
$connection6 = @fsockopen("$ip", $port, $errno, $errstr, $timeout);
}
if(!$connection6)
{
$sql = "DAMnet dBase (SQL) offline";
echo "<td width='60' align='center'><img border='0' src='off.gif'></td>";
echo "</tr>";
echo "</table>";
echo "</div>";
$sql1 = "1";
}
else
{
echo "<td width='60' align='center'><img border='0' src='on.gif'></td>";
echo "</tr>";
echo "</table>";
echo "</div>";
$sql1 = "0";
}
?>
<?
// if (isset($pop1))
$total = ("$pop1" + "$smtp1" + "$webmail1" + "$website1" + "$dns1" + "$sql1");
echo "<font color=#0099ff></br >aantal errors: ", "$total"," ";
if ($total >=1 )
{
echo "<font color=#000080></br >ther's send a e-mail to the Amdin!!!";
$message = "$getdate" . ", ";
$message .= "$gettime\n\n";
$message .= "$login_ip"." = ";
$message .= "$login_host\n\n";
$message .= "$smtp\n";
$message .= "$pop\n";
$message .= "$webmail\n";
$message .= "$website\n";
$message .= "$dns\n";
$message .= "$sql\n";
// $connection = @fsockopen("$ip", $port, $errno, $errstr, $timeout);
mail( "eigenadres@damnet.nl", "Error Server Results powerewd by DAMnet",
$message, "From: \"Services Check\" Informatie@damnet.nl" );
// header( "Location: http://damnet.nl/http.htm" );
}
else
{
//echo "alles oké";
echo "<img border='0' src='ThumbsUpICQ.jpg' align='center'>";
}
?>
<html>
<!-- Begin User Info -->
<table cellspacing="0" cellpadding="2" border="0" width="100%">
<tr>
<td>
<br>User info:
</td>
</tr>
<tr>
<td>
<b>Datum:</b> <?php echo "$getdate"; ?>.<br />
<b>Tijd:</b> <?php echo "$gettime"; ?><font size="1"> (time server)<font size="3"><br />
<b>IP:</b> <?php echo "$login_ip"; ?><font size="1"> (remote address local)<font size="3"><br />
<b>IP:</b> <?php echo "$b"; ?><font size="1"> (remote address)<font size="3"><br />
<b>DNS naam:</b> <?php echo "$login_host"; ?><br />
<b>IP:</b> <?php echo "$a"; ?><font size="1"> (http x forwarded)<font size="3"><br />
<b>IP:</b> <?php echo "$ip3"; ?><font size="1"> (remote local)<font size="3"><br />
<b>IP:</b> <?php echo "$ip4"; ?><font size="1"> (remote address local)<font size="3"><br />
<b>Browser:</b> <?php echo $_SERVER["HTTP_USER_AGENT"]; ?><br />
<p><font size="1">01-10-2004 by DAMnet</font></p>
</td>
</tr>
</table>
<!-- End User Info -->
<FORM ACTION="index.php" METHOD="POST" target="_top">
<p align=left><input type="submit" value="Check Again">
</html>
<?php
echo "<p align=left><font color=#0099ff>tijd voor maken deze pagina (excl. testen): " ;
echo microtime()-$time;
echo "sec.";
?>