Solved

How to make website like www.showmyip.com in PHP language

Posted on 2004-09-08
13
718 Views
Last Modified: 2008-02-01
Any body tell me how to make something just like www.showmyip.com in PHP language, Which have to give all informations About user on the single page.

I know this is possible in PL and CGI but i need this stuff in php.
i am not a BIG programmer of php thats why i am asking this question.
0
Comment
Question by:shanino
  • 5
  • 4
13 Comments
 
LVL 4

Accepted Solution

by:
iceboxman earned 63 total points
Comment Utility
Use something like:

<?php
echo $_SERVER['REMOTE_ADDR']
?>

This will display the IP address of the remote user. Take a look at the link below for some more interesting variables.

http://www.php.net/manual/en/reserved.variables.php#reserved.variables.server
0
 
LVL 4

Expert Comment

by:iceboxman
Comment Utility
Oops, forgot the semicolon

<?php
echo $_SERVER['REMOTE_ADDR'];
?>
0
 
LVL 1

Assisted Solution

by:x-tinct
x-tinct earned 62 total points
Comment Utility
To see all that is stored in the _SERVER array:

<html>
<body>
<pre>
<?php
  print_r($_SERVER);  // prints all elements of the server array
?>
</pre>
</body>
</html>

It is not very pretty, but there you can see what you can get.
0
 
LVL 2

Expert Comment

by:Rajkumar_G
Comment Utility
echo "<br>Server Varibles : ";
   echo "<pre>";
    print_r($_SERVER);  // prints all elements of the server array
   echo "</pre>";

   echo "<br>Environment Variables : ";
   echo "<pre>";
    print_r($_ENV);  // prints all elements of the Environment array
   echo "</pre>";

   echo "<br>Cookies :  ";
   echo "<pre>";
    print_r($_COOKIE);  // prints cookies data
   echo "</pre>";

   echo "<br>Session Variables : ";
   echo "<pre>";
    print_r($_SESSION);  // prints session values
   echo "</pre>";


from these find out what is your requirement
0
 
LVL 1

Expert Comment

by:x-tinct
Comment Utility
$_ENV does not contain client information, only server info.
$_COOKIES and $_SESSION is only variables you have stored on the client and is useless for anyone else than the server developer.

If you want browser information like resulution and stuff, you will have to use javascript. Take a look at the sourcecode of the page you referred to see how this is done.

If you want country information, you will need to use some a IP-country service. Maxmind.com has a PHP module that implements this.
http://www.maxmind.com/app/php
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 1

Expert Comment

by:x-tinct
Comment Utility
Part of the question: "...give ALL informations about USER..."

iceboxman answer is correct, but didn't answer the question. (ALL info)
Rajkumar_G answer is also correct, but it describes how to show server info instead of user info. (about USER)

The site http://www.showmyip.com/ shows info from the client request, dns lookup, country lookup and browser info from javascript as I answered.
0
 
LVL 4

Expert Comment

by:iceboxman
Comment Utility
Actually, my answer did include showing all information:

I gave a reference to the PHP variables that display all the information that is needed.  The rest of the people pretty much regurgitated what I said.

"This will display the IP address of the remote user. Take a look at the link below for some more interesting variables.

http://www.php.net/manual/en/reserved.variables.php#reserved.variables.server"
0
 
LVL 4

Expert Comment

by:iceboxman
Comment Utility
The information displayed on www.showmyip.com can all be obtained by looking at the information provided.
0
 
LVL 1

Expert Comment

by:x-tinct
Comment Utility
Ok, sorry about the link. That is true, the information in the $_SERVER variable is described there. But this can not give all the information about the user that is displayed on showmyip.com. Take a closer look, it does for instance not include screen resolution, nor does it include country information (only prefered language or ip address), etc...

So I suggest we split the points if ok by iceboxman?
0
 
LVL 4

Expert Comment

by:iceboxman
Comment Utility
Your right.  Screen resolution can only be given by JavaScript.  You can see that if you look at the page source of www.showmyip.com.

As for the point split, that's fine.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now