connect($dbconfig["server"], $dbconfig["appender_name"], $dbconfig["appender_pwd"], $dbconfig["database"]);
*/
include($_SERVER['DOCUMENT_ROOT']."/__tool/common.php");
$html = false;
if(strpos($_SERVER['HTTP_USER_AGENT'], 'Mozilla') === 0 && strpos($_SERVER['HTTP_USER_AGENT'], 'Opera') === FALSE)
$html = true;
$timer = 5;
$om = false;
$ip = get_ip();
if(strpos($_SERVER['HTTP_USER_AGENT'], 'Opera Mini') && $_SERVER['HTTP_X_FORWARDED_FOR']) {
$ip_ = sprintf("%u", ip2long($_SERVER['HTTP_X_FORWARDED_FOR']));
$om = true;
} else
$ip_ = sprintf("%u", ip2long($ip));
$url = $img = $text = '';
//$rs = $db->execute("SELECT country FROM wb_adv_ips WHERE from_ip<=$ip_ AND to_ip>=$ip_");
//$country = $rs->getNumOfRows() > 0 ? $rs->fields['country'] : 'zz';
//$country = 'za'; //$om = true;
$dt = date('Y-m-d');
/*
if($country != 'zz') {
$body = @file_get_contents("/etc/thttpd/adv_banners.conf.".$country);
if($body) {
$arr = explode("\n", $body);
$cnt = count($arr);
$i = rand(0, $cnt-1);
$found = false;
$j=0;
while($j < $cnt && !$found) {
$adv = $arr[$i];
if(preg_match ("/^(.*?)<\/a>
()?
$/i", $adv, $matches) ) {
if($matches[4] && $om) {
$i++;
} else {
$url = $matches[1];
$text = $matches[2];
$img = $matches[3];
$found = true;
break;
}
} else
$i++;
if($i == $cnt)
$i=0;
$j++;
}
}
if(!$found)
$country = 'zz';
// echo "i=$i j=$j cnt=$cnt found=$found country=$country
";
}
*/
if(!$url) {
$header_redirect = true;
$url = "http://down3.ucweb.com/ucbrowser/en/?bid=444&pub=carol-cash@ru-wen&url=&title=";
/*if($_SERVER['QUERY_STRING'] == 2)
$url = "http://vidnonstop.1124.ru/pr/4873458169/";
else*/ //if($_SERVER['QUERY_STRING'] == 2 || $_SERVER['QUERY_STRING'] == 3)
// else
// $url ="http://mmska.wbtiger.mmska.ru/yb/4873458169/erotic";
}
//if($_SERVER['QUERY_STRING'] == 20 && strpos($_SERVER['HTTP_USER_AGENT'], 'Android'))
// $url ="http://id-poker.wen.ru/Poker-Texas-v2.6.0.apk";
//$db->execute("INSERT INTO wb_adv_stat(dt, country) VALUES('$dt', '$country') ON DUPLICATE KEY UPDATE dt=dt, clicks=clicks+1");
//$db->execute("INSERT INTO wb_adv_log(dt, country, user_agent, ip, xf_ip, url) VALUES(now(), '$country', '".f2sql($_SERVER['HTTP_USER_AGENT'])."', '".f2sql($ip)."', '".f2sql($_SERVER['HTTP_X_FORWARDED_FOR'])."', '".f2sql($url)."')");
if($header_redirect) {
header("Location: $url");
exit;
}
if($html) {
header("Content-type: text/html; charset=utf-8");
echo '';
echo "\n\n";
echo '';
echo "\nLoading...\n";
echo "\n\n";
} else {
header("Content-type: text/vnd.wap.wml; charset=utf-8");
echo '';
echo '';
echo "\n";
echo "";
//$db->close();
?>";
}
if($text)
echo "$text";
else
echo "Loading...";
if($img)
echo "
";
if($html)
echo "\n";
else
echo "\n