non mi è mai capitata una cosa simile...
allora praticamente quando un messaggio viene inviato correttamente tramite heder(location) reindirizzo ad una pagina "contact_mailer.php" dove tramite $_get e $_server['http_referer'] controllo la provenienza in modo che se un uente vada direttamente in questa pagina visualizza un messaggio diverso..ovviamente in locale va una meraviglia ma su aruba il messaggio viene inviato per mail, viene inserito nel db ma invece di andare alla pagina "contact_mailer.php" ricarica la stessa pagina "contatti.php" troncata.. evidentemente da qualche errore ma che non me lo visualizza nell'output...
può essere perchè aruba usa php 4 e non il 5? cosa cambia dal 4 al 5 i miei script?
ecco il codice della pagina "contact_mailer"
Codice PHP:
<?php header("Cache-Control: Private");
include("ls/gzip/init_gzip.php");
$arrayRes = array();
if(isset($_GET['result']) && isset($_SERVER['HTTP_REFERER'])) {
if($_GET['result']=="info-err-db" && (stripos($_SERVER['HTTP_REFERER'], $_SERVER['SERVER_NAME']) === false)) {
$title = 'ERRORE INVIO DEL MESSAGGIO';
$mess = '[img]img/generale/no.gif[/img]
[b]Il messaggio non è stato inviato correttamente![/b]
Fra qualche secondo verrai reindirizzato alla pagina precedente per reinviare il messaggio.
( [url="javascript:history.back(-1)"]Se non vieni reindirizzato clicca quì[/url] oppure clicca sul tasto "TORNA INDIETRO" del tuo Browser. )';
$redirect = 'javascript:history.back(-1);';
$arrayRes[] = $title;
$arrayRes[] = $mess;
$arrayRes[] = $redirect;
} elseif($_GET['result']=="info-err-mail" && (stripos($_SERVER['HTTP_REFERER'], $_SERVER['SERVER_NAME']) === false)) {
$title = 'ERRORE INVIO DEL MESSAGGIO';
$mess = '[img]img/generale/no.gif[/img]
[b]Il messaggio non è stato inviato correttamente![/b]
Fra qualche secondo verrai reindirizzato alla pagina precedente per reinviare il messaggio.
( [url="javascript:history.back(-1)"]Se non vieni reindirizzato clicca quì[/url] oppure clicca sul tasto "TORNA INDIETRO" del tuo Browser. )';
$redirect = 'javascript:history.back(-1);';
$arrayRes[] = $title;
$arrayRes[] = $mess;
$arrayRes[] = $redirect;
} else {
$title = 'MESSAGGIO INVIATO CORRETTAMENTE';
$mess = '[img]img/generale/ok.gif[/img]
[b]Il messaggio è stato inviato correttamente![/b]
Fra qualche secondo verrai reindirizzato alla HomPage del sito.
( [url="index.php"]Se non vuoi aspettare clicca quì[/url] )';
$redirect = 'index.php';
$arrayRes[] = $title;
$arrayRes[] = $mess;
$arrayRes[] = $redirect;
}
} else {
$title = 'ERRORE';
$mess = '[img]img/generale/no.gif[/img]
[b]Non dovresti visualizzare questa pagina...[/b]';
$redirect = 'index.php';
$arrayRes[] = $title;
$arrayRes[] = $mess;
$arrayRes[] = $redirect;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="it" xml:lang="it">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>SITO - <?php echo $arrayRes[0]; ?></title>
<meta name="Title" content="SITO - <?php echo $arrayRes[0]; ?>" />
<style type="text/css">
a.mail_ass:link,a.mail_ass:visited,a.mail_ass:active { text-decoration: none; color: #11315A; }
a.mail_ass:hover { text-decoration: underline; color: #FF0000; }
</style>
</head>
<body style="background-color: #CCCCCC; color: #415463; font-size: 12px; font-family: Verdana, Arial, Helvetica, sans-serif">
<div>
<div style="padding: 5px; border: 1px solid #415463; text-align: center; margin: 0 auto; background-color: #F2F3F4; width: 500px; height: 130px">
<?php echo $arrayRes[1]; header('Refresh: 5; url='.$arrayRes[2]); ?>
</div>
</div>
</body>
</html>
<?php include("ls/gzip/close_gzip.php"); ?>
ovviamente con "init_gzip.php" inizializzo l'output buffering.
questo invece è il codice di controllo sulla pagina "contatti.php"
Codice PHP:
$date = getdate();
$data = $date['mday'].'/'.$date['mon'].'/'.$date['year'];
if($date['minutes']<10) {
$minuti = '0'.$date['minutes'];
} else {
$minuti = $date['minutes'];
}
if($date['hours']<10) {
$ore = '0'.$date['hours'];
} else {
$ore = $date['hours'];
}
$ora = $ore.':'.$minuti;
//filtri
include("ls/filtri/filtri.php");
//inizializzo tutti gli errori FALSE
$testoErr = FALSE;
$nomeErr = FALSE;
$cognomeErr = FALSE;
$telefonoErr = FALSE;
$emailErr = FALSE;
$arrayErr = array();
if(isset($_POST['submit'])) {
/*carico variabili da POST*/
$nome = strip_tags($_POST['nome']);
$cognome = strip_tags($_POST['cognome']);
$telefono = $_POST['telefono'];
$email = strip_tags($_POST['email']);
$testo = nl2br(htmlspecialchars($_POST['testo'],ENT_NOQUOTES));
if($nome != "") {
if(controllaStringaUguale($nome)) {
$nomeErr = TRUE;
$err1 = "Il \"Nome\" che hai inserito contiene solo caratteri uguali.
";
$arrayErr[] = $err1;
}
}
if($nome != "") {
if(isBadwords($nome)) {
$nomeErr = TRUE;
$err2 = "Il \"Nome\" che hai inserito contiene parole non consentite (es. hai inserito delle parolacce).
";
$arrayErr[] = $err2;
}
}
if($nome != "") {
if(strlen($nome) < 2) {
$nomeErr = TRUE;
$err3 = "Hai inserito un \"Nome\" inferiore ai 2 caratteri.
";
$arrayErr[] = $err3;
}
}
if($nome != "") {
if(strpos($nome,"0") != FALSE || strpos($nome,"1") != FALSE || strpos($nome,"2") != FALSE || strpos($nome,"3") != FALSE || strpos($nome,"4") != FALSE || strpos($nome,"5") != FALSE || strpos($nome,"6") != FALSE || strpos($nome,"7") != FALSE || strpos($nome,"8") != FALSE || strpos($nome,"9") != FALSE) {
$nomeErr = TRUE;
$err4 = "Il campo \"Nome\" non può contenere valori NUMERICI.
";
$arrayErr[] = $err4;
}
}
if($cognome != "") {
if(controllaStringaUguale($cognome)) {
$cognomeErr = TRUE;
$err5 = "Il \"Cognome\" che hai inserito contiene solo caratteri uguali.
";
$arrayErr[] = $err5;
}
}
if($cognome != "") {
if(isBadwords($cognome)) {
$cognomeErr = TRUE;
$err6 = "Il \"Testo\" che hai inserito contiene parole non consentite (es. hai inserito delle parolacce).
";
$arrayErr[] = $err6;
}
}
if($cognome != "") {
if(strlen($cognome) < 2) {
$cognomeErr = TRUE;
$err7 = "Hai inserito un \"Cognome\" inferiore ai 2 caratteri.
";
$arrayErr[] = $err7;
}
}
if($cognome != "") {
if(strpos($cognome,"0") != FALSE || strpos($cognome,"1") != FALSE || strpos($cognome,"2") != FALSE || strpos($cognome,"3") != FALSE || strpos($cognome,"4") != FALSE || strpos($cognome,"5") != FALSE || strpos($cognome,"6") != FALSE || strpos($cognome,"7") != FALSE || strpos($cognome,"8") != FALSE || strpos($cognome,"9") != FALSE) {
$cognomeErr = TRUE;
$err8 = "Il campo \"Cognome\" non può contenere valori NUMERICI.
";
$arrayErr[] = $err8;
}
}
if($nome != "" && $cognome != "") {
if($nome == $cognome) {
$nomeErr = TRUE;
$cognomeErr = TRUE;
$err9 = "Il campo \"Nome\" risulta essere uguale al campo \"Cognome\".
";
$arrayErr[] = $err9;
}
}
if($telefono != '') {
if(is_numeric(trim($telefono)) == FALSE) {
$telefonoErr = TRUE;
$err10 = "Il campo \"Telefono\" può contenere solamente caratteri NUMERICI.
";
$arrayErr[] = $err10;
}
}
if($telefono != "") {
if(strlen($telefono) < 5) {
$telefonoErr = TRUE;
$err11 = "Hai inserito un numero di \"Telefono\" troppo breve. (almeno 5 numeri)
";
$arrayErr[] = $err11;
}
}
if($telefono != "") {
if(is_numeric($telefono)) {
if(controllaStringaUguale($telefono)) {
$telefonoErr = TRUE;
$err12 = "Il numero di \"Telefono\" che hai inserito contiene solo numeri uguali.
";
$arrayErr[] = $err12;
}
}
}
if($email != "") {
if(!ereg("^[^@ ]+@[^@ ]+\.[^@ \.]+$",$email)) {
$emailErr = TRUE;
$err13 = "Non hai scritto correttamente il tuo indirizzo \"E-mail\".
";
$arrayErr[] = $err13;
}
}
if($email == "") {
$emailErr = TRUE;
$err14 = "Hai lasciato vuoto il campo \"E-mail\".
";
$arrayErr[] = $err14;
}
if(controllaStringaUguale($testo)) {
$testoErr = TRUE;
$err15 = "Il Testo che hai immsesso contiene solo caratteri uguali.
";
$arrayErr[] = $err15;
}
if(isBadwords($testo)) {
$testoErr = TRUE;
$err16 = "Il \"Testo\" che hai immesso contiene parole non consentite (es. hai inserito delle parolacce).
";
$arrayErr[] = $err16;
}
if($testo == "") {
$testoErr = TRUE;
$err17 = "Hai lasciato vuoto il campo \"Testo\".
";
$arrayErr[] = $err17;
}
if (count($arrayErr) != 0) {
echo '[img]img/iconcine/err_write.gif[/img]<font style="color: #FF0000; font-weight: bold">Il Messaggio non è stato inviato perchè hai commesso i seguenti errori:
';
for($i=0; $i<count($arrayErr); $i++) {
echo '- '.$arrayErr[$i];
}
echo '</font>
';
} else {
if($telefono == '') {
$ins_q = "INSERT INTO contatti(data,ora,nome,cognome,email,testo) VALUES('$data','$ora','$nome','$cognome','$email','$testo')";
} else {
$ins_q = "INSERT INTO contatti(data,ora,nome,cognome,telefono,email,testo) VALUES('$data','$ora','$nome','$cognome','$telefono','$email','$testo')";
}
include("ls/conn/conn.php");
$conn = connetti();
$q = mysql_query($ins_q);
if($q != FALSE) {
disconnetti($conn);
$to = "info@sito.org";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: [email]info@SITO.org[/email]";
include("ls/contatti/corpo_mail.php");
if (mail($to,"Richiesta Info - SITO",$corpo,$headers)) {
header("location: contact_mailer.php?result=info-mail-ok");
exit;
} else {
header("location: contact_mailer.php?result=info-err-mail");
exit;
}
} else {
disconnetti($conn);
header("location: contact_mailer.php?result=info-err-db");
exit;
}
}
}
?>
spero troviate il motivo del problema e se ho commesso io qualche errore...grazie..