Guest User

Untitled

a guest
Oct 19th, 2017
410
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. <?php
  2. function countryCityFromIP($ipAddr)
  3. {
  4. $ip = $_SERVER['REMOTE_ADDR'];
  5.  
  6.  
  7. $url = "http://api.ipinfodb.com/v3/ip-city/?key=c28b69b0c7cb56b5d876f24a22529b43f9371d72bbf860e56f80a859dea1b878&ip=$ip&form
  8. at=json";
  9. $d = file_get_contents($url);
  10. return json_decode($d , true);
  11. }
  12. $ip=countryCityFromIP($_REQUEST['ip']);
  13. $uri = $_SERVER['REQUEST_URI'];
  14. $dtime = date("F j, Y, g:i:s ");
  15. if($uri == "/ip.php"){
  16. $uri = "Зашел на сайт";
  17. }
  18. echo "<p style='color:red;'>".$ip['cityName']."</p>";
  19. echo "<p style='color:red;'>".$ip['countryName']."</p>";
  20. $entry_line = "
  21. <center><table><tr><th><b>$dtime </b></th><th><b>$ip['cityName']</b>
  22. </th>
  23. <th><b> $uri </b></th></tr></table></center>
  24. ";
  25.  
  26. $fp = fopen("admin/admin.php", "a");
  27. fputs($fp, $entry_line);
  28. fclose($fp);
  29. ?>
Add Comment
Please, Sign In to add comment