Ciao a tutti, ho bisogno di un aiuto importante per far funzionare questo Form Mail "NON RIESCO A FARE LA VALIDAZIONE CAPTCHA" - Mi aiutate per favore??
-Questo è il file "FORM.html":
	
	
	
		
-Questo è il file "VALIDATION.js":
	
	
	
		
-Questo è il file "CAPTCHA.php":
	
	
	
		
-Questo è il file "INVIA.php":
	
	
	
		
:: Grazie per l'aiuto anticipatamente!!
 Grazie per l'aiuto anticipatamente!!  ::
 ::
				
			-Questo è il file "FORM.html":
		HTML:
	
	<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>FORM JAVASCRIPT</title>
<script type="text/javascript" language="javascript" src="validation.js"></script>
<script>
function reload_captcha () {
    document.getElementById("captcha").src = "captcha.php?" + Math.random();
}
</script>
</head>
<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0">
<form method="POST" name="modulo" action="invia.php" onSubmit="return Controlla(this);">
                    <div align="left">
                    <div align="left">
                    <div align="left">
                <table border="0" width="450" cellspacing="0" cellpadding="0" id="table380">
                    <tr>
                        <td>
<i><b>
                            <font face="Arial" color="#4B4B4B">
                            Verifica disponibilità</font></b></i></td>
                    </tr>
                    <tr>
                        <td>
                            <div align="center">
                                <table border="0" width="100%">
                                    <tr>
                                        <td width="111">
                                    <font face="Arial" size="2" color="#4B4B4B">
                                    Cognome:</font><font face="Verdana" style="font-size: 10pt; font-weight: 700" color="#FF0000">*</font></td>
                                        <td> </td>
                                        <td>
                                    <font face="Arial" size="2" color="#4B4B4B">
                                    Nome:</font><font face="Verdana" style="font-size: 10pt; font-weight: 700" color="#FF0000">*</font></td>
                                        <td> </td>
                                    </tr>
                                    <tr>
                                        <td width="111">
                                    <font size="4" face="Palatino Linotype">
                                    <input type="text" name="cognome" size="25" style="border:1px solid #D1D1D1; float: left; padding-left:4px; padding-right:4px; padding-top:1px; padding-bottom:1px; color:#43C5C3; font-family:Bookman Old Style; background-image: url('text.jpg')"></font></td>
                                        <td> </td>
                                        <td>
                                    <font size="4" face="Palatino Linotype">
                                    <input name="nome" size="25" style="border:1px solid #D1D1D1; float: left; padding-left:4px; padding-right:4px; padding-top:1px; padding-bottom:1px; color:#43C5C3; font-family:Bookman Old Style; background-image: url('text.jpg')"></font></td>
                                        <td> </td>
                                    </tr>
                                    <tr>
                                        <td width="111">
                                    <font face="Arial" size="2" color="#4B4B4B">
                                    Telefono/Cellulare:</font><font face="Verdana" style="font-size: 10pt; font-weight: 700" color="#FF0000">*</font></td>
                                        <td> </td>
                                        <td>
                                        <font face="Arial" size="2" color="#4B4B4B">
                                    Città:</font><font face="Verdana" style="font-size: 10pt; font-weight: 700" color="#FF0000">*</font></td>
                                        <td> </td>
                                    </tr>
                                    <tr>
                                        <td width="111">
                                    <font size="4" face="Palatino Linotype">
                                    <input type="text" name="telefono" size="25" style="border:1px solid #D1D1D1; float: left; padding-left:4px; padding-right:4px; padding-top:1px; padding-bottom:1px; color:#43C5C3; font-family:Bookman Old Style; background-image: url('text.jpg')"></font></td>
                                        <td> </td>
                                        <td>
                                    <font size="4" face="Palatino Linotype">
                                    <input type="text" name="citta" size="30" style="border:1px solid #D1D1D1; float: left; padding-left:4px; padding-right:4px; padding-top:1px; padding-bottom:1px; color:#43C5C3; font-family:Bookman Old Style; background-image: url('text.jpg')"></font></td>
                                        <td> </td>
                                    </tr>
                                    <tr>
                                        <td width="111">
                                    <font face="Arial" size="2" color="#4B4B4B">
                                    E-mail:</font><font face="Verdana" style="font-size: 10pt; font-weight: 700" color="#FF0000">*</font></td>
                                        <td> </td>
                                        <td> </td>
                                        <td> </td>
                                    </tr>
                                    <tr>
                                        <td width="111">
                                    <font size="4" face="Palatino Linotype">
                                    <input type="text" name="email" size="25" style="border:1px solid #D1D1D1; float: left; padding-left:4px; padding-right:4px; padding-top:1px; padding-bottom:1px; color:#43C5C3; font-family:Bookman Old Style; background-image: url('text.jpg')"></font></td>
                                        <td> </td>
                                        <td> </td>
                                        <td> </td>
                                    </tr>
                                </table>
                            </div>
                                </td>
                    </tr>
                    <tr>
                        <td>
 </td>
                    </tr>
                    <tr>
                        <td>
<table cellSpacing="0" cellPadding="0" align="center" border="0" id="table677" width="340">
    <tr>
        <td style="FONT-SIZE: 9pt; COLOR: #003e84; FONT-FAMILY: Verdana" vAlign="top">
         </td>
        <td style="FONT-SIZE: 9pt; COLOR: #003e84; FONT-FAMILY: Verdana" vAlign="top" width="160">
         <p><font size="2" color="#4B4B4B" face="Arial">Modalità di 
        pagamento:</font><b><font color="#FF0000" size="2">*</font></b></td>
        <td style="FONT-SIZE: 9pt; COLOR: #003e84; FONT-FAMILY: Verdana" width="159">
        <font size="2" color="#000000"><br>
        </font>
        <font face="Verdana">
        <input type="radio" value="Bonifico Bancario" name="pagamento" checked></font><font size="2" color="#000000"><font face="Arial">Bonifico 
        Bancario</font><br>
        </font>
        <font face="Verdana">
        <input type="radio" value="Contanti" name="pagamento" ></font><font size="2" color="#000000"><font face="Arial">Contanti</font><font face="Palatino Linotype"><br>
 </font></font></td>
    </tr>
</table>
                                    <div align="center">
                                        <table border="0" width="400" cellpadding="0" id="table678">
                                            <tr>
                                                <td width="20">
                                                <p align="left">
                                                <label for="accetto">
                                                <input id="accetto" type="checkbox" value="accetto" name="C6" checked /></label>
                                                </td>
                                                <td>
                                                <a href="file:///E:/Backup%20ELIO%2005.06.2012/Materiale%20di%20Elio/sito%20ELMAR/Sito%20v.23%20con%20nuova%20Area%20protetta/protect/protect-APREAMARE/x" class="linkelmar">
                                                <font face="Arial" color="#4B4B4B" size="1">
                                                <span style="text-decoration: none">
                                                Autorizzo trattamento Dati 
                                                Personali</span></font><b><span style="text-decoration: none"><font face="Arial" size="1" color="#4B4B4B">
                                                »</font></span></b></a></td>
                                                <td width="146">
                                                <p align="center">
                                                <b>
                                                <font size="2" face="Arial" color="#4B4B4B">
                                                (</font><font color="#FF0000" size="2" face="Verdana">*</font><font size="2" face="Arial" color="#4B4B4B">) 
                                                    </font><i><span lang="it">
                                                <font size="1" face="Arial" color="#4B4B4B">
                                                Campi obbligatori</font></span></i></b></td>
                                                <td width="18">
                                                 </td>
                                            </tr>
                                        </table>
<div align="center">
    <table border="0" width="425" id="table679">
        <tr>
            <td width="76"> </td>
            <td width="320">
             </td>
            <td width="15">
             </td>
        </tr>
        <tr>
            <td width="76"><font face="Arial" size="2" color="#4B4B4B">
            Particolari servizi o necessità:</font></td>
            <td width="320">
            <textarea name="richieste" rows="5" cols="50" style="border:1px solid #C0C0C0; padding-left:3px; padding-right:3px; color:#43C5C3; font-family:Arial"></textarea></td>
            <td width="15">
             </td>
        </tr>
    </table>
    <p> </div></div>
                                </td>
                    </tr>
                    <tr>
                        <td>
<img src="captcha.php" alt="Captcha" id="captcha" border="1px" value='<?php $_POST["captcha"] ?>'/>
<img border="0" src="code-refresh.png" width="16" height="16" onClick="reload_captcha()">
<font color="#4B4B4B">» </font>
<input type="text" name="codice" size="5" maxlength="3" style="border:1px solid #D1D1D1; padding-left:4px; padding-right:4px; padding-top:1px; padding-bottom:1px; color:#43C5C3; font-family:Bookman Old Style; background-image: url('text.jpg')"></td>
                    </tr>
                    <tr>
                        <td>
                                    <div align="left">
                                        <table border="0" width="228" cellspacing="4" height="74">
                                            <tr>
                                                <td width="218">
                <input type="button" value="Verifica disponibilità" onClick="Controlla()" style="width: 270; height: 74; color: #FFFFFF; font-family: Verdana; font-size: 11; font-weight: bold; border-width: 0; padding-left: 10px; padding-right: 10px; padding-top: 8px; padding-bottom: 10px; background-image: url('Pulsante-invia.jpg'); float:left"></td>
                                            </tr>
                                        </table>
                                    </div>
                                </td>
                    </tr>
                    </form>
                    </table>
                    </div>
                    </div>
                    </div>
</body>
</html>-Questo è il file "VALIDATION.js":
		Codice:
	
	// *** INIZIO ***
function Controlla(){
var cognome = document.forms.modulo.cognome.value;
var nome = document.forms.modulo.nome.value;
var email = document.forms.modulo.email.value;
var telefono = document.forms.modulo.telefono.value;
var citta = document.forms.modulo.citta.value;
var captcha = document.getElementById("captcha");
var codice = document.forms.modulo.codice.value;
var email_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;  //Indirizzo email valido
var num_reg_exp = /^([0-9])+$/;  //Inserimento solo Numeri
var reg_exp = /^([a-zA-Z0-9])+$/;  //Inserimento Lettere e Numeri
var let_reg_exp = /^([a-zA-Z])+$/;  //Inserimento solo Lettere
var alertMsg = 'Il form contiene uno o pi\371 errori:\n';
/*
\371 = ù
\350 = è
\340 = à
*/
Errore="";
    if(cognome==""){Errore=alertMsg += ' -> Il campo Cognome \350 richiesto\n';
                                                  document.forms.modulo.cognome.value = '';
                                                 }
    if(nome==""){Errore=alertMsg += " -> Il campo Nome \350 richiesto\n";
                                                  document.forms.modulo.nome.value = '';
                                                 }
                                                                             
    if(!email_reg_exp.test(email)){Errore=alertMsg += " -> Il campo E-mail deve contenere un indirizzo email valido\n";
                                                  document.forms.modulo.email.value = '';
                                                 }
    if(!num_reg_exp.test(telefono)){Errore=alertMsg += " -> Il campo Telefono deve contenere solo numeri\n";
                                                  document.forms.modulo.telefono.value = '';
                                                 }
                                                 
    if(citta==""){Errore=alertMsg += " -> Il campo Citt\340 \350 richiesto\n";
                                                  document.forms.modulo.citta.value = '';
                                                 }
                                                                                                                                                                                                  
    if (document.forms.modulo.accetto.checked==false){Errore=alertMsg += " -> Il checkbox Autorizzo trattamento dati deve essere selezionato\n";
                                                 }
                    
    if(codice != captcha){Errore=alertMsg += " -> Il campo Captcha non corrisponde\n";
                                                  document.forms.modulo.codice.value = '';
                                                 }                                                                                                                                                                  
                                                                                        
    if(Errore==""){
          document.forms.modulo.action = 'invia.php';
          document.forms.modulo.submit();
    }else{
        alert(Errore);
    }
}
// *** FINE ***-Questo è il file "CAPTCHA.php":
		PHP:
	
	<?php 
//Avvio della sessione dove conserverò il codice captcha.
session_start();
//Genero un codice di 3 cifre in maniera random.
$random_txt = md5(microtime());
$random_txt = substr($random_txt, 0, 3);
//Creo un immagine png (leggera) sfruttandolo come sfondo (120x40px)
$immagine = imagecreatefrompng("captcha.png");
//Seleziono il colore del testo in formato RGB nel nostro caso
//0,0,0 equivale al colore Black
$colore = imagecolorallocate($immagine, 0, 0, 0);
//Creo un immagine finale, dove i campi numerici identificano 
//la grandezza del carattere, la distanza da sinistra e la distanza dal 
//margine alto
imagestring($immagine, 100, 35, 15, $random_txt, $colore);
//Creo la sessione che conserva il testo random
$_SESSION['CODICE'] = $random_txt;
//Visualizzo l'immagine per il captcha
header("Content-type: image/jpeg");
imagejpeg($immagine);
?>-Questo è il file "INVIA.php":
		PHP:
	
	<?php 
// PARAMETRI E-MAIL
$email_destinatario = "xxxx@xxxx.it";
$nome_mittente = "xxxxx";
$email_mittente = "info@xxxxxx.it";
$oggetto_email = "RICHIESTA DISPONIBILITA";
$pagina_form = "form.html";
// PAGINA DI RINGRAZIAMENTO
$pagina_grazie = "grazie.php";
//*******************************************************************
// *** DATI ***
$cognome      = ltrim(rtrim(strip_tags(stripslashes($_POST['cognome']))));
$nome         = ltrim(rtrim(strip_tags(stripslashes($_POST['nome']))));
$email        = ltrim(rtrim(strip_tags(stripslashes($_POST['email']))));
$telefono     = ltrim(rtrim(strip_tags(stripslashes($_POST['telefono']))));
$citta        = ltrim(rtrim(strip_tags(stripslashes($_POST['citta']))));
$richieste    = ltrim(rtrim(strip_tags(stripslashes($_POST['richieste']))));
//*******************************************************************
$ip        = getenv("REMOTE_ADDR");
$ora       = date ("H:i:s"); 
$oggi      = date ("d/m/Y");
//*******************************************************************
// OTTENERE LA VERSIONE PHP.
       $php_versione = "PHP/" . phpversion();
//*******************************************************************
// PARAMETRI MESSAGGIO E-MAIL.
$msgformat  = "Inviato il $oggi alle ore $ora Da:\n
Cognome: $cognome
Nome: $nome
Citta: $citta
Tel/Cell: $telefono
E-mail: $email
Pagamento: $pagamento
Particolari servizi o necessita: $richieste
-------------------------------------
Indirizzo IP: $ip
Versione $php_versione";
//*******************************************************************************************************************
// MODALITA DI PAGAMENTO *******************************************************************
if($pagamento == "Bonifico Bancario") {
       "Bonifico Bancario";
        } elseif($pagamento == "Contanti") {
           "Contanti";
              }  
      
//*** INVIO E-MAIL **************************************************************************************
       if ($_SESSION['CODICE']=!$_POST['codice']) {
              echo "<script language=javascript>alert('Il codice Captcha inserito non corrisponde.')</script>";
              header("Location: $pagina_form");
       } else {
mail($email_destinatario, $oggetto_email, $msgformat, "From: $nome_mittente <$email_mittente>");
    header("Location: $pagina_grazie");
       } 
?>::
 Grazie per l'aiuto anticipatamente!!
 Grazie per l'aiuto anticipatamente!!  ::
 ::
			
				Ultima modifica di un moderatore: 
			
		
	
										
										
											
	
										
									
								 
	 
	 
 
		 Grazie per la risposta che mi hai dato, e sopratutto Grazie anticipatamente per l'aiuto!!
 Grazie per la risposta che mi hai dato, e sopratutto Grazie anticipatamente per l'aiuto!!  
 
		 
 
		 
 
		