Creating Auto Checker for IP Network Lifetime
June 27th, 2009 by dr.emi
Hi! I have a tutorial to check lifetime connectivity for IP and PORT in your Network. You may use it as component of enterpise application to check IP and PORT.
So, what next ???
Offcourse, we need this files: ipchecker.php, frame_ip.php, index.php, and jquery framework.
First create ipchecker.php for function handler:
Code:
<?
/**
#
# Auto Checker for IP Network Lifetime
# Author hairul azami a.k.a dr.emi <webmaster@dremi.info>
# Website http://dremi.info
# License: GPL
#
**/
error_reporting(0);
define("_IMAGES", "images/");
define("_IPROUTER", "192.168.1.1");
function checkIP($ip, $p)
{
//error_reporting(E_ALL);
@set_time_limit(0);
$address = "$ip"; //your public IP
$port = $p; // your IP open port
$fp = @fsockopen($address,$port,$errno,$errstr,10);
stream_set_timeout($fp, 1);
if ($fp)
{
$statusIPport = "<font color=green>Connected</font>";
$imgTitle = "Connected";
$imgStats = "accepted_32.png";
}
else
{
$statusIPport = "<font color=#CCCCCC>Disconnect</font>";
$imgTitle = "Disconnect";
$imgStats = "warning_32.png";
}
$info = stream_get_meta_data($fp);
if($info['timed_out'])
{
$statusIPport = "<font color=#CCCCCC>Time Out</font>";
$imgTitle = "Time Out";
$imgStats = "cancel_32.png";
}
flush();
$checkID = strtoupper(gethostbyaddr($address));
if($checkID != $address)
{
$comname = $checkID;
}
elseif($checkID == _IPROUTER)
{
$comname = "ROUTER";
}
else
{
$comname = "NONAME";
}
echo "
<div style='text-align:center;'>
<img src='"._IMAGES . $imgStats."' alt='$imgTitle' title='$imgTitle' border=0><br>
<strong>$imgTitle</strong><br>
$address:$port<br>
$comname
</dvi>";
}
checkIP($_GET['ip'], $_GET['port']);
?>
The function will used as checker for each of variable IP and PORT
Second, create an jQuery Auto Load for file, called as frame_ip.php
In this file, you must load jQuery framework to complete javascript function bellow
Code:
<script language="javascript" src="jquery-1.2.6.min.js"></script>
<script language="javascript">
//show animation
$(function(){
$("#ajax_display").ajaxStart(function(){
$(this).html('<div style="text-align:center"><img src="images/ajax-loader-trans.gif"/><br>Checking Target...</div>');
});
$("#ajax_display").ajaxSuccess(function(){
$(this).html('');
});
$("#ajax_display").ajaxError(function(url){
alert('jqSajax is error ');
});
});
</script>
Then to load ipchecker.php, I use this code:
<div id="ajax_display"></div>
<script type="text/javascript">
function getRandom() {
$("#random").hide("slow");
$("#random").load("ipchecker.php?ip=<? echo $_GET['ip']; ?>&port=<? echo $_GET['port']; ?>", '', callback);
}
function callback() {
$("#random").show("slow");
setTimeout("getRandom();", 10000*2);
}
$(document).ready(getRandom);
</script>
<div id="random"></div>
While ip and port was defined in iframe URL, PHP function checkIP($ip, $p) will work.
I use this line for set the time while load ipchecker.php from first time to next load progress.
setTimeout("getRandom();", 10000*2);
The last is index.php
This file will give you GUI of all process
<?
for($i=1;$i<=10;$i++)
{
?>
<div id="ipslot">
<iframe scrolling="No" frameborder="0" class="frameloader" width="100px" height="100px" name="ajax_ipchecker" src="frame_ip.php?ip=192.168.1.<? echo $i; ?>&port=80">
</iframe>
</div>
<?
}
?>
While index.php loaded, frame_ip.php will work as “data sender” from URL, so we can check it in checkIP function.
Well this is screenshoot while you access index.php from http://localhost/[foldername]/index.php

OK, I think it’s really good time to see you here, thanks for read
If you find any bug / report, just comment here ..
Hello my fox! Glad to see you today!If you love my tutorial, please chose any action from the left button.
Just say it with fill the comment form.
My Friends Link
10001 Inspirasi 4w1n.Blogspot.Com Afial blog Afotsum.CO.NR Alfikry Blogspot Ancaran.Com Andrian.Blogdrive.Com AngsaRea AraZidsi Arteknindo.Com ArtheZoo.TK Articlecillin Belajar Gratis Blog Si Bochan BloGila_U2.Blogdrive.Com BOGIRO Book and Movie Review Can_Dra Blog Catalog-Tutorial CatatanLou.110mb.Com Coin-Kevin DataBagus.Com Dede Permana, S. Kom (PT. BITA Bandung) Deniall.Com Desire 8 Distro & Clothing Diplomski.Com Ensept.Com Esato.Com Faris Wijaya FarisW.Com Blog Fendix Wordpress Foxxed-ART Gadget and Tech Gedex.Web.ID GejalaGila.Com GraphicVN HendiHen.Com Henny Indrianty Hmzaky-dot.Blogspot.Com I D I K IDWebHost.BIZ IDWebHost.Com Ilivetodesign.Com Ilmu Grafis Inez Nugroho Irenk Design IT Club Lombok Jafair.Multiply.Com Jaloe Blog Spot Jenggot Community JiranKubur Jurnal Jaloee K B M S Blog Klik-Kanan.Com LearnSimply LensaDarbi MadeInAra - Graphic Design Mark Xaviar Mifka.Multiply.Com More Tech Tips! Ngetixide.Wordpress.Com Nursingmedia.Blogspot.Com OneMoment.CO.NR PC MILD Percikan Iman Bandung Profit Trading Forex Pulsa Center PuwaSila Denpasar Rumah Sakit Herbal SEO Articles and Newsletters Seputar Info Wanita {Niella Anwar} SMKN 3 Batu Supermodel and Celebrity Tedy Blog TeguhNET Articles The-Sulton.Com TopBlogArea.Com Tutorial Flash - Blog Apri Tutorial Website UdaraMaya.Com WebDesigner.Web.ID Yudha Yudhanto, S. KomSupporter
Sponsors
Subcribe RSS Feed
Flick Group dr.emi
Contact The Doctor
Head Studio:
dr.emi creative design
Jl. Tubagus Ismail Dalam No. 18
Gg. Kubang Sari II Bandung
Jawa Barat Indonesia 40132
Email:
info[at]dremi.net
webmaster[at]dremi.info
YM: hairulazami
GTalk: dremi007
Skype: hairulazami
dr.emi creative design
SEO Articles & Newsletters
Forum dremi.info
Clients
Partner
Free Download
Recent Comments
- dr.emi: pake netbeans aja berur biar gampang :D...
- widya: maaf mau numpang nanya cara instalasi apache tomcat di windo...
- dr.emi: OK bro, sama sama....
- Mahfudin: Terima ksih banyak boss, ini yang saya cari semoga amal baik...
- kang adang: INOVATIF... GAK RUGI MAMPIR KESINI... TERIMAKASIH ILMUNYA......
- dr.emi: @fahmi ikutin air mengalir aja bero......
- ila: like this rodi hartono, teteplah jadi seorang rodi, jangan...
Recent Posts
- Ajaran Ahmadiyah dan Keyakinannya yang Cacat dan Menyesatkan
- Vacancy for Software Development Engineer
- Sony Ericsson Xperia X10 - Ponsel Pertama Menggunakan Android OS
- Lowongan Kerja Master PHP
- Waspada Doa Orang Terzalimi (PercikanIman.ORG)
- Ultah dremi.INFO ke - 5 (050510)
- Download file tutorial Photoshop Legendaris dr.emi + PSD
- Panen Projek dengan Teknik DOBEL PEDAL
- Jalan ini tak semulus yang gw bayangin
- Great themes for Ubuntu 9.04 and ubuntu 9.10 Karmic Koala
Archives
Popular Tags
3D illustration abstract design adsense aero button animation banner clean navigation colouring layer CSS tutorials effect form interface glassy effect google gradient style GUI photoshop design hacker handcoded HTML IT job jQuery layer mask layer style photoshop logo lowongan kerja merancang web pen tool photo retouch photoshop design PHP PHP Advance PHP login product demo relationship search engine shapping spirit tab link text effect transparent gradient web articles web based software web design web development web header web layout web tips

























PSD Files
PHP Source Code






