Adi's Blog

Jangan Salahkan Saya Jika Ilmu Anda Bertambah …

Deteksi IP dan Browser dengan PHP

Berikut ini adalaha cara mendeteksi IP dan browser anda, emang sih udah banyak yang bikin ini tutorial,, tp gpp lah, nambah koleksi ilmu aja, mudah2an sih gak sama dengan tutorial orang lain,😛

<?php
$ip = $HTTP_SERVER_VARS['REMOTE_ADDR'];
echo "<b>IP Anda</b> <br> $ip <br>";
$useragent = $_SERVER ['HTTP_USER_AGENT'];
echo "<b>Browser Anda </b><br> ";
if (strpos($useragent,"Firefox"))
{
$browser="Mozilla Firefox";
$icon = "icon browser/firefox.jpg";
echo "<img src='$icon'> <br>";
echo " $browser";
}

elseif (strpos($useragent,"Chrome"))
{
$browser="Google Chrome";
$icon = "icon browser/chrome.png";
echo "<img src='$icon'> <br>";
echo " $browser";
}

elseif (strpos($useragent,"Opera"))
{
$browser="Opera";
$icon = "icon browser/opera.png";
echo "<img src='$icon'> <br>";
echo " $browser";
}

elseif (strpos($useragent,"MSIE"))
{
$browser="Internet Explorer";
$icon = "icon browser/ie.gif";
echo "<img src='$icon'> <br>";
echo " $browser";
}

elseif (strpos($useragent,"SeaMonkey"))
{
$browser="Sea Monkey";
$icon = "icon browser/seamonkey.jpg";
echo "<img src='$icon'> <br>";
echo " $browser";
}

elseif (strpos($useragent,"Flock"))
{
$browser="Flock";
$icon = "icon browser/flock.png";
echo "<img src='$icon'> <br>";
echo " $browser";
}

elseif (strpos($useragent,"Safari"))
{
$browser="Safari";
$icon = "icon browser/safari.png";
echo "<img src='$icon'> <br>";
echo " $browser";
}

elseif (strpos($useragent,"Orca"))
{
$browser="Orca";
$icon = "icon browser/orca.jpg";
echo "<img src='$icon'> <br>";
echo " $browser";
}
?>

Demo

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: