'; $nome_sito = ' '.$sito; }else{ $style = ''; $nome_sito = ''; } /* * suppongo che la lingua principale sia l'italiano --> id_lingua = 1 */ if ( is_null($id_lingua) || strlen($id_lingua)<=0 || $id_lingua == '' ){ $id_lingua = 1; } if ( is_null($id) || strlen($id)<=0 || $id == '' ){ $id = 0; } if ( is_null($id_padre) || strlen($id_padre)<=0 || $id_padre == '' ){ $id_padre = 0; } switch ($act){ case 'login': $result = login_utente(trim($_REQUEST['user']),trim($_REQUEST['password'])); $_SESSION['id_utente'] = $result['id_utente']; $_SESSION['logged'] = $result['logged']; break; case 'invia_contatti': $risultato = invia_contatti(); break; case 'logout': $_SESSION['id_utente'] = 0; $_SESSION['logged'] = -1; break; } /* * controllo se la sezione è protetta */ $sql = "SELECT tipo FROM tb_dati WHERE codice=".$id.";"; $rs = mysql_query($sql) or die(mysql_error()); $arr = mysql_fetch_array($rs); mysql_free_result($rs); if ( $arr['tipo'] == 'P' ){ $codice_controllo = trova_padre($id); }else{ $codice_controllo = $id; } $controllo_sezione = controllo_sezione($codice_controllo); /* * se la sezione è protetta e l'utente NON ha già effettuato un login --> lo rimando al login * se la sezione è protetta e l'utente ha già effettuato un login --> controllo che sia abilitato a vederla */ if ( $controllo_sezione && $_SESSION['logged'] == 1 ){ $controllo_utente = controllo_utente($_SESSION['id_utente'],$id_padre); if ( !$controllo_utente ){ $opt = 'login'; } }elseif ( $controllo_sezione && $_SESSION['logged'] != 1 ){ $opt = 'login'; } /* * trovo i meta tag */ $meta = trova_meta($id); $title = $nome_sito.' - '.$meta['title']; $description = 'Gruppo Geo S.r.l. - '.$meta['description']; $keywords = $meta['keywords']; ?> <?=$title?>

'.$sql.'
'; $rs = mysql_query($sql) or die(mysql_error()); while ( $arr = mysql_fetch_array($rs) ){ $nome = stripslashes($arr['nome']); $codice = $arr['codice']; $testo.= '
  • '.$nome.'
  • '; } mysql_free_result($rs); $immagine = ''; $immagine = immagini($id,'',$titolo); if ( strlen(trim($immagine)) > 0 ){ $immagine.= '

    '; } $html_code = '
    '.$titolo.'

    '.$immagine.'
      '.$testo.'
    '; echo $html_code; break; */ case 'articolo': $content = ''; $html_code = ''; $html_code_art = ''; $html_code_all = ''; if ( $id_sito == 2 ){ $id = trova_figlio($id); } /* * nome articolo */ $titolo = titolo($id,$id_lingua); /* * contenuto file html */ $sql = "SELECT file_html FROM tb_pagine WHERE codice=".$id." AND id_lingua=".$id_lingua." AND id_sito=".$id_sito.";"; $rs = mysql_query($sql) or die(mysql_error()); $arr = mysql_fetch_array($rs); $file_html = $arr['file_html']; mysql_free_result($rs); $path = '/pagine/'.$file_html; if ( file_exists($path) ){ $handle = fopen($path,'r'); $content = fread($handle,filesize($path)); $content = trim($content); fclose($handle); /* * cerco di sostituire tutti i colori con #ffffff */ if ( strlen($content) > 0 ){ $content = colori_testo($content); } } /* * allegati */ $sql = "SELECT file,titolo FROM tb_allegati WHERE codice=".$id.";"; $rs = mysql_query($sql) or die(mysql_error()); while($arr = mysql_fetch_array($rs)){ $html_code_all.= ''.stripslashes(trim($arr['titolo'])).'
    '; } mysql_free_result($rs); if ( strlen($html_code_all) > 0 ){ $html_code_all = '
    Scarica allegati:

    '.$html_code_all; } /* * articoli della stessa sezione */ if ( $id_sito != 2 ){ $sql = "SELECT tipo FROM tb_dati WHERE codice=".$id.";"; $rs = mysql_query($sql) or die(mysql_error()); $arr = mysql_fetch_array($rs); mysql_free_result($rs); if ( $arr['tipo'] == 'P' ){ $codicePadre = trova_padre($id); }else{ $codicePadre = $id; } $sql = "SELECT da.codice,nome FROM tb_dati da, tb_descrizioni de WHERE da.codice = de.codice AND da.id_sito = de.id_sito AND "; $sql.= "codicePadre = ".$codicePadre." AND de.attivo = 1 AND de.id_sito=".$id_sito." AND id_lingua=".$id_lingua." ORDER BY de.ordine;"; $rs = mysql_query($sql) or die(mysql_error()); while ( $arr = mysql_fetch_array($rs) ){ $nome = stripslashes($arr['nome']); $codice = $arr['codice']; $html_code_art.= ' '.$nome.' | '; } mysql_free_result($rs); if ( strlen($html_code_art) > 0 ){ $html_code_art = substr($html_code_art,0,strlen($html_code_art)-strlen(' | ')); } } /* * output $html_code = '
    '.$titolo.'

    '.$content.'

    '.$html_code_all.'
    '.$html_code_art.' '; */ $html_code = $content.'

    '.$html_code_all.'
    '.$html_code_art.' '; echo $html_code; break; default: /* $pagina = 'home_'.$id_lingua.'_'.$id_sito.'.html'; $sql = "SELECT contenuto FROM tb_pagine WHERE id_lingua='".$id_lingua."' AND file_html='".$pagina."';"; $rs = mysql_query($sql) or die(mysql_error()); $num = (int)mysql_num_rows($rs); $arr = mysql_fetch_array($rs); mysql_free_result($rs); if ( $num > 0 ){ echo $arr['contenuto']; } */ require_once('/agenzia_immobiliare/mappa_sito.html'); } ?>