Originariamente inviato da webbeloz
sarà bene che lo posti prima di arrivare a 6500 post per la soluzione!
:maLOL:
Allora:
sul primo frame ho questo:
codice:
mailform = "mailform.php";
confirm = "Grazie. A breve ricevera' la mail di conferma.";
action = "send";
//
// setto il focus su nome
//
Selection.setFocus("nome");
//
// controllo validita mail
//
function validate(address) {
if (address.length>=7) {
if (address.indexOf("@")>0) {
if ((address.indexOf("@")+2)<address.lastIndexOf(".")) {
if (address.lastIndexOf(".")<(address.length-2)) {
return (true);
}
}
}
}
return (false);
}
//
// controllo campi
//
function formcheck() {
if ((((mail == null)) || (mail.length<1))) {
erroremail.gotoAndPlay(2);
action = "";
}
if (!validate(mail)) {
erroremail.gotoAndPlay(2);
action = "";
}
if ((nome == null) || (nome == "")) {
nomerrore.gotoAndPlay(2);
action = "";
}
if ((testo == null) || (testo == "")) {
erroremsg.gotoAndPlay(2);
action = "";
}
if ((validate(mail)) && (mail != error1) && (nome != "") && (testo != "")) {
action = "send";
loadVariablesNum(mailform, 1, "POST");
gotoAndPlay("attesa");
stella.gotoAndPlay(2);
}
}
stop();
Sul fotogramma etichettato attesa ho questo:
codice:
loadVariablesNum(mailform, 1);
answer = confirm;
nome = "";
mail = "";
testo = "";
sullo stesso layer del fotogramma attesa(precisamente tre frame dopo quello) ho inseritoquesto:
codice:
if (answer != confirm) {
gotoAndPlay ("fatto");
}
ed infine al tasto invia questo:
codice:
on (release) {
formcheck ();
}
il file php è questo:
codice:
$adminaddress = "mio@sito.com";
$siteaddress ="http://www.miosito.com";
$sitename = "nome sito";
//No need to change anything below ...
// Gets the date and time from your server
$date = date("m/d/Y H:i:s");
// Gets the IP Address
if ($REMOTE_ADDR == "") $ip = "no ip";
else $ip = getHostByAddr($REMOTE_ADDR);
// Gets the POST Headers - the Flash variables
$action = $HTTP_POST_VARS['action'] ;
$mail = $HTTP_POST_VARS['mail'] ;
$nome = $HTTP_POST_VARS['nome'] ;
$testo = $HTTP_POST_VARS['testo'] ;
//Process the form data!
// and send the information collected in the Flash form to Your nominated email address
if ($action == "send") {
//
mail ("$adminaddress","Email da sito",
"il visitatore del sito ha lasciato le seguenti informazioni\n
Nome: $nome
Email: $mail\n
Il suo commento:
------------------------------
$testo
Info registrate :
------------------------------
Using: $HTTP_USER_AGENT
Hostname: $ip
IP address: $REMOTE_ADDR
Date/Time: $date","FROM:$adminaddress" ) ;
//This sends a confirmation to your visitor
mail ("$mail","Grazie per aver visitato $sitename",
"Egregio $nome,\n
la ringraziamo per averci contattato dal nostro sito: $sitename!\n
Cordiali Saluti,
$sitename
$siteaddress","FROM:$adminaddress") ;
//Confirmation is sent back to the Flash form that the process is complete
$sendresult = "Thank you. You will receive a confirmation email shortly.";
$send_answer = "answer=";
$send_answer .= rawurlencode($sendresult);
echo $send_answer;
} //
?>