Skip to content

Instantly share code, notes, and snippets.

/Script.html Secret

Created June 30, 2014 18:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/75212e254599fad1c0ce to your computer and use it in GitHub Desktop.
Save anonymous/75212e254599fad1c0ce to your computer and use it in GitHub Desktop.
Creep Blocker
<script type="text/javascript">
var bannedips=[]
var bannedurls=[]
var final_destination = "http://www.google.com"
var ip = '<!--#echo var="REMOTE_ADDR"-->'
var handleips=bannedips.join("|")
handleips=new RegExp(handleips, "i")
var handleurls=bannedurls.join("|")
handleurls=new RegExp(handleurls,"i")
if ((bannedips.length > 0 && ip.search(handleips)!=-1)||(bannedurls.length > 0 && document.referrer.search(handleurls)!=-1)){
window.location.replace(final_destination)
}
</script>
How to Install:
Paste the entire code snippet just after the "<head>" tag.
How to Customise
Blacklisted IPs:
Edit bannedips
Must be quoted and have a comma between each quoted IP address.
Blacklisted Referrers:
Edit bannedurls
Must be quoted and have a comma between each quoted URL
Remember to leave off http:// in front of URL
License:
Public Domain. Do what you want with this just don't blame me.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment