Configuracio(); $Id_Usuari_Actual = ""; $Id_Client_Actual = ""; $Tipus_Usuari = ""; $Esta_Identificat = ($Sessions->Current_Session()) ? 1 : 0; if($Esta_Identificat){ $Id_Usuari_Actual = $Sessions->Session_Info($Sessions->Current_Session(),"Id_Usuari"); $Tipus_Usuari=$Sessions->Tipus_Usuari($Sessions->Current_Session()); if($Tipus_Usuari == "usuari"){ $sql_query="SELECT * FROM Clients WHERE Id_Usuari = ".$Id_Usuari_Actual; $Info=$Funcions->queryToArray($sql_query); if($Info[0]['Id_Client']){ $Id_Client_Actual=$Info[0]['Id_Client']; } } } $idioma_actual=$Funcions->queryToArray("SELECT Id_Idioma FROM Idiomes WHERE Codi='".$_GET['idioma']."'"); $Id_Idioma_Actual=$idioma_actual[0]['Id_Idioma']; $Idiomes=$Funcions->queryToArray("SELECT * FROM Idiomes WHERE Estat = 1 ORDER BY Ordre ASC"); $sql_query="SELECT * FROM Categories as c LEFT JOIN Categories_Traduccio AS ct ON c.Id_Categoria = ct.Id_Categoria AND ct.Id_Idioma_Traduccio = ".$Id_Idioma_Actual." WHERE c.Estat = 1 ORDER BY Ordre ASC"; $Categories=$Funcions->queryToArray($sql_query); $sql_query="SELECT * FROM Tipus_Activitats as ta LEFT JOIN Tipus_Activitats_Traduccio AS tat ON ta.Id_Tipus_Activitat = tat.Id_Tipus_Activitat AND tat.Id_Idioma_Traduccio = ".$Id_Idioma_Actual." LEFT JOIN Categories AS c ON ta.Id_Categoria = c.Id_Categoria WHERE c.Estat = 1 ORDER BY Nom ASC"; $Tipus_Activitats=$Funcions->queryToArray($sql_query); $sql_query="SELECT ta.*,tat.*,ct.Url_Amigable AS Url_Amigable_Categoria,info_preu.Preu_Final FROM Activitats_Tipus AS at LEFT JOIN Activitats AS info ON info.Id_Activitat = at.Id_Activitat LEFT JOIN Activitats_Preus AS info_preu ON info_preu.Id_Activitat = at.Id_Activitat LEFT JOIN Tipus_Activitats AS ta ON ta.Id_Tipus_Activitat = at.Id_Tipus_Activitat LEFT JOIN Tipus_Activitats_Traduccio AS tat ON ta.Id_Tipus_Activitat = tat.Id_Tipus_Activitat AND tat.Id_Idioma_Traduccio = ".$Id_Idioma_Actual." LEFT JOIN Categories_Traduccio AS ct ON ta.Id_Categoria = ct.Id_Categoria AND tat.Id_Idioma_Traduccio = ".$Id_Idioma_Actual." WHERE info_preu.Preu_Final > 0 AND info_preu.No_Preu_Minim = 0 AND info.Estat = 1 GROUP BY at.Id_Tipus_Activitat ORDER BY RAND() LIMIT 5"; $Tipus_Activitat_Te_Puede_Interesar=$Funcions->queryToArray($sql_query); if($Tipus_Activitat_Te_Puede_Interesar[0]['Id_Tipus_Activitat']){ for($i=0;$iqueryToArray($sql_query); $Tipus_Activitat_Te_Puede_Interesar[$i]['Total']=$Info[0]['Contador']; $Tipus_Activitat_Te_Puede_Interesar[$i]['Foto']=$Funcions->fotoTipusActivitat($Tipus_Activitat_Te_Puede_Interesar[$i]['Id_Tipus_Activitat']); } } /* CAIXA BUSCADOR */ $Buscador = array( 'Id_Categoria' => '', 'Id_Tipus_Activitat' => '', 'Id_Provincia' => '', 'Id_Municipi' => '' ); $sql_query="SELECT categoria_tradu.* FROM Activitats_Tipus AS tipus LEFT JOIN Activitats AS activitat ON activitat.Id_Activitat = tipus.Id_Activitat LEFT JOIN Tipus_Activitats AS tipus_info ON tipus_info.Id_Tipus_Activitat = tipus.Id_Tipus_Activitat LEFT JOIN Categories AS categoria_info ON categoria_info.Id_Categoria = tipus_info.Id_Categoria LEFT JOIN Categories_Traduccio AS categoria_tradu ON categoria_info.Id_Categoria = categoria_tradu.Id_Categoria AND categoria_tradu.Id_Idioma_Traduccio = ".$Id_Idioma_Actual." WHERE activitat.Estat = 1 AND categoria_info.Estat = 1 GROUP BY categoria_info.Id_Categoria ORDER BY categoria_info.Ordre ASC"; $Buscador_Categories=$Funcions->queryToArray($sql_query); /******************/ $parts=parse_url("https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']); if(isset($parts['query'])) parse_str($parts['query'], $vars); $landing=(!isset($_COOKIE['landing'])) ? 1 : 0; $google_event=""; $google_event_category=""; $google_event_action=""; $google_event_label=""; $google_event_value=""; $sql_query="SELECT p.* FROM Activitats AS a LEFT JOIN Municipis AS m ON a.Id_Municipi = m.Id_Municipi LEFT JOIN Provincies AS p ON p.Id_Provincia = m.Id_Provincia WHERE a.Estat = 1 GROUP BY m.Id_Provincia ORDER BY p.Provincia ASC"; $Provincies_Footer=$Funcions->queryToArray($sql_query); $variables_fixes=array("url_path","Provincies_Footer","google_event","google_event_category","google_event_action","google_event_label","google_event_value","Facebook_Pixel","landing","fotos_url","img_url","Tipus_Activitat_Te_Puede_Interesar","Buscador","Buscador_Tipus_Activitats","Buscador_Provincies","Buscador_Municipis","Buscador_Categories","Esta_Identificat","Tipus_Usuari","Aviso_Pagina_Desactivada","title","meta_description","meta_keywords","idioma","Idiomes","Config","Categories","Tipus_Activitats"); //$Buscador_Tipus_Activitats=""; //$Buscador_Provincies=""; $Buscador_Municipis=""; $sql_query="SELECT tipus_tradu.* FROM Activitats_Tipus AS tipus LEFT JOIN Activitats AS activitat ON activitat.Id_Activitat = tipus.Id_Activitat LEFT JOIN Tipus_Activitats AS tipus_info ON tipus_info.Id_Tipus_Activitat = tipus.Id_Tipus_Activitat LEFT JOIN Tipus_Activitats_Traduccio AS tipus_tradu ON tipus.Id_Tipus_Activitat = tipus_tradu.Id_Tipus_Activitat AND tipus_tradu.Id_Idioma_Traduccio = ".$Id_Idioma_Actual." WHERE activitat.Estat = 1 GROUP BY tipus.Id_Tipus_Activitat ORDER BY tipus_tradu.Nom ASC"; $Buscador_Tipus_Activitats=$Funcions->queryToArray($sql_query); $sql_query="SELECT provincia.* FROM Activitats_Tipus AS tipus LEFT JOIN Activitats AS activitat ON activitat.Id_Activitat = tipus.Id_Activitat LEFT JOIN Municipis AS municipi ON activitat.Id_Municipi = municipi.Id_Municipi LEFT JOIN Provincies AS provincia ON provincia.Id_Provincia = municipi.Id_Provincia WHERE activitat.Estat = 1 GROUP BY provincia.Id_Provincia ORDER BY provincia.Provincia ASC"; $Buscador_Provincies=$Funcions->queryToArray($sql_query); $Aviso_Pagina_Desactivada=0; #################### # PÀGINA PRINCIPAL # #################### if(!isset($_REQUEST['dos'])){ $sql_query="SELECT * FROM Provincies ORDER BY Provincia ASC"; $Provincies=$Funcions->queryToArray($sql_query); $variables_fixes[]="Provincies"; /* Llista de tipus activitats que no tenen foto $sql_query="SELECT * FROM Tipus_Activitats_Traduccio"; $Info=$Funcions->queryToArray($sql_query); for($i=0;$i"; } } */ $sql_query="SELECT info.*,tradu.*,m.Municipi,p.Provincia,proveidor.Nom AS Proveidor, tipus_tradu.Nom AS Tipus_Activitat,tipus_tradu.Url_Amigable AS Tipus_Activitat_Url_Amigable, categoria.Nom AS Categoria,categoria.Url_Amigable AS Categoria_Url_Amigable, MIN(info_preu.Preu_Final) AS Preu_Final,info_preu.Dies_Duracio,info_preu.Descompte,info_preu.Preu FROM Activitats AS info LEFT JOIN Activitats_Tipus AS tipus_activitat ON info.Id_Activitat = tipus_activitat.Id_Activitat LEFT JOIN Activitats_Traduccio AS tradu ON tradu.Id_Activitat = info.Id_Activitat AND tradu.Id_Idioma_Traduccio = ".$Id_Idioma_Actual." LEFT JOIN Tipus_Activitats AS tipus ON tipus.Id_Tipus_Activitat = tipus_activitat.Id_Tipus_Activitat LEFT JOIN Tipus_Activitats_Traduccio AS tipus_tradu ON tipus_tradu.Id_Tipus_Activitat = tipus_activitat.Id_Tipus_Activitat LEFT JOIN Categories_Traduccio AS categoria ON categoria.Id_Categoria = tipus.Id_Categoria LEFT JOIN Municipis AS m ON m.Id_Municipi = info.Id_Municipi LEFT JOIN Provincies AS p ON m.Id_Provincia = p.Id_Provincia LEFT JOIN Proveidors AS proveidor ON proveidor.Id_Proveidor = info.Id_Proveidor AND proveidor.Visible = 1 LEFT JOIN Activitats_Preus AS info_preu ON info_preu.Id_Activitat = info.Id_Activitat LEFT JOIN Activitats_Preus_Traduccio AS tradu_preu ON tradu_preu.Id_Preu = info_preu.Id_Preu AND tradu_preu.Id_Idioma_Traduccio = ".$Id_Idioma_Actual." WHERE info.Estat = 1 AND info_preu.No_Preu_Minim = 0 AND info.Destacada = 1 GROUP BY info.Id_Activitat ORDER BY RAND() LIMIT 4"; $Activitats=$Funcions->queryToArray($sql_query); if($Activitats[0]['Id_Activitat']){ for($i=0;$ifotoPrincipalActivitat($Activitats[$i]['Id_Activitat']); $Activitats[$i]['Total_Fotos'] = $Funcions->totalFotosActivitat($Activitats[$i]['Id_Activitat']); $Activitats[$i]['Total_Videos'] = $Funcions->totalVideosActivitat($Activitats[$i]['Id_Activitat']); $Activitats[$i]['Total_Opinions'] = $Funcions->totalOpinionsActivitat($Activitats[$i]['Id_Activitat']); $Activitats[$i]['Valoracio'] = $Funcions->valoracioActivitat($Activitats[$i]['Id_Activitat']); $Activitats[$i]['Valoracio_Nom'] = $Funcions->nomValoracio($Activitats[$i]['Valoracio']); $sql_query="SELECT * FROM Activitats_Fotos WHERE Id_Activitat = ".$Activitats[$i]['Id_Activitat']; $Activitats[$i]['Fotos'] = $Funcions->queryToArray($sql_query); } } $sql_query="SELECT at.*,tat.*,ct.Url_Amigable AS Url_Amigable_Categoria,info_preu.Preu_Final FROM Activitats_Tipus AS at LEFT JOIN Activitats AS info ON info.Id_Activitat = at.Id_Activitat LEFT JOIN Activitats_Preus AS info_preu ON info_preu.Id_Activitat = at.Id_Activitat LEFT JOIN Tipus_Activitats as ta ON ta.Id_Tipus_Activitat = at.Id_Tipus_Activitat LEFT JOIN Tipus_Activitats_Traduccio AS tat ON ta.Id_Tipus_Activitat = tat.Id_Tipus_Activitat AND tat.Id_Idioma_Traduccio = ".$Id_Idioma_Actual." LEFT JOIN Categories_Traduccio AS ct ON ta.Id_Categoria = ct.Id_Categoria AND tat.Id_Idioma_Traduccio = ".$Id_Idioma_Actual." WHERE info_preu.Preu_Final > 0 AND info_preu.No_Preu_Minim = 0 AND info.Estat = 1 GROUP BY at.Id_Tipus_Activitat ORDER BY RAND() ASC LIMIT 12"; $Categoria_Tipus_Activitats=$Funcions->queryToArray($sql_query); if($Categoria_Tipus_Activitats[0]['Id_Tipus_Activitat']){ for($i=0;$iqueryToArray($sql_query); if($Preus[0]['Id_Preu']){ $Categoria_Tipus_Activitats[$i]['Preu_Final'] = $Preus[0]['Preu_Final']; }else{ $Categoria_Tipus_Activitats[$i]['Preu_Final'] = "0"; } } } $Num_x_columna = round(count($Categoria_Tipus_Activitats)/4,0,PHP_ROUND_HALF_UP); $col=1; $n=0; $sql_where_tipus=""; for($i=0;$iqueryToArray($sql_query); for($i=0;$itemplate_dir = WEB_PATH."templates/web/"; for($i=0;$iassign($variables_fixes[$i],$$variables_fixes[$i]); } $smarty->assign("Traduccio",$Traduccio[$idioma]); $smarty->assign("Slider",$Slider); $smarty->assign("Entrades_Blog",$Entrades_Blog); $smarty->assign("Activitats",$Activitats); $smarty->assign("Categoria_Tipus_Activitats",$Categoria_Tipus_Activitats); $web_content = $smarty->fetch("templates/web/index.htm"); echo $web_content; exit; } //Categories $mostra_categoria=0; $mostra_tipus_activitat=0; if(isset($_REQUEST['dos'])){ $Busca_Categoria=$_REQUEST['dos']; $sql_query="SELECT * FROM Categories AS info LEFT JOIN Categories_Traduccio AS tradu ON tradu.Id_Categoria = info.Id_Categoria WHERE tradu.Id_Idioma_Traduccio = ".$Id_Idioma_Actual." AND tradu.Url_Amigable = '".$Busca_Categoria."' AND info.Estat = 1"; $Categoria=$Funcions->queryToArray($sql_query); if(isset($Categoria[0]['Id_Categoria']) && !isset($_REQUEST['tres'])){ $mostra_categoria=1; } } if(isset($_REQUEST['tres']) && isset($Categoria[0]['Id_Categoria'])){ $Busca_Tipo_Activitat=$_REQUEST['tres']; $sql_query="SELECT * FROM Tipus_Activitats AS info LEFT JOIN Tipus_Activitats_Traduccio AS tradu ON tradu.Id_Tipus_Activitat = info.Id_Tipus_Activitat WHERE tradu.Id_Idioma_Traduccio = ".$Id_Idioma_Actual." AND tradu.Url_Amigable = '".$Busca_Tipo_Activitat."' AND info.Id_Categoria = ".$Categoria[0]['Id_Categoria']; $Tipus_Activitat=$Funcions->queryToArray($sql_query); if(isset($Tipus_Activitat[0]['Id_Categoria']) && ( !isset($_REQUEST['quatre']) || is_numeric($_REQUEST['quatre']))){ $mostra_tipus_activitat=1; } } $Id_Provincia_Llista=0; if(isset($_REQUEST['quatre']) && substr($_REQUEST['quatre'],-4)!=".php" && isset($Categoria[0]['Id_Categoria']) && isset($Tipus_Activitat[0]['Id_Categoria'])){ $Provincia_Rewrite = $_REQUEST['quatre']; $sql_query="SELECT * FROM Provincies WHERE Url_Amigable = '".$Provincia_Rewrite."'"; $Provincia=$Funcions->queryToArray($sql_query); if($Provincia[0]['Id_Provincia']){ $Id_Provincia_Llista=$Provincia[0]['Id_Provincia']; $variables_fixes[] = "Provincia"; $mostra_tipus_activitat=1; unset($_REQUEST['quatre']); } } if(isset($_REQUEST['quatre']) && substr($_REQUEST['quatre'],-4)==".php" && isset($Categoria[0]['Id_Categoria']) && isset($Tipus_Activitat[0]['Id_Categoria'])){ $Busca_Activitat=substr($_REQUEST['quatre'],0,-4); $sql_estat=""; if(!$Esta_Identificat){ $sql_estat = " AND Estat = 1"; } $sql_query="SELECT * FROM Activitats AS info LEFT JOIN Activitats_Traduccio AS tradu ON tradu.Id_Activitat = info.Id_Activitat LEFT JOIN Activitats_Tipus AS tipus_activitat ON info.Id_Activitat = tipus_activitat.Id_Activitat WHERE tradu.Id_Idioma_Traduccio = ".$Id_Idioma_Actual." AND tradu.Url_Amigable = '".$Busca_Activitat."' AND tipus_activitat.Id_Tipus_Activitat = ".$Tipus_Activitat[0]['Id_Tipus_Activitat']. $sql_estat; $Activitat=$Funcions->queryToArray($sql_query); if(isset($Activitat[0]['Id_Activitat']) && !isset($_REQUEST['cinc'])){ $mostra_activitat=1; } } //Mostra categoria if(isset($Categoria[0]['Id_Categoria']) && $mostra_categoria){ $title = $Categoria[0]['Nom']; $meta_description = ""; $meta_keywords = ""; $variables_fixes[]="Provincies"; $variables_fixes[]="Num_x_columna"; $sql_query="SELECT * FROM Provincies ORDER BY Provincia ASC"; $Provincies=$Funcions->queryToArray($sql_query); $sql_query="SELECT ta.*,tat.* FROM Activitats_Tipus AS at LEFT JOIN Activitats AS a ON a.Id_Activitat = at.Id_Activitat LEFT JOIN Tipus_Activitats as ta ON ta.Id_Tipus_Activitat = at.Id_Tipus_Activitat LEFT JOIN Tipus_Activitats_Traduccio AS tat ON ta.Id_Tipus_Activitat = tat.Id_Tipus_Activitat AND tat.Id_Idioma_Traduccio = ".$Id_Idioma_Actual." WHERE ta.Id_Categoria = ".$Categoria[0]['Id_Categoria']." AND a.Estat = 1 GROUP BY at.Id_Tipus_Activitat ORDER BY Nom ASC"; $Categoria_Tipus_Activitats=$Funcions->queryToArray($sql_query); if($Categoria_Tipus_Activitats[0]['Id_Tipus_Activitat']){ for($i=0;$iqueryToArray($sql_query); if($Preus[0]['Id_Preu']){ $Categoria_Tipus_Activitats[$i]['Preu_Final'] = $Preus[0]['Preu_Final']; $sql_query="SELECT p.* FROM Activitats_Tipus AS ta LEFT JOIN Activitats AS a ON a.Id_Activitat = ta.Id_Activitat LEFT JOIN Municipis AS m ON a.Id_Municipi = m.Id_Municipi LEFT JOIN Provincies AS p ON p.Id_Provincia = m.Id_Provincia WHERE a.Estat = 1 AND ta.Id_Tipus_Activitat = ".$Categoria_Tipus_Activitats[$i]['Id_Tipus_Activitat']." GROUP BY m.Id_Provincia ORDER BY p.Provincia ASC"; $Categoria_Tipus_Activitats[$i]['Provincies']=$Funcions->queryToArray($sql_query); }else{ $Categoria_Tipus_Activitats[$i]['Preu_Final'] = "0"; } $Categoria_Tipus_Activitats[$i]['Foto']=$Funcions->fotoTipusActivitat($Categoria_Tipus_Activitats[$i]['Id_Tipus_Activitat']); } } $Num_x_columna = round(count($Categoria_Tipus_Activitats)/3,0,PHP_ROUND_HALF_UP); $col=1; $n=0; $sql_where_tipus=""; $meta_keywords=strtolower($Categoria[0]['Nom']); for($i=0;$iqueryToArray($sql_query); $Categoria_Tipus_Activitats[$i]['Total']=$Info[0]['Contador']; } $meta_keywords=str_replace(" / ",",",$meta_keywords); $Categoria[0]['Destacat_1'] = $Config['Destacat_'.$Categoria[0]['Id_Categoria'].'_1']; $Categoria[0]['Destacat_2'] = $Config['Destacat_'.$Categoria[0]['Id_Categoria'].'_2']; $Categoria[0]['Destacat_3'] = $Config['Destacat_'.$Categoria[0]['Id_Categoria'].'_3']; $sql_query="SELECT * FROM Tipus_Activitats as ta LEFT JOIN Tipus_Activitats_Traduccio AS tat ON ta.Id_Tipus_Activitat = tat.Id_Tipus_Activitat AND tat.Id_Idioma_Traduccio = ".$Id_Idioma_Actual." WHERE ta.Id_Categoria = ".$Categoria[0]['Id_Categoria']." ORDER BY Nom ASC"; $Categories_Destacades=$Funcions->queryToArray($sql_query); if($Categories_Destacades[0]['Id_Tipus_Activitat']){ for($i=0;$iqueryToArray($sql_query); if($Preus[0]['Id_Preu']){ $Categories_Destacades[$i]['Preu_Final'] = $Preus[0]['Preu_Final']; }else{ $Categories_Destacades[$i]['Preu_Final'] = "0"; } $Categories_Destacades[$i]['Foto']=$Funcions->fotoTipusActivitat($Categories_Destacades[$i]['Id_Tipus_Activitat']); $sql_query="SELECT COUNT(*) AS Contador FROM Activitats_Tipus AS info LEFT JOIN Activitats AS activitat ON info.Id_Activitat = activitat.Id_Activitat WHERE info.Id_Tipus_Activitat = ".$Categories_Destacades[$i]['Id_Tipus_Activitat']." AND activitat.Estat = 1 "; $Info=$Funcions->queryToArray($sql_query); $Categories_Destacades[$i]['Total']=$Info[0]['Contador']; } } $sql_query="SELECT info.Coordenades,tradu.*,tipus_tradu.Url_Amigable AS Tipus_Activitat_Url_Amigable FROM Activitats AS info LEFT JOIN Activitats_Tipus AS tipus_activitat ON info.Id_Activitat = tipus_activitat.Id_Activitat LEFT JOIN Activitats_Traduccio AS tradu ON tradu.Id_Activitat = info.Id_Activitat AND tradu.Id_Idioma_Traduccio = ".$Id_Idioma_Actual." LEFT JOIN Tipus_Activitats_Traduccio AS tipus_tradu ON tipus_tradu.Id_Tipus_Activitat = tipus_activitat.Id_Tipus_Activitat AND tipus_tradu.Id_Idioma_Traduccio = ".$Id_Idioma_Actual." WHERE info.Estat = 1 AND ($sql_where_tipus)"; $Punts=$Funcions->queryToArray($sql_query); $sql_query="SELECT info.*,tradu.*,m.Municipi,p.Provincia,proveidor.Nom AS Proveidor, tipus_tradu.Nom AS Tipus_Activitat,tipus_tradu.Url_Amigable AS Tipus_Activitat_Url_Amigable, categoria.Nom AS Categoria,categoria.Url_Amigable AS Categoria_Url_Amigable FROM Activitats AS info LEFT JOIN Activitats_Tipus AS tipus_activitat ON info.Id_Activitat = tipus_activitat.Id_Activitat LEFT JOIN Activitats_Traduccio AS tradu ON tradu.Id_Activitat = info.Id_Activitat AND tradu.Id_Idioma_Traduccio = ".$Id_Idioma_Actual." LEFT JOIN Tipus_Activitats AS tipus ON tipus.Id_Tipus_Activitat = tipus_activitat.Id_Tipus_Activitat LEFT JOIN Tipus_Activitats_Traduccio AS tipus_tradu ON tipus_tradu.Id_Tipus_Activitat = tipus_activitat.Id_Tipus_Activitat LEFT JOIN Categories_Traduccio AS categoria ON categoria.Id_Categoria = tipus.Id_Categoria LEFT JOIN Municipis AS m ON m.Id_Municipi = info.Id_Municipi LEFT JOIN Provincies AS p ON m.Id_Provincia = p.Id_Provincia LEFT JOIN Proveidors AS proveidor ON proveidor.Id_Proveidor = info.Id_Proveidor AND proveidor.Visible = 1 WHERE info.Estat = 1 AND ($sql_where_tipus) GROUP BY info.Id_Activitat ORDER BY info.Comissio DESC LIMIT 5 "; $Activitats_Destacades=$Funcions->queryToArray($sql_query); if($Activitats_Destacades[0]['Id_Activitat']){ for($i=0;$ifotoPrincipalActivitat($Activitats_Destacades[$i]['Id_Activitat']); $Activitats_Destacades[$i]['Total_Fotos'] = $Funcions->totalFotosActivitat($Activitats_Destacades[$i]['Id_Activitat']); $Activitats_Destacades[$i]['Total_Videos'] = $Funcions->totalVideosActivitat($Activitats_Destacades[$i]['Id_Activitat']); $Activitats_Destacades[$i]['Total_Opinions'] = $Funcions->totalOpinionsActivitat($Activitats_Destacades[$i]['Id_Activitat']); $Activitats_Destacades[$i]['Valoracio'] = $Funcions->valoracioActivitat($Activitats_Destacades[$i]['Id_Activitat']); $Activitats_Destacades[$i]['Valoracio_Nom'] = $Funcions->nomValoracio($Activitats_Destacades[$i]['Valoracio']); $sql_query="SELECT * FROM Activitats_Fotos WHERE Id_Activitat = ".$Activitats_Destacades[$i]['Id_Activitat']; $Activitats_Destacades[$i]['Fotos'] = $Funcions->queryToArray($sql_query); $Activitats_Destacades[$i]['Preu'] = ""; $Activitats_Destacades[$i]['Preu_Final'] = "0"; $Activitats_Destacades[$i]['Descompte'] = ""; $Activitats_Destacades[$i]['Preus'] = ""; $sql_query="SELECT * FROM Activitats_Preus AS info LEFT JOIN Activitats_Preus_Traduccio AS tradu ON tradu.Id_Preu = info.Id_Preu AND tradu.Id_Idioma_Traduccio = ".$Id_Idioma_Actual." WHERE Id_Activitat = ".$Activitats_Destacades[$i]['Id_Activitat']." AND info.No_Preu_Minim = 0 ORDER BY Preu_Final ASC"; $Preus = $Funcions->queryToArray($sql_query); if($Preus[0]['Id_Preu']){ $Activitats_Destacades[$i]['Preu'] = $Preus[0]['Preu']; $Activitats_Destacades[$i]['Preu_Final'] = $Preus[0]['Preu_Final']; $Activitats_Destacades[$i]['Descompte'] = $Preus[0]['Descompte']; $Activitats_Destacades[$i]['Preus'] = $Preus; } } } $google_event="1"; $google_event_category="Categoria"; $google_event_action="Visita"; $google_event_label=""; $google_event_value=""; $smarty = new Smarty; $smarty->template_dir = WEB_PATH."templates/web/"; for($i=0;$iassign($variables_fixes[$i],$$variables_fixes[$i]); } $smarty->assign("Traduccio",$Traduccio[$idioma]); $smarty->assign("Categoria",$Categoria[0]); $smarty->assign("Categoria_Tipus_Activitats",$Categoria_Tipus_Activitats); $smarty->assign("Categories_Destacades",$Categories_Destacades); $smarty->assign("Punts",$Punts); $smarty->assign("Activitats_Destacades",$Activitats_Destacades); $web_content = $smarty->fetch("templates/web/categoria.htm"); echo $web_content; exit; } //Mostra tipus activitat if(isset($Tipus_Activitat[0]['Id_Categoria']) && $mostra_tipus_activitat){ $sql_where_provincia=""; if($Id_Provincia_Llista){ $sql_where_provincia=" AND m.Id_Provincia = ".$Id_Provincia_Llista; } $sql_query="SELECT * FROM Provincies ORDER BY Provincia ASC"; $Provincies=$Funcions->queryToArray($sql_query); $variables_fixes[]="Provincies"; $sql_query="SELECT * FROM Tipus_Activitats as ta LEFT JOIN Tipus_Activitats_Traduccio AS tat ON ta.Id_Tipus_Activitat = tat.Id_Tipus_Activitat AND tat.Id_Idioma_Traduccio = ".$Id_Idioma_Actual." WHERE ta.Id_Categoria = ".$Categoria[0]['Id_Categoria']." ORDER BY Nom ASC"; $Categoria_Tipus_Activitats=$Funcions->queryToArray($sql_query); /*** filtres ***/ $parts=parse_url("https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']); if(isset($parts['query'])) parse_str($parts['query'], $_REQUEST); $filtrar_provincia=""; $filtrar_poblacion=""; $filtrar_orden=""; $sql_filtro=""; $sql_filtro_municipio=""; if(isset($_REQUEST['o'])){ switch ($_REQUEST['o']) { case "e1": $sql_order="info.Destacada DESC, Preu_Final ASC"; break; case "e2": $sql_order="info.Destacada DESC, Preu_Final DESC"; break; case "pr": $sql_order="info.Destacada DESC, p.Provincia ASC"; break; case "po": $sql_order="info.Destacada DESC, m.Municipi ASC"; break; default: $sql_order="info.Destacada DESC, info.Comissio DESC, info.Id_Activitat ASC"; } $filtrar_orden=$_REQUEST['o']; }else{ $sql_order="info.Destacada DESC, Preu_Final ASC"; $filtrar_orden="e1"; } if(isset($_REQUEST['pr']) && is_numeric($_REQUEST['pr']) && $_REQUEST['pr'] > 0){ $sql_filtro.=" AND m.Id_Provincia = ".$_REQUEST['pr']; $filtrar_provincia=$_REQUEST['pr']; $sql_filtro_municipio= "AND m.Id_Provincia = ".$_REQUEST['pr']; } if(isset($_REQUEST['po']) && is_numeric($_REQUEST['po']) && $_REQUEST['po'] > 0){ $sql_query="SELECT * FROM Municipis WHERE Id_Municipi = ".$_REQUEST['po']." AND Id_Provincia = ".$_REQUEST['pr']; $Info=$Funcions->queryToArray($sql_query); if($Info[0]['Id_Municipi']){ $sql_filtro.=" AND info.Id_Municipi = ".$_REQUEST['po']; $filtrar_poblacion=$_REQUEST['po']; } } /***** fi filtres *****/ $sql_query="SELECT p.* FROM Activitats_Tipus AS t LEFT JOIN Activitats AS a ON t.Id_Activitat = a.Id_Activitat LEFT JOIN Municipis AS m ON a.Id_Municipi = m.Id_Municipi LEFT JOIN Provincies AS p ON p.Id_Provincia = m.Id_Provincia WHERE a.Id_Municipi > 0 AND a.Estat = 1 AND t.Id_Tipus_Activitat = ".$Tipus_Activitat[0]['Id_Tipus_Activitat']." ".$sql_where_provincia." GROUP BY p.Provincia ORDER BY p.Provincia ASC"; $Activitats_Provincies=$Funcions->queryToArray($sql_query); $sql_query="SELECT m.* FROM Activitats_Tipus AS t LEFT JOIN Activitats AS a ON t.Id_Activitat = a.Id_Activitat LEFT JOIN Municipis AS m ON a.Id_Municipi = m.Id_Municipi WHERE a.Id_Municipi > 0 AND a.Estat = 1 AND t.Id_Tipus_Activitat = ".$Tipus_Activitat[0]['Id_Tipus_Activitat']." ".$sql_filtro_municipio." ".$sql_where_provincia." GROUP BY m.Municipi ORDER BY m.Municipi ASC"; $Activitats_Municipis=$Funcions->queryToArray($sql_query); $sql_query_llista="SELECT info.*,tradu.*,m.Municipi,p.Provincia,proveidor.Nom AS Proveidor, tipus_tradu.Nom AS Tipus_Activitat,tipus_tradu.Url_Amigable AS Tipus_Activitat_Url_Amigable, categoria.Nom AS Categoria,categoria.Url_Amigable AS Categoria_Url_Amigable, MIN(info_preu.Preu_Final) AS Preu_Final,info_preu.Descompte,info_preu.Preu FROM Activitats AS info LEFT JOIN Activitats_Tipus AS tipus_activitat ON info.Id_Activitat = tipus_activitat.Id_Activitat LEFT JOIN Activitats_Traduccio AS tradu ON tradu.Id_Activitat = info.Id_Activitat AND tradu.Id_Idioma_Traduccio = ".$Id_Idioma_Actual." LEFT JOIN Tipus_Activitats AS tipus ON tipus.Id_Tipus_Activitat = tipus_activitat.Id_Tipus_Activitat LEFT JOIN Tipus_Activitats_Traduccio AS tipus_tradu ON tipus_tradu.Id_Tipus_Activitat = tipus_activitat.Id_Tipus_Activitat LEFT JOIN Categories_Traduccio AS categoria ON categoria.Id_Categoria = tipus.Id_Categoria LEFT JOIN Municipis AS m ON m.Id_Municipi = info.Id_Municipi LEFT JOIN Provincies AS p ON m.Id_Provincia = p.Id_Provincia LEFT JOIN Proveidors AS proveidor ON proveidor.Id_Proveidor = info.Id_Proveidor AND proveidor.Visible = 1 LEFT JOIN Activitats_Preus AS info_preu ON info_preu.Id_Activitat = info.Id_Activitat LEFT JOIN Activitats_Preus_Traduccio AS tradu_preu ON tradu_preu.Id_Preu = info_preu.Id_Preu AND tradu_preu.Id_Idioma_Traduccio = ".$Id_Idioma_Actual." WHERE tipus_activitat.Id_Tipus_Activitat = ".$Tipus_Activitat[0]['Id_Tipus_Activitat']." AND info_preu.No_Preu_Minim = 0 AND info.Estat = 1 ".$sql_where_provincia." GROUP BY info_preu.Id_Activitat"; $ListaCompleta_Sense_Filtres=$Funcions->queryToArray($sql_query_llista); $Total_Sense_Filtres=count($ListaCompleta_Sense_Filtres); if(!$ListaCompleta_Sense_Filtres[0]['Id_Activitat']){ $Total_Sense_Filtres=0; } $Tipus_Activitat[0]['Total_Sense_Filtres']=$Total_Sense_Filtres; /*paginacio*/ $pagina_actual=(isset($_GET['quatre']) && is_numeric($_GET['quatre'])) ? $_GET['quatre'] : 1; $sql_query_llista="SELECT info.*,tradu.*,m.Municipi,p.Provincia,proveidor.Nom AS Proveidor, tipus_tradu.Nom AS Tipus_Activitat,tipus_tradu.Url_Amigable AS Tipus_Activitat_Url_Amigable, categoria.Nom AS Categoria,categoria.Url_Amigable AS Categoria_Url_Amigable, MIN(info_preu.Preu_Final) AS Preu_Final,info_preu.Descompte,info_preu.Preu FROM Activitats AS info LEFT JOIN Activitats_Tipus AS tipus_activitat ON info.Id_Activitat = tipus_activitat.Id_Activitat LEFT JOIN Activitats_Traduccio AS tradu ON tradu.Id_Activitat = info.Id_Activitat AND tradu.Id_Idioma_Traduccio = ".$Id_Idioma_Actual." LEFT JOIN Tipus_Activitats AS tipus ON tipus.Id_Tipus_Activitat = tipus_activitat.Id_Tipus_Activitat LEFT JOIN Tipus_Activitats_Traduccio AS tipus_tradu ON tipus_tradu.Id_Tipus_Activitat = tipus_activitat.Id_Tipus_Activitat LEFT JOIN Categories_Traduccio AS categoria ON categoria.Id_Categoria = tipus.Id_Categoria LEFT JOIN Municipis AS m ON m.Id_Municipi = info.Id_Municipi LEFT JOIN Provincies AS p ON m.Id_Provincia = p.Id_Provincia LEFT JOIN Proveidors AS proveidor ON proveidor.Id_Proveidor = info.Id_Proveidor AND proveidor.Visible = 1 LEFT JOIN Activitats_Preus AS info_preu ON info_preu.Id_Activitat = info.Id_Activitat LEFT JOIN Activitats_Preus_Traduccio AS tradu_preu ON tradu_preu.Id_Preu = info_preu.Id_Preu AND tradu_preu.Id_Idioma_Traduccio = ".$Id_Idioma_Actual." WHERE tipus_activitat.Id_Tipus_Activitat = ".$Tipus_Activitat[0]['Id_Tipus_Activitat']." AND info_preu.No_Preu_Minim = 0 AND info.Estat = 1 ".$sql_filtro." ".$sql_where_provincia." GROUP BY info_preu.Id_Activitat ORDER BY ".$sql_order; $ListaCompleta=$Funcions->queryToArray($sql_query_llista); $total_registres=count($ListaCompleta); if(!$ListaCompleta[0]['Id_Activitat']){ $total_registres=0; } if($Id_Provincia_Llista && $total_registres == "0"){ $Funcions->mostraPagina404($Id_Idioma_Actual); exit; } $Tipus_Activitat[0]['Total']=$total_registres; $num_x_pagina=15; $pagina_seguent=0; $pagina_anterior=0; $total_pagines=($total_registres%$num_x_pagina == 0) ? $total_registres/$num_x_pagina : intval($total_registres/$num_x_pagina)+1; if($total_pagines>1 && $pagina_actual > $total_pagines){ $Funcions->mostraPagina404($Id_Idioma_Actual); exit; } if($pagina_actual>1){ $pagina_anterior=$pagina_actual-1; } if($pagina_actual < $total_pagines){ $pagina_seguent=$pagina_actual+1; } $resultat_inici=($pagina_actual-1)*$num_x_pagina+1; /*****************/ $sql_query=$sql_query_llista." LIMIT ".($pagina_actual-1)*$num_x_pagina.",$num_x_pagina"; $Activitats=$Funcions->queryToArray($sql_query); $resultat_final=$resultat_inici+count($Activitats)-1; $resultat_mostrant=count($Activitats); if($Activitats[0]['Id_Activitat']){ for($i=0;$ifotoPrincipalActivitat($Activitats[$i]['Id_Activitat']); $Activitats[$i]['Total_Fotos'] = $Funcions->totalFotosActivitat($Activitats[$i]['Id_Activitat']); $Activitats[$i]['Total_Videos'] = $Funcions->totalVideosActivitat($Activitats[$i]['Id_Activitat']); $Activitats[$i]['Total_Opinions'] = $Funcions->totalOpinionsActivitat($Activitats[$i]['Id_Activitat']); $Activitats[$i]['Valoracio'] = $Funcions->valoracioActivitat($Activitats[$i]['Id_Activitat']); $Activitats[$i]['Valoracio_Nom'] = $Funcions->nomValoracio($Activitats[$i]['Valoracio']); $Activitats[$i]['Preu'] = ""; $Activitats[$i]['Preu_Final'] = "0"; $Activitats[$i]['Descompte'] = ""; $Activitats[$i]['Preus'] = ""; $sql_query="SELECT * FROM Activitats_Preus AS info LEFT JOIN Activitats_Preus_Traduccio AS tradu ON tradu.Id_Preu = info.Id_Preu AND tradu.Id_Idioma_Traduccio = ".$Id_Idioma_Actual." WHERE Id_Activitat = ".$Activitats[$i]['Id_Activitat']." AND info.No_Preu_Minim = 0 ORDER BY Preu_Final ASC"; $Preus = $Funcions->queryToArray($sql_query); if($Preus[0]['Id_Preu']){ $Activitats[$i]['Preu'] = $Preus[0]['Preu']; $Activitats[$i]['Preu_Final'] = $Preus[0]['Preu_Final']; $Activitats[$i]['Descompte'] = $Preus[0]['Descompte']; $Activitats[$i]['Preus'] = $Preus; } $sql_query="SELECT * FROM Activitats_Fotos WHERE Id_Activitat = ".$Activitats[$i]['Id_Activitat']; $Activitats[$i]['Fotos'] = $Funcions->queryToArray($sql_query); } } $google_event="1"; $google_event_category="Tipus_Activitat"; $google_event_action="Visita"; $google_event_label=""; $google_event_value=""; $title = $Tipus_Activitat[0]['Nom']." - ".$Categoria[0]['Nom']; $meta_description = $Tipus_Activitat[0]['Descripcio']; $meta_keywords = ""; if($Id_Provincia_Llista){ $title = $Tipus_Activitat[0]['Nom']." ".$Provincia[0]['Provincia']; } $img_facebook="fotos/actividades/c/".$Tipus_Activitat[0]['Url_Amigable'].".jpg"; $variables_fixes[]="img_facebook"; $smarty = new Smarty; $smarty->template_dir = WEB_PATH."templates/web/"; for($i=0;$iassign($variables_fixes[$i],$$variables_fixes[$i]); } $smarty->assign("Traduccio",$Traduccio[$idioma]); $smarty->assign("Tipus_Activitat",$Tipus_Activitat[0]); $smarty->assign("Categoria",$Categoria[0]); $smarty->assign("Categoria_Tipus_Activitats",$Categoria_Tipus_Activitats); $smarty->assign("Activitats",$Activitats); $smarty->assign("pagina_actual",$pagina_actual); $smarty->assign("total_pagines",$total_pagines); $smarty->assign("pagina_anterior",$pagina_anterior); $smarty->assign("pagina_seguent",$pagina_seguent); $smarty->assign("resultat_inici",$resultat_inici); $smarty->assign("resultat_final",$resultat_final); $smarty->assign("resultat_mostrant",$resultat_mostrant); $smarty->assign("resultat_mostrant",$resultat_mostrant); $smarty->assign("Total_Resultats",$total_registres); $smarty->assign("Activitats_Provincies",$Activitats_Provincies); $smarty->assign("Activitats_Municipis",$Activitats_Municipis); $smarty->assign("filtrar_provincia",$filtrar_provincia); $smarty->assign("filtrar_poblacion",$filtrar_poblacion); $smarty->assign("filtrar_orden",$filtrar_orden); $web_content = $smarty->fetch("templates/web/tipus_activitat.htm"); echo $web_content; exit; } //Mostra activitat if(isset($Activitat[0]['Id_Activitat']) && $mostra_activitat){ if($Activitat[0]['Estat'] == 0){ $Aviso_Pagina_Desactivada=1; } if(isset($Activitat[0]['Id_Municipi'])){ $sql_query="SELECT * FROM Municipis WHERE Id_Municipi = ".$Activitat[0]['Id_Municipi']; $Municipi=$Funcions->queryToArray($sql_query); } if(isset($Municipi[0]['Id_Provincia'])){ $sql_query="SELECT * FROM Provincies WHERE Id_Provincia = ".$Municipi[0]['Id_Provincia']; $Provincia=$Funcions->queryToArray($sql_query); } $Activitat[0]['Foto'] = $Funcions->fotoPrincipalActivitat($Activitat[0]['Id_Activitat']); $Activitat[0]['Total_Fotos'] = $Funcions->totalFotosActivitat($Activitat[0]['Id_Activitat']); $Activitat[0]['Total_Videos'] = $Funcions->totalVideosActivitat($Activitat[0]['Id_Activitat']); $Activitat[0]['Total_Opinions'] = $Funcions->totalOpinionsActivitat($Activitat[0]['Id_Activitat']); $Activitat[0]['Valoracio'] = $Funcions->valoracioActivitat($Activitat[0]['Id_Activitat']); $Activitat[0]['Valoracio_Nom'] = $Funcions->nomValoracio($Activitat[0]['Valoracio']); $Activitat[0]['Preu'] = ""; $Activitat[0]['Preu_Final'] = ""; $Activitat[0]['Descompte'] = ""; $Activitat[0]['Preus'] = ""; $Activitat[0]['Dies_Valid'] = ""; $Activitat[0]['Data_Inici'] = ""; $Activitat[0]['Data_Final'] = ""; $Preu_Mes_Baix = ""; $sql_query="SELECT * FROM Activitats_Preus AS info LEFT JOIN Activitats_Preus_Traduccio AS tradu ON tradu.Id_Preu = info.Id_Preu AND tradu.Id_Idioma_Traduccio = ".$Id_Idioma_Actual." WHERE Id_Activitat = ".$Activitat[0]['Id_Activitat']." ORDER BY Preu_Final ASC"; $Preus = $Funcions->queryToArray($sql_query); if($Preus[0]['Id_Preu']){ for($i=0;$i= $Preus[$i]['Data_Final']){ $Preus[$i]['Estat'] = 0; }else{ $Preus[$i]['Estat'] = 1; /* if(date("Y-m-d") < $Preus[$i]['Data_Inici']){ $time_referencia=strtotime($Preus[$i]['Data_Inici']); $proxim_dia_setmana=$dies[0]; while(date("N",$time_referencia) != $proxim_dia_setmana){ $time_referencia+=3600*24; } $Preus[$i]['Proxima_Data'] = $time_referencia; }else{ $time_referencia=time(); $proxim_dia_setmana=0; for($j=0;$j date("N",$time_referencia) && !$proxim_dia_setmana){ $proxim_dia_setmana = $dies[$j]; } } if(!$proxim_dia_setmana){ $proxim_dia_setmana=$dies[0]; } include_once("langs/en.php"); $Preus[$i]['Proxima_Data'] = strtotime("next ".$Traduccio['en']['dies']['dia_'.$proxim_dia_setmana]); } */ } }else{ $Preus[$i]['Estat'] = 1; } } $Activitat[0]['Dies_Valid'] = $Preus[0]['Dies_Valid']; $Activitat[0]['Data_Inici'] = $Preus[0]['Data_Inici']; $Activitat[0]['Data_Final'] = $Preus[0]['Data_Final']; $Activitat[0]['Preu'] = $Preus[0]['Preu']; $Activitat[0]['Preu_Final'] = $Preus[0]['Preu_Final']; $Activitat[0]['Descompte'] = $Preus[0]['Descompte']; $Activitat[0]['Preus'] = $Preus; $Activitat[0]['Preu_Mes_Baix'] = $Preu_Mes_Baix; $Activitat[0]['Preu_Mes_Baix_Final'] = $Preu_Mes_Baix_Final; } $sql_query="SELECT * FROM Activitats_Fotos WHERE Id_Activitat = ".$Activitat[0]['Id_Activitat']; $Fotos = $Funcions->queryToArray($sql_query); $sql_query="SELECT * FROM Activitats_Videos WHERE Id_Activitat = ".$Activitat[0]['Id_Activitat']; $Videos = $Funcions->queryToArray($sql_query); $sql_query="SELECT * FROM Activitats_Opinions WHERE Id_Activitat = ".$Activitat[0]['Id_Activitat']." AND Estat = 1 ORDER BY Data DESC LIMIT 5"; $Opinions = $Funcions->queryToArray($sql_query); $sql_query="SELECT * FROM Activitats_Opinions WHERE Id_Activitat = ".$Activitat[0]['Id_Activitat']." AND Estat = 1 ORDER BY Data DESC"; $Totes_Opinions = $Funcions->queryToArray($sql_query); $Facebook_Pixel = "ViewContent"; $google_event="1"; $google_event_category="Activitat"; $google_event_action="Visita"; $google_event_label=""; $google_event_value=""; $title = $Activitat[0]['Nom']; $meta_description = $Tipus_Activitat[0]['Nom']." en ".$Municipi[0]['Municipi']." desde ".$Activitat[0]['Preu_Final']."€. ". $Activitat[0]['Nom']; $meta_keywords = ""; if($Activitat[0]['Foto']){ $img_facebook="fotos/actividades/g/".$Activitat[0]['Foto']; $variables_fixes[]="img_facebook"; } $smarty = new Smarty; $smarty->template_dir = WEB_PATH."templates/web/"; for($i=0;$iassign($variables_fixes[$i],$$variables_fixes[$i]); } $smarty->assign("Traduccio",$Traduccio[$idioma]); $smarty->assign("Tipus_Activitat",$Tipus_Activitat[0]); $smarty->assign("Categoria",$Categoria[0]); if(isset($Municipi[0]['Id_Municipi'])) $smarty->assign("Municipi",$Municipi[0]); if(isset($Provincia[0]['Id_Provincia'])) $smarty->assign("Provincia",$Provincia[0]); $smarty->assign("Activitat",$Activitat[0]); $smarty->assign("Fotos",$Fotos); $smarty->assign("Videos",$Videos); $smarty->assign("Opinions",$Opinions); $smarty->assign("Totes_Opinions",$Totes_Opinions); $web_content = $smarty->fetch("templates/web/activitat.htm"); echo $web_content; exit; } //Buscador if($_REQUEST['dos'] == $Traduccio[$idioma]['directori']['buscador']){ $parts=parse_url("https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']); parse_str($parts['query'], $_REQUEST); $sql_query="SELECT * FROM Provincies ORDER BY Provincia ASC"; $Provincies=$Funcions->queryToArray($sql_query); $Id_Categoria = ""; $Id_Tipus_Activitat = ""; $Id_Provincia = ""; $Id_Municipi = ""; $Preu_Inici = ""; $Preu_Final = ""; $Text = ""; if(isset($_REQUEST['cat'])) $Id_Categoria = preg_replace("/[^0-9]/","",$_REQUEST['cat']); if(isset($_REQUEST['tip'])) $Id_Tipus_Activitat = preg_replace("/[^0-9]/","",$_REQUEST['tip']); if(isset($_REQUEST['prov'])) $Id_Provincia = preg_replace("/[^0-9]/","",$_REQUEST['prov']); if(isset($_REQUEST['pob'])) $Id_Municipi = preg_replace("/[^0-9]/","",$_REQUEST['pob']); if(isset($_REQUEST['p1'])) $Preu_Inici = preg_replace("/[^0-9]/","",$_REQUEST['p1']); if(isset($_REQUEST['p2'])) $Preu_Final = preg_replace("/[^0-9]/","",$_REQUEST['p2']); if(isset($_REQUEST['text'])) $Text = $_REQUEST['text']; //if($Id_Provincia){ // $sql_query="SELECT * FROM Municipis WHERE Id_Provincia = $Id_Provincia ORDER BY Municipi ASC"; $sql_where=""; if($Id_Tipus_Activitat > 0){ $sql_where.=" AND at.Id_Tipus_Activitat = ".$Id_Tipus_Activitat; } if($Id_Categoria > 0){ $sql_where.=" AND ta.Id_Categoria = ".$Id_Categoria; } if($Id_Provincia > 0){ $sql_where.=" AND m.Id_Provincia = ".$Id_Provincia; } $sql_query="SELECT m.* FROM Activitats AS a LEFT JOIN Activitats_Tipus AS at ON at.Id_Activitat = a.Id_Activitat LEFT JOIN Tipus_Activitats AS ta ON ta.Id_Tipus_Activitat = at.Id_Tipus_Activitat LEFT JOIN Municipis AS m ON a.Id_Municipi = m.Id_Municipi WHERE a.Id_Municipi > 0 AND a.Estat = 1 ".$sql_where." GROUP BY m.Municipi ORDER BY m.Municipi ASC"; $Buscador_Municipis=$Funcions->queryToArray($sql_query); //} $sql_tipus_activitat=""; $sql_categoria=""; $sql_provincia=""; $sql_municipi=""; $sql_preu=""; $sql_text=""; if($Id_Categoria > 0){ $sql_categoria = " AND tipus.Id_Categoria = ".$Id_Categoria; $Buscador['Id_Categoria']=$Id_Categoria; $sql_query="SELECT * FROM Categories_Traduccio WHERE Id_Categoria = ".$Id_Categoria." AND Id_Idioma_Traduccio =".$Id_Idioma_Actual; $Info=$Funcions->queryToArray($sql_query); $buscando[]=$Info[0]['Nom']; } if($Id_Tipus_Activitat > 0){ $sql_tipus_activitat = " AND tipus_activitat.Id_Tipus_Activitat = ".$Id_Tipus_Activitat; $Buscador['Id_Tipus_Activitat']=$Id_Tipus_Activitat; $sql_query="SELECT * FROM Tipus_Activitats_Traduccio WHERE Id_Tipus_Activitat = ".$Id_Tipus_Activitat." AND Id_Idioma_Traduccio =".$Id_Idioma_Actual; $Info=$Funcions->queryToArray($sql_query); $buscando[]=$Info[0]['Nom']; } if($Id_Provincia > 0){ $sql_provincia = " AND m.Id_Provincia = ".$Id_Provincia; $Buscador['Id_Provincia']=$Id_Provincia; $sql_query="SELECT * FROM Provincies WHERE Id_Provincia = ".$Id_Provincia; $Info=$Funcions->queryToArray($sql_query); $buscando[]=$Info[0]['Provincia']; } if($Id_Municipi > 0){ $sql_municipi = " AND info.Id_Municipi = ".$Id_Municipi; $Buscador['Id_Municipi']=$Id_Municipi; $sql_query="SELECT * FROM Municipis WHERE Id_Municipi = ".$Id_Municipi; $Info=$Funcions->queryToArray($sql_query); $buscando[]=$Info[0]['Municipi']; } if($Preu_Inici && $Preu_Final){ $Preu_Inici=preg_replace("/[^0-9]/","",$Preu_Inici); $Preu_Final=preg_replace("/[^0-9]/","",$Preu_Final); $sql_preu = " AND Preu_Final >= ".$Preu_Inici." AND Preu_Final <= ".$Preu_Final; $Buscador['Preu_Inici']=$Preu_Inici; $Buscador['Preu_Final']=$Preu_Final; } if($Text){ $sql_text = " AND (tradu.Nom LIKE '%".$Text."%' OR tradu.Descripcio LIKE '%".$Text."%')"; $Buscador['Text']=$Text; }else{ $Buscador['Text'] = ""; } if(isset($buscando)){ $Buscador['Buscando_En']=implode(", ",$buscando); }else{ $Buscador['Buscando_En']=""; } if(isset($_REQUEST['o'])){ switch ($_REQUEST['o']) { case "e1": $sql_order="info.Destacada DESC, info_preu.Preu_Final ASC"; break; case "e2": $sql_order="info.Destacada DESC, info_preu.Preu_Final DESC"; break; case "pr": $sql_order="info.Destacada DESC, p.Provincia ASC"; break; case "po": $sql_order="info.Destacada DESC, m.Municipi ASC"; break; default: $sql_order="info.Destacada DESC, info.Comissio DESC, info.Id_Activitat ASC"; } $filtrar_orden=$_REQUEST['o']; }else{ $sql_order="info.Destacada DESC, info.Comissio DESC, info.Id_Activitat ASC"; } if(isset($filtrar_orden)){ $Buscador['filtrar_orden']=$filtrar_orden; }else{ $Buscador['filtrar_orden']=""; } /*paginacio*/ $pagina_actual=(isset($_REQUEST['pagina'])) ? $_REQUEST['pagina'] : 1; $sql_query="SELECT info.Id_Activitat, MIN(info_preu.Preu_Final) AS Preu_Final FROM Activitats AS info LEFT JOIN Activitats_Tipus AS tipus_activitat ON info.Id_Activitat = tipus_activitat.Id_Activitat LEFT JOIN Activitats_Traduccio AS tradu ON tradu.Id_Activitat = info.Id_Activitat AND tradu.Id_Idioma_Traduccio = ".$Id_Idioma_Actual." LEFT JOIN Tipus_Activitats AS tipus ON tipus.Id_Tipus_Activitat = tipus_activitat.Id_Tipus_Activitat LEFT JOIN Tipus_Activitats_Traduccio AS tipus_tradu ON tipus_tradu.Id_Tipus_Activitat = tipus_activitat.Id_Tipus_Activitat LEFT JOIN Categories_Traduccio AS categoria ON categoria.Id_Categoria = tipus.Id_Categoria LEFT JOIN Municipis AS m ON m.Id_Municipi = info.Id_Municipi LEFT JOIN Provincies AS p ON m.Id_Provincia = p.Id_Provincia LEFT JOIN Proveidors AS proveidor ON proveidor.Id_Proveidor = info.Id_Proveidor AND proveidor.Visible = 1 LEFT JOIN Activitats_Preus AS info_preu ON info_preu.Id_Activitat = info.Id_Activitat LEFT JOIN Activitats_Preus_Traduccio AS tradu_preu ON tradu_preu.Id_Preu = info_preu.Id_Preu AND tradu_preu.Id_Idioma_Traduccio = ".$Id_Idioma_Actual." WHERE info.Estat = 1 AND info_preu.No_Preu_Minim = 0 $sql_tipus_activitat $sql_categoria $sql_provincia $sql_municipi $sql_preu $sql_text GROUP BY info.Id_Activitat ORDER BY $sql_order "; $ListaCompleta=$Funcions->queryToArray($sql_query); $total_registres=count($ListaCompleta); if(!$ListaCompleta[0]['Id_Activitat']){ $total_registres=0; } $num_x_pagina=15; $pagina_seguent=0; $pagina_anterior=0; $total_pagines=($total_registres%$num_x_pagina == 0) ? $total_registres/$num_x_pagina : intval($total_registres/$num_x_pagina)+1; if($total_pagines>1 && $pagina_actual > $total_pagines){ $Funcions->mostraPagina404($Id_Idioma_Actual); exit; } if($pagina_actual>1){ $pagina_anterior=$pagina_actual-1; } if($pagina_actual < $total_pagines){ $pagina_seguent=$pagina_actual+1; } $resultat_inici=($pagina_actual-1)*$num_x_pagina+1; /*****************/ $sql_query="SELECT info.*,tradu.*,m.Municipi,p.Provincia,proveidor.Nom AS Proveidor, tipus_tradu.Nom AS Tipus_Activitat,tipus_tradu.Url_Amigable AS Tipus_Activitat_Url_Amigable, categoria.Nom AS Categoria,categoria.Url_Amigable AS Categoria_Url_Amigable, MIN(info_preu.Preu_Final) AS Preu_Final,info_preu.Descompte,info_preu.Preu FROM Activitats AS info LEFT JOIN Activitats_Tipus AS tipus_activitat ON info.Id_Activitat = tipus_activitat.Id_Activitat LEFT JOIN Activitats_Traduccio AS tradu ON tradu.Id_Activitat = info.Id_Activitat AND tradu.Id_Idioma_Traduccio = ".$Id_Idioma_Actual." LEFT JOIN Tipus_Activitats AS tipus ON tipus.Id_Tipus_Activitat = tipus_activitat.Id_Tipus_Activitat LEFT JOIN Tipus_Activitats_Traduccio AS tipus_tradu ON tipus_tradu.Id_Tipus_Activitat = tipus_activitat.Id_Tipus_Activitat LEFT JOIN Categories_Traduccio AS categoria ON categoria.Id_Categoria = tipus.Id_Categoria LEFT JOIN Municipis AS m ON m.Id_Municipi = info.Id_Municipi LEFT JOIN Provincies AS p ON m.Id_Provincia = p.Id_Provincia LEFT JOIN Proveidors AS proveidor ON proveidor.Id_Proveidor = info.Id_Proveidor AND proveidor.Visible = 1 LEFT JOIN Activitats_Preus AS info_preu ON info_preu.Id_Activitat = info.Id_Activitat LEFT JOIN Activitats_Preus_Traduccio AS tradu_preu ON tradu_preu.Id_Preu = info_preu.Id_Preu AND tradu_preu.Id_Idioma_Traduccio = ".$Id_Idioma_Actual." WHERE info.Estat = 1 AND info_preu.No_Preu_Minim = 0 $sql_tipus_activitat $sql_categoria $sql_provincia $sql_municipi $sql_preu $sql_text GROUP BY info.Id_Activitat ORDER BY $sql_order LIMIT ".($pagina_actual-1)*$num_x_pagina.",$num_x_pagina"; $Activitats=$Funcions->queryToArray($sql_query); $resultat_final=$resultat_inici+count($Activitats)-1; if($Activitats[0]['Id_Activitat']){ for($i=0;$ifotoPrincipalActivitat($Activitats[$i]['Id_Activitat']); $Activitats[$i]['Total_Fotos'] = $Funcions->totalFotosActivitat($Activitats[$i]['Id_Activitat']); $Activitats[$i]['Total_Videos'] = $Funcions->totalVideosActivitat($Activitats[$i]['Id_Activitat']); $Activitats[$i]['Total_Opinions'] = $Funcions->totalOpinionsActivitat($Activitats[$i]['Id_Activitat']); $Activitats[$i]['Valoracio'] = $Funcions->valoracioActivitat($Activitats[$i]['Id_Activitat']); $Activitats[$i]['Valoracio_Nom'] = $Funcions->nomValoracio($Activitats[$i]['Valoracio']); $sql_query="SELECT * FROM Activitats_Fotos WHERE Id_Activitat = ".$Activitats[$i]['Id_Activitat']; $Activitats[$i]['Fotos'] = $Funcions->queryToArray($sql_query); /* $Activitats[$i]['Preu'] = ""; $Activitats[$i]['Preu_Final'] = "0"; $Activitats[$i]['Descompte'] = ""; $Activitats[$i]['Preus'] = ""; $sql_query="SELECT * FROM Activitats_Preus AS info LEFT JOIN Activitats_Preus_Traduccio AS tradu ON tradu.Id_Preu = info.Id_Preu AND tradu.Id_Idioma_Traduccio = ".$Id_Idioma_Actual." WHERE Id_Activitat = ".$Activitats[$i]['Id_Activitat']." ORDER BY Preu_Final ASC"; $Preus = $Funcions->queryToArray($sql_query); if($Preus[0]['Id_Preu']){ $Activitats[$i]['Preu'] = $Preus[0]['Preu']; $Activitats[$i]['Preu_Final'] = $Preus[0]['Preu_Final']; $Activitats[$i]['Descompte'] = $Preus[0]['Descompte']; $Activitats[$i]['Preus'] = $Preus; } */ } } if($Buscador['Id_Categoria']){ $sql_query="SELECT tipus_tradu.* FROM Activitats_Tipus AS tipus LEFT JOIN Activitats AS activitat ON activitat.Id_Activitat = tipus.Id_Activitat LEFT JOIN Tipus_Activitats AS tipus_info ON tipus_info.Id_Tipus_Activitat = tipus.Id_Tipus_Activitat LEFT JOIN Tipus_Activitats_Traduccio AS tipus_tradu ON tipus.Id_Tipus_Activitat = tipus_tradu.Id_Tipus_Activitat AND tipus_tradu.Id_Idioma_Traduccio = ".$Id_Idioma_Actual." WHERE activitat.Estat = 1 AND tipus_info.Id_Categoria=".$Buscador['Id_Categoria']." GROUP BY tipus.Id_Tipus_Activitat ORDER BY tipus_tradu.Nom ASC"; $Buscador_Tipus_Activitats=$Funcions->queryToArray($sql_query); $variables_fixes[] = "Buscador_Tipus_Activitats"; } if($Buscador['Id_Tipus_Activitat']){ $sql_query="SELECT provincia.* FROM Activitats_Tipus AS tipus LEFT JOIN Activitats AS activitat ON activitat.Id_Activitat = tipus.Id_Activitat LEFT JOIN Municipis AS municipi ON activitat.Id_Municipi = municipi.Id_Municipi LEFT JOIN Provincies AS provincia ON provincia.Id_Provincia = municipi.Id_Provincia WHERE activitat.Estat = 1 AND tipus.Id_Tipus_Activitat=".$Buscador['Id_Tipus_Activitat']." GROUP BY provincia.Id_Provincia ORDER BY provincia.Provincia ASC"; $Buscador_Provincies=$Funcions->queryToArray($sql_query); $variables_fixes[] = "Buscador_Provincies"; }else{ $sql_query="SELECT provincia.* FROM Activitats_Tipus AS tipus LEFT JOIN Activitats AS activitat ON activitat.Id_Activitat = tipus.Id_Activitat LEFT JOIN Municipis AS municipi ON activitat.Id_Municipi = municipi.Id_Municipi LEFT JOIN Provincies AS provincia ON provincia.Id_Provincia = municipi.Id_Provincia WHERE activitat.Estat = 1 GROUP BY provincia.Id_Provincia ORDER BY provincia.Provincia ASC"; $Buscador_Provincies=$Funcions->queryToArray($sql_query); $variables_fixes[] = "Buscador_Provincies"; } if($Buscador['Id_Provincia']){ $sql_where=""; if($Buscador['Id_Tipus_Activitat'] > 0){ $sql_where.=" AND at.Id_Tipus_Activitat = ".$Buscador['Id_Tipus_Activitat']; } if($Buscador['Id_Categoria'] > 0){ $sql_where.=" AND ta.Id_Categoria = ".$Buscador['Id_Categoria']; } if($Buscador['Id_Provincia'] > 0){ $sql_where.=" AND m.Id_Provincia = ".$Buscador['Id_Provincia']; } $sql_query="SELECT m.* FROM Activitats AS a LEFT JOIN Activitats_Tipus AS at ON at.Id_Activitat = a.Id_Activitat LEFT JOIN Tipus_Activitats AS ta ON ta.Id_Tipus_Activitat = at.Id_Tipus_Activitat LEFT JOIN Municipis AS m ON a.Id_Municipi = m.Id_Municipi WHERE a.Id_Municipi > 0 AND a.Estat = 1 ".$sql_where." GROUP BY m.Municipi ORDER BY m.Municipi ASC"; $Buscador_Municipis=$Funcions->queryToArray($sql_query); $variables_fixes[] = "Buscador_Municipis"; } $Facebook_Pixel = "Search"; $google_event="1"; $google_event_category="Buscador"; $google_event_action="Buscar"; $google_event_label=""; $google_event_value=""; $smarty = new Smarty; $smarty->template_dir = WEB_PATH."templates/web/"; for($i=0;$iassign($variables_fixes[$i],$$variables_fixes[$i]); } $smarty->assign("Traduccio",$Traduccio[$idioma]); $smarty->assign("Activitats",$Activitats); $smarty->assign("Total_Resultats",$total_registres); $smarty->assign("Provincies",$Provincies); if(isset($Municipis)) $smarty->assign("Municipis",$Municipis); $smarty->assign("pagina_actual",$pagina_actual); $smarty->assign("total_pagines",$total_pagines); $smarty->assign("pagina_anterior",$pagina_anterior); $smarty->assign("pagina_seguent",$pagina_seguent); $smarty->assign("resultat_inici",$resultat_inici); $smarty->assign("resultat_final",$resultat_final); $web_content = $smarty->fetch("templates/web/buscador.htm"); echo $web_content; exit; } //Llista activitats per provincia $Id_Provincia_Llista = 0; if(substr($_REQUEST['dos'],0, strlen($Traduccio[$idioma]['directori']['actividades-aventura'])) == $Traduccio[$idioma]['directori']['actividades-aventura']){ $Provincia_Rewrite = substr($_REQUEST['dos'], strlen($Traduccio[$idioma]['directori']['actividades-aventura'])+1); $sql_query="SELECT * FROM Provincies WHERE Url_Amigable = '".$Provincia_Rewrite."'"; $Provincia=$Funcions->queryToArray($sql_query); if($Provincia[0]['Id_Provincia']){ $Id_Provincia_Llista=$Provincia[0]['Id_Provincia']; $variables_fixes[] = "Provincia"; } } //Llista de totes les activitats if($_REQUEST['dos'] == $Traduccio[$idioma]['directori']['actividades'] || $Id_Provincia_Llista){ $sql_where_provincia=""; if($Id_Provincia_Llista){ $sql_where_provincia=" AND municipi.Id_Provincia = ".$Id_Provincia_Llista; } for($j=0;$jqueryToArray($sql_query); if($Categoria_Tipus_Activitats[0]['Id_Tipus_Activitat']){ for($i=0;$iqueryToArray($sql_query); if($Preus[0]['Id_Preu']){ $Categoria_Tipus_Activitats[$i]['Preu_Final'] = $Preus[0]['Preu_Final']; }else{ $Categoria_Tipus_Activitats[$i]['Preu_Final'] = "0"; } $Categoria_Tipus_Activitats[$i]['Foto']=$Funcions->fotoTipusActivitat($Categoria_Tipus_Activitats[$i]['Id_Tipus_Activitat']); } } $Num_x_columna = round(count($Categoria_Tipus_Activitats)/3,0,PHP_ROUND_HALF_UP); $col=1; $n=0; $sql_where_tipus=""; $Total_Categoria_Tipus_Activitats=0; for($i=0;$iqueryToArray($sql_query); $Categoria_Tipus_Activitats[$i]['Total']=$Info[0]['Contador']; $Total_Categoria_Tipus_Activitats+=($Info[0]['Contador'] > 0) ? 1 : 0; } } $Categories[$j]['Destacat_1'] = $Config['Destacat_'.$Categories[$j]['Id_Categoria'].'_1']; $Categories[$j]['Destacat_2'] = $Config['Destacat_'.$Categories[$j]['Id_Categoria'].'_2']; $Categories[$j]['Destacat_3'] = $Config['Destacat_'.$Categories[$j]['Id_Categoria'].'_3']; $Categories[$j]['Tipus_Activitats']=$Categoria_Tipus_Activitats; $Categories[$j]['Total_Tipus_Activitats'] = $Total_Categoria_Tipus_Activitats; } if($Id_Provincia_Llista){ $title="Actividades de aventura ".$Provincia[0]['Provincia']; $meta_description="Actividades y deportes de aventura en ".$Provincia[0]['Provincia'].". Compra o regala actividades en ".$Provincia[0]['Provincia']; }else{ $title="Actividades y deportes de aventura"; $meta_description="Compra o regala actividades de aventura. Lista de todos los deportes de aventura disponibles en ACTIVIclick"; } $smarty = new Smarty; $smarty->template_dir = WEB_PATH."templates/web/"; for($i=0;$iassign($variables_fixes[$i],$$variables_fixes[$i]); } $smarty->assign("Traduccio",$Traduccio[$idioma]); $smarty->assign("Categories",$Categories); if($Id_Provincia_Llista){ $web_content = $smarty->fetch("templates/web/llista_categories_provincia.htm"); }else{ $web_content = $smarty->fetch("templates/web/llista_categories.htm"); } echo $web_content; exit; } //Atenció client if($_REQUEST['dos'] == $Traduccio[$idioma]['directori']['atencion-cliente'].".php"){ $smarty = new Smarty; $smarty->template_dir = WEB_PATH."templates/web/"; for($i=0;$iassign($variables_fixes[$i],$$variables_fixes[$i]); } $smarty->assign("Traduccio",$Traduccio[$idioma]); $smarty->assign("Categories",$Categories); $web_content = $smarty->fetch("templates/web/atencio_client.htm"); echo $web_content; exit; } //Formulari contacte if($_REQUEST['dos'] == $Traduccio[$idioma]['directori']['contacto'].".php"){ $enviado=0; if(isset($_POST['accio']) && $_POST['accio'] == "enviar"){ if($_POST['Nombre'] && $_POST['Apellidos'] && $_POST['Email'] && $_POST['Telefono'] && $_POST['Asunto'] && $_POST['Comentarios']){ $smarty = new Smarty; $smarty->template_dir = WEB_PATH."templates/web/"; $smarty->assign("Datos",$_POST); $msg = $smarty->fetch("templates/emails/contacto.htm"); $mail = new PHPMailer(); $mail->From = utf8_decode($_POST['Email']); $mail->FromName = utf8_decode($_POST['Nombre']." ".$_POST['Apellidos']); $mail->Subject = utf8_decode("Formulario de contacto: ". $_POST['Asunto']); $mail->AddEmbeddedImage('img/logo-mailing.png', 'logo'); $mail->AddEmbeddedImage('img/bk-menu.png', 'fonsmenu'); $mail->MsgHTML(utf8_decode($msg)); $mail->AddAddress("incidencias@activiclick.com"); $mail->Send(); $enviado=1; } } $smarty = new Smarty; $smarty->template_dir = WEB_PATH."templates/web/"; for($i=0;$iassign($variables_fixes[$i],$$variables_fixes[$i]); } $smarty->assign("Traduccio",$Traduccio[$idioma]); $smarty->assign("Categories",$Categories); $smarty->assign("enviado",$enviado); $web_content = $smarty->fetch("templates/web/contacto.htm"); echo $web_content; exit; } //Registre d'usuari if($_REQUEST['dos'] == $Traduccio[$idioma]['directori']['registro'].".php"){ $ok=0; $error=0; $sql_query="SELECT * FROM Provincies as p ORDER BY p.Provincia ASC"; $Provincies=$Funcions->queryToArray($sql_query); if(isset($_POST['accio'])){ if($_POST['accio'] == "guardar" && $_POST['Nombre'] && $_POST['Apellidos'] && $_POST['Telefono'] && $_POST['Id_Provincia'] && $_POST['Email'] && $_POST['Email2'] && $_POST['Pass'] && $_POST['Pass2']){ if($_POST['Email'] != $_POST['Email2']) $error = "2"; if($_POST['Pass'] != $_POST['Pass2'] && !$error) $error = "3"; if(!$error){ $sql_query="SELECT * FROM Usuaris WHERE Email = '".$_POST['Email']."'"; $Info=$Funcions->queryToArray($sql_query); if($Info[0]['Email'] == $_POST['Email']){ $error = "1"; }else{ $time=time(); foreach($_POST AS $key => $value)$_POST[$key]=addslashes($value); mysql_query("INSERT INTO Usuaris (Email,Contrasenya,Nivell,Estat,Data_Registre,Ultim_Acces) VALUES ('".$_POST['Email']."','".md5($_POST['Pass'])."','usuari','0','".$time."','0');"); $Id_Usuari=mysql_insert_id(); if($Id_Usuari){ mysql_query("INSERT INTO Clients (Id_Usuari,Nom,Cognoms,Email,Telefon,Id_Provincia) VALUES ('$Id_Usuari','".$_POST['Nombre']."','".$_POST['Apellidos']."','".$_POST['Email']."','".$_POST['Telefono']."','".$_POST['Id_Provincia']."')"); $Id_Client=mysql_insert_id(); if($Id_Client){ if(isset($_POST['alta_newsletter']) && $_POST['alta_newsletter'] == "1"){ $sql_query="SELECT * FROM Butlletins_Subscrits WHERE Email ='".$_POST['Email']."'"; $Info=$Funcions->queryToArray($sql_query); if(!$Info[0]['Email']){ $Origen='registro'; mysql_query("INSERT INTO Butlletins_Subscrits (Email,Id_Provincia,Id_Idioma,Data_Alta,Confirmat,Origen) VALUES ('".$_POST['Email']."','".$_POST['Id_Provincia']."','$Id_Idioma_Actual','".time()."','0','$Origen');"); } } $enc=md5(time().$_POST['Email'].$Id_Usuari); $Url="https://".$_SERVER['SERVER_NAME']."/".$idioma."/".$Traduccio[$idioma]['directori']['registro']."/".$enc; $smarty = new Smarty; $smarty->template_dir = WEB_PATH."templates/web/"; $smarty->assign("Nombre",$_POST['Nombre']); $smarty->assign("Url",$Url); $msg = $smarty->fetch("templates/emails/usuario_confirmar_registro.htm"); $mail = new PHPMailer(); $mail->From = "info@activiclick.com"; $mail->FromName = utf8_decode("ACTIVIclick"); $mail->Subject = utf8_decode($Traduccio[$idioma]['subjects']['usuario_confirmar_registro']); $mail->AddEmbeddedImage('img/logo-mailing.png', 'logo'); $mail->AddEmbeddedImage('img/bk-menu.png', 'fonsmenu'); $mail->MsgHTML(utf8_decode($msg)); $mail->AddAddress($_POST['Email']); $mail->Send(); $Facebook_Pixel = "CompleteRegistration"; $google_event="1"; $google_event_category="Registre"; $google_event_action="Registre"; $google_event_label=""; $google_event_value=""; $ok=1; }else{ $error=4; } }else{ $error=4; } } } } } $smarty = new Smarty; $smarty->template_dir = WEB_PATH."templates/web/"; for($i=0;$iassign($variables_fixes[$i],$$variables_fixes[$i]); } $smarty->assign("Traduccio",$Traduccio[$idioma]); $smarty->assign("Categories",$Categories); $smarty->assign("Provincies",$Provincies); $smarty->assign("ok",$ok); $smarty->assign("error",$error); $smarty->assign("Nombre", (isset($_POST['Nombre'])) ? $_POST['Nombre'] : ""); $smarty->assign("Apellidos", (isset($_POST['Apellidos'])) ? $_POST['Apellidos'] : ""); $smarty->assign("Telefono", (isset($_POST['Nombre'])) ? $_POST['Telefono'] : ""); $smarty->assign("Id_Provincia", (isset($_POST['Nombre'])) ? $_POST['Id_Provincia'] : ""); $smarty->assign("Email", (isset($_POST['Email'])) ? $_POST['Email'] : ""); $smarty->assign("Email2", (isset($_POST['Email2'])) ? $_POST['Email2'] : ""); $web_content = $smarty->fetch("templates/web/registre.htm"); echo $web_content; exit; } //Confirmar compte d'usuari if($_REQUEST['dos'] == $Traduccio[$idioma]['directori']['registro'] && isset($_REQUEST['tres']) && strlen($_REQUEST['tres']) == 32){ $enc=$_REQUEST['tres']; $sql_query="SELECT * FROM Usuaris WHERE MD5(CONCAT(Data_Registre,Email,Id_Usuari)) = '$enc' AND Estat = 0"; $Info=$Funcions->queryToArray($sql_query); if($Info[0]['Id_Usuari']){ $ok=1; mysql_query("UPDATE Usuaris SET Estat = 1 WHERE Id_Usuari = ".$Info[0]['Id_Usuari']); $sql_query="SELECT * FROM Butlletins_Subscrits WHERE Email ='".$Info[0]['Email']."'"; $InfoMail=$Funcions->queryToArray($sql_query); if($InfoMail[0]['Email']){ mysql_query("UPDATE Butlletins_Subscrits SET Confirmat = 1 WHERE Email = '".$Info[0]['Email']."'"); } }else{ $Funcions->mostraPagina404($Id_Idioma_Actual); exit; } $smarty = new Smarty; $smarty->template_dir = WEB_PATH."templates/web/"; for($i=0;$iassign($variables_fixes[$i],$$variables_fixes[$i]); } $smarty->assign("Traduccio",$Traduccio[$idioma]); $smarty->assign("ok",$ok); $web_content = $smarty->fetch("templates/web/registre_confirmacio.htm"); echo $web_content; exit; } //Recuperar contrasenya if($_REQUEST['dos'] == $Traduccio[$idioma]['directori']['recuperar'].".php"){ $ok=0; $error=0; if(isset($_POST['accio'])){ if($_POST['accio']=="enviar" && $_POST['Email']){ $sql_query="SELECT * FROM Usuaris WHERE Email = '".$_POST['Email']."'"; $Info=$Funcions->queryToArray($sql_query); if($Info[0]['Email'] == $_POST['Email']){ $ok=1; if($Info[0]['Nivell'] == "usuari"){ $sql_query="SELECT Nom FROM Clients WHERE Id_Usuari = ".$Info[0]['Id_Usuari']; $Dades=$Funcions->queryToArray($sql_query); } $Time_Limit = time()+3600*24; $enc=md5(rand(11111111,999999)*time()); $Url="https://".$_SERVER['SERVER_NAME']."/".$idioma."/".$Traduccio[$idioma]['directori']['recuperar']."/".$enc; mysql_query("DELETE FROM Usuaris_Recuperacio WHERE Id_Usuari = ".$Info[0]['Id_Usuari']); mysql_query("INSERT INTO Usuaris_Recuperacio (Codi,Id_Usuari,Data_Expiracio) VALUES ('$enc','".$Info[0]['Id_Usuari']."','".$Time_Limit."');"); $smarty = new Smarty; $smarty->template_dir = WEB_PATH."templates/web/"; if($Dades)$smarty->assign("Nombre",$Dades[0]['Nom']); $smarty->assign("Url",$Url); $msg = $smarty->fetch("templates/emails/usuario_recuperar_contrasena.htm"); $mail = new PHPMailer(); $mail->From = "info@activiclick.com"; $mail->FromName = utf8_decode("ACTIVIclick"); $mail->Subject = utf8_decode($Traduccio[$idioma]['subjects']['usuario_recuperar_contrasena']); $mail->AddEmbeddedImage('img/logo-mailing.png', 'logo'); $mail->AddEmbeddedImage('img/bk-menu.png', 'fonsmenu'); $mail->MsgHTML(utf8_decode($msg)); $mail->AddAddress($_POST['Email']); $mail->Send(); }else{ $error=1; } } } $smarty = new Smarty; $smarty->template_dir = WEB_PATH."templates/web/"; for($i=0;$iassign($variables_fixes[$i],$$variables_fixes[$i]); } $smarty->assign("Traduccio",$Traduccio[$idioma]); $smarty->assign("Categories",$Categories); $smarty->assign("ok",$ok); $smarty->assign("error",$error); $smarty->assign("Email", (isset($_POST['Email'])) ? $_POST['Email'] : ""); $web_content = $smarty->fetch("templates/web/recuperar.htm"); echo $web_content; exit; } //Recuperar contrasenya - Enviament del a nova contrasenya if($_REQUEST['dos'] == $Traduccio[$idioma]['directori']['recuperar'] && isset($_REQUEST['tres']) && strlen($_REQUEST['tres']) == 32){ $enc=$_REQUEST['tres']; $ok=0; $error=0; $sql_query="SELECT ur.*,u.Email,u.Nivell FROM Usuaris_Recuperacio AS ur LEFT JOIN Usuaris AS u ON u.Id_Usuari = ur.Id_Usuari WHERE ur.Codi = '$enc'"; $Info=$Funcions->queryToArray($sql_query); if($Info[0]['Id_Usuari']){ if(time() > $Info[0]['Data_Expiracio']){ $error=1; mysql_query("DELETE FROM Usuaris_Recuperacio WHERE Codi = '$enc'"); }else{ $ok=1; $New_Pass = $Funcions->generateRandomString(); mysql_query("UPDATE Usuaris SET Contrasenya = '".md5($New_Pass)."' WHERE Id_Usuari = ".$Info[0]['Id_Usuari']); mysql_query("DELETE FROM Usuaris_Recuperacio WHERE Codi = '$enc'"); if($Info[0]['Nivell'] == "usuari"){ $sql_query="SELECT Nom FROM Clients WHERE Id_Usuari = ".$Info[0]['Id_Usuari']; $Dades=$Funcions->queryToArray($sql_query); } $smarty = new Smarty; $smarty->template_dir = WEB_PATH."templates/web/"; $smarty->assign("Nombre",$Dades[0]['Nom']); $smarty->assign("Email",$Info[0]['Email']); $smarty->assign("Password",$New_Pass); $msg = $smarty->fetch("templates/emails/usuario_contrasena_nueva.htm"); $mail = new PHPMailer(); $mail->From = "info@activiclick.com"; $mail->FromName = utf8_decode("ACTIVIclick"); $mail->Subject = utf8_decode($Traduccio[$idioma]['subjects']['usuario_contrasena_nueva']); $mail->AddEmbeddedImage('img/logo-mailing.png', 'logo'); $mail->AddEmbeddedImage('img/bk-menu.png', 'fonsmenu'); $mail->MsgHTML(utf8_decode($msg)); $mail->AddAddress($Info[0]['Email']); $mail->Send(); } }else{ $Funcions->mostraPagina404($Id_Idioma_Actual); exit; } $smarty = new Smarty; $smarty->template_dir = WEB_PATH."templates/web/"; for($i=0;$iassign($variables_fixes[$i],$$variables_fixes[$i]); } $smarty->assign("Traduccio",$Traduccio[$idioma]); $smarty->assign("ok",$ok); $smarty->assign("error",$error); $web_content = $smarty->fetch("templates/web/recuperar_confirmacio.htm"); echo $web_content; exit; } //Comprar if($_REQUEST['dos'] == $Traduccio[$idioma]['directori']['comprar'] && !isset($_REQUEST['tres'])){ $Funcions->funcioComprar(); } //Guardar reserva if($_REQUEST['dos'] == $Traduccio[$idioma]['directori']['reservar'] && !isset($_REQUEST['tres'])){ $reserva_guardada = 1; $error_login=0; $error_registre=0; $Id_Client=0; if($_POST['accio']=="guardar_reserva"){ if(isset($_POST['registrat'])){ $Id_Client_Actual=0; if($_POST['registrat'] == "1"){ if($_POST['Login_Email'] && $_POST['Login_Pass']){ $Session=$Sessions->User_Login($_POST['Login_Email'],$_POST['Login_Pass']); if($Session){ $Esta_Identificat = 1; $Tipus_Usuari=$Sessions->Tipus_Usuari($Session); $Id_Usuari_Actual = $Sessions->Session_Info($Session,"Id_Usuari"); $Tipus_Usuari=$Sessions->Tipus_Usuari($Session); if($Tipus_Usuari == "usuari"){ $sql_query="SELECT * FROM Clients WHERE Id_Usuari = ".$Id_Usuari_Actual; $Info=$Funcions->queryToArray($sql_query); if($Info[0]['Id_Client']){ $Id_Client=$Info[0]['Id_Client']; $Id_Client_Actual=$Info[0]['Id_Client']; } }else{ $error_login=2; $Sessions->Remove_Current_Session(); $Id_Client=0; $Id_Client_Actual=0; } } } if(!$Id_Client_Actual){ $variables_fixes[]="error_login"; $variables_fixes[]="_POST"; $_POST['accio']="comprar"; if(!$error_login)$error_login=1; $reserva_guardada=0; if(isset($_POST['targeta_regal']) && $_POST['targeta_regal'] == "1"){ $Funcions->funcioComprarTargetaRegal(); }else{ $Funcions->funcioComprar(); } } }else{ if($_POST['Registre_Nom'] && $_POST['Registre_Cognoms'] && $_POST['Registre_Telefon'] && $_POST['Registre_Id_Provincia'] && $_POST['Registre_Email'] && $_POST['Registre_Email2'] && $_POST['Registre_Pass'] && $_POST['Registre_Pass2']){ if($_POST['Registre_Email'] != $_POST['Registre_Email2']) $error_registre = "2"; if($_POST['Registre_Pass'] != $_POST['Registre_Pass2'] && !$error_registre) $error_registre = "3"; if(!$error_registre){ $sql_query="SELECT * FROM Usuaris WHERE Email = '".$_POST['Registre_Email']."'"; $Info=$Funcions->queryToArray($sql_query); if($Info[0]['Email'] == $_POST['Registre_Email']){ $error_registre = "1"; }else{ $time=time(); foreach($_POST AS $key => $value)$_POST[$key]=addslashes($value); mysql_query("INSERT INTO Usuaris (Email,Contrasenya,Nivell,Estat,Data_Registre,Ultim_Acces) VALUES ('".$_POST['Registre_Email']."','".md5($_POST['Registre_Pass'])."','usuari','0','".$time."','0');"); $Id_Usuari=mysql_insert_id(); if($Id_Usuari){ mysql_query("INSERT INTO Clients (Id_Usuari,Nom,Cognoms,Email,Telefon,Id_Provincia) VALUES ('$Id_Usuari','".$_POST['Registre_Nom']."','".$_POST['Registre_Cognoms']."','".$_POST['Registre_Email']."','".$_POST['Registre_Telefon']."','".$_POST['Registre_Id_Provincia']."')"); $Id_Client=mysql_insert_id(); if($Id_Client){ $enc=md5(time().$_POST['Registre_Email'].$Id_Usuari); $Url="https://".$_SERVER['SERVER_NAME']."/".$idioma."/".$Traduccio[$idioma]['directori']['registro']."/".$enc; $smarty = new Smarty; $smarty->template_dir = WEB_PATH."templates/web/"; $smarty->assign("Nombre",$_POST['Registre_Nom']); $smarty->assign("Url",$Url); $msg = $smarty->fetch("templates/emails/usuario_confirmar_registro.htm"); $mail = new PHPMailer(); $mail->From = "info@activiclick.com"; $mail->FromName = utf8_decode("ACTIVIclick"); $mail->Subject = utf8_decode($Traduccio[$idioma]['subjects']['usuario_confirmar_registro']); $mail->AddEmbeddedImage('img/logo-mailing.png', 'logo'); $mail->AddEmbeddedImage('img/bk-menu.png', 'fonsmenu'); $mail->MsgHTML(utf8_decode($msg)); $mail->AddAddress($_POST['Registre_Email']); $mail->Send(); $Sessio = $Sessions->New_Session($Id_Usuari); }else{ $error_registre=4; } }else{ $error_registre=4; } } } } } if(!$Id_Client){ $variables_fixes[]="error_registre"; $variables_fixes[]="_POST"; $_POST['accio']="comprar"; //$error_registre=1; $reserva_guardada=0; if(isset($_POST['targeta_regal']) && $_POST['targeta_regal'] == "1"){ $Funcions->funcioComprarTargetaRegal(); }else{ $Funcions->funcioComprar(); } } } if($Esta_Identificat && $Tipus_Usuari == "usuari" && $Id_Client_Actual){ $Id_Client = $Id_Client_Actual; } if($Tipus_Usuari == "admin" || $Tipus_Usuari == "empresa"){ $variables_fixes[]="Tipus_Usuari"; $smarty = new Smarty; $smarty->template_dir = WEB_PATH."templates/web/"; for($i=0;$iassign($variables_fixes[$i],$$variables_fixes[$i]); } $smarty->assign("Traduccio",$Traduccio[$idioma]); if(isset($_POST['targeta_regal']) && $_POST['targeta_regal'] == "1"){ $web_content = $smarty->fetch("templates/web/targeta_regal_comprar.htm"); }else{ $web_content = $smarty->fetch("templates/web/comprar.htm"); } echo $web_content; exit; } if($Id_Client){ $Subtotal=0; $Suma_Comissio=0; $Targeta_Regal = 0; if(!isset($_POST['targeta_regal']) && !isset($_POST['Import'])){ $items=explode(";",$_POST['items']); $c=0; for($i=0;$i 0){ $sql_query="SELECT info.*,info_tradu.*,preu.*,preu_tradu.*,m.Municipi,p.Provincia,proveidor.Nom AS Proveidor FROM Activitats AS info LEFT JOIN Activitats_Traduccio AS info_tradu ON info_tradu.Id_Activitat = info.Id_Activitat AND info_tradu.Id_Idioma_Traduccio = ".$Id_Idioma_Actual." LEFT JOIN Activitats_Preus AS preu ON info.Id_Activitat = preu.Id_Activitat AND preu.Id_Preu = ".$Id_Preu." LEFT JOIN Activitats_Preus_Traduccio AS preu_tradu ON preu_tradu.Id_Preu = preu.Id_Preu AND preu_tradu.Id_Idioma_Traduccio = ".$Id_Idioma_Actual." LEFT JOIN Municipis AS m ON m.Id_Municipi = info.Id_Municipi LEFT JOIN Provincies AS p ON m.Id_Provincia = p.Id_Provincia LEFT JOIN Proveidors AS proveidor ON proveidor.Id_Proveidor = info.Id_Proveidor AND proveidor.Visible = 1 WHERE info.Id_Activitat = ".$Id_Activitat." AND preu.Minim_Unitats <= ".$Unitats." AND preu.Maxim_Unitats >= ".$Unitats." "; $Info=$Funcions->queryToArray($sql_query); if($Info[0]['Id_Activitat']){ $sql_query="SELECT * FROM Activitats AS info LEFT JOIN Activitats_Traduccio AS tradu ON tradu.Id_Activitat = info.Id_Activitat WHERE tradu.Id_Idioma_Traduccio = ".$Id_Idioma_Actual." AND info.Id_Activitat = '".$_POST['Id_Activitat']."'"; $Activitat=$Funcions->queryToArray($sql_query); $Activitat=$Activitat[0]; if(isset($Info[0]['Dies_Disponible'])){ $dies=explode(",",$Info[0]['Dies_Disponible']); if(count($dies) == 7){ $Info[0]['Dies']=$Traduccio[$idioma]['dies']['tots']; }else{ for($j=0;$j 0){ if($Info[0]['Dies_Valid'] == "1"){ $Info[0]['Data_Inici'] = date("Y-m-d"); $Info[0]['Data_Final'] = date("Y-m-d"); }else{ $Info[0]['Data_Inici'] = date("Y-m-d"); $Info[0]['Data_Final'] = date("Y-m-d",time()+3600*24*$Info[0]['Dies_Valid']); } } $Info[0]['Unitats'] = $Unitats; $Info[0]['Preu_Suma'] = $Info[0]['Preu_Final']*$Unitats; $Preu_Sense_Iva = $Info[0]['Preu_Suma'] / 1.21; $Subtotal+=$Info[0]['Preu_Final']*$Unitats; $Suma_Comissio+=$Preu_Sense_Iva/100*$Activitat['Comissio']; $Activitats[$c]=$Info[0]; $Activitats[$c]['Numeracion'] = $c+1; $c++; } } } }else{ $Subtotal=$_POST['Import']; $Targeta_Regal = 1; } if($Subtotal>0){ $Pagament=0; $Enviament=0; $Descompte=0; $Id_Usuari=0; $Id_Val=0; $Codi=""; $Preu_Regal=0; $Regal="no"; if(isset($_POST['regal']) && $_POST['regal'] == "1"){ $_POST['Regal_Envio_Caja'] = "express"; if($_POST['tipus_regal'] == "caja" && $_POST['Regal_Nom'] && $_POST['Regal_Telefon'] && $_POST['Regal_Email'] && $_POST['Regal_Direccio'] && $_POST['Regal_Envio_Caja']){ $Regal="caixa"; $Preu_Regal=$Config['Preu_Caixa_Regal']; $Enviament=$Config['Preu_Enviament_Express']; /* if($_POST['Regal_Envio_Caja'] == "normal"){ $Enviament=$Config['Preu_Enviament_Normal']; } else if($_POST['Regal_Envio_Caja'] == "express"){ $Enviament=$Config['Preu_Enviament_Express']; }else{ $Regal="no"; $Preu_Regal=0; } */ } if($_POST['tipus_regal'] == "vale" && $_POST['Vale_De'] && $_POST['Vale_Para'] && $_POST['Vale_Email']){ $Regal="vale"; } } if(isset($_POST['cp'])){ $cr=($Regal == "caixa") ? 1 : 0; $llista=$Funcions->revisarCuponDescuento($_POST['cp'],$_POST['st'],$cr); if($llista['estat'] == "1"){ $sql_query="SELECT * FROM Vals_Descompte WHERE Codi = '".$_POST['cp']."'"; $info=$Funcions->queryToArray($sql_query); if($info[0]['Codi']){ $Id_Val=$info[0]['Id_Val']; $Codi=$info[0]['Codi']; $Descompte=$llista['descompte']; } } } if($_POST['metode_pagament'] == "paypal"){ $Total_Previ = $Subtotal + $Preu_Regal + $Enviament - $Descompte; //$Pagament = sprintf("%.2f",$Total_Previ/100*3.4+0.35); $Pagament = 0; } $Total=$Subtotal + $Preu_Regal + $Enviament + $Pagament - $Descompte; if($Total<0) $Total=0; $Id_Reserva=$Funcions->generarNumeroReserva(); if($Total=="0"){ $_POST['metode_pagament']="gratis"; } $Data_Reserva=date("Y-m-d H:i:s"); $sql_query="INSERT INTO Reserves (Id_Reserva,Data_Reserva,Id_Client,Id_Val,Codi,Regal,Metode_Pagament,Preu_Subtotal,Preu_Regal,Preu_Enviament,Preu_Pagament,Preu_Descompte,Preu_Total,Estat_Pagament,Comissio,Targeta_Regal) VALUES ('".$Id_Reserva."','".$Data_Reserva."','$Id_Client','$Id_Val','$Codi','$Regal','".$_POST['metode_pagament']."','$Subtotal','$Preu_Regal','$Enviament','$Pagament','$Descompte','$Total','0','$Suma_Comissio','$Targeta_Regal'); "; mysql_query($sql_query); //$Id_Reserva=mysql_insert_id(); if($Id_Reserva){ //guardem informació assistents foreach($_POST AS $key => $value){ if(substr($key,0,10) == "Assistent_"){ $Nom=addslashes($value); list($Assistent,$Id_Preu,$Num) = explode("_",$key); mysql_query("INSERT INTO Reserves_Assistents (Id_Reserva,Id_Preu,Nom) VALUES ('$Id_Reserva','$Id_Preu','$Nom');"); echo mysql_error(); } } if(!$Targeta_Regal){ //guardem informació activitats for($i=0;$ireservaPagada($Id_Reserva); $enc=md5($Id_Reserva.$Data_Reserva); $UrlRetorn="https://".$_SERVER['SERVER_NAME']."/".$idioma."/".$Traduccio[$idioma]['directori']['tpv']."/".$enc; if($_POST['metode_pagament'] == "paypal"){ require_once('includes/paypal.class.php'); // include the class file $p = new paypal_class; // initiate an instance of the class $p->paypal_url = $Config_Paypal['url']; // paypal url //$p->paypal_url = 'https://www.paypal.com/cgi-bin/webscr'; // paypal url $p->add_field('business', $Config_Paypal['email']); $p->add_field('return', $UrlRetorn); $p->add_field('cancel_return', $UrlRetorn); $p->add_field('notify_url', 'https://'.$_SERVER['SERVER_NAME'].'/paypal.php'); $p->add_field('currency_code', "EUR"); $p->add_field('item_name', 'Reserva '.$Id_Reserva); $p->add_field('amount', $Total); //for($i=0;$iadd_field('item_name_'.$i, $caixes_paypal[$i]['nom']); // $p->add_field('amount_'.$i, $caixes_paypal[$i]['preu']); //} $p->submit_paypal_post(); // submit the fields to paypal exit; } if($_POST['metode_pagament'] == "gratis" && $Total == "0"){ $Funcions->reservaPagada($Id_Reserva); header("Location: ".$UrlRetorn); exit; }else{ $id_pagament=time(); mysql_query("INSERT INTO Pagaments_Tpv VALUES ('$id_pagament','$Id_Reserva','".time()."','0','','$Total','0');"); $import=$Total*100; //TPV SHA-256 include_once("includes/apiRedsys.php"); $miObj = new RedsysAPI; $miObj->setParameter("DS_MERCHANT_AMOUNT",$import); $miObj->setParameter("DS_MERCHANT_ORDER",strval($id_pagament)); $miObj->setParameter("DS_MERCHANT_MERCHANTCODE",$Config_Tpv['code']); $miObj->setParameter("DS_MERCHANT_CURRENCY",$Config_Tpv['currency']); $miObj->setParameter("DS_MERCHANT_TRANSACTIONTYPE",$Config_Tpv['tipo_operacion']); $miObj->setParameter("DS_MERCHANT_TERMINAL",$Config_Tpv['terminal']); $miObj->setParameter("DS_MERCHANT_MERCHANTURL",$Config_Tpv['urlMerchant']); $miObj->setParameter("DS_MERCHANT_URLOK",$UrlRetorn); $miObj->setParameter("DS_MERCHANT_URLKO",$UrlRetorn); $json = $miObj->arrayToJson(); $version="HMAC_SHA256_V1"; $kc = $Config_Tpv['clave'];//Clave recuperada de CANALES $request = ""; $params = $miObj->createMerchantParameters(); $signature = $miObj->createMerchantSignature($kc); //Fi TPV SHA256 $Config_Tpv['signatura']= $signature; $Config_Tpv['params']= $params; $variables_fixes[] = "Config_Tpv"; } //$Funcions->reservaPagada($Id_Reserva); $smarty = new Smarty; $smarty->template_dir = WEB_PATH."templates/web/"; for($i=0;$iassign($variables_fixes[$i],$$variables_fixes[$i]); } $smarty->assign("Traduccio",$Traduccio[$idioma]); $smarty->assign("UrlRetorn",$UrlRetorn); $smarty->assign("Tipus_Pagament","tpv"); $smarty->assign("Camps",""); $web_content = $smarty->fetch("templates/web/pagament_redireccionant.htm"); } echo $web_content; exit; } //Tarjeta regalo if($_REQUEST['dos'] == $Traduccio[$idioma]['directori']['tarjeta-regalo'].".php" && !isset($_REQUEST['tres'])){ $Funcions->funcioComprarTargetaRegal(); } //Regala activitat if($_REQUEST['dos'] == $Traduccio[$idioma]['directori']['regalar-actividad'].".php" && !isset($_REQUEST['tres'])){ $smarty = new Smarty; $smarty->template_dir = WEB_PATH."templates/web/"; for($i=0;$iassign($variables_fixes[$i],$$variables_fixes[$i]); } $smarty->assign("Traduccio",$Traduccio[$idioma]); $web_content = $smarty->fetch("templates/web/regalar_activitat.htm"); echo $web_content; exit; } //Ofertas if($_REQUEST['dos'] == $Traduccio[$idioma]['directori']['ofertas'].".php" && !isset($_REQUEST['tres'])){ /*** filtres ***/ $parts=parse_url("https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']); if(isset($parts['query'])) parse_str($parts['query'], $_REQUEST); /*paginacio*/ $pagina_actual=(isset($_REQUEST['pag'])) ? $_REQUEST['pag'] : 1; $sql_query_llista="SELECT info.*,tradu.*,m.Municipi,p.Provincia,proveidor.Nom AS Proveidor, tipus_tradu.Nom AS Tipus_Activitat,tipus_tradu.Url_Amigable AS Tipus_Activitat_Url_Amigable, categoria.Nom AS Categoria,categoria.Url_Amigable AS Categoria_Url_Amigable, info_preu.Preu_Final,info_preu.Descompte,info_preu.Preu FROM Activitats AS info LEFT JOIN Activitats_Tipus AS tipus_activitat ON info.Id_Activitat = tipus_activitat.Id_Activitat LEFT JOIN Activitats_Traduccio AS tradu ON tradu.Id_Activitat = info.Id_Activitat AND tradu.Id_Idioma_Traduccio = ".$Id_Idioma_Actual." LEFT JOIN Tipus_Activitats AS tipus ON tipus.Id_Tipus_Activitat = tipus_activitat.Id_Tipus_Activitat LEFT JOIN Tipus_Activitats_Traduccio AS tipus_tradu ON tipus_tradu.Id_Tipus_Activitat = tipus_activitat.Id_Tipus_Activitat LEFT JOIN Categories_Traduccio AS categoria ON categoria.Id_Categoria = tipus.Id_Categoria LEFT JOIN Municipis AS m ON m.Id_Municipi = info.Id_Municipi LEFT JOIN Provincies AS p ON m.Id_Provincia = p.Id_Provincia LEFT JOIN Proveidors AS proveidor ON proveidor.Id_Proveidor = info.Id_Proveidor AND proveidor.Visible = 1 LEFT JOIN Activitats_Preus AS info_preu ON info_preu.Id_Activitat = info.Id_Activitat AND info_preu.Descompte > 0 LEFT JOIN Activitats_Preus_Traduccio AS tradu_preu ON tradu_preu.Id_Preu = info_preu.Id_Preu AND tradu_preu.Id_Idioma_Traduccio = ".$Id_Idioma_Actual." WHERE info.Estat = 1 AND info_preu.Descompte > 0 GROUP BY info_preu.Id_Activitat ORDER BY info.Destacada DESC, info.Comissio DESC, info.Id_Activitat DESC"; $ListaCompleta=$Funcions->queryToArray($sql_query_llista); $total_registres=count($ListaCompleta); if(!$ListaCompleta[0]['Id_Activitat']){ $total_registres=0; } $num_x_pagina=15; $pagina_seguent=0; $pagina_anterior=0; $total_pagines=($total_registres%$num_x_pagina == 0) ? $total_registres/$num_x_pagina : intval($total_registres/$num_x_pagina)+1; if($total_pagines>1 && $pagina_actual > $total_pagines){ $Funcions->mostraPagina404($Id_Idioma_Actual); exit; } if($pagina_actual>1){ $pagina_anterior=$pagina_actual-1; } if($pagina_actual < $total_pagines){ $pagina_seguent=$pagina_actual+1; } $resultat_inici=($pagina_actual-1)*$num_x_pagina+1; /*****************/ $sql_query="SELECT info.*,tradu.*,m.Municipi,p.Provincia,proveidor.Nom AS Proveidor, tipus_tradu.Nom AS Tipus_Activitat,tipus_tradu.Url_Amigable AS Tipus_Activitat_Url_Amigable, categoria.Nom AS Categoria,categoria.Url_Amigable AS Categoria_Url_Amigable, info_preu.Preu_Final,info_preu.Descompte,info_preu.Preu FROM Activitats AS info LEFT JOIN Activitats_Tipus AS tipus_activitat ON info.Id_Activitat = tipus_activitat.Id_Activitat LEFT JOIN Activitats_Traduccio AS tradu ON tradu.Id_Activitat = info.Id_Activitat AND tradu.Id_Idioma_Traduccio = ".$Id_Idioma_Actual." LEFT JOIN Tipus_Activitats AS tipus ON tipus.Id_Tipus_Activitat = tipus_activitat.Id_Tipus_Activitat LEFT JOIN Tipus_Activitats_Traduccio AS tipus_tradu ON tipus_tradu.Id_Tipus_Activitat = tipus_activitat.Id_Tipus_Activitat LEFT JOIN Categories_Traduccio AS categoria ON categoria.Id_Categoria = tipus.Id_Categoria LEFT JOIN Municipis AS m ON m.Id_Municipi = info.Id_Municipi LEFT JOIN Provincies AS p ON m.Id_Provincia = p.Id_Provincia LEFT JOIN Proveidors AS proveidor ON proveidor.Id_Proveidor = info.Id_Proveidor AND proveidor.Visible = 1 LEFT JOIN Activitats_Preus AS info_preu ON info_preu.Id_Activitat = info.Id_Activitat AND info_preu.Descompte > 0 LEFT JOIN Activitats_Preus_Traduccio AS tradu_preu ON tradu_preu.Id_Preu = info_preu.Id_Preu AND tradu_preu.Id_Idioma_Traduccio = ".$Id_Idioma_Actual." WHERE info.Estat = 1 AND info_preu.Descompte > 0 GROUP BY info_preu.Id_Activitat ORDER BY info.Destacada DESC, info.Comissio DESC, info.Id_Activitat DESC"; $sql_query=$sql_query_llista." LIMIT ".($pagina_actual-1)*$num_x_pagina.",$num_x_pagina"; $Activitats=$Funcions->queryToArray($sql_query); $resultat_final=$resultat_inici+count($Activitats)-1; $resultat_mostrant=count($Activitats); if($Activitats[0]['Id_Activitat']){ for($i=0;$ifotoPrincipalActivitat($Activitats[$i]['Id_Activitat']); $Activitats[$i]['Total_Fotos'] = $Funcions->totalFotosActivitat($Activitats[$i]['Id_Activitat']); $Activitats[$i]['Total_Videos'] = $Funcions->totalVideosActivitat($Activitats[$i]['Id_Activitat']); $Activitats[$i]['Total_Opinions'] = $Funcions->totalOpinionsActivitat($Activitats[$i]['Id_Activitat']); $Activitats[$i]['Valoracio'] = $Funcions->valoracioActivitat($Activitats[$i]['Id_Activitat']); $Activitats[$i]['Valoracio_Nom'] = $Funcions->nomValoracio($Activitats[$i]['Valoracio']); $sql_query="SELECT * FROM Activitats_Fotos WHERE Id_Activitat = ".$Activitats[$i]['Id_Activitat']; $Activitats[$i]['Fotos'] = $Funcions->queryToArray($sql_query); } } $smarty = new Smarty; $smarty->template_dir = WEB_PATH."templates/web/"; for($i=0;$iassign($variables_fixes[$i],$$variables_fixes[$i]); } $smarty->assign("Traduccio",$Traduccio[$idioma]); $smarty->assign("Activitats",$Activitats); $smarty->assign("ofertes",1); $smarty->assign("pagina_actual",$pagina_actual); $smarty->assign("total_pagines",$total_pagines); $smarty->assign("pagina_anterior",$pagina_anterior); $smarty->assign("pagina_seguent",$pagina_seguent); $smarty->assign("resultat_inici",$resultat_inici); $smarty->assign("resultat_final",$resultat_final); $smarty->assign("resultat_mostrant",$resultat_mostrant); $smarty->assign("resultat_mostrant",$resultat_mostrant); $smarty->assign("total_registres",$total_registres); $web_content = $smarty->fetch("templates/web/ofertes.htm"); echo $web_content; exit; } //Quiénes somos if($_REQUEST['dos'] == $Traduccio[$idioma]['directori']['quienes-somos'].".php" && !isset($_REQUEST['tres'])){ $smarty = new Smarty; $smarty->template_dir = WEB_PATH."templates/web/"; for($i=0;$iassign($variables_fixes[$i],$$variables_fixes[$i]); } $smarty->assign("Traduccio",$Traduccio[$idioma]); $web_content = $smarty->fetch("templates/web/quienes_somos.htm"); echo $web_content; exit; } //Privacidad if($_REQUEST['dos'] == $Traduccio[$idioma]['directori']['cookies'].".php" && !isset($_REQUEST['tres'])){ $smarty = new Smarty; $smarty->template_dir = WEB_PATH."templates/web/"; for($i=0;$iassign($variables_fixes[$i],$$variables_fixes[$i]); } $smarty->assign("Traduccio",$Traduccio[$idioma]); $web_content = $smarty->fetch("templates/web/cookies.htm"); echo $web_content; exit; } //Condiciones if($_REQUEST['dos'] == $Traduccio[$idioma]['directori']['condiciones'].".php" && !isset($_REQUEST['tres'])){ $smarty = new Smarty; $smarty->template_dir = WEB_PATH."templates/web/"; for($i=0;$iassign($variables_fixes[$i],$$variables_fixes[$i]); } $smarty->assign("Traduccio",$Traduccio[$idioma]); $web_content = $smarty->fetch("templates/web/condiciones.htm"); echo $web_content; exit; } //publicar if($_REQUEST['dos'] == $Traduccio[$idioma]['directori']['publicar'].".php" && !isset($_REQUEST['tres'])){ $enviado=0; if(isset($_POST['accio']) && $_POST['accio'] == "enviar"){ if($_POST['Persona_Contacto'] && $_POST['Empresa'] && $_POST['Email'] && $_POST['Telefono'] && $_POST['Web'] && $_POST['Asunto'] && $_POST['Comentarios']){ $smarty = new Smarty; $smarty->template_dir = WEB_PATH."templates/web/"; $smarty->assign("Datos",$_POST); $msg = $smarty->fetch("templates/emails/contacto_publicar.htm"); $mail = new PHPMailer(); $mail->From = utf8_decode($_POST['Email']); $mail->FromName = utf8_decode($_POST['Empresa']); $mail->Subject = utf8_decode("Formulario de contacto PUBLICAR ACTIVIDADES GRATIS"); $mail->AddEmbeddedImage('img/logo-mailing.png', 'logo'); $mail->AddEmbeddedImage('img/bk-menu.png', 'fonsmenu'); $mail->MsgHTML(utf8_decode($msg)); $mail->AddAddress("info@activiclick.com"); $mail->Send(); $enviado=1; } } $smarty = new Smarty; $smarty->template_dir = WEB_PATH."templates/web/"; for($i=0;$iassign($variables_fixes[$i],$$variables_fixes[$i]); } $smarty->assign("Traduccio",$Traduccio[$idioma]); $smarty->assign("enviado",$enviado); $web_content = $smarty->fetch("templates/web/publicar.htm"); echo $web_content; exit; } //caja regalo if($_REQUEST['dos'] == $Traduccio[$idioma]['directori']['caja-regalo'].".php" && !isset($_REQUEST['tres'])){ $smarty = new Smarty; $smarty->template_dir = WEB_PATH."templates/web/"; for($i=0;$iassign($variables_fixes[$i],$$variables_fixes[$i]); } $smarty->assign("Traduccio",$Traduccio[$idioma]); $web_content = $smarty->fetch("templates/web/caja_regalo.htm"); echo $web_content; exit; } //Pàgina de retorn TPV if($_REQUEST['dos'] == $Traduccio[$idioma]['directori']['tpv'] && isset($_REQUEST['tres']) && strlen($_REQUEST['tres']) == 32){ $sql_query="SELECT * FROM Reserves AS r LEFT JOIN Clients AS c ON r.Id_Client = c.Id_Client WHERE MD5(CONCAT(r.Id_Reserva,r.Data_Reserva)) = '".$_REQUEST['tres']."'"; $Reserva=$Funcions->queryToArray($sql_query); if($Reserva[0]['Id_Reserva']){ if(isset($_POST['accio']) && $_POST['accio']=="pago"){ $Data_Reserva=time(); $Total=$Reserva[0]['Preu_Total']; $Id_Reserva=$Reserva[0]['Id_Reserva']; $enc=md5($Id_Reserva.$Reserva[0]['Data_Reserva']); $UrlRetorn="https://".$_SERVER['SERVER_NAME']."/".$idioma."/".$Traduccio[$idioma]['directori']['tpv']."/".$enc; if($Reserva[0]['Metode_Pagament'] == "paypal"){ require_once('includes/paypal.class.php'); // include the class file $p = new paypal_class; // initiate an instance of the class $p->paypal_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr'; // paypal url //$p->paypal_url = 'https://www.paypal.com/cgi-bin/webscr'; // paypal url $p->add_field('business', 'business@spacebits.es'); $p->add_field('return', $UrlRetorn); $p->add_field('cancel_return', $UrlRetorn); $p->add_field('notify_url', 'https://'.$_SERVER['SERVER_NAME'].'/paypal.php'); $p->add_field('currency_code', "EUR"); $p->add_field('item_name', 'Reserva '.$Id_Reserva); $p->add_field('amount', $Total); //for($i=0;$iadd_field('item_name_'.$i, $caixes_paypal[$i]['nom']); // $p->add_field('amount_'.$i, $caixes_paypal[$i]['preu']); //} $p->submit_paypal_post(); // submit the fields to paypal exit; }else{ $id_pagament=time(); mysql_query("INSERT INTO Pagaments_Tpv VALUES ('$id_pagament','$Id_Reserva','".time()."','0','','$Total','0');"); $import=$Total*100; $message = $import.$id_pagament.$Config_Tpv['code'].$Config_Tpv['currency'].$Config_Tpv['tipo_operacion'].$Config_Tpv['urlMerchant'].$Config_Tpv['clave']; $res = mysql_query("SELECT SHA1('$message');"); $signature=mysql_result($res,0,0); $Config_Tpv['urlOK'] = $UrlRetorn; $Config_Tpv['urlKO'] = $UrlRetorn; $Config_Tpv['Import'] = $import; $Config_Tpv['Id'] = $id_pagament; $Config_Tpv['signatura']= $signature; $variables_fixes[] = "Config_Tpv"; } $Facebook_Pixel = "InitiateCheckout"; $google_event="1"; $google_event_category="Reserva"; $google_event_action="Tpv"; //$Funcions->reservaPagada($Id_Reserva); $smarty = new Smarty; $smarty->template_dir = WEB_PATH."templates/web/"; for($i=0;$iassign($variables_fixes[$i],$$variables_fixes[$i]); } $smarty->assign("Traduccio",$Traduccio[$idioma]); $smarty->assign("UrlRetorn",$UrlRetorn); $smarty->assign("Tipus_Pagament","tpv"); $smarty->assign("Camps",""); $web_content = $smarty->fetch("templates/web/pagament_redireccionant.htm"); echo $web_content; exit; } $sql_query="SELECT * FROM Clients WHERE Id_Client = ".$Reserva[0]['Id_Client']; $Client=$Funcions->queryToArray($sql_query); if($Reserva[0]['Estat_Pagament'] == "1"){ $Facebook_Pixel = "Purchase"; $google_event="1"; $google_event_category="Reserva"; $google_event_action="Ok"; $google_event_value=$Reserva[0]['Preu_Total']; }else{ $google_event="1"; $google_event_category="Reserva"; $google_event_action="Ko"; $google_event_value=$Reserva[0]['Preu_Total']; } $smarty = new Smarty; $smarty->template_dir = WEB_PATH."templates/web/"; for($i=0;$iassign($variables_fixes[$i],$$variables_fixes[$i]); } $smarty->assign("Traduccio",$Traduccio[$idioma]); $smarty->assign("Client",$Client[0]); $smarty->assign("Reserva",$Reserva[0]); if($Reserva[0]['Estat_Pagament'] == "1"){ $web_content = $smarty->fetch("templates/web/reserva_ok.htm"); }else{ $web_content = $smarty->fetch("templates/web/reserva_ko.htm"); } echo $web_content; exit; }else{ $Funcions->mostraPagina404($Id_Idioma_Actual); } } /**************************** BUTLLETINS **************************************************/ //Butlletins if($_REQUEST['dos'] == $Traduccio[$idioma]['directori']['boletin'] && !isset($_REQUEST['tres'])){ $sql_query="SELECT * FROM Provincies ORDER BY Provincia ASC"; $Provincies=$Funcions->queryToArray($sql_query); $msg=""; $Origen=""; if(isset($_POST['accio'])){ $landing=0; if($_POST['accio']=="afegir" && $_POST['email']){ $sql_query="SELECT * FROM Butlletins_Subscrits WHERE Email = '".$_POST['email']."'"; $Subscrit=$Funcions->queryToArray($sql_query); if($Subscrit[0]['Email']){ if($Subscrit[0]['Confirmat'] == "1") $msg = 3; else{ $Data_Alta=$Subscrit[0]['Data_Alta']; $Email=$Subscrit[0]['Email']; $msg = 1; } }else{ $Data_Alta=time(); $Email=$_POST['email']; $Origen='home'; if(isset($_POST['origen_landing']) && $_POST['origen_landing'] == "1"){ $Origen='landing'; } mysql_query("INSERT INTO Butlletins_Subscrits (Email,Id_Provincia,Id_Idioma,Data_Alta,Confirmat,Origen) VALUES ('".$_POST['email']."','0','$Id_Idioma_Actual','".time()."','0','$Origen');"); $msg=2; } if($msg == "1" || $msg == "2"){ $enc=md5($Email.$Data_Alta); $Url="https://".$_SERVER['SERVER_NAME']."/".$idioma."/".$Traduccio[$idioma]['directori']['boletin']."/".$Traduccio[$idioma]['directori']['alta_boletin'].$enc; $smarty = new Smarty; $smarty->template_dir = WEB_PATH."templates/emails/"; foreach($_POST AS $camp => $valor){ $smarty->assign($camp,$valor); } $smarty->assign("Url",$Url); $mail_content = $smarty->fetch("templates/emails/confirmacio_alta_boletin.htm"); $mail = new PHPMailer(); $mail->From = "info@activiclick.com"; $mail->FromName = utf8_decode("ACTIVIclick"); $mail->Subject = utf8_decode($Traduccio[$idioma]['subjects']['confirmacio_alta_boletin']); $mail->MsgHTML(utf8_decode($mail_content)); $mail->AddAddress($_POST['email']); $mail->AddEmbeddedImage('img/logo-mailing.png', 'logo'); $mail->AddEmbeddedImage('img/bk-menu.png', 'fonsmenu'); $mail->Send(); } } } $variables_fixes[] = "msg"; $variables_fixes[] = "Provincies"; $variables_fixes[] = "Origen"; $smarty = new Smarty; $smarty->template_dir = WEB_PATH."templates/web/"; $smarty->assign("Traduccio",$Traduccio[$idioma]); for($i=0;$iassign($variables_fixes[$i],$$variables_fixes[$i]); } $web_content = $smarty->fetch("templates/web/butlletins.htm"); echo $web_content; exit; } //Confirmació alta butlletí //Butlletins if($_REQUEST['dos'] == $Traduccio[$idioma]['directori']['boletin'] && isset($_REQUEST['tres']) && substr($_REQUEST['tres'],0,strlen($Traduccio[$idioma]['directori']['alta_boletin'])) == $Traduccio[$idioma]['directori']['alta_boletin']) { $Codi=substr($_REQUEST['tres'],-32); if(strlen($Codi) < 32){ $Funcions->mostraPagina404($Id_Idioma_Actual); exit; } $sql_query="SELECT * FROM Butlletins_Subscrits WHERE MD5(CONCAT(Email,Data_Alta)) = '$Codi' AND Confirmat = 0"; $Info=$Funcions->queryToArray($sql_query); if(!$Info[0]['Email']){ $Funcions->mostraPagina404($Id_Idioma_Actual); exit; } $Origen=$Info[0]['Origen']; mysql_query("UPDATE Butlletins_Subscrits SET Confirmat = 1 WHERE MD5(CONCAT(Email,Data_Alta)) = '$Codi' AND Confirmat = 0"); $variables_fixes[] = "Origen"; if($Origen == "landing"){ do{ $Codi=strtoupper(date("Y").$Funcions->generateRandomString(6)); $sql_query="SELECT * FROM Vals_Descompte WHERE Codi = '".$Codi."'"; $Val=$Funcions->queryToArray($sql_query); }while($Val[0]['Id_Val']); $Descripcio="Alta newsletter des de landing page (email ".$Info[0]['Email'].")"; mysql_query("INSERT INTO Vals_Descompte VALUES ('','$Codi','$Descripcio','1','0','1','0','1','percentatge','subtotal','5','');"); $smarty = new Smarty; $smarty->template_dir = WEB_PATH."templates/emails/"; $smarty->assign("Codi",$Codi); $msg = $smarty->fetch("templates/emails/cupon_descuento.htm"); $mail = new PHPMailer(); $mail->From = "info@activiclick.com"; $mail->FromName = utf8_decode("ACTIVIclick"); $mail->Subject = utf8_decode($Traduccio[$idioma]['subjects']['cupon_descuento']); $mail->AddEmbeddedImage('img/logo-mailing.png', 'logo'); $mail->AddEmbeddedImage('img/bk-menu.png', 'fonsmenu'); $mail->MsgHTML(utf8_decode($msg)); $mail->AddAddress($Info[0]['Email']); $mail->Send(); } $Facebook_Pixel = "Lead"; $google_event="1"; $google_event_category="Newsletter"; $google_event_action="Confirmar"; $smarty = new Smarty; $smarty->template_dir = WEB_PATH."templates/web/"; $smarty->assign("Traduccio",$Traduccio[$idioma]); for($i=0;$iassign($variables_fixes[$i],$$variables_fixes[$i]); } $web_content = $smarty->fetch("templates/web/butlletins_alta_confirmada.htm"); echo $web_content; exit; } //Baja boletin if($_REQUEST['dos'] == $Traduccio[$idioma]['directori']['boletin'] && isset($_REQUEST['tres']) && substr($_REQUEST['tres'],0,strlen($Traduccio[$idioma]['directori']['baja_boletin'])) == $Traduccio[$idioma]['directori']['baja_boletin']) { $Codi=substr($_REQUEST['tres'],-32); if(strlen($Codi) < 32){ $Funcions->mostraPagina404($Id_Idioma_Actual); exit; } $sql_query="SELECT * FROM Butlletins_Subscrits WHERE MD5(CONCAT(Email,Data_Alta)) = '$Codi' AND Confirmat = 1"; $Info=$Funcions->queryToArray($sql_query); if(!$Info[0]['Email']){ $Funcions->mostraPagina404($Id_Idioma_Actual); exit; } mysql_query("DELETE FROM Butlletins_Subscrits WHERE MD5(CONCAT(Email,Data_Alta)) = '$Codi' AND Confirmat = 1"); $smarty = new Smarty; $smarty->template_dir = WEB_PATH."templates/web/"; $smarty->assign("Traduccio",$Traduccio[$idioma]); for($i=0;$iassign($variables_fixes[$i],$$variables_fixes[$i]); } $web_content = $smarty->fetch("templates/web/butlletins_baja_confirmada.htm"); echo $web_content; exit; } $Funcions->mostraPagina404($Id_Idioma_Actual); exit; ?>