euclidean
Nouveau membre
bonjour, mon problème est le suivant: de manière aléatoir les enregistrements sur une base mysql ne se font pas. je dis bien aléatoire. un client sur 10 à peu près. le script en question est composé de trois partie. une requête mysql, un envoi par smtp d'un message de confirmation au client, un envoie par la fonction mail() de notification au webmaster.
Quant les enregistrements dans la base ne se font pas les emails sont quand même reçus. ce que je voudrais comprendre c'est si le script est trop lourd (problème d'optimisation, si mon serveur virtuel (256 ram) peut avoir des problèmes entre la requête smtp et la'ccès à la base (je précise que sur ce serveur ne tourne que ces deux services !)
voici un morceau du code:
récupération des variables et requête mysql:
if (empty ($_POST['reservation'])) { header('Location: request.php'); die; }
else {
require("class/class.phpmailer.php");
$reservation = $_POST['reservation']; $name = $_POST['name']; $email = $_POST['email']; $arrival = $_POST['arrival']; $departure = $_POST['departure']; $nights = $_POST['nights']; $display_arrival = $_POST['display_arrival']; $display_departure = $_POST['display_departure']; $mysql_arrival = $_POST['mysql_arrival']; $mysql_departure = $_POST['mysql_departure']; $adults = $_POST['adults']; $children1 = $_POST['children1']; $children2 = $_POST['children2']; $type1 = $_POST['room1']; $type2 = $_POST['room2']; $type3 = $_POST['room3']; $address = $_POST['address']; $country = $_POST['country']; $fax = $_POST['fax']; $phone = $_POST['phone']; $comments = $_POST['comments']; $name_card = $_POST['name']; $CardNumber = $_POST['CardNumber']; $CardType = $_POST['CardType']; $ExpMonth = $_POST['ExpMonth']; $ExpYear = $_POST['ExpYear']; $ccv = $_POST['ccv']; $earlymorning = $_POST['earlymorning']." ".$_POST['flight_early']; $pulloutsofa = $_POST['pulloutsofa']; $twinbeds = $_POST['twinbeds']; $doublebeds = $_POST['doublebeds']; $foldaway = $_POST['foldaway']; $babycot = $_POST['babycot']; $highchair = $_POST['highchair']; $taxi = $_POST['taxi']; $flight = $_POST['taxi']." ".$_POST['flight']; $date=(date("d/m/y")); $special = $earlymorning." ".$flight." ".$pulloutsofa." ".$twinbeds." ".$doublebeds." ".$foldaway." ".$babycot." ".$highchair; $room = $type1." ".$type2." ".$type3;
$link = mysql_connect("localhost", "xxxxx", "xxxxx") or die ("Technical error. Please hit your browser back button and submit the form again. thank you !");
mysql_select_db("xxxxx") or die("Technical error. Please hit your browser back button and submit the form again. thank you !");
$query = "INSERT INTO xxxxx VALUES ('$id', '$reservation', '$email', '$name', '$address', '$country', '$phone', '$fax', '$room', '$arrival', '$departure', '$mysql_arrival', '$mysql_departure', '$nights', '$adults', '$children1', '$children2', '$comments', '$name_card', '$CardNumber', '$CardType', '$ExpMonth', '$ExpYear', '$ccv', '$special', 'no', '$date')";
$result = mysql_query($query) or die("Technical error. Please hit your browser back button and submit the form again. thank you !");
mysql_close($link);
envoi smtp vie phpmailer (aucune erreur de ce côté là):
$mail = new PHPMailer(); $mail->IsSMTP(); $mail->Host = "mail.xxxxx.com"; $mail->SMTPAuth = true; $mail->Username = "booking@xxxxx.com"; $mail->Password = "xxxxx"; $mail->From = "booking@xxxxx.com"; $mail->FromName = "xxxxx"; $mail->AddAddress("$email", "$name"); $mail->AddReplyTo("booking@xxxxx.com"); $mail->WordWrap = 72; $mail->IsHTML(true); $mail->Subject = "Your Booking Request"; $mail->Body ="<html><head><style type='text/css'>body,td { font-family: helvetica, arial, verdana; font-size: 11px; color: #000000; }</style></head><body><table width=\"100%\" cellpadding=10 cellspacing=0 border=0><tr><td height=\"15\" bgcolor=\"#E4E0CF\"></td></tr></table><p>Thank you for your enquiry.<br><br>This is an automatic response to your request. We will deal with it personally and send you a reply as soon as possible.</p><td align=left valign=top width=70%><p>First choice: <font color=\"#CC6600\">$type1</font> - Second choice: <font color=\"#CC6600\">$type2</font> - Third choice: <font color=\"#CC6600\">$type3</font></p><p>Arrival: <font color=\"#CC6600\">$display_arrival</font></p><p>Departure: <font color=\"#CC6600\">$display_departure</font> - Number of nights: <font color=\"#CC6600\">$nights</font></p><p>Adults: <font color=\"#CC6600\">$adults</font> - Children(0-10): <font color=\"#CC6600\">$children1</font> - Children(10-16): <font color=\"#CC6600\">$children2</font> </p></td></tr><tr><td align=left valign=top colspan=2><p><b>Special requests selected:</b> $special</p>
<p><b>Comments:</b><br />$comments</p></td></table></body></html>";
$mail->AltBody = "Dear $name, You receive this message because your email client can't display the copy of the booking request you've just made on our website. You will receive soon a final confirmation for your booking request or a proposal from us. Thank you. Arni.";
if(!$mail->Send()) { echo "We are sorry. Our server couldn't register your booking request because of a technical problem. please contact info@roomwithaview.is directly to submit your request <p>"; echo "Mailer Error: " . $mail->ErrorInfo; exit; }
puis ensuite vient la fonction mail, redirection vers une page de confirmation et fermeture de l'accolade du debut.
je ne trouve pas la solution.
merci de m'aider !
Quant les enregistrements dans la base ne se font pas les emails sont quand même reçus. ce que je voudrais comprendre c'est si le script est trop lourd (problème d'optimisation, si mon serveur virtuel (256 ram) peut avoir des problèmes entre la requête smtp et la'ccès à la base (je précise que sur ce serveur ne tourne que ces deux services !)
voici un morceau du code:
récupération des variables et requête mysql:
if (empty ($_POST['reservation'])) { header('Location: request.php'); die; }
else {
require("class/class.phpmailer.php");
$reservation = $_POST['reservation']; $name = $_POST['name']; $email = $_POST['email']; $arrival = $_POST['arrival']; $departure = $_POST['departure']; $nights = $_POST['nights']; $display_arrival = $_POST['display_arrival']; $display_departure = $_POST['display_departure']; $mysql_arrival = $_POST['mysql_arrival']; $mysql_departure = $_POST['mysql_departure']; $adults = $_POST['adults']; $children1 = $_POST['children1']; $children2 = $_POST['children2']; $type1 = $_POST['room1']; $type2 = $_POST['room2']; $type3 = $_POST['room3']; $address = $_POST['address']; $country = $_POST['country']; $fax = $_POST['fax']; $phone = $_POST['phone']; $comments = $_POST['comments']; $name_card = $_POST['name']; $CardNumber = $_POST['CardNumber']; $CardType = $_POST['CardType']; $ExpMonth = $_POST['ExpMonth']; $ExpYear = $_POST['ExpYear']; $ccv = $_POST['ccv']; $earlymorning = $_POST['earlymorning']." ".$_POST['flight_early']; $pulloutsofa = $_POST['pulloutsofa']; $twinbeds = $_POST['twinbeds']; $doublebeds = $_POST['doublebeds']; $foldaway = $_POST['foldaway']; $babycot = $_POST['babycot']; $highchair = $_POST['highchair']; $taxi = $_POST['taxi']; $flight = $_POST['taxi']." ".$_POST['flight']; $date=(date("d/m/y")); $special = $earlymorning." ".$flight." ".$pulloutsofa." ".$twinbeds." ".$doublebeds." ".$foldaway." ".$babycot." ".$highchair; $room = $type1." ".$type2." ".$type3;
$link = mysql_connect("localhost", "xxxxx", "xxxxx") or die ("Technical error. Please hit your browser back button and submit the form again. thank you !");
mysql_select_db("xxxxx") or die("Technical error. Please hit your browser back button and submit the form again. thank you !");
$query = "INSERT INTO xxxxx VALUES ('$id', '$reservation', '$email', '$name', '$address', '$country', '$phone', '$fax', '$room', '$arrival', '$departure', '$mysql_arrival', '$mysql_departure', '$nights', '$adults', '$children1', '$children2', '$comments', '$name_card', '$CardNumber', '$CardType', '$ExpMonth', '$ExpYear', '$ccv', '$special', 'no', '$date')";
$result = mysql_query($query) or die("Technical error. Please hit your browser back button and submit the form again. thank you !");
mysql_close($link);
envoi smtp vie phpmailer (aucune erreur de ce côté là):
$mail = new PHPMailer(); $mail->IsSMTP(); $mail->Host = "mail.xxxxx.com"; $mail->SMTPAuth = true; $mail->Username = "booking@xxxxx.com"; $mail->Password = "xxxxx"; $mail->From = "booking@xxxxx.com"; $mail->FromName = "xxxxx"; $mail->AddAddress("$email", "$name"); $mail->AddReplyTo("booking@xxxxx.com"); $mail->WordWrap = 72; $mail->IsHTML(true); $mail->Subject = "Your Booking Request"; $mail->Body ="<html><head><style type='text/css'>body,td { font-family: helvetica, arial, verdana; font-size: 11px; color: #000000; }</style></head><body><table width=\"100%\" cellpadding=10 cellspacing=0 border=0><tr><td height=\"15\" bgcolor=\"#E4E0CF\"></td></tr></table><p>Thank you for your enquiry.<br><br>This is an automatic response to your request. We will deal with it personally and send you a reply as soon as possible.</p><td align=left valign=top width=70%><p>First choice: <font color=\"#CC6600\">$type1</font> - Second choice: <font color=\"#CC6600\">$type2</font> - Third choice: <font color=\"#CC6600\">$type3</font></p><p>Arrival: <font color=\"#CC6600\">$display_arrival</font></p><p>Departure: <font color=\"#CC6600\">$display_departure</font> - Number of nights: <font color=\"#CC6600\">$nights</font></p><p>Adults: <font color=\"#CC6600\">$adults</font> - Children(0-10): <font color=\"#CC6600\">$children1</font> - Children(10-16): <font color=\"#CC6600\">$children2</font> </p></td></tr><tr><td align=left valign=top colspan=2><p><b>Special requests selected:</b> $special</p>
<p><b>Comments:</b><br />$comments</p></td></table></body></html>";
$mail->AltBody = "Dear $name, You receive this message because your email client can't display the copy of the booking request you've just made on our website. You will receive soon a final confirmation for your booking request or a proposal from us. Thank you. Arni.";
if(!$mail->Send()) { echo "We are sorry. Our server couldn't register your booking request because of a technical problem. please contact info@roomwithaview.is directly to submit your request <p>"; echo "Mailer Error: " . $mail->ErrorInfo; exit; }
puis ensuite vient la fonction mail, redirection vers une page de confirmation et fermeture de l'accolade du debut.
je ne trouve pas la solution.
merci de m'aider !