Created
March 9, 2010 07:14
-
-
Save leebyron/326328 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Options +FollowSymlinks | |
RewriteEngine on | |
# No intersticial for direct reference and self-reference | |
RewriteCond %{HTTP_REFERER} !^$ | |
RewriteCond %{HTTP_REFERER} !^http(s)?://box.leebyron.com/.*$ [NC] | |
# Add a line item for every website you don't need an intersticial for | |
# I've added my own website, gmail and facebook | |
RewriteCond %{HTTP_REFERER} !^http(s)?://([^\.]*.)?leebyron.com/.*$ [NC] | |
RewriteCond %{HTTP_REFERER} !^http(s)?://mail.google.com/.*$ [NC] | |
RewriteCond %{HTTP_REFERER} !^http://([^\.]*.)?facebook.com/.*$ [NC] | |
RewriteRule ^([^/]+)/?$ /?file=$1&referrer=%{HTTP_REFERER} [R=302,L,P] | |
# This directs assets the page tries to load to dropbox.com | |
RewriteCond %{REQUEST_URI} favicon [OR] | |
RewriteCond %{REQUEST_URI} static/images/psychobox\.png | |
RewriteRule ^(.*)$ http://www.dropbox.com/$1 [L] | |
# This ensures that a clean load of box.leebyron.com/ goes somewhere | |
RewriteCond %{REQUEST_FILENAME} index | |
RewriteRule \. index.php [L] | |
# All urls that would otherwise 404 we direct to our dropbox user account | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteRule ^(.*)$ http://dl.dropbox.com/u/2219535/$1 [P,L] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
// get referrer domain | |
$referrer_dirs = explode('/', $_SERVER['HTTP_REFERER']); | |
$domain = str_replace('www.', '', $referrer_dirs[2]); | |
// mail link | |
$mail_subject = rawurlencode('Bad dropbox link on ' . $domain); | |
$mail_message = rawurlencode('I clicked it at: ' . $_SERVER['HTTP_REFERER']); | |
$mail_link = 'mailto:[email protected]?subject=' . $mail_subject . | |
'&body=' . $mail_message; | |
?> | |
<html> | |
<head> | |
<title>Lee Byron | Dropbox</title> | |
<style> | |
body { | |
font-family: "Segoe UI", "Lucida Grande", "Tahoma", sans; | |
margin: 40px 150px; | |
width: 400px; | |
line-height: 18px; | |
font-size: 13px; | |
} | |
h3 { | |
color: #333; | |
font-size: 16px; | |
} | |
h3.dropbox { | |
background-image: url(_db.png); | |
background-repeat: no-repeat; | |
position: relative; | |
left: -24px; | |
padding-left: 24px; | |
} | |
a { | |
color: #3b5998; | |
text-decoration: none; | |
} | |
a.hidden { | |
color: #000; | |
font-style: italic; | |
text-decoration: none; | |
} | |
a:hover { | |
color: #3b5998; | |
text-decoration: underline; | |
} | |
</style> | |
</head> | |
<body> | |
<h3 class="dropbox">Dropbox</h3> | |
<p>This is the personal dropbox of Lee Byron.</p> | |
<? if ($_SERVER['REQUEST_URI'] != "/") { ?> | |
<p>You were linked here from another website, <a href="<?=$_SERVER['HTTP_REFERER']?>" class="hidden"><?=$domain?></a>, who may be abusing the fact that I have files available to the public. You can let me know, please <a href="<?=$mail_link?>">send me a message</a>.</p> | |
<p><b> | |
Anyway, you were probably after this: | |
<a href="/<?=$_GET['file']?>"><?=$_GET['file']?></a> | |
</b></p> | |
<? } ?> | |
<p>Do you have a <a href="https://www.dropbox.com/referrals/NTIyMTk1MzU5">dropbox</a>? | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment