Ciao, scusate forse sono un po fuso (...e sarebbe ora che prendo una pausa) non riesco a capire perche dopo aver fatto il send il sito mi rimane bloccato in pagina bianca!
/*** Settaggio variabili globali PHP/4.1.2 ***/
if (!isset($_SERVER)) {$_SERVER = $HTTP_SERVER_VARS;}
if (!isset($_GET)) {$_GET = $HTTP_GET_VARS;}
if (!isset($_POST)) {$_POST = $HTTP_POST_VARS;}
if (!isset($_COOKIE)) {$_COOKIE = $HTTP_COOKIE_VARS;}
if (!isset($_FILES)) {$_FILES = $HTTP_POST_FILES;}
if (!isset($_ENV)) {$_ENV = $HTTP_ENV_VARS;}
if (!isset($_SESSION)) {$_SESSION = $HTTP_SERVER_VARS;}
/*** Impostazione dei messaggi di errore (solo per testing) ***/
error_reporting(0);
/*** Lettura del template ***/
$template_code = implode("",file($_POST['template_file']));
/*** Sostituzione dei valori ***/
$parsed = preg_replace('/()/e', '$_POST[\'$2\']', $template_code);
/*** Lettura dei valori ***/
$splitted = explode("#-#-#-#",$parsed);
$vars = array(
"from_name" => trim($splitted[0]),
"from_mail" => trim($splitted[1]),
"to_name" => trim($splitted[2]),
"to_mail" => trim($splitted[3]),
"reply_name" => trim($splitted[4]),
"reply_mail" => trim($splitted[5]),
"subject" => trim($splitted[6]),
"body" => $splitted[7],
"sent" => $splitted[8]
);
/*** Controllo dei campi ***/
if (($vars['from_name'] == "") || ($vars['from_mail'] == "") || ($vars['to_name'] == "") || ($vars['to_mail'] == "") || ($vars['reply_name'] == "") || ($vars['reply_mail'] == "") || ($vars['subject'] == "") || ($vars['body'] == "")) {exit();}
/*** Scrittura degli headers SMTP ***/
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/plain; charset=iso-8859-1\r\n";
$headers .= "Content-Transfer-Encoding: 8bit\r\n";
$headers .= "From: \"".$vars['from_name']."\" <".$vars['from_mail'].">\r\n";
$headers .= "To: \"".$vars['to_name']."\" <".$vars['to_mail'].">\r\n";
$headers .= "Reply-To: \"".$vars['reply_name']."\" <".$vars['reply_mail'].">\r\n";
/*** Invio della mail e operazioni successive ***/
if (mail($vars['to_mail'],$vars['subject'],$vars['body'],$headers)) {
if (stristr($vars['sent'],"goto=")) {
$goto = str_replace("goto=","",trim($vars['sent']));
header("Location: ".$goto);
}
else {echo $vars['sent'];}
}
Questo è il template:
#-#-#-#
#-#-#-#
xxxxxxxxxxxxxxxxxx
#-#-#-#
prova@ibero.it
#-#-#-#
#-#-#-#
#-#-#-#
#-#-#-#
#-#-#-#
goto:http://www.xxx.com
![]()