define( "DATABASE", $database_connectDb ); define( "EXPIRE", 14400 ); define( "COOKIE_NAME", "private_".DATABASE ); define( "COOKIE_NAME_PRIVATE", "private_".DATABASE."_registered" ); if($action=="logout"){ setcookie(COOKIE_NAME, '', time() - 3600, '/'); setcookie(COOKIE_NAME_PRIVATE, '', time() - 3600, '/'); header ("Location: ".getUrl(array("action"),$currentPage,0)); exit; } //Utenti Registrati $tabella="utente"; $cookieName=COOKIE_NAME; $isLogged = getIsLogged($tabella, $cookieName); if($isLogged){ $tmp=explode("-", $_COOKIE[$cookieName]); $idLogged = loadFromDbSimple("id",$tabella,"utente='".$tmp[0]."'",""); $nameLogged = getNmLogged($tabella, $idLogged); } //Utenti Area Privata $tabella="utente_privato"; $cookieName=COOKIE_NAME_PRIVATE; $isLoggedPrivate = getIsLogged($tabella, $cookieName); if($isLoggedPrivate){ $tmp=explode("-", $_COOKIE[$cookieName]); $idLoggedPrivate = loadFromDbSimple("id",$tabella,"utente='".$tmp[0]."'",""); $nameLogged = getNmLogged($tabella, $idLoggedPrivate); } function getNmLogged($tabella, $idLogged) { $tmp=getCampoNome($tabella); $isCognome=($tmp=="cognome"); if($isCognome) $tmp.=",nome"; loadFromDbSimple($tmp,$tabella,"id='".$idLogged."'","tmp"); if($isCognome) { global $tmp_cognome; global $tmp_nome; $nameLogged=$tmp_cognome." ".$tmp_nome; } else { global ${"tmp_".$tmp}; $nameLogged=${"tmp_".$tmp}; } return $nameLogged; } function getIsLogged($tabella, $cookieName) { $cookie_var = explode("-", $_COOKIE[$cookieName]); $utente = $cookie_var[0]; $password = $cookie_var[1]; $result = "select password, 1 as auth from ".$tabella." where utente='".$utente."' and password='".$password."' and is_attivo=1"; $row = mysql_fetch_array(mysql_query( $result )); $isLogged = ($row[auth]); if(!$isLogged) $isLogged = checkCookie($tabella, $cookieName); return $isLogged; } function checkCookie($tabella, $cookieName){ if (isset($_POST['utente']) && (($_POST[nmForm]=="login" && $tabella=="utente") || ($_POST[nmForm]=="login_area_privata" && $tabella=="utente_privato"))){ $utente=$_POST['utente']; $password=$_POST['password']; return AuthenticateUser ( $utente, $password, $tabella, $cookieName ); } } function GenerateSecret($utente, $encrypted_password, $tabella, $cookieName) { $cookie_val = "$utente-$encrypted_password"; setcookie($cookieName, $cookie_val, time()+EXPIRE, '/'); $data = date('YmdHi'); $query = "update ".$tabella." set data_ultimo_accesso='".$data."' where utente='".$utente."' and password='".$encrypted_password."' and is_attivo=1"; mysql_query( $query ); global $currentPage; header ("Location: ".getUrl(array("action"),$currentPage,0)); exit; } function AuthenticateUser($utente, $password, $tabella, $cookieName) { $appoggio=md5("$password"."$utente"); $utente=strip_tags(trim($utente)); $utente = ereg_replace('=', '', $utente); $utente = ereg_replace(' or', ' ', $utente); $utente = ereg_replace('or ', ' ', $utente); $utente = ereg_replace('and ', ' ', $utente); $utente = ereg_replace(' and', ' ', $utente); //$utente = ereg_replace(' ', '', $utente); $arg = "select password, 1 as auth from ".$tabella." where utente='".$utente."' and password='".$appoggio."' and is_attivo=1"; $row = mysql_fetch_array(mysql_query( $arg )); if ($row[auth]) GenerateSecret( $utente, $row[password], $tabella, $cookieName ); return $row[auth]; } ?>
Next to Coghinas‘ river is Badesi marina with its 8 Km long beach. Close to the beach is a charming small village set on a hill along the cost which links Castelsardo, a famous ancient town and Santa Teresa di Gallura one of the most renown touristic location of the area.
For the countryside lovers very close to Badesi there is a typical Sardinian village called Aggius and the fantastic moon valley, a must of the area. The main Hotel & Resort of the area is Le Dune Resort & Spa, a 484 rooms just few meter from the main beach with all main comforts and facilities. An ideal place for families
Sign up our newsletter and receive offers and news periodically that HOTELS SARDINIA has exclusively choose for you.
Your personal data will be dealt in electronic format for the relative purpose to the post of the information demanded through this module.