host=host; $db->name=db; $db->user=user; $db->pass=pass; $db->login() or die("ERRORE DI CONNESSIONE AL DB
"); $node=new node; $node->dblink=$db->link; if(!$node->load(default_node)){ die("ERRORE DURANTE IL CARICAMENTO DELLA CONFIGURAZIONE
"); } $tool=new tool(); $sec=new section; $sec->dblink=$db->link; $cat=new category; $cat->host=host; $cat->name=db; $cat->user=user; $cat->pass=pass; $cat->login() or die("ERRORE DI CONNESSIONE AL DB
"); $cat->docpath="/download/"; $cat->photopath="/photo/"; $cat->prewpath="/prew/"; $cat->thumbpath="/thumb/"; $cat->vidpath="/video/"; $user=new user(); $user->host=host; $user->name=db; $user->user=user; $user->pass=pass; $user->login() or die("ERRORE DI CONNESSIONE AL DB
"); $user->companylogin=false; #richieste da interfacce ajax if(isset($_POST["aj_action"])){ switch($_POST["aj_action"]){ default: die(); break; } die(); } # Parsificazione dell'url richiesto $url=$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; if(!$purl=parse_url($url)){ die(); } if(isset($purl["query"])){ parse_str($purl["query"],$q); } # assegnazione delle variabili di sessione if(isset($_POST["wsa"])){ $_SESSION["wsa"]=$_POST["wsa"]; }else{ if(isset($q["wsa"])){ $_SESSION["wsa"]=$q["wsa"]; } } if(!isset($_SESSION["wsa"])){ $_SESSION["wsa"]="home"; } if(isset($q["sid"])){ $_SESSION["sid"]=$q["sid"]; } if(!isset($_SESSION["sid"])){ $_SESSION["sid"]=""; } if(isset($q["cmid"])){ $_SESSION["cmid"]=$q["cmid"]; } if(!isset($_SESSION["cmid"])){ $_SESSION["cmid"]=""; } if(isset($q["cid"])){ $_SESSION["cid"]=$q["cid"]; } if(!isset($_SESSION["cid"])){ $_SESSION["cid"]=""; } if(isset($q["iid"])){ $_SESSION["iid"]=$q["iid"]; } if(!isset($_SESSION["iid"])){ $_SESSION["iid"]=""; } if(isset($q["im"])){ $_SESSION["im"]=$q["im"]; } if(!isset($_SESSION["im"])){ $_SESSION["im"]=""; } if(isset($q["lang_id"])){ $_SESSION["lang_id"]=$q["lang_id"]; } if(!isset($_SESSION["lang_id"])){ $_SESSION["lang_id"]=default_lang; } if(isset($_POST["srchkey"])){ $_SESSION["srchkey"]=$_POST["srchkey"]; } if(!isset($_SESSION["srchkey"])){ $_SESSION["srchkey"]=""; } if(isset($_POST["show_order"])){ $_SESSION["show_order"]=$_POST["show_order"]; } if(!isset($_SESSION["show_order"])){ $_SESSION["show_order"]="rilevanza"; } if(isset($_POST["show_mode"])){ $_SESSION["show_mode"]=$_POST["show_mode"]; } if(!isset($_SESSION["show_mode"])){ $_SESSION["show_mode"]="asc"; } if(!isset($_SESSION["cat_master"])){ $_SESSION["cat_master"]=""; } # selezione della pre-action da eseguire if($_SESSION["wsa"]=="login"){ if(isset($_POST["lr"])){ $valid_form=true; if((!isset($_POST["user_name_id"]))||($_POST["user_name_id"]=="")||(!$user->login_data_validation($_POST["user_name_id"]))){ $valid_form=false; } if((!isset($_POST["user_pass"]))||($_POST["user_pass"]=="")||(!$user->login_data_validation($_POST["user_pass"]))){ $valid_form=false; } if($valid_form){ if(!$user->is_connected($_POST["user_name_id"])){ if($logdata=$user->user_login($_POST,99)){ if($logdata["user_level"]>=$node->fld["node_admin_level"]){ $_SESSION["user_name_id"]=$logdata["user_name_id"]; $_SESSION["user_id"]=$logdata["user_id"]; $_SESSION["user_key"]=$logdata["user_session_key"]; $login_response="OK"; }else{ $user->user_logout($user->user_id($_POST["user_name_id"])); $login_response="ADMIN_LOGIN"; } }else{ $login_response="BAD_LOGIN"; } }else{ $user->user_logout($user->user_id($_POST["user_name_id"])); $login_response="ALREADY_CONNECTED"; } }else{ $login_response="KO"; } }else{ $login_response="KO"; } $_SESSION["wsa"]=$_POST["last_wsa"]; } if($_SESSION["wsa"]=="logout"){ session_destroy(); if(isset($_SESSION["user_id"])){ unset($_SESSION["user_id"]); } if(isset($_SESSION["user_name_id"])){ unset($_SESSION["user_name_id"]); } if(isset($_SESSION["user_key"])){ unset($_SESSION["user_key"]); } $_SESSION["wsa"]=$_GET["last_wsa"]; } if($_SESSION["wsa"]=="mlistsubscription"){ if(($_POST["mls_mail"]!="")&&(count($_POST["grp"])>0)){ if($user->mail_address_validation($_POST["mls_mail"])){ $sql="select mls_id from mlist_subscriber where mls_mail = '".$_POST["mls_mail"]."'"; $res_ml=mysql_query($sql,$cat->link); if(0==mysql_num_rows($res_ml)){ $sql="insert into mlist_subscriber (mlist_id, mls_id, mls_mail, mls_state) values "; $sql.="('2', NULL, '".$_POST["mls_mail"]."', 'active')"; if(mysql_query($sql,$cat->link)){ $mls_id=mysql_insert_id($cat->link); for($i=0;$ilink); } $mlist_rsp="OK"; }else{ $mlist_rsp="KO"; } }else{ $mlist_rsp="BADMAIL"; } }else{ $mlist_rsp="BADMAIL"; } }else{ $mlist_rsp="BADFORM"; } $_SESSION["wsa"]=$_POST["last_wsa"]; } # selezione della action da eseguire switch($_SESSION["wsa"]){ case"home": $_SESSION["siteside"]=""; $meta_keywords=""; $page_title="Prima Classe Group"; $meta_description=""; $inc="inc/home.inc.php"; break; case"viaggi": require_once('class/pager.class.php'); $_SESSION["sid"]=1; $cond=""; $cat_title=""; if($_SESSION["cid"]!=""){ if(!is_numeric($_SESSION["cid"])){ unset($_SESSION["cid"]); } if(0==mysql_num_rows($db->get("cat_id","category","cat_id = '".$_SESSION["cid"]."' and sec_id = '".$_SESSION["sid"]."'"))){ unset($_SESSION["cid"]); } if(!isset($_SESSION["cid"])){ $meta_keywords=""; $_SESSION["siteside"]=""; $page_title="Prima Classe Group"; $meta_description=""; $inc="inc/home.inc.php"; break; } $cat->load($_SESSION["cid"]); $cat_title=$cat->get_txt($cat->fld["cat_name_tid"],$_SESSION["lang_id"]); $cond.="and item.cat_id = '".$_SESSION["cid"]."' "; } if($cat_title==""){ $cat_title="Catalogo viaggi"; } $sql="select item.* from item join texts on item.item_name_tid = texts.tid where texts.lang_id = '".$_SESSION["lang_id"]."' "; /*if($_SESSION["srch_dest"]!=""){ $cond.="and texts.text_txt like '%".$_SESSION["srch_dest"]."%' "; }*/ $sql.=$cond."order by item.item_custom2 asc, item.item_custom3 asc"; $param=""; /*if(isset($_REQUEST["search"])){ $param="search=y"; $cat_title=$cat->get_txt(58,$_SESSION["lang_id"]); }*/ $pag=new pager($cat->link,$sql,record_X_page,link_X_page,$param); if(!$trips=$pag->querypage()){ $nrec=0; }else{ $nrec=$pag->num_rows; } $_SESSION["siteside"]="_tours"; $inc="inc/viaggi.inc.php"; break; case"viaggio": $_SESSION["sid"]=1; if(!is_numeric($_SESSION["iid"])){ unset($_SESSION["iid"]); } if(0==mysql_num_rows($db->get("item_id","item","item_id = '".$_SESSION["iid"]."' and sec_id = '".$_SESSION["sid"]."'"))){ unset($_SESSION["iid"]); } if(!isset($_SESSION["iid"])){ $meta_keywords=""; $page_title="Prima Classe Group"; $meta_description=""; $inc="inc/home.inc.php"; break; } $item=mysql_fetch_assoc($db->get("*","item", "item_id = '".$_SESSION["iid"]."'","","")); $cat->load($item["cat_id"]); $cat_title=$cat->get_txt($cat->fld["cat_name_tid"],$_SESSION["lang_id"]); $_SESSION["siteside"]="_tours"; $inc="inc/viaggio.inc.php"; break; case"primaclasse": $_SESSION["sid"]=3; $_SESSION["cid"]=5; $cat->load($_SESSION["cid"]); $inc="inc/profilo.inc.php"; break; case"servizi": $_SESSION["sid"]=5; $_SESSION["cid"]=8; $cat->load($_SESSION["cid"]); $inc="inc/servizi.inc.php"; break; case"flotta": $_SESSION["sid"]=4; $_SESSION["cid"]=6; $cat->load($_SESSION["cid"]); $inc="inc/flotta.inc.php"; break; case"privacy": $inc="inc/privacy.inc.php"; break; case"contatti": if((isset($_POST["go"]))&&($_POST["go"]=="INVIA")){ die(); $signin_rsp=""; if(($_POST["user_name"]=="")||($_POST["user_surname"]=="")||($_POST["user_mail"]=="")||($_POST["user_tel"]=="")||($_POST["msg"]=="")){ $signin_rsp="KO"; } if(($_POST["user_web_type"]=="agency")&&($_POST["user_corporate_name"]=="")){ $signin_rsp="KO"; } if($signin_rsp!="KO"){ if(!isset($_POST["subject"])){ $subject="Richiesta informazioni da primaclassegroup.com"; }else{ $subject=$_POST["subject"]; } $hd = "From: ".$_POST["user_surname"]." ".$_POST["user_name"]." <".$_POST["user_mail"].">\r\n"; $txt=file_get_contents('tmpl/contact.tmpl.php'); $txt=str_replace("##company##",$node->fld["node_company_name"],$txt); $txt=str_replace("##nome##",$_POST["user_surname"],$txt); $txt=str_replace("##cognome##",$_POST["user_name"],$txt); $_POST["user_web_type"]=="agency" ? $azienda="Azienda: ".$_POST["user_corporate_name"] : $azienda=""; $txt=str_replace("##ragsoc##",$azienda,$txt); $txt=str_replace("##tel##",$_POST["user_tel"],$txt); $txt=str_replace("##mail##",$_POST["user_mail"],$txt); $txt=str_replace("##msg##",$_POST["msg"],$txt); if(mail($node->fld["node_company_mail"], $subject, $txt, $hd)){ unset($_POST); $signin_rsp="OK"; }else{ $signin_rsp="KO"; } } } $inc="inc/contatti.inc.php"; break; case"registrazione": if(isset($_POST["ins_user"])){ $valid_form=true; if((!isset($_POST["user_name_id"]))||($_POST["user_name_id"]=="")||(!$user->login_data_validation($_POST["user_name_id"]))){ $valid_form=false; $err="Il nome utente scelto non è valido"; } if($user->exist_username($_POST["user_name_id"])){ $valid_form=false; $err="Il nome utente indicato è già usato da un altro cliente. Ti preghiamo di sceglierne uno differente."; } if((!isset($_POST["user_mail"]))||($_POST["user_mail"]=="")||(!$user->mail_address_validation($_POST["user_mail"]))||($_POST["user_mail"]!=$_POST["user_mail2"])){ $valid_form=false; $err="L'indirizzo mail indicato non è valido oppure non è stato inserito correttamente"; } if($user->exist_usermail($_POST["user_mail"])){ $valid_form=false; $err="L'indirizzo mail indicato è già presente nella nostra base dati, ti preghiamo di utilizzarne uno differente."; } if((!isset($_POST["privacy"]))||($_POST["privacy"]!="Y")){ $valid_form=false; $err="E' necessario acconsentire al trattamento dei dati anagrafici per poter effettuare la registrazione."; } if((!isset($_POST["user_corporate_name"]))||($_POST["user_corporate_name"]=="")){ $valid_form=false; $err="La ragione sociale specificata non è valida"; } if((!isset($_POST["user_corporate_piva"]))||($_POST["user_corporate_piva"]=="")){ $valid_form=false; $err="La partita IVA specificata non è valida"; } if((!isset($_POST["user_name"]))||($_POST["user_name"]=="")){ $valid_form=false; $err="Il nome della persona di riferimento non è valido"; } if((!isset($_POST["user_surname"]))||($_POST["user_surname"]=="")){ $valid_form=false; $err="Il cognome della persona di riferimento non è valido"; } if((!isset($_POST["user_address"]))||($_POST["user_address"]=="")){ $valid_form=false; $err="L'indirizzo non è valido"; } if((!isset($_POST["user_city"]))||($_POST["user_city"]=="")){ $valid_form=false; $err="La città non è valida"; } if((!isset($_POST["user_prov"]))||($_POST["user_prov"]=="")){ $valid_form=false; $err="La provincia non è valida"; } if((!isset($_POST["user_cap"]))||($_POST["user_cap"]=="")){ $valid_form=false; $err="Il cap non è valido"; } if((!isset($_POST["user_tel"]))||($_POST["user_tel"]=="")){ $valid_form=false; $err="Il contatto telefonico non è valido"; } if($valid_form){ $_POST["user_level"]=50; $_POST["user_pass"]=$user->create_pass(7); $_POST["user_type"]="web"; $_POST["user_state"]="waiting"; $_POST["user_credits"]=0; if($user->adduser($_POST)){ $ins_response="OK"; $mail_for_pass=$_POST["user_mail"]; }else{ $ins_response="KO"; $err="Si è verificato un errore imprevisto durante la registrazione utente. Ti preghimao di riprovare più tardi"; } if($ins_response=="OK"){ $subject="Conferma registrazione ".$node->fld["node_company_name"]; $hd = "From: ".$node->fld["node_company_name"]." <".$node->fld["node_company_mail"].">\r\n"; $txt=file_get_contents('tmpl/signin.tmpl.php'); $txt=str_replace("##company##",$node->fld["node_company_name"],$txt); $txt=str_replace("##companymail##",$node->fld["node_company_mail"],$txt); $txt=str_replace("##mail##",$_POST["user_mail"],$txt); $txt=str_replace("##url##",$node->fld["node_url"],$txt); $txt=str_replace("##user_name_id##",$_POST["user_name_id"],$txt); $txt=str_replace("##user_pass##",$_POST["user_pass"],$txt); mail($_POST["user_mail"], $subject, $txt, $hd); $subject="Richiesta attivazione agenzia"; $hd = "From: ".$_POST["user_corporate_name"]." <".$_POST["user_corporate_mail"].">\r\n"; $txt=file_get_contents('tmpl/signin_company_alert.tmpl.php'); $txt=str_replace("##company##",$node->fld["node_company_name"],$txt); $txt=str_replace("##companymail##",$node->fld["node_company_mail"],$txt); $txt=str_replace("##mail##",$_POST["user_mail"],$txt); $txt=str_replace("##url##",$node->fld["node_url"],$txt); $txt=str_replace("##user_name_id##",$_POST["user_name_id"],$txt); mail($node->fld["node_company_mail"], $subject, $txt, $hd); unset($_POST); } }else{ $ins_response="KO"; } } $inc="inc/registrazione.inc.php"; break; case"profiloutente": $inc="inc/profilo_utente.inc.php"; break; case"agenzie": $dags=$db->get("distinct(user_city)","user","user_level = '50' and (user_state = 'alive' or user_state = 'connected') and rcd_delete = 'N'","user_city asc"); $inc="inc/agenzie.inc.php"; break; } if(!isset($page_title)){ $page_title="Prima Classe Group"; } if(!isset($meta_keywords)){ $meta_keywords=""; } if(!isset($meta_description)){ $meta_description=""; } if(!isset($inc)){ $_SESSION["wsa"]="home"; $inc="inc/home.inc.php"; } if(!isset($_SESSION["siteside"])){ $_SESSION["siteside"]=""; } ?>