Skip to content

Instantly share code, notes, and snippets.

@hatzka-nezumi
Last active December 5, 2016 03:06
Show Gist options
  • Save hatzka-nezumi/0d6117d0b815cf80d53806d90273879c to your computer and use it in GitHub Desktop.
Save hatzka-nezumi/0d6117d0b815cf80d53806d90273879c to your computer and use it in GitHub Desktop.
Protect your users' privacy and security.
<?php
/* confirmtrack.php - protect your users' privacy and security
* by [email protected] - Creative Commons Zero
* Idea taken from medium.com
* to use, simply place links or iframes to this
* use the query string (GET) parameters:
* - 'url' for the url
* - 'name' for the name of the foreign service (optional)
* - 'reason' for the reason (see below) (optional)
* - 'oc' set to anything if this is your content (optional, if not added will disclaim ownership!)
*/
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
<title>Please confirm you want to access this page</title>
<style type='text/css'>
@import url('https://fonts.googleapis.com/css?family=Open+Sans:400,200');
body {
background-color: black;
color: white;
font-family: 'Open Sans', Helvetica, Arial, sans-serif;
text-align: center;
display: flex;
flex-direction: column;
justify-content: center;
height: 100vh;
}
#explain {
font-size: 0.8em;
font-weight: 200;
}
#confirm {
display: block;
padding: 0.5em;
margin: 10px auto;
width: 10em;
border: 2px solid white;
border-radius: 5px;
color: black;
background-color: white;
text-decoration: none;
font-size: 1.5em;
}
body.clicked {
background-color: white;
}
body.clicked * {
display: none;
}
</style>
</head>
<body>
<div id='main'>
Confirm you want to access content from
<?php
if ($_GET['name']) {
echo htmlspecialchars($_GET['name']);
} else {
echo 'an external site';
}
?>
</div>
<div id='confirm-holder'>
<a id='confirm' class='<?php echo($_GET['url'] ? '' : 'bad') ?>' rel='nofollow noreferrer noopener'
href='<?php echo(htmlspecialchars($_GET['url'])) ?>'>View content</a>
</div>
<div id='explain'>
I don't control this site, and <?php
switch ($_GET['reason']) {
case 'privacy':
echo('expect it to violate your privacy');
break;
case 'evilads':
echo('believe it may use malicious advertising');
break;
default:
echo('don\'t trust it either');
}
?>, so I'm putting this interstitital here to confirm that you're OK with viewing it.
(This is<?php echo($_GET['oc'] ? '' : 'n\'t') ?> my own work.)
</div>
<script type='text/javascript'>
function hidepage() {
document.getElementsByTagName('body')[0].classList.add('clicked');
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment