Top

What's my ip? v1.0


PHP Code
+ 1 likes
Please Register to submit score.
Bookmark and Share
Average Score  0.0 (of 0 scores)
Date Added  May 02, 2009
Last Updated  May 02, 2009
Tags  address  computer  firefox  ip  my  whats 

Introduction

Screenshot



Grab the Code

<html>
<body>
<b>Your IP address is:</b>
<?php
 
$ip=$_SERVER['REMOTE_ADDR'];
echo "$ip"; 
?>
<b>Name server:</b>
<?php
 
$ip=$_SERVER['REMOTE_ADDR'];
$ip2=$_SERVER['HTTP_REMOTE_HOST'];
if ($ip2=="")
 echo "$ip"; 
else
  echo "$ip1";  
?>
<b>Remote port:</b>
<?php
 
$port=$_SERVER['REMOTE_PORT'];
echo "$port"; 
?>
<b>Browser:</b>
<?php
   $browser=$_SERVER['HTTP_USER_AGENT'];
echo "$browser"; 
?>

Comments

  (4)  RSS
Vox91
Comments: 18
 
PHP Snippet:  What's my ip? v1.0
Posted on May 3, 2009 7:02 am
you also could echo the <b>*</b>:

like:
Code:
 echo "<b> Browser: </b>";


then you will get less opening and closing from php.
but although nice code if you are a beginner :)

edit;

also why working with variables in this script, it is shorter I know, but not need in this script.

And try to get your variables set at the beginning of your script like:

Code:

$ip = $_SERVER['REMOTE_ADDR'];
$ip = $_SERVER['REMOTE_ADDR'];
$ip2 = $_SERVER['HTTP_REMOTE_HOST'];
$port = $_SERVER['REMOTE_PORT'];
$browser = $_SERVER['HTTP_USER_AGENT'];
PATX
Comments: 389
 
PHP Snippet:  What's my ip? v1.0
Posted on Jun 13, 2009 7:26 pm
i may be mistaken but couldnt you do this with javascript (or any other lan for that point...)? anyway i dont really like php but good script. if i were to do it id choose python, buts dta just me.
bnc
Comments: 2
 
PHP Snippet:  What's my ip? v1.0
Posted on Aug 15, 2009 10:50 pm
Design and... >> What design? :D
A^1^T^E^A^M
Comments: 27
 
PHP Snippet:  What's my ip? v1.0
Posted on Oct 7, 2009 4:16 am
@bnc It's not full page, also and the sidebar is removed from the picture. Everything that I want is to see people what informations generate this code, not the design :)

Commenting Options

Register or Login to Hawkee.com or use your Facebook or Twitter account by clicking the corresponding button below.

  
Bottom