Advertisement
DSTAT

IP_Lookup

Aug 7th, 2017
6,432
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.66 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6.     <title>IP Lookup | ddosfilter.net</title>
  7. </head>
  8. <body>
  9.     <form class="form" method="POST">
  10.         <div class="title"><h2>Look up IP:</h2></div>
  11.         <label>IP:</label>
  12.         <div class="formRight"><input type="text" name="lookupip" maxlength="15" /></div>
  13.         <input type="submit" value="Look Up IP" name="lookupipbtn"/>
  14.     </form>
  15. <?php
  16. if (isset($_POST['lookupipbtn'])) {
  17.     $ip = $_POST['lookupip'];
  18.     if (empty($ip)) {
  19.         die('<center><h2>Error: No IP Specified.</h2></center></body></html>');
  20.     }
  21.     if (!filter_var($ip, FILTER_VALIDATE_IP)) {
  22.         die('<center><h2>Error: Invalid IP.</h2></center></body></html>');
  23.     }
  24. } else {
  25.     if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) {
  26.         $ip = $_SERVER['HTTP_CF_CONNECTING_IP'];
  27.     } else {
  28.         $ip = $_SERVER['REMOTE_ADDR'];
  29.     }
  30. }
  31. $long = ip2long($ip);
  32. if (!filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
  33.     echo '<center><h2>IP resides in a private range.</h2></center>';
  34. } else {
  35.     $ipinfo = json_decode(file_get_contents("http://ipinfo.io/{$ip}/json"));
  36.     /*
  37.     $ch = curl_init();
  38.     curl_setopt($ch, CURLOPT_URL, ("http://ipinfo.io/{$ip}/json"));
  39.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  40.     $ipinfo = json_decode(curl_exec($ch));
  41.     curl_close($ch);
  42.     */
  43. }
  44. if (empty($ip)) $ip = "Not Found";
  45. if (empty($long)) $long = "Not Found";
  46. if (empty($ipinfo->org)) $ipinfo->org = "Not Found";
  47. if (empty($ipinfo->hostname)) $ipinfo->hostname = "Not Found";
  48. if (empty($ipinfo->country)) $ipinfo->country = "Not Found";
  49. if (empty($ipinfo->city)) $ipinfo->city = "Not Found";
  50. if (empty($ipinfo->region)) $ipinfo->region = "Not Found";
  51. if (empty($ipinfo->postal)) $ipinfo->postal = "Not Found";
  52. if (empty($ipinfo->loc)) $ipinfo->loc = "Not Found";
  53.  
  54.  
  55. echo (' <center><h1>IP Information:</h1></center>
  56.     <table align="center">
  57.     <tr><td><b>IP : </b></td><td><b>'.$ipinfo->ip.'</b></td></tr>
  58.     <tr><td><b>Decimal : </b></td><td><b>'.$long.'</b></td></tr>
  59.     <tr><td><b>Organization : </b></td><td><b>'.$ipinfo->org.'</b></td></tr>
  60.     <tr><td><b>Host Name : </b></td><td><b>'.$ipinfo->hostname.'</b></td></tr>
  61.     <tr><td><b>Country : </b></td><td><b>'.$ipinfo->country.'</b></td></tr>
  62.     <tr><td><b>State : </b></td><td><b>'.$ipinfo->region.'</b></td></tr>
  63.     <tr><td><b>City : </b></td><td><b>'.$ipinfo->city.'</b></td></tr>
  64.     <tr><td><b>Postal : </b></td><td><b>'.$ipinfo->postal.'</b></td></tr>
  65.     <tr><td><b>Latitude/Longitude:</b></td><td><b>'.$ipinfo->loc.'</b></td></tr>
  66.     </table>
  67. ');
  68. ?>
  69. </body>
  70. <!-- Coded by DSTAT. Instagram: DDoS_Filter -->
  71. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement