Newsletter
$pageurl ="index.php?page=newsletter";
if ( $_GET['todo'] == "confirm" ) {
echo "
".$TXT_CONFERMA_NEWSLETTER."
";
$email = trim($_GET["email"]);
$code = trim($_GET["code"]);
$result = mysql_query("SELECT * FROM $tab_mailing_usr WHERE email = '$email'");
$rows = mysql_fetch_array($result);
$nome = $rows['nome'];
$cognome = $rows['cognome'];
$numrows = mysql_num_rows($result);
if ( $numrows == "0" ) { print "
".$TXT_EMAIL_INESISTENTE."
"; }
elseif ( $numrows == "1" ) {
if($rows['confirmed']==1) {echo "
".$TXT_NO_POSSIBILE_REGISTR."
";}
elseif($rows['rand']!=$_REQUEST['code']) {echo "
".$TXT_CODICE_ERRATO."
";}
else
{
echo "
".$TXT_GRAZIE." $nome $cognome.
".$TXT_A_BREVE_RICEVERAI."
";
$query = "UPDATE $tab_mailing_usr SET confirmed = '1' WHERE email = '$email' AND rand = '$code' AND confirmed = '0'";
mysql_query($query);
$subject = $TXT_CONFERMA_ISCRIZIONE;
}
}
}
if ( $_GET['todo'] == "unsubscribe" ) {
echo "
".$TXT_CANCELLATI_NEWSLETTER."
";
echo "
";
}
if ( $_POST['todo'] == "dounsubscribe" ) {
echo "
".$TXT_CANCELLATI_NEWSLETTER."
";
$email=trim($_POST["email"]);
if(ereg(".+\@.+\..+", $email) && (ereg("^[a-zA-Z0-9_@.-]+$", $email))) {
$query = "update $tab_mailing_usr set confirmed=-1 WHERE email = '$email'";
//echo $query;
mysql_query($query);
print "
".$TXT_NON_RICEVERAI_PIU."
"; }
else {
echo "
".$TXT_FORMATO_EMAIL_ERRATO."
";
echo "
";
}
}
if(!$_REQUEST['todo']) {
?>
$campi = array(
array("nome",array( $TXT_NOME,"text","required")),
array("cognome",array($TXT_COGNOME, "text", "required")),
array("email", array("Email","text","required email", $_POST['email'])),
array("tipo_form",array("","hidden","", "2"))
);
echo form($campi, 1,'form.php'); // array campi, privacy, action
echo "
";
}
?>