ERROR FILE NOT FOUND: " . $config['default_white_page'] . "! \r\n
";
die();
}
if (empty($config['default_offer_page']) || (!strstr($config['default_offer_page'], '://') && !is_file($config['default_offer_page']))) {
echo "ERROR FILE NOT FOUND: " . $config['default_offer_page'] . "! \r\n
";
die();
}
if (function_exists('header_remove')) header_remove("X-Powered-By");
@ini_set('expose_php', 'off');
$decodedData = json_decode($cloackedData, true);
if ($decodedData['status'] == "success") {
if($decodedData['render'] == "white") {
renderWhite($config['default_white_page'], $config['render_white_method']);
}
if($decodedData['render'] == "offer") {
if ($config['multiple_offer_page']) {
$arrOfferData = explode('|', $config['multiple_offer_data']);
foreach ($arrOfferData as $data) {
$detail = explode(';', $data);
if ($detail[0] == $decodedData['country_code']) {
renderOffer($detail[1], $config['allowed_params'], $config['render_offer_method']);
} else {
renderOffer($config['default_offer_page'], $config['allowed_params'], $config['render_offer_method']);
}
}
} else {
renderOffer($config['default_offer_page'], $config['allowed_params'], $config['render_offer_method']);
}
}
} else {
echo($cloackedData);
die();
}
function cloacked($url, $body = '')
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
if (!empty($body)) {
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "$body");
}
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_TIMEOUT, 45);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$r = @curl_exec($ch);
$responseCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($responseCode === 515) {
echo("Response Code : 515");
die();
}
return $r;
}
function renderOffer($offer, $utm = false, $method = 'iframe')
{
if (substr($offer, 0, 8) == 'https://' || substr($offer, 0, 7) == 'http://') {
if (!empty($_GET) && $utm) {
if (strstr($offer, '?')) $offer .= '&' . http_build_query($_GET);
else $offer .= '?' . http_build_query($_GET);
}
if ($method == '302') {
header("Location: " . $offer);
} else if ($method == 'iframe') {
echo "";
} else {
echo '';
}
} else
require_once($offer);
die();
}
function renderWhite($white, $method = 'curl')
{
if (substr($white, 0, 8) == 'https://' || substr($white, 0, 7) == 'http://') {
if ($method == '302') {
header("Location: " . $white);
} else {
if (!function_exists('curl_init')) $page = file_get_contents($white, 'r', stream_context_create(array('ssl' => array('verify_peer' => false, 'verify_peer_name' => false,))));
else $page = cloacked($white);
$page = preg_replace('#(]*>)#imU', '$1', $page, 1);
$page = preg_replace('#https://connect\.facebook\.net/[a-zA-Z_-]+/fbevents\.js#imU', '', $page);
if (empty($page)) {
header("HTTP/1.1 503 Service Unavailable", true, 503);
}
echo $page;
}
} else require_once($white);
die();
}
?>