<?php
include "../cfg.php";
$ip = getenv("REMOTE_ADDR");
$ip = htmlspecialchars(substr($ip,0,15), ENT_QUOTES);
$id = intval($_GET['id']);
$hash = md5("Fg_e3".$key.md5($ip));
// Выборка категорий и адалт/не адалт
$get_strike = mysql_query("SELECT noadult, back_slider FROM webmasters WHERE id = ".$id." LIMIT 1");
$row = mysql_fetch_array($get_strike);
$noadult = $row['noadult'];
$back_slider = $row['back_slider'];
$where = "";
if($noadult == 1) { $where .= "AND adult = 0"; }
// Закончили
include "../lib/geoip.php";
$country_code = getCOUNTRY($ip);
$time = date(G);
$count = mysql_num_rows(mysql_query("SELECT id FROM advert_slider WHERE clx > 0 AND status = 0 AND stopor = 0 "));
if(rand(1,2) == 1) { $sort = "DESC"; } else { $sort = "ASC"; }
$rs = mysql_query('SELECT id, img, name FROM advert_slider WHERE status = 0 AND clx > 0 AND (geo = "'.$country_code.'" OR geo = "") AND (stopor > count OR stopor = 0) AND ((start_time <= '.$time.' AND end_time >= '.$time.') OR (start_time = 0 AND end_time = 0)) '.$where.' ORDER BY id '.$sort.' LIMIT 10');
$i = 1;
$t = "";
while($a = mysql_fetch_array($rs)) {
$t .= "URL[".$i."]='<a h'+'r'+'e'+'f'+'='+'\"h'+'t'+'tp://".$cfgURL."/c'+'l'+'i'+'c'+'k'+'/'+'s'+'l'+'i'+'d'+'e'+'r'+'.'+'p'+'h'+'p'+'?'+'i'+'d'+'w'+'m'+'=".$id."&'+'i'+'d'+'a'+'d'+'v'+'=".$a['id']."&'+'h'+'a'+'s'+'h'+'=".$hash."\" target=\"_blank\"><img src=\"http://".$cfgURL."/images/slider/".$a['img']."\" border=\"0\" alt=\"".$a['name']."\" /></a></center>';";
$i++;
}
if($i == 1) {
if($back_slider) {
print "document.write('".html_entity_decode(stripslashes($back_slider), ENT_QUOTES)."');";
exit();
} else {
$t .= "URL[1]='<a href=\"http://".$cfgURL."/\" target=\"_blank\"><img src=\"http://".$cfgURL."/images/slider/noslider.gif\" border=\"0\" /></a></center>';";
}
}
?>
function addStyleSheet() {
var style = document.createElement('style');
style.type = 'text/css';
document.getElementsByTagName('head')[0].appendChild(style);
return document.styleSheets[document.styleSheets.length - 1];
}
function addStyle(ss, sel, rule) {
if (ss.addRule) { ss.addRule(sel, rule); }
else { if (ss.insertRule) { ss.insertRule(sel + ' {' + rule + '}', ss.cssRules.length); } }
}
var s = addStyleSheet();
addStyle(s, '.close', 'float:right;width: 19px;height: 19px;display: block; background: transparent url("http://<?php print $cfgURL; ?>/images/closyep.png") no-repeat !important;z-index: 10000;');
addStyle(s, '.advf54se', 'background: transparent url("http://<?php print $cfgURL; ?>/images/adv_top_bg.png") repeat-x !important;z-index: 10000;');
addStyle(s, 'table, td, tr', 'width:auto;padding: 0px !important; margin: 0px !important; text-align:auto !important;border:0 !important;');
var winWidth = 300;
var winHeight = 254;
URL=new Array;
<?php print $t; ?>
co=0;
var b=(URL.length-1);
var pause=24000;
function Rotate() {
if (co==b) {
co=1;
}else{
co=co+1;
}
rest=URL[co];
document.getElementById("IBlock").innerHTML = rest;
window.setTimeout('Rotate()',pause);
}
document.write('<?php if($count != 0) {?><div id="sliderbox" style="z-index:10000; position:absolute; display:none; padding:0px; margin:0px; left:10px; top:10px; width:300px; height:254px;">'+
'<table height="250" cellspacing="0" cellpadding="0" border="0" width="300"><tr class="advf54se"><td height="7" align="left"><a target="_blank" href="http://<?php print $cfgURL; ?>" style="float:left;color: #fff;font-size:11px;font-weight: 700;text-decoration: none;padding-left: 3px;" title="Рекламная сеть <?php print $cfgURL; ?>"><?php print $cfgURL; ?></a></td><td><a class="close" href="javascript:slider_close();" title="Закрыть баннер"></a></td></tr><tr><td valign="top" width="*" colspan="2">'+
'<div id="IBlock"></div>'+
'</td></tr></table></div><?php;} else{}?>');
var sliderboxwin = document.getElementById("sliderbox");
var ScrollHeight = winHeight;
var hidden = true;
setTimeout("showtbl()", 1);
setInterval("showtbl()", 1000);
setInterval("updatePosition()", 10);
setInterval("slide()", 20);
winHeight = winHeight + 16;
var fuckIE = false;
if (navigator.appName == "Microsoft Internet Explorer") {
fuckIE = true;
}
else {
sliderboxwin.style.position = "fixed";
}
if (navigator.appName == "Opera") {
winWidth = winWidth + 16;
winHeight = winHeight + 10;
}
if (navigator.appName == "Netscape") {
winWidth = winWidth + 16;
winHeight = winHeight + 8;
}
function slide() {
if (!hidden) {
if (ScrollHeight > 0) {
ScrollHeight = ScrollHeight - 10;
}
if (ScrollHeight < 0) {
ScrollHeight = 0;
}
}
}
function updatePosition() {
rightBottomWin("sliderbox", winWidth, winHeight - ScrollHeight);
return 0;
}
function getWinSize() {
var height = 0;
var width = 0;
if (self.innerHeight)
height = self.innerHeight;
else if (document.documentElement && document.documentElement.clientHeight)
height = document.documentElement.clientHeight;
else if (document.body)
height = document.body.clientHeight;
if (self.innerWidth)
width = self.innerWidth;
else if (document.documentElement && document.documentElement.clientWidth)
width = document.documentElement.clientWidth;
else if (document.body)
width = document.body.clientWidth;
var size = [width, height];
return size;
}
function centerWin(id, width, height) {
var winSize = getWinSize();
document.getElementById(id).style.left = (winSize[0]-width)/2+"px";
document.getElementById(id).style.top = (winSize[1]-height)/2+"px";
if (fuckIE == true) {
document.getElementById(id).style.left = (winSize[0]-width+document.body.scrollLeft)+"px";
document.getElementById(id).style.top = (winSize[1]-height+document.body.scrollTop)+"px";
}
}
function rightBottomWin(id, width, height) {
var winSize = getWinSize();
if (document.height)
if (document.height > winSize[1])
winSize[0] -= 16;
winSize[1] -= 1;
winSize[0] -= 5;
winSize[1] -= 5;
document.getElementById(id).style.left = (winSize[0]-width)+"px";
document.getElementById(id).style.top = (winSize[1]-height)+"px";
if (fuckIE == true) {
document.getElementById(id).style.left = (winSize[0]-width+document.body.scrollLeft)+"px";
document.getElementById(id).style.top = (winSize[1]-height+document.body.scrollTop)+"px";
}
return 0;
}
function getCookie(name) {
var cookie = " "+document.cookie;
var search = " "+name+"=";
var setStr = null;
var offset = 0;
var end = 0;
if (cookie.length > 0) {
offset = cookie.indexOf(search);
if (offset != -1) {
offset += search.length;
end = cookie.indexOf(";", offset)
if (end == -1) {
end = cookie.length;
}
setStr = unescape(cookie.substring(offset, end));
}
}
return(setStr);
}
function setCookie (name, value, expires, path, domain, secure) {
document.cookie = name + "=" + escape(value) + ((expires) ? "; expires=" + expires : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "")+ ((secure) ? "; secure" : "");
}
function showtbl(){
var expr = getCookie("untill");
if (expr==null || expr=="") {
sliderboxwin.style.display = "inline";
hidden = false;
}
}
function slider_close(){
var now = new Date();
var expire = new Date();
expire.setTime(now.getTime()+86400000);
sliderboxwin.style.display = "none";
document.body.removeChild(sliderboxwin);
ScrollHeight = winHeight;
hidden = true;
setCookie("untill", "1", expire.toGMTString());
}
function hidetbllong(){
var now = new Date();
var expire = new Date();
expire.setTime(now.getTime()+86400000);
sliderboxwin.style.display = "none";
ScrollHeight = winHeight;
hidden = true;
setCookie("untill", "1", expire.toGMTString());
}
Rotate();