Pagina 2 di 2 primaprima 1 2
Visualizzazione dei risultati da 11 a 16 su 16
  1. #11
    Ciao,
    io non sono un grandissimo esperto, ma per il mio sito ho fatto così:

    Ho fatto la pagina contatti che va rinominata .php [la mia si chiama proprio contatti.php]
    ed ho inserito questo codice
    Codice PHP:
    <html xmlns="http://www.w3.org/1999/xhtml" lang="it">

    <head>
    ....
    ....
       <title>Contatti</title>
    ....
    ....
     </head>
    <body>
    <div>
                 <?php echo stripslashes($_GET[message])?> 

                   
                 <form method="post" action="amailzing.php" enctype="multipart/form-data">
                 
                 


                 Inserisci il tuo nome 

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


                 
                 Inserisci il tuo indirizzo Email 

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


                 
                  Inserisci il messaggio 

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


                   
                 <input type="submit" value="Send the email!" />


    </div></body>
    nella stessa cartella dove ho salvato la pagina contatti.php va salvato un altro file:
    apri il block notes e gli copi tutto questo codice
    Codice PHP:
    <?php
    // aMAILzing version 1.1 - [url]http://scripts.inexistent.org[/url]
    // Copyright ©2005, 2007, Christine R., [email]cineee@gmail.com[/email]
    // Last updated December 2nd, 2007.
    // Please don't redistribute without written permission. :)

    // To change the settings, simply change "email@email.com" to the email address
    // you wish for the emails to be sent to, and "Thanks for your email, 
    // I'll get back on you later!" to the confirmation message you want to be shown
    // when everything is working just fine and the message was sent! :)
    // Please avoid use of quoation signs. (")

    $myemail "gookart21@yahoo.it";

    $thankyou "Grazie per averci scritto, sarete ricontattati il prima possibile :)";


    // If you're using file uploads, you may want to specify allowed file extensions.
    // To allow all extensions, simply remove the line below. (or put "//" in front of it)

    $allowed_fileuploads "png gif jpg zip rar html";


    // If you find yourself receiving a lot of spam, something as easy as asking an addition question
    // may decrease the amount noticeably, if not get rid of the spam entirely. To utilize this
    // simple way of doing it, add an extra input to your form, in which you promt the visitor to
    // enter the sum of 5 and 6. Give the input the name of "math". Then uncomment (remove //'s)
    // the following three lines.

    // if($_POST['math'] != '11' && $_POST['math'] != 'eleven'){
    //     die("Come on, that's kindergarten-level math. ;) Try again! What's the answer to 5+6?");
    // }












    // Don't edit anything below this line, unless you know what you are doing! :)




    // Make sure nobody gets stuck in infinite loops.

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









    // Gather all the required fields. Remove the REQUIRED part from their names. 
    // The bug which made the required fields appear last in the email has been fixed.

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





    // If there is a myemail value in the form, send the email to it instead!

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






    // Set default values if there exists none.

    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 "mail dal sito"; }// Validate inputs for email injections.

    reset($_POST);

    $injection false;

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









    // Write the start of the email body.

    $message =  "The following form was sent to you from your website!\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";





    // Find all the fields, and add them to the email.

    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";
    }





    // Write the rest of the email body.

    $message .= "-----------------------------------------------------------\n";
    $message .= " ";
    $message stripslashes($message);







    // Write the headers.

    $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: aMAILzing 1.1 [url]http://scripts.inexistent.org\n[/url]";
    $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(
    "The type of file is not allowed as attachments. Please go back and upload another file.");
                    }
                }


                
    $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 "L'idirizzo mail inserito non è valido";

    } 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 "Ci dispiace, ma non hai compilato il campo$plu ".$themissing.". Perfavore compila tutti i campi.";
    }






    // 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 .= ' [size="1"].[/size]';
    $thankyou urlencode($thankyou);



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

    // If you want a separate thankyou page, change the above to
    // header("Location: filename.html");
    // or
    // header("Location: filename.html?message=$thankyou");


    // And then, we're done!

    ?>
    il file lo salvi con nome amailzing.php
    ed in quel codice devi solo mettere il tuo indirizzo mail in questa riga:
    (") $myemail = "tuo indirizzo mail";

    p.s. ovviamente il sito deve fornire servizi php

  2. #12
    a ricman: che vuol dire Non Urlare? chi urla?
    se ti riferisci alle parole in maiuscolo, era solo per evidenziare la domanda, eh!

  3. #13
    Utente bannato
    Registrato dal
    Sep 2009
    Messaggi
    1,737
    Originariamente inviato da alessioflirt
    a ricman: che vuol dire Non Urlare? chi urla?
    se ti riferisci alle parole in maiuscolo, era solo per evidenziare la domanda, eh!
    ricman ha ragione, scrivere in maiuscolo equivale ad urlare, se devi evidenziare qualche cosa, usa il grassetto o il colore del testo e anche per il tuo hosting ha ragione, sei tu che devi sapere cosa hai acquistato, come daltro canto ti avevo già detto io, se voi essere aiutato non devi indisporre chi ti deve aiutare

  4. #14
    chiedo scusa, allora!

  5. #15
    allora, son partito dal principio, e intanto ho attivato le estensioni php sul mio server.

    ho fatto varie prove con form trovati qua e là sul web ma, con uno, che all'apparenza funziona, noto che l'email non arriva a destinazione; con il secondo, nel momento in cui si clicca su INVIA, mi dà un errore relativo a CGI...cosa è CGI?

    vi spiego meglio nel dettaglio:

    nel primo caso ho utilizzato due file, come spiegato su questo sito: http://www.antoniofullone.it/tutoria...-sito-con-php/ - ma il risultato è stato che, sembra funzionare, in quanto appare la pagina con la scritta MAIL INVIATA CON SUCCESSO, ma andando a controllare sulla posta elettronica non vi è nessuna mail;

    nel secondo caso ho usato l'esempio riportato su questo sito: http://we.register.it/support/formmail.html - l'ho seguito pari passo ma il risultato è, come ho detto , vano perchè l'email non arriva a destinazione e appare l'errore relativo a CGI.

    Cosa fare?

  6. #16
    Originariamente inviato da alessioflirt
    cosa è CGI?
    http://it.wikipedia.org/wiki/Common_Gateway_Interface


    Originariamente inviato da alessioflirt
    ma il risultato è stato che, sembra funzionare, in quanto appare la pagina con la scritta MAIL INVIATA CON SUCCESSO, ma andando a controllare sulla posta elettronica non vi è nessuna mail;
    Entrambi gli argomenti che stai trattando sono OT (non in linea col tema di questo forum).
    Lasciamo perdere i cgi... Torna al php (c'è anche un forum dedicato) e concentrati.
    Hai verificate di aver scritto bene l'indirizzo email a cui deve arrivare la l'email?
    Hai provato altri script? Nella sezione Script di Php, ce ne sono tantissimi...

    E soprattutto leggiti come funziona la funzione "mail()" di php seguendo istruzioni ed esempi (su php.net) puoi subito fare un test che funziona (provato e garantito)
    Fantasupermegafavolipermeramagicultra irresistibili
    4 10 30 100 1001 personaggi insuperabili fantaincredibili ultraimpossibili iperterribili irresistibili!!!

    "... a quell'età ... bastava un dito per fare la pace ..."
    fotine

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.