connect_error){return false;} $uri = $_SERVER["REQUEST_URI"]; $site = $_SERVER["SERVER_NAME"]; $date = date("Y-m-d"); $key = md5($date.$site.$uri); $conn->query("UPDATE `diario` SET hits=hits+1, ts=now() where `key`='".$key."'"); if ($conn->affected_rows==-1 || $conn->affected_rows==0) { $sql = "INSERT INTO `diario` (`fecha`, `dominio`, `uri`, `hits`, `key`) VALUES ('".$date."','".$site."','".$uri."',1,'".$key."')"; $conn->query($sql); if ($conn->affected_rows==-1 || $conn->affected_rows==0) { echo "Error: No se pudo crear la fila: " . $sql . "
" . $conn->error; } } $conn->close(); } function newGetPge(){ $ng = $_GET; if(isset($ng['mode']) && $ng['mode']!=""){ switch ($ng['mode']) { case 'x': $ng['ajaxbody'] = 1; break; case 'l': $ng['nomodulospge'] = 1; break; } } if(isset($ng['mode']) && $ng['mode']=="") unset($ng['mode']); if(isset($ng['acc']) && $ng['acc']!="") $ng['acc'] = $ng['acc']; if(isset($ng['fnc']) && $ng['fnc']=="") unset($ng['fnc']); if(isset($ng['prm']) && $ng['prm']=="") unset($ng['prm']); if(isset($ng['prm2']) && $ng['prm2']=="") unset($ng['prm2']); if(isset($ng['prm3']) && $ng['prm3']=="") unset($ng['prm3']); if(isset($ng['prm4']) && $ng['prm4']=="") unset($ng['prm4']); if(isset($ng['prm5']) && $ng['prm5']=="") unset($ng['prm5']); if(isset($ng['prm6']) && $ng['prm6']=="") unset($ng['prm6']); if(isset($ng['gps']) && $ng['gps']!="" && !is_numeric($ng['gps'])){ $ng['gps'] = substr($ng['gps'], 1); }else{ $ng['gps'] = 2; } if(!isset($ng['acc']) || $ng['acc']=="home"){ $ng['acc'] = "home"; $ng['fnc'] = "home"; $ng['gps'] = 1; } $_GET = $ng; } newGetPge(); /* Enable CORS en el API */ if(isset($_GET['api'])){ header("Access-Control-Allow-Origin: *"); header('Content-Type: application/json'); header("Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, DELETE, XMODIFY"); header("Access-Control-Allow-Headers: Authorization, PageGear-Token, PageGearToken, Content-Type, X-Requested-With"); } // La session en wangle es valida para todos los sub-dominios. if(strstr($_SERVER["SERVER_NAME"],"cambalachemos.com")!=false){ini_set('session.cookie_domain', '.cambalachemos.com');} if(isset($_POST['session_name_var'])){$_COOKIE[$_POST['session_name_var']] = $_POST['session_name'];} set_include_path(get_include_path().":/PageGear/pge/classes/"); date_default_timezone_set ("America/Bogota"); setlocale(LC_ALL, 'es_ES.UTF-8'); $headers = apache_request_headers(); if(isset($headers['PageGear-Token']) && $headers['PageGear-Token']!="undefined" && $headers['PageGear-Token']!="null"&& $headers['PageGear-Token']!=""){ @session_id($headers['PageGear-Token']); }elseif(isset($headers['Pagegear-Token']) && $headers['Pagegear-Token']!="undefined" && $headers['Pagegear-Token']!="null" && $headers['Pagegear-Token']!="") { @session_id($headers['Pagegear-Token']); }elseif(isset($headers['pagegear-token']) && $headers['pagegear-token']!="undefined" && $headers['pagegear-token']!="null" && $headers['pagegear-token']!="") { @session_id($headers['pagegear-token']); }elseif(isset($_GET['PGESS']) && $_GET['PGESS']!="undefined" && $_GET['PGESS']!="null" && $_GET['PGESS']!="") { @session_id($_GET['PGESS']); } @session_start(); ob_start(); /* Buscar contenido pre-procesado en cache */ (new PageGearCloudContentCache)->checkCache(); $dominioexp = explode(".",$_SERVER['HTTP_HOST']); $dominio = ($dominioexp[0] == "www")? str_replace("www.","",$_SERVER['HTTP_HOST']) : $_SERVER['HTTP_HOST']; $dominioexp = explode(":",$dominio); $dominio = (count($dominioexp)>1)? $dominioexp[0] : $dominio; function setPreTituloPGE( $titulo , $separador=" " ){global $metaTagsPGE;$metaTagsPGE['pretitulo'] = $titulo.$separador;} if(isset($_GET['template'])){define("__plantilla_def",$_GET['template']);} // Definir plantillas temporales /* Publicar si el sitio es accedido seguramente o no */ /* Contenido de Meta Etiquetas */ $MigasDePanPGE = ""; /* Crear la variable que guarda las migas de pan para el usuario */ $metaTagsPGE = array("descripcion"=>"","keywords"=>""); /* Crear variable glrobal para los metatags del sitio*/ $metaTagsPGE['CanonicalUrlPGE'] = ""; $metaTagsPGE['AuthorPGE'] = 'PageGear by Exusmultimedia [www.exus.com.co]'; $PGE_OG_DATA = NULL; $PGE_MOD_TEMPLATES = array(); $PGE_BROWSER_CACHE = true; // Configuracion especifica para este dominio require('indexcfg_domains.php'); // Abrir las conexiones a la base de datos. $__PGECONECTOR = mysqli_connect(__servidor,__usuariodb,__clavedb,__basededatos); $__PGECONECTOR_READ = mysqli_connect(__servidor_read,__usuariodb,__clavedb,__basededatos); // Importar configuracion del sistema global require('indexcfg.php'); // Monitoreo de Accesos al Cloud if(yainiciesesion_basic()){ send2log(); }else{ // add2stats(); } /** * Evitar el acceso a los contenidos cuando se vence el hosting. */ $suspendido = (new ConectorPageGearCloud())->getCampoSqlQueryCache("SELECT suspendido FROM pagegears WHERE idn=".__IDPGE,300); if($suspendido==1){ require("suspendido.php"); }else{ IniciarPageGear(); } /* Strings para los headers del cache */ if($PGE_BROWSER_CACHE && !isset($_GET['administrando']) && !(isset($_GET['acc']) && $_GET['acc']=="login") && !(isset($_GET['acc']) && $_GET['acc']=="pagos") ){ header("Content-type: text/html"); header("Pragma: cache"); header("Cache-Control: max-age=3600" ); header("Expires: ".gmdate("D, d M Y H:i:s", time()+600)); }else{ header("Pragma: no-cache"); header("Cache-Control: no-cache" ); } $salida = ob_get_contents(); if(function_exists("procesarBuffer_callback")){ $salida = procesarBuffer_callback($salida); } $salida = procesarBufferDeSalidaPGE($salida); /* Cerrar las conexiones a la DB */ @mysqli_close($__PGECONECTOR); @mysqli_close($__PGECONECTOR_READ); ob_end_clean(); /* Guardar contenido pre-procesado en cache */ (new PageGearCloudContentCache)->guardarCache($salida); ob_start(); echo utf8Encode($salida); ob_flush();