Salve a tutti non capisco l'errore che mi da l'output.
Warning: Cannot modify header information - headers already sent by (output started at /home/mobil57/public_html/viral-marketing-virale-adv-e-marketing.php:5) in /home/mobil57/public_html/viral-marketing-virale-adv-e-marketing.php on line 139
codice:
<?php
require_once('CaptchasDotNet.php');
//function to check for strings.
function checkStr($str) {
$strings = array("content-type:","mime-version:","multipart/mixed","Content-Transfer-Encoding:","bcc:","cc:","to:");
foreach($strings as $string) {
if(eregi($string, strtolower($str))) {
return true;
}
}
}
function noNewLines($str) {
if (eregi("(\r|\n)", $str)) {
return true;
}
}
$captchas = new CaptchasDotNet ('nome', 'codice','/tmp/captchasnet-random-strings','3600','abcdefghkmnopqrstuvwxyz','6','250','70');
if($_POST) {
$fNome = $_POST['fNome'];
$fCognome = $_POST['fCognome'];
$fTelefono = $_POST['fTelefono'];
$fEmail = $_POST['fEmail'];
$fComments = $_POST['fComments'];
$fCaptcha = $_POST['fCaptcha'];
$random_string = $_POST['random_string'];
if(noNewLines($fNome) == true || noNewLines($fCognome) == true || noNewLines($fTelefono) == true || noNewLines($fEmail) == true || checkStr($fComments) == true) {
$errmsg = 'Devi compilare tutti i campi';
} elseif (!$captchas->validate ($random_string)){
$errmsg = 'Devi inserire un codice di controllo anti-spam nuovo, aggiorna la pagina e riprova.';
} elseif (!$captchas->verify ($fCaptcha)) {
$errmsg = 'Controlla che il testo del controllo anti-spam sia corretto.';
} elseif ($fNome == '' || $fCognome == '' || $fTelefono == '' || $fEmail == '' || $fComments == '') {
$errmsg = 'Devi inserire Nome, Cognome, Telefono, Email e la tua Richiesta';
} else {
$msg = 'Nome: '. $fNome . "\n";
$msg.= 'Cognome: ' . $fCognome . "\n";
$msg.= 'Telefono: ' . $fTelefono . "\n";
$msg.= 'Email: ' . $fEmail . "\n";
$msg.= 'Richiesta: '. $fComments;
//send email
if(mail('nome@account.ext','Contatto dal sito:',$msg, 'From:noreply@account.ext')) {
header("Location:grazie.php");
}else {
$errmsg = 'Ci sono stati dei problemi riprova.';
}
}
} else {
$random_string = $captchas->random ();
$fNome = '';
$fCognome = '';
$fTelefono = '';
$fEmail = '';
$fComments = '';
}
?>
<?php
if(isset($errmsg)) {
echo '<p class="fuxia">'.$errmsg.'</p>'."\n";
}
?>
<form id="info" method="post" action="viral-marketing-virale-adv-e-marketing.php">
<label for="fNome">Nome: <span class="required">*</span></label>
<input class="textfield" type="text" name="fNome" id="fNome" value="<?php echo $fNome; ?>"/></p>
<label for="fCognome">Cognome: <span class="required">*</span></label>
<input class="textfield" type="text" name="fCognome" id="fCognome" value="<?php echo $fCognome; ?>"/></p>
<label for="fTelefono">Telefono: <span class="required">*</span></label>
<input class="textfield" type="text" name="fTelefono" id="fTelefono" value="<?php echo $fTelefono; ?>"/></p>
<label for="fEmail">E-mail: <span class="required">*</span></label>
<input class="textfield" type="text" name="fEmail" id="fEmail" value="<?php echo $fEmail; ?>"/></p>
<label for="fComments">Richiesta <span class="required">*</span></label>
<textarea name="fComments" id="fComments" cols="35" rows="5" class="textfield"><?php echo $fComments; ?></textarea></p>
<?= $captchas->image () ?>
Audio Fonetico (MP3)
<label for="fCaptcha">Inserisci il testo che vedi qui sopra
</label>
<input type="text" name="fCaptcha" id="fCaptcha" class="textfield" /></p>
<input type="hidden" name="random_string" id="random_string" value="<?php echo $random_string; ?>" />
<input type="submit" value="Invia" class="btn-submit" /></p>
</form>