PHP Classes

File: index.php

Recommend this page to a friend!
  Classes of Luis Martinez Ulloa   Tor Geoip Tools   index.php   Download  
File: index.php
Role: Example script
Content type: text/plain
Description: Web page example
Class: Tor Geoip Tools
Generate IPTables rules to block the range of a IP
Author: By
Last change:
Date: 2 years ago
Size: 610 bytes
 

Contents

Class file image Download
<?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>