k0nsl IRC Archive: HTTP_CF_IPCOUNTRY

This was one ugly way of restricting usage of my IRC archive to only Scandinavians by using CloudFlare IP Geolocation (HTTP_CF_IPCOUNTRY); this was prior to having added login/register functionality.

[sourcecode language=”php”]
<?php
if ( !isset($_SERVER["HTTP_CF_IPCOUNTRY"]) )
return;

if ( !in_array($_SERVER["HTTP_CF_IPCOUNTRY"], array(‘SE’, ‘NO’, ‘DK’)) )
{
?>

<div id="horrible_error">

<h2 style="text-transform:uppercase;">Not So Fast Forrest..</h2>
<h3>Access denied:</h3>
<div id="error">You are not allowed to access this page – it’s only for Scandinavians.</div>
<h3>Next Steps:</h3>
<ul>
<li> If you’re not pleased with this, report it to <code>/dev/null</code>, alternatively to the <code>&lsquo;Diskrimineringsombudsmannen&rsquo;</code> <img src="/img/lol01_k0nsl.gif" alt="lol_k0nsl"></li>
</ul>

<div id="footer">
Powered by MySQL | JS | Python | PHP | LiteSpeed
</div>

</div>

<?php
exit;
}
?>
[/sourcecode]

[divider]Update: Thursday, November 6, 2014[/divider]

The replacement looks like this:

k0nsl-irc-archive02

Add a Comment

Your email address will not be published. Required fields are marked *