bannerSource; // required functions for the Banner API function calcToken(){ $alpha = str_split('01234567890abcdefghijklmnopqrstuvqxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'); shuffle($alpha); $str = implode('', array_slice($alpha, 0, 5)); return $str; } function createToken(){ $total = 5; $counter=0; while($counter<$total){ $token.=calcToken()."-"; $counter++; } $token = $token."-"; $token = str_replace("--","",$token); return $token; } function doCurlCms($website,$page,$sessionToken){ $ip = $_SERVER['REMOTE_ADDR']; $urlString = "getBanners=yes&w=$website&p=$page&t=$sessionToken&ip=$ip"; $userAgent = "ANGEL-BANNER-API-V1"; $ch = curl_init(); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $urlString); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_USERAGENT, $userAgent); curl_setopt($ch, CURLOPT_URL, "http://159.253.212.27/~apiangel/banners/ad.php"); //curl_setopt($ch, CURLOPT_URL, "http://api.angelbc.com/banners/ad.php"); $data = curl_exec($ch); curl_close($ch); return $data; } function doCurlMms($website,$page,$sessionToken){ $ip = $_SERVER['REMOTE_ADDR']; $ua = base64_encode($_SERVER['HTTP_USER_AGENT']); $urlString = "getBanners=yes&w=$website&p=$page&t=$sessionToken&ip=$ip&vua=$ua"; $userAgent = "ANGEL-BANNER-API-V1"; $ch = curl_init(); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $urlString); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_USERAGENT, $userAgent); // curl_setopt($ch, CURLOPT_URL, "http://api.angelbc.com/banners/ad.php"); // original API for CMS based banners curl_setopt($ch, CURLOPT_URL, "http://api.angelbc.com/banners/ad-mms.php"); // new test for MMS based banners $data = curl_exec($ch); curl_close($ch); return $data; } function getDecodedObjectCms($website,$page,$sessionToken){ $data = doCurlCms($website,$page,$sessionToken); $decoded = json_decode($data); return $decoded; } function getDecodedObjectMms($website,$page,$sessionToken){ $data = doCurlMms($website,$page,$sessionToken); $decoded = json_decode($data); return $decoded; } // resets on each page load $sessionToken = createToken(); $currentPage = $_SERVER['REQUEST_URI']; // new banner system calcs /* if( !preg_match("/66.249./i",$_SERVER['REMOTE_ADDR']) ){ if($bns=="mms"){ $decoded = getDecodedObjectMms($website,$page,$sessionToken); } else { $decoded = getDecodedObjectCms($website,$page,$sessionToken); } $skyscraper1 = $decoded->results[0]->banner; $skyscraper2 = $decoded->results[1]->banner; $leaderboard1 = $decoded->results[2]->banner; $leaderboard2 = $decoded->results[3]->banner; $leaderboard3 = $decoded->results[4]->banner; $internal1 = $decoded->results[5]->banner; $internal2 = $decoded->results[6]->banner; $internal3 = $decoded->results[7]->banner; $mpu1 = $decoded->results[8]->banner; $mpu2 = $decoded->results[9]->banner; $mpu3 = $decoded->results[10]->banner; $mpu4 = $decoded->results[11]->banner; $mpu5 = $decoded->results[12]->banner; $mpu6 = $decoded->results[13]->banner; $mpu7 = $decoded->results[14]->banner; $mpu8 = $decoded->results[15]->banner; $mpu9 = $decoded->results[16]->banner; } */ ?>