Internet Business Daily

internet business : web trends : technology news

Archive for February, 2009

Website Cloaking Script

Posted by Matthew Berman On February - 12 - 2009

I have been doing a lot of affiliate marketing lately and one of my biggest concerns is always protecting my landing page from competitors. Since I’m tracking every visitor that comes to my landing page, I can get a good idea of how many of those visits are competitors looking for ideas for their sites. I can’t really blame them, I check up on my competitors as well. This doesn’t mean I don’t attempt to protect myself.

With the help of Ben from WickedFire.com I put together a short script that will cloak your site from anyone not coming from the exact sources you specify. You can even white list IP addresses to make sure no direct traffic comes to the site that doesn’t belong there. Be careful with that one since you might be sending away actual customers. I always redirect to the offer page just to be certain.

So, here is the script:

<?php

if(!empty($_SERVER['HTTP_REFERER'])) {
 $referer = parse_url($_SERVER['HTTP_REFERER']);

 preg_match(‘/[^.]+\.[^.]+$/’, $referer['host'], $match);

  if ($match[0] != ‘trafficsource.com’) {
   header(“Location: http://www.offerpage.com”); //redirect all traffic that comes from any source except the one listed above
   exit;
  }
}

if(empty($_SERVER['HTTP_REFERER'])) {
 $visitor = $_SERVER['REMOTE_ADDR'];

 if (!(preg_match(“/xx.xxx.xxx.xx/”,$visitor)) && !(preg_match(“/yy.yyy.yyy.yy/”,$visitor))) {
 header(‘Location: http://www.offerpage.com?subid=directTraffic’); //redirect all IP addresses to this that are not the IP addresses listed above
  exit;
 }
}

?>

This should do the trick. Remember to fill out the correct information in the script, it won’t “just work.” One last thing to remember is that when you enter a traffic source, it should be the root domain (myspace.com, google.com, facebook.com) and nothing else. The script will parse the referring source down to just the root domain. You can add as many IP addresses as you want just by adding another AND (&&) operator. You can also tweak this code to cloak your site anyway you want. Hope you enjoy!

Guest Post on JonathanVolk.com

Posted by Matthew Berman On February - 5 - 2009

Well, it’s not really a guest post but a list of beginner’s tips I wrote in a post on WickedFire that Jon enjoyed and decided to post on his blog. Here’s the link to the beginner’s Facebook tips.

The very next day after I wrote that a lot of things changed on Facebook. They started accepting pretty much any type of advertising, as opposed to before when they were very restrictive. One thing I would like to append to that article is that Facebook is now approving ads at all hours it seems. I had a group of ads approved at 2pm PST. The prime time to get ads approved is still middle day though.

I’ll be posting an article to this blog soon, so come back soon!