problème de redirection
Posté : 04 janv. 2012, 16:51
Bonjour,
J'ai créé une page ou j'envoie de information via un mail. Tout se passe tiptop, mais quand je veux rediriger sur la page de confirmation rien ne se passe.
J'ai créé une page ou j'envoie de information via un mail. Tout se passe tiptop, mais quand je veux rediriger sur la page de confirmation rien ne se passe.
<?php header( 'content-type: text/html; charset=utf-8' );
session_start();
?>
<html>
<head>
<link href="style.css" rel="stylesheet" type="text/css">
<title>PHPMailer - SMTP basic test with authentication</title>
</head>
<body>
<?php
if(empty($_POST['nom']) || empty($_POST['prenom']) || empty($_POST['adresse']) || empty($_POST['npa'])|| empty($_POST['ville'])|| empty($_POST['email']) )
{
echo'<table align="center" width="1000">
<tr><td class="bodycentre"align="center" class="texte" valign="middle" >';
echo'<br><br><br><br><br><br><samp class="texte" > ATTENTION seule le champ note peux rester vide! </span><a href="javascript:history.back();">Retour au formulaire </a>';
echo'
</td></tr>
<tr><td class="texte" colspan="2">
<hr class="texte">Site optimisé pour Safari.<br>
© 2011 Graphisme : Valentina Zofra et Sarah Richoux / Codage : Martial Croisier<br>
Contact : <a href="mailto:[email protected]" class="lien">Webmaster</a> / <a href="mailto:[email protected]" class="lien">Informations</a><br>
</td></tr></table>';
}
elseif($_SESSION['code'] != $_POST['verif']) {
echo'<table align="center" width="1000">
<tr><td class="bodycentre"align="center" class="texte" valign="middle" >';
echo'<br><br><br><br><br><br><span class="texte"> ATTENTION le code sécurité est faux!</span> <a href="javascript:history.back();" class="bleu">Retour au formulaire </a>';
echo'
</td></tr>
<tr><td class="texte" colspan="2">
<hr class="texte">Site optimisé pour Safari.<br>
© 2011 Graphisme : Valentina Zofra et Sarah Richoux / Codage : Martial Croisier<br>
Contact : <a href="mailto:[email protected]" class="lien">Webmaster</a> / <a href="mailto:[email protected]" class="lien">Informations</a><br>
</td></tr></table>';
}
else
{
//error_reporting(E_ALL);
error_reporting(E_STRICT);
date_default_timezone_set('America/Toronto');
require_once('phpmailer/class.phpmailer.php');
//include("phpmailer/examples/class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
$mail = new PHPMailer();
$body = ('Bonjour '.$_POST['nom'].' '.$_POST['prenom'].",<br><br>Vous venez de passer la commande suivante via le Shop des Kamikazes.<br><br>
CD New Born : <strong>".$_POST['new']."</strong> fois<br><br>
CD Show Must Go On : <strong>".$_POST['show']."</strong> fois<br><br>
CD X : <strong>".$_POST['X'].
"</strong> fois<br><br>Prix total de la commande : <strong>".$_POST['prix'].
"Frs</strong><br><br><strong> Livraison et facturation:</strong><br><br>
Nom Prénom: ".$_POST['nom'].' '.$_POST['prenom']."<br><br>
Adresse : ".$_POST['adresse']."<br><br>
NPA Ville: ".$_POST['npa'].' '.$_POST['ville']."<br><br>
Email: ".$_POST['email']."<br><br>
Note ".$_POST['note']."<br>"
);
$body = eregi_replace("[\]",'',$body);
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "smtp.netplus.ch"; // SMTP server
$mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
// 1 = errors and messages
// 2 = messages only
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Host = "smtp.netplus.ch"; // sets the SMTP server
$mail->Port = 587; // set the SMTP port for the GMAIL server
$mail->Username = "[email protected]"; // SMTP account username
$mail->Password = "77srammars77"; // SMTP account password
$mail->SetFrom(''.$_POST['email'].'', ''.$_POST['nom'].''.$_POST['prenom'].'');
$mail->AddReplyTo(''.$_POST['email'].'',''.$_POST['nom'].''.$_POST['prenom'].'');
$mail->Subject = "Voici une nouvelle commande depuis le shop des Kamikazes";
$mail->MsgHTML($body);
$address = "[email protected]";
$mail->AddAddress($address);
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
header("location:shopconfirme.php");
}
}
?>
</body>
</html>
Normalement cela fonction bien avec se genre de code
header("location:shopconfirme.php");
Merci a celui qui pourra m'aider