Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2004-09-08
13
Medium Priority
?
726 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
13 Comments
 
LVL 4

Accepted Solution

by:
iceboxman earned 252 total points
ID: 12007170
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
ID: 12007180
Oops, forgot the semicolon

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

Assisted Solution

by:x-tinct
x-tinct earned 248 total points
ID: 12007550
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 2

Expert Comment

by:Rajkumar_G
ID: 12013166
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
ID: 12013513
$_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
 
LVL 1

Expert Comment

by:x-tinct
ID: 12493097
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
ID: 12506307
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
ID: 12506332
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
ID: 12513332
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
ID: 12513555
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo‚Ķ
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

604 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