Visualizzazione dei risultati da 1 a 5 su 5

Discussione: errore nel email

  1. #1

    errore nel email

    ciao ragazzi, mi potete dire perche quando inviano email dal mio sito mi arriva anche la scritta ( SUBMIT: invia! ) ? aspetto vostra risposta grazie

    <form method="post" action="emails.php" enctype="multipart/form-data">
    <div align="center"><?php echo stripslashes($_GET[message])?>
    <div align="right">

    Nome
    <input type="text" name="nameREQUIRED" />




    Email
    <input type="text" name="emailREQUIRED" />





    Website
    <input type="text" name="website" />




    <textarea name="message" cols="30" rows="7"> </textarea>




    Allega foto
    <input type="file" name="attachment" />




    <input name="submit" type="submit" value="Invia!" />


    </div></div>
    </form>

  2. #2

  3. #3
    ciao filippo, si lo so' che non invia e solo il modulo per i campi del nome, del sito ed della email. L'email che mi arriva funziona bene con il file php, e solo che mi visualizza i nomi del pulsante,cioe' (Submit: Invia!)
    comunque il file php e questo che invia(quello ceh dicevi tu)

    emails.php
    -----------------------------------
    <?php


    $myemail = "miaemail@mail.com";

    $thankyou = "Email spedita correttamente.";

    $allowed_fileuploads = "png gif jpg ";


    if(!$_POST)
    die('Please don\'t access this file directly.');

    while(list($key,$val) = each($_POST)) {
    if(stristr($key,'REQUIRED')){
    $key = str_replace('REQUIRED','',$key);
    $fields[$key] = $val;
    if($val == ''){
    $missing[] = ''.$key.'';
    }
    } else {
    $fields[$key] = $val;
    }
    }

    if(isset($fields['myemail']))
    $myemail = $fields['myemail'];

    if(isset($fields['name'])){ $name = $fields['name']; } else { $name = "aMAILzing"; }
    if(isset($fields['email'])){ $email = $fields['email']; } else { $email = $myemail; }
    if(isset($fields['subject'])){ $subject = $fields['subject']; } else { $subject = "Web Form"; }

    reset($_POST);

    $injection = false;

    foreach($_POST as $key => $value){
    if(preg_match("/(content-type|bcc:|cc:|script|onclick|onmouseover)/i", $value)){
    $injection = true;
    }
    }

    $message = "Email proveniente dal sito pmkristal!\n";
    $message .= "-----------------------------------------------------------\n";
    $message .= "Ip: ".$_SERVER['REMOTE_ADDR']."\n";
    $message .= "Host: ".@gethostbyaddr($_SERVER['REMOTE_ADDR'])."\n";
    $message .= "Browser: ".$_SERVER['HTTP_USER_AGENT']."\n";
    $message .= "Referrer: ".$_SERVER['HTTP_REFERER']."\n\n";

    foreach($fields as $k=>$v) {
    if($v && !stristr($k,'REQUIRED'))
    if(is_array($v))
    $message .= ucfirst($k).": ".implode(', ', $v)."\n\n";
    else
    $message .= ucfirst($k).": $v\n\n";
    }

    $message .= "-----------------------------------------------------------\n";
    $message .= "Creata da - http://www.pmkristal.com";
    $message = stripslashes($message);

    $mail_boundary = "x".md5(time())."x";
    $header = "From: $name <$email>\n";
    $header .= "MIME-Version: 1.0\n";
    $header .= "Content-type: multipart/mixed; boundary=\"{$mail_boundary}\"\n";
    $header .= "X-Priority: 3\n";
    $header .= "X-MSMail-Priority: Normal\n";
    $header .= "X-Mailer: Creata da http://www.pmkristal.com\n";
    $header .= "This is a multi-part message in MIME format.\n\n";
    $header .= "--{$mail_boundary}\n";
    $header .= "Content-type: text/plain; charset=\"iso-8859-1\"\n";
    $header .= "Date: ".date('R')."\n";
    $header .= "Content-Transfer-Encoding:7bit\n\n";
    $header .= $message."\n\n";
    // Attach the uploaded files, if there is any.

    if($_FILES){

    if (get_magic_quotes_runtime() == 1){
    set_magic_quotes_runtime(0);
    }

    foreach($_FILES as $key=>$value){

    foreach($value as $key2 => $value2){
    $$key2 = $value2;
    }

    if (is_uploaded_file($tmp_name)) {
    if(isset($allowed_fileuploads)){
    $fileextensions = explode(' ', $allowed_fileuploads);
    $thisfile = explode('.', $name);
    $thisfile = array_pop($thisfile);

    if(!in_array($thisfile, $fileextensions)){
    die("Spiacente ma i file zippati non sono consentiti.");
    }
    }


    $fp = fopen($tmp_name,'rb');
    $read = fread($fp,$size);
    fclose($fp);

    $file = base64_encode($read);
    $file = chunk_split($file);

    $header .= "--$mail_boundary\n";
    $header .= "Content-type: $type; name=\"$name\"\n";
    $header .= "Content-Transfer-Encoding:base64\n";
    $header .= "Content-Disposition: attachment; filename=\"$name\"\n\n";
    $header .= $file."\n\n";
    }
    }
    }







    // Now, lets deal with what we've got so far!

    $valid_email = eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$", $email);

    if(!isset($missing) && $valid_email && $injection != true) {
    mail($myemail,$subject,'',$header);

    } elseif(!$valid_email){
    $thankyou = "La tua email non e' valida- Riprova di nuovo.";

    } elseif($injection == true){
    die("Email injection attempt detected and blocked.");

    } else {
    if(count($missing)>1){
    $last = array_pop($missing);
    $themissing = implode(', ',$missing).' and '.$last;
    $plu = 's';
    } else {
    $themissing = $missing[0];
    }
    $thankyou = "Sorry, but you do not seem to have filled out the field$plu ".$themissing.". Please go back and fill out all the required fields!";
    }






    // And, in the very end, we've got to catch the referrers and redirect back to where we came from.

    $ref = getenv("HTTP_REFERER");
    if (stristr($ref,'?'))
    $sep = "&";
    else
    $sep = "?";

    $thankyou .= ' .';
    $thankyou = urlencode($thankyou);



    header("Location: $ref${sep}message=$thankyou");



    ?>

  4. #4
    Il motivo per cui viene aggiunto il campo submit è il modo in cui viene creato il messaggio (vedi il ciclo
    while(list($key,$val) = each($_POST))).
    Modifica il form come segue:

    Codice PHP:
    <input type="submit" value="Invia!" /> 
    P.S.
    In futuro, cerca di usare il bbcode PHP per includere del codice nei tuoi post.

  5. #5
    Grazie Filippo, era li l'errore. Ti posso chiedere un ultimo consiglio, sul tasto che carica un immagine sempre in quello script c'è scritto sfoglia, ma se volessi cambiarlo in "search" (dovrei metterlo in una pagina inglese)come posso fare, cio' aggiunto value="search" ma niente , come dovrei risolvere, o dipende dalla nazionalita che si trova la pagina internet
    e lo visualizza in inglese automaticamente

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 © 2024 vBulletin Solutions, Inc. All rights reserved.