Codice PHP:
<?
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "registrazione")) {
$query_validate_email = mysql_query("SELECT * FROM utenti WHERE email ='".$_POST['email']."'");
$lista_validate_email = mysql_num_rows($query_validate_email);
for ($x_validate_email = 0; $x_validate_email < $lista_validate_email; $x_validate_email++)
{
$validate_email = mysql_fetch_assoc($query_validate_email);
}
if($validate_email['email'] != $_POST['email']){
$now= getdate();
$currentTime = $now["hours"] . ":" . $now["minutes"] . ":" . $now["seconds"];
$currentDate = $now["mday"] . "." . $now["mon"] . "." . $now["year"];
$password=$_POST['password'];
$insertSQL = sprintf("INSERT INTO utenti ( nome, cognome, email, password, sesso, giorno, mese, anno, citta, provincia, `data`, ora) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['nome'], "text"),
GetSQLValueString($_POST['cognome'], "text"),
GetSQLValueString($_POST['email'], "text"),
GetSQLValueString($password, "text"),
GetSQLValueString($_POST['sesso'], "text"),
GetSQLValueString($_POST['giorno'], "text"),
GetSQLValueString($_POST['mese'], "text"),
GetSQLValueString($_POST['anno'], "text"),
GetSQLValueString($_POST['citta'], "text"),
GetSQLValueString($_POST['provincia'], "text"),
GetSQLValueString($currentDate, "text"),
GetSQLValueString($currentTime, "text"));
mysql_select_db($database_connessione, $connessione);
$Result1 = mysql_query($insertSQL, $connessione) or die(mysql_error());
}
header("www.google.it");
}
?>