#native_company# #native_desc#
#native_cta#

Simply Web monitoring

By Jeff Espiritu
on October 26, 2004

Version: 1

Type: Full Script

Category: HTTP

License: GNU General Public License

Description: You can monitor your website downtime status including SMTP, POP, FTP and SSH.
and automatically send alert to the assigned email in the config.php.

<?php
/*
Created by http://smallcapitalbusiness.com

Other Scripts we made:
 - Traffic Exchange Link (The New Generation)
 - Simply FAQ Script
 - Write Text to the Image
 - Image Resizer
 - Simple Web Monitoring
 - Capture TGP New listing
 - Exit Popup Exchange Service
 - Domain Redirection Service
 - TGP or Thumbnail Gallery Post

GNU : Do not remove our signature at the bottom page
*/
?>

CONFIG.PHP
<?php
//******** From Email, enter your email here
$fromEmail="[email protected]";


//******** Website to monitor without http://www.
$websiteURL="smallcapitalbusiness.com";

//******** Type the emails to send the down time alert, you can use comma (,) to seperate multiple emails
//******** Do not use the email of the website that you are monitoring, because if its down then the email is down as well.
$toEmail="[email protected]";


//******** The Subject of the email once send you an alert. 
$subject="Monitoring Alert";

?>

WEBMONITOR.PHP
<?php
include("config.php");

function checkit($link,$port)
{
         $packs=5; 
	 $nError=0;
	 $rturn=TRUE;
         for ($a=0;$a<=$packs;$a++)
	{
             $url = @fsockopen(server($link), $port, &$errno, &$errstr, 5);
             if (!$url) {$rturn=FALSE; break;}
             @fclose($url);
         }
         return $rturn;
}

function server($link){
         if(strstr($link,"/")){$link = substr($link, 0, strpos($link, "/"));}
         return $link;
}

$content="";
if(!checkit("$websiteURL",80)) $content.="Website, ";
if(!checkit($websiteURL,25)) $content.="SMTP, ";
if(!checkit($websiteURL,21)) $content.="FTP, ";
if(!checkit($websiteURL,110)) $content.="POP3, ";
if(!checkit($websiteURL,22)) $content.="SSH";

if($content!="")
{
$content="Site $websiteURL problem in ".$content.".  Time occured ".date("m-d-Y h:i a");
$from="$fromEmail";
$mailheaders  = "MIME-Version: 1.0rn";
$mailheaders .= "Content-type: text/html; charset=iso-8859-1rn";
$mailheaders .= "From: $fromn";
$mailheaders .= "Reply-To: $fromn";

mail("$toEmail","$subject",$content, $mailheaders);
}

?>