Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

GustavoLopes

Contagem regressiva (5 segundos) não ínicia as vezes..

Recommended Posts

Olá a todos,

 

Possuo um sistema de um protetor de links , hospedado na DetonaHost e dominio na GoDaddy.

O sistema é parecido com adf.ly ou adv.li. (praticamente igual)

 

Na parte do protetor em si , com a contagem regressiva para liberar o link eu percebi em outros navegadores (no que uso diariamente,firefox,estava normal) que eles não inciaram (ficava só no "Please Wait 5 seconds...") , porém depois funcionou normal e deixei quieto.

Quando fui testar em outro computador ele não iniciou o contador nem a pau.

 

Link de demonstração: http://www.mundo-droid.com/4I (Por favor me digam se funcionou ou não no PC de vocês)

 

 

Código da página .php:

<?php
ini_set('display_errors', 0);
require_once '../global.php';
require_once ROOT_PATH . '/inc/analyzer.class.php';

function kill() { System::redirect(SITE_LOCATION); exit; };
if (isset($_GET['uid']) && isset($_GET['url'])) {
	$G_UID = intval($_GET['uid']);
	
	$G_URL_R = $G_UID . '/' . ($_GET['adt'] != 1 ? 'banner/' : '');
	$G_URL = $_SERVER['REQUEST_URI'];
	$G_URL = substr($G_URL, strpos($G_URL, $G_URL_R) + strlen($G_URL_R));
	
	$G_ADT = $_GET['adt'] != 1 ? 'Top Banner' : 'Interstitial';
	$urlsb = substr($G_URL, 0, strpos($G_URL, '://'));
	if (!$urlsb) {
		$G_URL = 'http://' . $G_URL;
	}
	if (!is_numeric($G_UID) || !Utilities::validateURL($G_URL)) {
		kill();
	}
} else if(!preg_match('|^[0-9a-zA-Z]{1,6}$|', $_GET['to'])) {
	kill();
}

$G_SHORT = false;
if ($G_UID && $G_URL && $G_ADT) {
	$surl  = SITE_LOCATION;
	$db    = System::getDB();
	$user  = $G_UID;
	if ($tmp = $db->getField($_GLOBAL['TABLES']['LINKS'], 'short_url', 
							 "`long_url`='{$G_URL}' AND `adtype`='{$G_ADT}' AND `user`='{$user}'")) {
		$short = $tmp;
		$data  = System::getDB()->getRows($_GLOBAL['TABLES']['LINKS'], "`short_url`='{$short}'", '', '1');
	} else {
		$data = array('long_url' => $G_URL, 'adtype' => $G_ADT, 'user' => $user);
		$db->query('LOCK TABLES ' . $_GLOBAL['TABLES']['LINKS'] . ' WRITE;');
		$lid = $db->insert($_GLOBAL['TABLES']['LINKS'], $data);
		$db->query('UNLOCK TABLES');
		$short = $surl . Utilities::compressInt($lid);
		$db->update($_GLOBAL['TABLES']['LINKS'], array('short_url' => $short), "`id`='{$lid}'");
		$data  = System::getDB()->getRows($_GLOBAL['TABLES']['LINKS'], "`id`='{$lid}'", '', '1');
	}
	$G_SHORT = $short;
} else {
	$surl  = Utilities::removeURLQueries(Utilities::getCurrentURL());
	$data  = System::getDB()->getRows($_GLOBAL['TABLES']['LINKS'], "`short_url`='{$surl}'", '', '1');
}

$lid   = $data['id'];
$oid   = $data['user'];
$url   = $data['long_url'];
$title = $data['title'];
$adtyp = $data['adtype'] == 'Interstitial' ? 1 : 2;
if (!$url) kill();

$HTTP_REFERER = !$_SERVER["HTTP_REFERER"] ? getenv('HTTP_REFERER') : $_SERVER["HTTP_REFERER"];

if ($data['adtype'] == 'None') {
	$analyzer = new Analyzer($lid, $oid, 0, $HTTP_REFERER);
	$analyzer->_record($adtype);
	System::redirect($url);
}

function get_ad() {
	global $_GLOBAL, $data, $HTTP_REFERER;
	$a  = new Analyzer(0, 0, 0);
	if ($a->_isCrawler()) die('Crawlers are not allowed here');
	$db =  System::getDB();
	$t  = $data['adtype'] != 'Interstitial' ? 'Banner' : 'Interstitial';
	$cc = $a->country($a->ip());
	$ci = $db->getField($_GLOBAL['TABLES']['PACKAGES'], 'id', "`code`='{$cc}' AND `advert_type`='{$t}'");
	$c  = $db->getRows($_GLOBAL['TABLES']['CAMPAIGNS'], "`status`='2' AND `advert_type`='{$t}'");
	$valid = array();
	for ($i = 0; $i < count($c); $i++) {
		if ($c[$i]['spent_today'] >= $c[$i]['daily_budget'] && $c[$i]['daily_budget'] != 0) continue;
		$pkg = explode(';', $c[$i]['packages']);
		foreach ($pkg as $p) {
			$t = explode(',', $p);
			if ($t[0] == $ci || $t[0] == '1' || $t[0] == '242') $valid[] = $c[$i];
		}
	}
	return $valid[rand(0, count($valid) - 1)];
}

$AD = get_ad();
$aid = $AD['id'] | 0;
if ($adtyp == 2) {
	$analyzer = new Analyzer($lid, $oid, $aid, $HTTP_REFERER);
	$analyzer->_record('top_banner', 3);
}

$_user = new User($_GLOBAL['TABLES']['USERS'], $oid, System::getDB());
?>
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
	<title><?php echo $title ? $title : SITE_PAGE_TITLE; ?></title>
	<meta http-equiv="X-UA-Compatible" content="IE=8; IE=9" />
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
	<link rel="stylesheet" type="text/css" href="<?php echo SITE_LOCATION; ?>css/style.css.php?fly" />
	<script type="text/javascript" src="<?php echo SITE_LOCATION; ?>js/jquery.min.js"></script> 
	<script type="text/javascript" src="<?php echo SITE_LOCATION; ?>js/jquery.libs.js"></script> 
</head> 
<body style="background:#FFFFFF;">
	<noscript>
		<div style="padding: 5px; background-color: red; color: #ffffff; text-align:center; margin-top: 10px; margin-bottom: 10px;">
			Your browser currently does not support javascript or you have javascript turned off.
			This site will have very limited functionality without javascript.
			Please use a modern browser with javascript or enable the javascript option.
		</div>
	</noscript>
	<div class="fly_head" style="max-height:80px;">
		<?php if ($adtyp == 2) { ?>
		<div class="logo" style="display:inline-block;font-weight:bold;margin:0;max-height:100px;"></div>
		<div class="fly_banner" style="margin:0 20px;display:inline-block;">
			<a href="#">
				<img src="<?php echo $AD['website_banner']; ?>" width="720px" height="90px" border="0" />
			</a>
		</div>
		<div style="float:right;display:inline-block;margin:5px 0;width:100px;text-align:right;font-size:11px;">
			<a href="#" class="close"><img src="<?php echo SITE_LOCATION; ?>images/close.png" border="0" /></a>
			<a href="#" style="font-weight:600;position:absolute;color:white;text-decoration:none;top:90px;right:20px;">
				ADVERTISEMENT
			</a>
		</div>
		<?php } else { ?>
		<div class="logo" style="display:inline-block;font-weight:bold;margin:5px 0;max-height:115px;"></div>
		<div style="float:right;display:inline-block;margin:20px 0;">
			Please wait...<span id="redirectin">5</span>
		</div>
		<?php } ?>
		<div style="clear:both;"></div>
	</div>
	<div class="fly_head_bottom">
		<?php if ($adtyp != 2) { ?>
		<div style="display:inline-block;">
		
		</div>
		<?php } ?>
		<div style="clear:both;"></div>
	</div>
	<?php
		$src = $adtyp == 1 ? $AD['website_url'] : $url;
		echo "<iframe class='fly_frame' src='{$src}' scrolling='auto' frameborder='0' style='width:100%;'></iframe>";
	?>
    
    
	<script type="text/javascript">
		<?php
			function get_js_03() {
				global $AD, $aid, $lid, $oid, $adtyp, $url, $HTTP_REFERER;
				ob_start();
		?>
		$(document).ready(function() {
			$('iframe.fly_frame').height($(document).height()-$('div.fly_head').height()-($('div.fly_head_bottom').height()*2));
		});
		$('iframe.fly_frame').ready(function() {
			<?php if ($adtyp == 1) { ?>
			var a0x1 = -2;
			var rr = function() {
				if (a0x1 < 0) {
					$.post('<?php echo SITE_LOCATION; ?>fly/ajax.fly.php',{opt:'check_log',args:{lid:<?php echo $lid; ?>,oid:<?php echo $oid; ?>}},
							function(r) {
								var j = eval('(' + r + ')');
								if (j.message && a0x1 != -2) {
									clearInterval(si);
									var skip_ad = $('<div class="skip_btn"><a href="#">Continuar >></a></div>');
									$('div.fly_head span#redirectin').parent().css('margin', '6px').html(skip_ad);
									skip_ad.click(function() {
										$.post('<?php echo SITE_LOCATION; ?>fly/ajax.fly.php',
												{opt:'make_log',args:{aid:<?php echo $aid; ?>,lid:<?php echo $lid; ?>,oid:<?php echo $oid; ?>,ref: <?php echo "'{$HTTP_REFERER}'"; ?>}},
												function(rr) {
													var jj = eval('(' + rr + ')');
													if (jj.message && a0x1 != -2) {
														top.location.href = jj.message.url;
													}
												}
										);
										skip_ad.html('Loading Page...');
									});
								} else {
									a0x1 = 5;
								}
							}
					);
				} else {
					$('span#redirectin').text(a0x1--);
				}
			}; rr();
			var si = setInterval(rr, 1000);
			<?php } else { ?>
			$('div.fly_banner a').click(function() {
				$.post('<?php echo SITE_LOCATION; ?>fly/ajax.fly.php',{opt:'click_log',args:{aid:<?php echo $aid; ?>,lid:<?php echo $lid; ?>,oid:<?php echo $oid; ?>,ref: <?php echo "'{$HTTP_REFERER}'"; ?>}},
						function() {
							top.location.href = '<?php echo $AD['website_url']; ?>';
						}
				);
			});
			$('div.fly_head a.close').click(function() {
				$('div.fly_head').remove();
				$('div.fly_head_bottom').remove();
				top.location.href = '<?php echo $url; ?>';
			});
			<?php } ?>
		});
	<?php
			$c = ob_get_contents();
			ob_end_clean();
			return $c;
		}
		echo Utilities::JSPack(get_js_03());
	?>
	</script>
	<?php if ($ga = $_user->get('ga_code')) { ?>
	<script type="text/javascript"> 
		var _gaq = _gaq || [];
		_gaq.push(['_setAccount', '<?php echo $ga; ?>']);
		_gaq.push(['_trackPageview']);

		(function() {
			var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
			ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
			(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga);
		})();
	</script>
	<?php } ?>
</body> 
</html>

 

 

Aguardo respostas..

 

 

Obrigado.

Compartilhar este post


Link para o post
Compartilhar em outros sites

Amigo este tipo de contador é feito com javascript.

Obrigado por responder.

 

Então desculpe se postei aqui , pois não sabia se era php ou no javascript que tava.

 

Você consegue me ajudar ?

Meio urgente..

Compartilhar este post


Link para o post
Compartilhar em outros sites

Brother com setInterval ou setTimeout você consegue fazer, no google bastante artigos falando sobre isso.

 

http://codigofonte.uol.com.br/codigo/js-dhtml/diversos/contagem-regressiva

http://www.ficheiro.com.br/criando-contagem-regressiva-com-javascript/

Compartilhar este post


Link para o post
Compartilhar em outros sites
O link de demonstração retorna erro 404.
É porque o link do tópico estava com um espaço no final , desculpeLink certo:http://www.mundo-droid.com/4i

 

Obrigado amigo.Só mais uma coisa , poderia me dizer aonde esta o código do contador na pagina ?

Compartilhar este post


Link para o post
Compartilhar em outros sites

Caramba, me redirecinou para site de pronografia!! o.O



Ufa! da segunda vez que acessei foi normal mas o contador não funciona e provavelmente tem algum código malicioso injetado nesse site.



O endereço ao após clicar em seu link foi este:

 

e1057971e415b70b.100girlsfree.com/gw.php

 

Alerta: conteúdo ---ográfico!

Compartilhar este post


Link para o post
Compartilhar em outros sites

Caramba, me redirecinou para site de pronografia!! o.OUfa! da segunda vez que acessei foi normal mas o contador não funciona e provavelmente tem algum código malicioso injetado nesse site.

Sério amigo ? Me desculpe .Eu baixei esse script pronto. Nunca aconteceu isso comigo e nem nos outros PCs que teatro.O código esta ai. Alguém pode me dizer como arrumar o contador e se existe algum código malicioso ?(O site não tem virus)

 

Galera ,

Acabei de testar aqui e percebi que é minha hospedagem paga da DetonaHost que não tem algo que o script precisa.

Pois na 000webhost free funciona.

 

O que eu posso fazer ?

Compartilhar este post


Link para o post
Compartilhar em outros sites

Galera o link não está mais funcionando porque estou tentando arrumar.

 

Por favor , alguem que conheça .php / javascript pode me ajudar ?

Podemos até negociar algum valor.

 

Preciso que alguem revise o código , arrume o problema do contador que quando hospedo o site no 000webhost grátis ele funciona , na hospedagem paga detonahost não funciona.

Sem contar que deve ter um código que está abrindo um site ---o as vezes ao acessar o site.

 

email: gustavolopesandroid@gmail.com

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.