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 ..
Popularity: 22% [?]
Hello my fox! Glad to see you today!If you love my tutorial, please chose any action from the left button.
11 Comments
Dear Mas Dremi,
Demo-nya sudah saya coba dan mantaf.
Tapi ada beberapa IP address yang unavailable padahal PC tersebut dengan IP yang sama dalam keadaan connected. Bisa di bantu mas?
Oya ada masukan nih mas, kalau bisa set IP-nya jgn dibikin random bisa gak ?
Contoh Saya hanya ingin menampilkan IP berdasarkan department masing-masing.
Thank You.
@david
terimakasih. jika ip yang dicek menggunakan port, cek ketersediaan portnya. misal jika port 80, maka ip tersebut memiliki web servis, biasanya apache. cek web servis, apakah sudah berjalan dengan baik. jika tidak disertai port, maka kemunngkinan ada firewall yang menahan hak akses untuk membuat socket pada IP tersebut. semoga berhasil
dok, saya kurang ngerti masalah setting ip yg di file php, yg mana aj yg perlu diubah ip na? apa cuma yg ini aj define(“_IPROUTER”, “192.168.1.1″); ? mohon pencerahanna..
dok, saya kurang ngerti ma setting ip yg mau di cek di php, apa yg diganti cuma ini aj “define(“_IPROUTER”, “192.168.1.1″);” ?
tolong pencerahannya…
biasa nya IP router make itu, tapi sesuaikan saja kalo berbeda. kalo sama, ga perlu dirubah. yang pnting itu ip targetnya.
IP nya dicek, range nya dari berapa sampe barpa yang ada dalam jaringan, kalo make router biasanya 192.168.1.X, kalo ga make biasanya 192.168.0.x
trus klo ane mau cek ping antar komputer dalam jaringan bisa gk langsung pake ip komputer yg dituju?
kmarin ane coba ganti ip dsana pake ip komputer yg dituju tapi gk mau dia dok…
ane pake
define(“_IPROUTER”, “192.168.0.1″);
$address = “$ip”; //your public IP
$port = $p; // your IP open port
tapi bgitu dieksekusi gk nampil apa” dok, cuma kotak kosong doank… -_-
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 Ubaid UdaraMaya.Com WebDesigner.Web.ID Yudha Yudhanto, S. KomAdvertise
Sponsors
Most Popular Posts
- Membuat Manajemen Hak Akses User dengan Codeigniter
- Interactive Ajax Data Management with Codeigniter
- Web Design Layout Plus Implementasi jQuery Tab Content
- Simple Swing Login Form And getText()
- Web Base Controller System with NirCMD
- Create a simple application to open an EXE file on the window with JAVA
- How to Check Username Availability using jQuery + PHP
- dreLogin v.2.0 Has Release
- The Chain Tutorial from FuelYourCreativity
- Email untuk Pak ESBEYE di HUT RI ke 65
Category
Subcribe RSS Feed
Translate
Flick Group dr.emi
dr.emi creative design
SEO Articles & Newsletters
Forum dremi.info
Free Download
Recent Comments
- dr.emi: @ade itu make toggle nya jQuery: http://api.jquery.com/slid...
- dr.emi: ma sama..... mas berok...
- dr.emi: ada mas berok: http://www.dremi.info/tutorials/jquery/drelo...
- datih: apakah ada syntak Log-in php ???...
- Armin: ngakalin rounded corner biar compatible di semua browser kek...
- Armin: edan ini, tutorialnya langsung sehalaman...gkgkk.. sukses b...
- erny: kereeennn... makasiihhh... kapan2 balik lg! hehehe. :D...
Recent Posts
- MARJINAL DI TVONE "RADIO SHOW"
- Mail Yahoo make me frustrating
- Sharing Pengalaman menggunakan CI dan CakePHP
- Lowongan Kerja dr.emi creative design - Oktober 2011
- Happy Eid Mubarak - May God Bless You!
- Lowongan untuk PHP Programmer (PT Xsis Mitra Utama)
- Fenomena ustad/ustazah jadi2an di tipi sedang marak
- Sayang sekali tak dapat nonton Marky Ramones
- [FIX] Installing Ruby on Rails 3, MySQL and SOLVE few problem on UBUNTU 10.10 (Maverick)
- Small Tip, big solution in SVN Problem
Archives
Popular Tags
3D illustration abstract design adsense aero button animation banner clean navigation codeigniter colouring layer CSS tutorials effect form interface glassy effect google gradient style GUI photoshop design hacker handcoded HTML indonesian culture IT job jQuery layer mask logo lowongan kerja merancang web pen tool photo retouch photoshop design PHP PHP Advance PHP login php programmer product demo relationship search engine shapping spirit text effect transparent gradient web articles web design web development web header web layout web tips





















PSD Files
PHP Source Code






