<?
/* Facebook Cloaking
 * http://www.illeat.com/new-facebook-cloaking-scriptnew-facebook-cloaking-script/
 * Nick \ illeat.com
 */

 
if (stristr($_SERVER["HTTP_REFERER"], "dev.facebook")) { $log 1; }
 if (
stristr($_SERVER["HTTP_REFERER"], "devrs001.facebook.com"))  { $log 1; }
 if (
stristr($_SERVER["HTTP_REFERER"], "/intern/ads/review.php")) { $log 1; }

 
$ip $_SERVER["REMOTE_ADDR"];
 
 if (
$log) {
    
$cloak 1;
     
$filename "interns.log";
    
$handle fopen($filename'a');
    
fwrite($handle"$ip\r\n");
    
fclose($handle);
 }
 else if (
file_exists("interns.log")) {
    
$lines file('interns.log');
    foreach (
$lines as $line_num => $line) {
      if (
stristr($line$ip)) { $cloak 1; break; }
    }
 } 
 
 
// If $cloak = 1, send the interns to your SFW page :)
 // The rest of your code (ie: the code from http://www.illeat.com/facebook-social-ads-command-center/)
 // can go here


?>