Aiuto....![]()
Per favore date un'occhiata a questo script.
Funziona tutto tranne che no esegue l'ultima funzione (oltre a dirmi Unespected T_ELSE):
<?php
$email = $_POST['email'];
$receiverMail = $_POST['mailto'];
$subject = $_POST['subject'];
$redirect = $_POST['redirect'];
$stringa = "L'email che hai inserito non è valida";
$msgformat = "ISCRIZIONE ALLA MAILING LIST\n\nEmail: $email";
if (eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$", $email))
{list($alias, $domain) = split("@", $email);
if (checkdnsrr($domain, "MX"))
{
getmxrr($domain, $mxhosts);
foreach($mxhosts as $mxKey => $mxValue);
}
else {
echo "<script language=\"JavaScript\">\n";
echo "alert(\"$stringa\");\n";
echo "history.back();";
echo "</script>";
}
}
else {
echo "<script language=\"JavaScript\">\n";
echo "alert(\"$stringa\");\n";
echo "history.back();";
echo "</script>";
}
else {
header("Location: $redirect");
mail($receiverMail, $subject, $msgformat, "From: $email");
} ?>