session_start();
// include("admin/functions.php");
include("include.php");
//if($_SESSION["limba"]==""){$_SESSION["limba"]="english";}
//include("languages/".$_SESSION["limba"].".php");
echo $_SESSION["limba"];
if (!empty($_POST["update_profile"]))
{
$error="";
if (((strlen(trim($_POST["password"])))<6)||($_POST["password"]!=$_POST["password1"]))
{
$eroare=$variabila[277];
$error .= 'La password deve essere superiore a 6 caratteri oppure le due password non coincidono\n';
$pas="er";
}
else $_SESSION['password'] = $_POST["password"];
$select_user = mysql_query("select * from ".$tables."users where Username='".trim($_POST["username"])."'") ;
if ((strlen(trim($_POST["username"]))<6)||(mysql_num_rows($select_user)>0))
{
$error .= 'La user deve essere superiore a 6 caratteri\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 .= 'Email errata\n';
$em="er";
}
else $_SESSION['email'] = $_POST["email"];
if ((strlen(trim($_POST['firma'])))==0)
{
$error .= 'None e cognome mancanti\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 .= 'Indirizzo mancante\n';
$adr="er";
}
else $_SESSION['address'] = $_POST["address"];
if ((strlen(trim($_POST['contactphone'])))==0)
{
$error .= 'Telefono mancante\n';
$contact="er";
}
else $_SESSION["contactphone"] = $_POST["contactphone"];
if ((strlen(trim($_POST["town"])))==0)
{
$error .= 'Citta mancante\n';
$tw="er";
}
else $_SESSION['town'] = $_POST["town"];
if ((strlen(trim($_POST["postcode"])))==0)
{
$error .= 'CAP mancante\n';
$pc="er";
}
else $_SESSION['postcode'] = $_POST["postcode"];
if ($error=="")
{
$sql="SELECT * FROM `".$tables."users`
where `Email` = '".$_SESSION['email']."'
";
$result_test=mysql_query($sql);
if(mysql_num_rows($result_test)==0)
{
$insert_user = mysql_query("INSERT INTO ".$tables."users set
Username='".addslashes($_SESSION['username'])."',
Password='".addslashes($_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 nel 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";
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-clienti.php?x=Il nuovo account è stato creato.");
}else {$error="You have already register with us .
Please use current your account.";}
}
}
/*function isChecked($check,$skin ){
$checkmark = ( $check == $skin)? "class='errorfield'":"class='field'" ;
return $checkmark;
}
function isSelected($check1,$skin1 ){
$checkmark1 = ( $check1 == $skin1)? "SELECTED":"" ;
return $checkmark1;
}
*/
?>