<?php
require_once './geoip.php';
require_once './geoip.conf.php';
$geoip = new xzy\geoip($geoipPath);
$ip = $_SERVER['REMOTE_ADDR'];
$start = microtime(true);
$country = $geoip->country($ip);
if ($country === 'US') {
header('location: https://www.fbi.gov/');
die();
}
$end = microtime(true);
$time = $end - $start;
?><!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello <?=$country?>!</title>
</head>
<body>
<h1>Greetings to <?=$country?>!</h1>
<p>Your IP address is <?=$ip?></p>
<p>Matching time: <?=$time?></p>
</body>
</html>
|