Title: [PHP] Beacon Code Author: Anonymous Pastebin link: http://pastebin.com/Sx4HfyNT First Edit: Saturday 4th of January 2014 01:02:36 AM CDT Last Edit: Saturday 4th of January 2014 01:02:36 AM CDT h3 {         display: inline;         font-family: "Helvetica Neue", Helvetica, sans-serif;         font-size:200px;         color: #ed3c95;         text-shadow:                 0 1px 0 #99258e,                 0 2px 0 #99258e,                 0 3px 0 #99258e,                 0 4px 0 #f6b7d2,                 0 5px 0 #f6b7d2,                 0 6px 0 #f6b7d2,                 0 6px 1px rgba(0, 0, 0, 0.1),                 0 0 5px rgba(0, 0, 0, 0.1),                 0 1px 3px rgba(0, 0, 0, 0.3),                 0 3px 5px rgba(0, 0, 0, 0.2),                 0 5px 10px rgba(0, 0, 0, 0.25),                 0 10px 10px rgba(0, 0, 0, 0.2),                 0 20px 20px rgba(0, 0, 0, 0.15); } h3:hover {         position:relative;         top:3px;         text-shadow:                 0 1px 0 #99258e,                 0 2px 0 #99258e,                 0 3px 0 #f6b7d2,                 0 4px 0 #f6b7d2,                 0 0 5px rgba(0, 0, 0, 0.1),                 0 1px 3px rgba(0, 0, 0, 0.3),                 0 3px 5px rgba(0, 0, 0, 0.2),                 0 5px 10px rgba(0, 0, 0, 0.25),                 0 10px 10px rgba(0, 0, 0, 0.2); } h3:active {         position:relative;         top:6px;         text-shadow:                 0 1px 0 #99258e,                 0 2px 0 #f6b7d2,                 0 1px 3px rgba(0, 0, 0, 0.3),                 0 3px 5px rgba(0, 0, 0, 0.2),                 0 1px 5px rgba(0, 0, 0, 0.25); }   h3 a,a:link,a:visited,a:hover,a:active,a:focus {         text-decoration:none; } .console {         background-color:#EEE;         width:400px;         font-size:10px;         margin-left:auto;         margin-right:auto;         overflow:hidden; } .consolecontrol {         background-color:#EEE;         width:400px;         height:15px;         font-size:10px;         margin-left:auto;         margin-right:auto; } .consolecontrol:hover {         background-color:#ffffee; } .markerfailbar {         background:#ffffee;         width:100%; } threads);$i++) //cycle through all the threads on this page                 {                         if(!empty($json_dump->threads[$i]->posts[0]->sub)) //make sure the thread has a title (or sub (im guessing "subtext" or something))                         {                                 foreach($keywords as $key)//cycle through keywords                                 {                                         if(stristr($json_dump->threads[$i]->posts[0]->sub,$key)!=FALSE)//compare the title to the keywords, case insenstive.                                         {                                                       $threadJson = getThreadJson($json_dump->threads[$i]->posts[0]->no); //do this once, to save from having to load the page from 4chan more than once                                                 if(checkForMarkerFromThreadJson($threadJson)==true)                                                 {                                                         writeRawText("thread.cache", $json_dump->threads[$i]->posts[0]->no);                                                         markerFound($threadJson);                                                         return true;                                                 }                                         }                                 }                         }                 }         }               echo "

";         echo "

*external boop*



";         echo "
mlpg.co couldn't find the marker. Try the 413chan archive locator
";//In case the marker isn't anywhere we can find, give them a link to the 413chan locator         return false; }   function writeRawText($fileURI, $content) {         $fp = fopen($fileURI, "w+");         if(!$fp) {           //echo "cache failure";           return false;         }       fputs($fp, $content);       fclose($fp); } function readRawText($fileURI, $mode) {           $raw = "";         $handle = @fopen($fileURI, $mode);         if($handle==false)         {                 return false;         }         while (!feof($handle))         {                 $raw .= fread($handle,8192);         }         fclose($handle);         return $raw; } function getThreadJson($threadID) {         $threadRaw = readRawText("http://a.4cdn.org/mlp/res/". $threadID. ".json", "r");         if($threadRaw==false)         {                 //echo "Thread failed to load, please refresh the page.
";                 return false;         }         $threadJson = json_decode($threadRaw);//push the json data into something php can read         return $threadJson; } function getpageJson($pageNum) {         $pageRaw = readRawText("http://a.4cdn.org/mlp/". $pageNum. ".json", "r");         if($pageRaw==false)         {                 //echo "4chan page failed to load, please refresh the page.
";                 return false;         }         $pageJson = json_decode($pageRaw);//push the json data into something php can read         return $pageJson; } function checkForMarkerFromThreadJson($threadJson) {         for($i=0;$i<=sizeof($threadJson->posts)-1;$i++)//cycle through every post in thread         {                 if(!empty($threadJson->posts[$i]->filename))//make sure the post has an image (by checking if post data contains a filename)                 {                         if($threadJson->posts[$i]->md5 == "YgIC5DRjGYcY2F4I+vJkOw==")//compare image md5 with the known marker md5                         {                                 return true;                         }                 }         }         return false; } function markerFound($threadJson) {         echo "

*boop*

";//BOOP         echo "


";         if(!empty($threadJson->posts[0]->com))//if OP post has text         {                 echo "
Thread topic: ". strip_tags(substr($threadJson->posts[0]->com,0,125)). "...". "
";//strip tags to remove any embedded html, and only display the first 125 chars         }         echo "
Replies: ". sizeof($threadJson->posts);//number of replies         echo " Images: ". $threadJson->posts[0]->images; //number of images         $name = "";         if(!empty($threadJson->posts[0]->name)) //check for namefag OP         {                 $name = strip_tags($threadJson->posts[0]->name);         }         elseif(!empty($threadJson->posts[0]->trip))//check for tripfag OP         {                 $name = strip_tags($threadJson->posts[0]->trip);         }         else //check for anon OP         {         $name = "Anonymous";         }         echo " Posted by: ". $name;         echo "
"; } function checkCache() { //1 read thread from file (if none exists, skip to 3) //2 cycle through posts in thread for the marker to hit the md5 //3 if it doesn't, return false, run the normal findthread() and write the result to the cache   $cachedThread = readRawText("thread.cache", "r");//read the file           if($cachedThread!=false)//if it finds text in the file         {                 $json = getThreadJson($cachedThread);                         if ($json!=false)                         {                         if(checkForMarkerFromThreadJson($json)==true)                         {                                 markerFound($json);                         }                         else                         {                                 findthread();                         }                 }                 else                 {                 findthread();                 }         }         else         {                 findthread();         } } checkCache(); ?> time: ".substr($totaltime,0,5)."s

"; ?>