session_start(); // include("admin/functions.php"); include("include.php"); //if($_SESSION["limba"]==""){$_SESSION["limba"]="english";} //include("languages/".$_SESSION["limba"].".php"); if (!empty($_POST["update_profile"])) { $error=""; if (((strlen(trim($_POST["password"])))<6)||($_POST["password"]!=$_POST["password1"])) { $eroare=$variabila[277]; $error .= "La password deve avere almeno 6 caratteri oppure le password non corrispondono! Verificare prego \n"; $pas="er"; } else $_SESSION['password'] = $_POST["password"]; $select_user = mysql_query("select * from ".$tables."agenti where Username='".trim($_POST["username"])."'") ; if ((strlen(trim($_POST["username"]))<6)) { $error .= "l'USERNAME deve avere 6 caratteri \n"; $pas="er"; } else if((mysql_num_rows($select_user)>0)) { $error .= " l'USEERNAME e' gia' in uso, scegliere un\'altro per favore \n "; $pas="er"; }else{ $_SESSION['username'] = $_POST["username"];} if (trim($_POST['email']) == "" || strpos($_POST['email'],"@") >= strrpos($_POST['email'],".") || strpos($_POST['email'],"@") >= strrpos($_POST['email'],".")-1 || strpos($_POST['email']," ") > 0 || strpos($_POST['email'],"@") < 0 || strrpos($_POST['email'],".") < 0 || strrpos($_POST['email'],".") == strlen($_POST['email'])-1) { $error .= "l'indirizzo email inserito non e' coretto \n"; $em="er"; } else $_SESSION['email'] = $_POST["email"]; if ((strlen(trim($_POST['firma'])))==0) { $error .= " Nome e Cognome e' campo obbligatiorio\n"; $fn="er"; } else $_SESSION["firma"] = $_POST["firma"]; if ((strlen(trim($_POST['celular'])))==0) { } else $_SESSION["celular"] = $_POST["celular"]; if ((strlen(trim($_POST["address"])))==0) { $error .= "Via/P.zza e' campo obbligatiorio\n"; $adr="er"; } else $_SESSION['address'] = $_POST["address"]; if ((strlen(trim($_POST['contactphone'])))==0) { $error .= "Recapito telefonico e' campo obbligatiorio\n"; $contact="er"; } else $_SESSION["contactphone"] = $_POST["contactphone"]; if ((strlen(trim($_POST["town"])))==0) { $error .="Localita' e' campo obbligatiorio\n"; $tw="er"; } else $_SESSION['town'] = $_POST["town"]; if ((strlen(trim($_POST["postcode"])))==0) { $error .= "CAP e' campo obbligatiorio\n"; $pc="er"; } else $_SESSION['postcode'] = $_POST["postcode"]; if ($error=="") { $sql="SELECT * FROM `".$tables."agenti` WHERE `Email` = '".$_SESSION['email']."' "; $result_test=mysql_query($sql); if(mysql_num_rows($result_test)==0) { $insert_user = mysql_query("INSERT INTO ".$tables."agenti set Username='".addslashes($_SESSION['username'])."', Password='".$_SESSION['password']."', Town='".$_SESSION['town']."', County='".$_SESSION['county']."', Postcode='".$_SESSION['postcode']."', Email='".$_SESSION['email']."', nume ='".addslashes($_SESSION['firma'])."', celular ='".addslashes($_SESSION['celular'])."', Address='".addslashes($_SESSION['address'])."', Accept_newsletter='".$_POST['newsletter']."', ContactPhone='".$_SESSION['contactphone']."', hash='".md5($_SESSION['email'])."', confirmat=1 ") or die(mysql_error()); $pid=mysql_insert_id(); //$_SESSION['UserName']=$_SESSION['username']; //$_SESSION['DealerID']=$pid; //$_SESSION['UserCountry']=$_SESSION['county']; $pid_user=mysql_insert_id(); //------------------------------------------------------------------------------- $html_ver="Registrazione sul sito ".$adresawebsite."\nHai fatto la richiesta per registrarti sul sito $adresawebsite con questo email ".$_SESSION['email']." .\n Le tue password sono:\n Username: ".$_SESSION['username']." Password: ".$_SESSION['password']." "; $headers = "From: office@plusvalueservizi.com\n"; //specify MIME version 1.0 //$headers .= "MIME-Version: 1.0\n"; //unique boundary //$boundary = uniqid("assocred"); //tell e-mail client this e-mail contains//alternate versions //$headers .= "Content-Type: multipart/alternative" . // "; boundary = $boundary\n\n"; //message to people with clients who don't //understand MIME //$headers .= "This is a MIME encoded message.\n\n"; //plain text version of message //$headers .= "--$boundary\n" . // "Content-Type: text/plain; charset=ISO-8859-1\n" . // "Content-Transfer-Encoding: base64\n\n"; //$headers .= chunk_split(base64_encode($textver)); //HTML version of message /*$headers .= "--$boundary\n" . "Content-Type: text/html; charset=ISO-8859-1\n" . "Content-Transfer-Encoding: base64\n\n"; $headers .= chunk_split(base64_encode($html_ver)); $headers .= "--$boundary\n" ; */ //send message mail($_SESSION['email'], "Registratione sul sito ".$adresawebsite, $html_ver, $headers); //---------------------------------------------------------------------------------- $_SESSION['username']=''; $_SESSION['password']=''; $_SESSION['town']=''; $_SESSION['county']=''; $_SESSION['postcode']=''; $_SESSION['email']=''; $_SESSION['firma']=''; $_SESSION['celular']=''; $_SESSION['address']=''; $_SESSION['contactphone']=''; $_SESSION['email']=''; header("Location: login-agenti.php?x=Il nuovo account è stato creato."); }else {$error="Sei gia' registrato sul nostro sito. \\n Usa il conto esistente gia'.";} } } /*function isChecked($check,$skin ){ $checkmark = ( $check == $skin)? "class='errorfield'":"class='field'" ; return $checkmark; } function isSelected($check1,$skin1 ){ $checkmark1 = ( $check1 == $skin1)? "SELECTED":"" ; return $checkmark1; } */ ?>