I’ve added a Your IP tab at the top of the site that will bring you to a page that displays your current IP address as well as some other http connection-related information. A geeky little task I’ve been meaning to do for awhile now. Here’s the code I hacked together for it. As always, please report any problems you encounter with it, and any suggestions you may have for ways to improve the code and/or experience.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US"> <style type="text/css" media="screen"> * { margin:0; padding:0; } body { background-color:#00000; } h1 { font-family: 'Trebuchet MS','Lucida Grande',Verdana,Arial,Sans-Serif; font-size: 65px; margin-top: 35px; text-align: center; margin-bottom: 35px; color: #006699; } h2 { font-family: 'Trebuchet MS','Lucida Grande',Verdana,Arial,Sans-Serif; font-size: 19px; text-align: left; color: #929280; } ul { font-size: 19px; margin-top: 20px; margin-bottom:35px; margin-left: 15px; color: #929280; } li { font-family: 'Trebuchet MS','Lucida Grande',Verdana,Arial,Sans-Serif; margin-top: 10px; } li span { font-family: 'Trebuchet MS','Lucida Grande',Verdana,Arial,Sans-Serif; font-size: 16px/1; color: #ccc; } </style> <body> <div> <?php $IP = $_SERVER["REMOTE_ADDR"]; $host = @gethostbyaddr($_SERVER["REMOTE_ADDR"]); ?> <h1><?php echo $IP; ?></h1> </div> <div> <h2>More info</h2> </div> <div> <ul> <?php echo '<li><strong>Remote Port:</strong> <span>'.$_SERVER["REMOTE_PORT"].'</span></li>'; echo '<li><strong>Request Method:</strong> <span>'.$_SERVER["REQUEST_METHOD"].'</span></li>'; echo '<li><strong>Server Protocol:</strong> <span>'.$_SERVER["SERVER_PROTOCOL"].'</span></li>'; echo '<li><strong>Host:</strong> <span>'.$host.'</span></li>'; echo '<li><strong>User Agent:</strong> <span>'.$_SERVER["HTTP_USER_AGENT"].'</span></li>'; ?> </ul> </div> </body> </html> |