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="fromyouremail@yourdomain.com";
//******** 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="youremailtosend@yourdomain.com";
//******** 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.0\r\n";
$mailheaders .= "Content-type: text/html; charset=iso-8859-1\r\n";
$mailheaders .= "From: $from\n";
$mailheaders .= "Reply-To: $from\n";
mail("$toEmail","$subject",$content, $mailheaders);
}
?>