Solved

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

Posted on 2004-09-08
13
723 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 63 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 62 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
This article discusses how to implement server side field validation and display customized error messages to the client.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

734 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