Visualizzazione dei risultati da 1 a 6 su 6
  1. #1

    Flash & PHP - Form Mail

    Ciao a tutti. Sto inserendo sul mio sito un form mail. Non mi funziona. Tutte le volte che finisco di compilare i moduli(nome,email,ecc ecc) mi da il messaggio l'email non è stata inviata.

    Vi allego il codice del file php:

    <?
    if(isset($_POST['flashMAIL'])){
    //////////////////////////////////////////////
    $nome = htmlspecialchars(stripslashes(utf8_decode(trim($_P OST['nome']))),ENT_QUOTES);
    $email = htmlspecialchars(stripslashes(utf8_decode(trim($_P OST['email']))),ENT_QUOTES);
    $oggetto = htmlspecialchars(stripslashes(utf8_decode(trim($_P OST['oggetto']))),ENT_QUOTES);
    $msg = nl2br(stripslashes(utf8_decode(trim($_POST['msg']))));
    $msg = str_replace("
    ","[br]",$msg);
    $msg = htmlspecialchars($msg,ENT_QUOTES);
    $msg = str_replace("[br]","
    ",$msg);

    $page = "localhost";
    $to = "miamail";
    //////////////////////////////////////////////
    $messaggio ='
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head>
    <title>'.$page.'</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <style type="text/css">
    body {margin:0px;padding:0px;}
    table {width: 100%;font-family:Verdana, Arial, Helvetica, sans-serif;}
    .tdSX {width:40%;font-size:13px;color:#333333;}
    .tdDX {width:60%;font-size:13px;color:#000066;}
    #titolo {width: 100%;font-size:14px;color:#003366;text-decoration:underline;}
    </style>
    </head><body><table>
    <tr><td colspan="2"></td></tr><tr><td align="center" class="tdSX">Nome:</td>
    <td align="center" class="tdDX">'.$nome.'</td></tr>
    <tr><td align="center" class="tdSX">E-mail:</td><td align="center" class="tdDX">'.$email.'</td></tr>
    <tr><td align="center" class="tdSX">messaggio:</td><td align="center" class="tdDX">'.$msg.'</td></tr>
    </table></body></html>';
    $intestazioni = "MIME-Version: 1.0\r\n";
    $intestazioni .= "Content-type: text/html; charset=iso-8859-1\r\n";
    $intestazioni .= "To: ".$to."\r\n";
    $intestazioni .= "From: ".$nome." <".$email.">\r\n";
    $intestazioni .= "Return-Path: ".$nome."\n";
    if (mail($to, $oggetto, $messaggio, $intestazioni)) { print "ris=ok"; } else { print "ris=error"; }
    } else {
    print "ris=error";
    }
    ?>

    Questo la stringa in FLASH:

    cancella.onRelease = function() {
    for (i=0; i<campi.length; i++) {
    eval(campi[i]).text = "";
    }
    };
    invio.onRelease = function() {
    dati = new LoadVars();
    campiVuoti = false;
    for (i=0; i<(campi.length-1); i++) {
    if (eval(campi[i]).text == "") {
    campiVuoti = true;
    break;
    }
    dati[campi[i]] = eval(campi[i]).text;
    }
    if (!campiVuoti) {
    dati.flashMAIL = true;
    dati.onLoad = function(ok) {
    if (ok) {
    if (this.ris == "ok") {
    esito.text = "L'e-mail è stata inviata correttamente";
    for (i=0; i<(campi.length-1); i++) {
    eval(campi[i]).text = "";
    }
    } else {
    esito.text = "L'e-mail non è stata inviata";
    }
    } else {
    esito.text = "Errore durante l'invio dei dati";
    }
    };
    dati.sendAndLoad("sendmail.php", dati, "POST");
    } else {
    delete dati;
    esito.text = "Tutti i campi sono obbligatori";
    }
    };
    cancella.onRollOver = function() {
    this.nextFrame();
    };
    cancella.onRollOut = cancella.onReleaseOutside=function () {
    this.prevFrame();
    };
    invio.onRollOver = function() {
    this.nextFrame();
    };
    invio.onRollOut = invio.onReleaseOutside=function () {
    this.prevFrame();
    };



    Dove sbaglio?!

    Grazie anticipatamente!!!

    Nico

    ps miamail è sostitutivo della mia email... Non è quello l'errore...

  2. #2
    NOn conosco bene PHP ma cosa indichi con flashMAIL ???

    codice:
    if(isset($_POST['flashMAIL'])){
               // ............................
    
    } else {
    print "ris=error";
    }

  3. #3
    Ciao, non so bene, purtroppo... E' un codice che avevo trovato sul web...

    Qualcuno sa dirmi qualcosa?

    GRAZIE!

    Nico

  4. #4
    Scusate se UPpo!

    Nessuno sa rispondere?
    Grazie!

  5. #5
    prova con questo a me funziona bene.
    Ovviamente nel form di flash le input box devono chiamarsi con gli stessi nomi del php.

    FLASH:
    on (release) {
    mail="INDIRIZZO EMAIL";
    getURL("indirizzo dove si trova il file.php", "0", "POST");
    }

    PHP:

    <html>

    <?php


    if(!isset($_POST)) $_POST = $HTTP_POST_VARS;
    if(!isset($_FILES)) $_FILES = $HTTP_POST_FILES;

    // tosend è la variabile che memorizza l’email del destinatario (es. email del nostro cliente)
    $tosend="mail";

    // l’oggetto del nostra email
    $oggetto=$_POST['soggetto'];

    // nome è la proprietà del nostro oggetto loadVars
    $nome=$_POST['nome'];

    //recupero il cognome
    $cognome= $_POST['cognome'];

    // recupero l'email del mittente
    $email= $_POST['eemail'];

    // recupero il messaggio note
    $note=$_POST['note'];

    //create the directory if doesn't exists (should have write permissons)
    if(!is_dir("./files")) mkdir("./files", 0755);
    //move the uploaded file
    move_uploaded_file($_FILES['Filedata']['tmp_name'], "./files/".$_FILES['Filedata']['name']);

    // ASSEGNIAMO A VARIABILI PIU' LEGGIBILI, LE PROPRIETA' DELL'ALLEGATO
    $attach = $_FILES["allegato"]["tmp_name"];
    $file_name = $_FILES["allegato"]["name"];
    $file_type = $_FILES["allegato"]["type"];
    $file_size = $_FILES["allegato"]["size"];

    // DELIMITATORE
    $boundary = md5(uniqid(microtime()));

    // APRIAMO L'ALLEGATO PER LEGGERLO E CODIFICARLO
    $file = @fopen($attach, "r");
    $contents = @fread($file, $file_size);
    $encoded_attach = chunk_split(base64_encode($contents));
    @fclose($file);


    // ora devo costruire il messaggio che riceverà il nostro destinatario
    // \n è un ritorno a capo ma si è liberi di cotruire il messaggio come si vuole
    $strMessage="Nome: " . $nome. "\n";
    $strMessage=$strMessage . "Cognome: " . $cognome . "\n";
    $strMessage=$strMessage . "Email: " . $email . "\n";
    $strMessage=$strMessage . "Messaggio: " . $note . "\n";
    //Invio mail : la funzione mail di PHP restituisce un valore boolean true se è andato tutto a buon fine
    // false in caso di errori
    $flag_success = mail("$tosend", "$oggetto", "$strMessage", "From: $email");

    //Segnalazione dell' eventuale errore : se $flag_succes è false c'è stato un'errore e comunico a flash
    // stampando una stringa error= true che sarà recuperata da flash altrimenti errore= true;
    if (!$flag_success) {
    echo "error=true";
    }
    else
    {
    echo"";

    }
    ?>


    <META HTTP-EQUIV="Refresh" CONTENT="0;URL=http://sito/">
    </html>

  6. #6
    Grazie Bobo, ora provo!

    N.

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.