if ($_GET['cmd']=="add"){
$host="localhost";
$user="romaonline";
$password="ks82b38cds22";
$dbh=mysql_pconnect($host,$user,$password) or die("Impossibile connettersi a MySQL!!");
$database=mysql_select_db("congressi",$dbh) or die("Impossibile connettersi a MySQL!!");
//Controlla che l'email non sia già presente nel database
$rw=mysql_query("SELECT * FROM utenti WHERE email='".$_POST["email"]."'");
if (mysql_fetch_array($rw)){ ?>
} else {
/***********************************************************************************
*** GENERATORE PASSWORD ***
***********************************************************************************/
while (strlen($mypass)<8){
$type=rand(0,1);
if ($type==0) $mypass = $mypass . chr(rand(97,122));
else $mypass = $mypass . rand(0,9);
}
$type=rand(0,4);
if ($type==0) $car=".";
elseif ($type==1) $car="-";
elseif ($type==2) $car="_";
elseif ($type==3) $car="-";
elseif ($type==4) $car="?";
$posizione=rand(1,7);
$mypass=substr($mypass,0,$posizione).$car.substr($mypass,$posizione);
mysql_query("INSERT INTO utenti(email,password,nome,cognome,citta,telefono,azienda,attivo)
VALUES(
'".$_POST["email"]."',
'".$mypass."',
'".$_POST["nome"]."',
'".$_POST["cognome"]."',
'".$_POST["citta"]."',
'".$_POST["telefono"]."',
'".$_POST["azienda"]."',
0
);");
$a="info@romaonline.net";
$oggetto="RomaOnLine.net - Registrazione utente al Convention Bureau";
$messaggio = "Un nuovo utente ha richiesto l'attivazione dell'account per poter accedere alla sezione riservata del Convention Bureau.
RomaOnLine invierà nella vostra email la password che vi consentirà di accedere nell'area riservata dei GDS/ADV. E' quindi necessario fornire un indirizzo di posta elettronica valido per accedervi.