Guest User

Untitled

a guest
Dec 16th, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. $url = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
  2. $ip = $_SERVER['REMOTE_ADDR'];
  3.  
  4. if (strpos($ip, '95.180.') !== false) {$canbe = 'sky';}
  5. elseif (strpos($ip, '109.122.') !== false) {$canbe = 'sea';}
  6. elseif (strpos($ip, '79.101.') !== false) {$canbe = 'earth';}
  7. else {$canbe = 'unknown';}
  8.  
  9. try {
  10. $sql = "insert into stat (ip, url, canbe) values (:aip, :aurl, :acanbe)";
  11. $st = $db->prepare($sql);
  12. $st->execute([
  13. ":aip" => $ip,
  14. ":aurl" => $url,
  15. ":acanbe" => $canbe
  16. ]);
  17. }
  18. catch(PDOException $e) {
  19. echo $e->getMessage();
  20. }
Add Comment
Please, Sign In to add comment