webide Posted March 6, 2007 Share Posted March 6, 2007 Hello, I look for an allowing contribution to a customer to send a file embellish with images during the order. I suggest articles engraving. I ais my basic models but me wish to give the possibility of personalizing these products by the customers by letting them send the image to be engraved. I ais tried this contribution who allows the download of images but me ais a bug because when I send a photo, he reappoints her by my name and my first name (with a space between) and the image does not appear in the e-mail. I think that the problem is situated on one of 2 files this below <? class mime_mail { var $parts; var $to; var $from; var $headers; var $subject; var $body; function mime_mail() { $this->parts = array(); $this->to = ""; $this->from = ""; $this->subject = ""; $this->body = ""; $this->headers = ""; } function add_attachment($message, $name = "", $ctype = "application/octet-stream") { $this->parts[] = array ( "ctype" => $ctype, "message" => $message, "encode" => $encode, "name" => $name ); } function build_message($part) { $message = $part["message"]; $message = chunk_split(base64_encode($message)); $encoding = "base64"; if ($part["name"]!="") { $dispstring = "Content-Disposition: attachment; filename=\"$part[name]\"\n"; } return "Content-Type: ".$part["ctype"]. ($part["name"]?"; name = \"".$part["name"]."\"" : ""). "\nContent-Transfer-Encoding: $encoding\n".$dispstring."\n$message\n"; } function build_multipart() { $boundary = "b".md5(uniqid(time())); $multipart = "Content-Type: multipart/mixed; boundary=$boundary\n\nThis is a MIME encoded message.\n\n--$boundary"; for($i = sizeof($this->parts)-1; $i >= 0; $i--) { $multipart .= "\n".$this->build_message($this->parts[$i])."--$boundary"; } return $multipart.= "--\n"; } function send() { $mime = ""; if (!empty($this->from)) $mime .= "From: ".$this->from."\n"; if (!empty($this->headers)) $mime .= $this->headers."\n"; if (!empty($this->body)) $this->add_attachment($this->body, "", "text/plain"); $mime .= "MIME-Version: 1.0\n".$this->build_multipart(); $success = mail($this->to, $this->subject, "", $mime); } }; ?> or include("config.inc"); include("mailsend.inc"); $img_info = getimagesize($bild); $img_info1 = getimagesize($bild1); $img_info2 = getimagesize($bild2); $img_info3 = getimagesize($bild3); $img_info4 = getimagesize($bild4); $img_info5 = getimagesize($bild5); $img_info6 = getimagesize($bild6); $img_info7 = getimagesize($bild7); $img_info8 = getimagesize($bild8); $img_info9 = getimagesize($bild9); $img_info10 = getimagesize($bild10); $img_info11 = getimagesize($bild11); $img_info12 = getimagesize($bild12); if ($bild) { if ($img_info[2] == '2') { $bildneu = "".$name."1.jpg"; } else { include("error.php"); exit; } } if ($bild1) { if ($img_info1[2] == '2') { $bildneu1 = "".$name."2.jpg"; } else { include("error.php"); exit; } } if ($bild2) { if ($img_info2[2] == '2') { $bildneu2 = "".$name."3.jpg"; } else { include("error.php"); exit; } } if ($bild3) { if ($img_info3[2] == '2') { $bildneu3 = "".$name."4.jpg"; } else { include("error.php"); exit; } } if ($bild4) { if ($img_info4[2] == '2') { $bildneu4 = "".$name."5.jpg"; } else { include("error.php"); exit; } } if ($bild5) { if ($img_info5[2] == '2') { $bildneu5 = "".$name."6.jpg"; } else { include("error.php"); exit; } } if ($bild6) { if ($img_info6[2] == '2') { $bildneu6 = "".$name."7.jpg"; } else { include("error.php"); exit; } } if ($bild7) { if ($img_info7[2] == '2') { $bildneu7 = "".$name."8.jpg"; } else { include("error.php"); exit; } } if ($bild8) { if ($img_info8[2] == '2') { $bildneu8 = "".$name."9.jpg"; } else { include("error.php"); exit; } } if ($bild9) { if ($img_info9[2] == '2') { $bildneu9 = "".$name."10.jpg"; } else { include("error.php"); exit; } } if ($bild10) { if ($img_info10[2] == '2') { $bildneu10 = "".$name."11.jpg"; } else { include("error.php"); exit; } } if ($bild11) { if ($img_info11[2] == '2') { $bildneu11 = "".$name."12.jpg"; } else { include("error.php"); exit; } } if ($bild12) { if ($img_info12[2] == '2') { $bildneu12 = "".$name."13.jpg"; } else { include("error.php"); exit; } } if ($bild) { copy($bild,$bildneu); // copie l'image $attachment = fread(fopen($bildneu, "r"), filesize($bildneu)); } if ($bild1) { copy($bild1,$bildneu1); // Kopiert das Bild $attachment1 = fread(fopen($bildneu1, "r"), filesize($bildneu1)); } if ($bild2) { copy($bild2,$bildneu2); // Kopiert das Bild $attachment2 = fread(fopen($bildneu2, "r"), filesize($bildneu2)); } if ($bild3) { copy($bild3,$bildneu3); // Kopiert das Bild $attachment3 = fread(fopen($bildneu3, "r"), filesize($bildneu3)); } if ($bild4) { copy($bild4,$bildneu4); // Kopiert das Bild $attachment4 = fread(fopen($bildneu4, "r"), filesize($bildneu4)); } if ($bild5) { copy($bild5,$bildneu5); // Kopiert das Bild $attachment5 = fread(fopen($bildneu5, "r"), filesize($bildneu5)); } if ($bild6) { copy($bild6,$bildneu6); // Kopiert das Bild $attachment6 = fread(fopen($bildneu6, "r"), filesize($bildneu6)); } if ($bild7) { copy($bild7,$bildneu7); // Kopiert das Bild $attachment7 = fread(fopen($bildneu7, "r"), filesize($bildneu7)); } if ($bild8) { copy($bild8,$bildneu8); // Kopiert das Bild $attachment8 = fread(fopen($bildneu8, "r"), filesize($bildneu8)); } if ($bild9) { copy($bild9,$bildneu9); // Kopiert das Bild $attachment9 = fread(fopen($bildneu9, "r"), filesize($bildneu9)); } if ($bild10) { copy($bild10,$bildneu10); // Kopiert das Bild $attachment10 = fread(fopen($bildneu10, "r"), filesize($bildneu10)); } if ($bild11) { copy($bild11,$bildneu11); // Kopiert das Bild $attachment11 = fread(fopen($bildneu11, "r"), filesize($bildneu11)); } if ($bild12) { copy($bild12,$bildneu12); // Kopiert das Bild $attachment12 = fread(fopen($bildneu12, "r"), filesize($bildneu12)); } $header.="Kundenname: ".$name."\n\n"; $header.="Kundenmail: ".$email."\n\n"; $header.="Bestellnummer: ".$betreff.""; $mail = new mime_mail(); $mail->headers = "Message-ID: <$mail_from>"; $mail->headers = "X-Mailer: PHP/".phpversion().""; $mail->headers = "X-Sender-IP: $REMOTE_ADDR"; $mail->from = "$email"; $mail->headers = "Errors-To: $mail_from"; $mail->to = "$mail_from"; $mail->subject = "Bildversand über Shopsystem"; $mail->body = "$header"; if ($bildneu) { if(eregi("(jpg)$",$bildneu)) { $mail->add_attachment("$attachment", $bildneu, "image/jpeg"); } } if ($bildneu1) { if(eregi("(jpg)$",$bildneu1)) { $mail->add_attachment("$attachment1", $bildneu1, "image/jpeg"); } } if ($bildneu2) { if(eregi("(jpg)$",$bildneu2)) { $mail->add_attachment("$attachment2", $bildneu2, "image/jpeg"); } } if ($bildneu3) { if(eregi("(jpg)$",$bildneu3)) { $mail->add_attachment("$attachment3", $bildneu3, "image/jpeg"); } } if ($bildneu4) { if(eregi("(jpg)$",$bildneu4)) { $mail->add_attachment("$attachment4", $bildneu4, "image/jpeg"); } } if ($bildneu5) { if(eregi("(jpg)$",$bildneu5)) { $mail->add_attachment("$attachment5", $bildneu5, "image/jpeg"); } } if ($bildneu6) { if(eregi("(jpg)$",$bildneu6)) { $mail->add_attachment("$attachment6", $bildneu6, "image/jpeg"); } } if ($bildneu7) { if(eregi("(jpg)$",$bildneu7)) { $mail->add_attachment("$attachment7", $bildneu7, "image/jpeg"); } } if ($bildneu8) { if(eregi("(jpg)$",$bildneu8)) { $mail->add_attachment("$attachment8", $bildneu8, "image/jpeg"); } } if ($bildneu9) { if(eregi("(jpg)$",$bildneu9)) { $mail->add_attachment("$attachment9", $bildneu9, "image/jpeg"); } } if ($bildneu10) { if(eregi("(jpg)$",$bildneu10)) { $mail->add_attachment("$attachment10", $bildneu10, "image/jpeg"); } } if ($bildneu11) { if(eregi("(jpg)$",$bildneu11)) { $mail->add_attachment("$attachment11", $bildneu11, "image/jpeg"); } } if ($bildneu12) { if(eregi("(jpg)$",$bildneu12)) { $mail->add_attachment("$attachment12", $bildneu12, "image/jpeg"); } } $mail->send(); @unlink($bildneu); // Efface l'image temporaire @unlink($bildneu1); // Löscht das temporäre Bild @unlink($bildneu2); // Löscht das temporäre Bild @unlink($bildneu3); // Löscht das temporäre Bild @unlink($bildneu4); // Löscht das temporäre Bild @unlink($bildneu5); // Löscht das temporäre Bild @unlink($bildneu6); // Löscht das temporäre Bild @unlink($bildneu7); // Löscht das temporäre Bild @unlink($bildneu8); // Löscht das temporäre Bild @unlink($bildneu9); // Löscht das temporäre Bild @unlink($bildneu10); // Löscht das temporäre Bild @unlink($bildneu11); // Löscht das temporäre Bild @unlink($bildneu12); // Löscht das temporäre Bild include("ok.php"); ?> If somebody had the answer it would help me a lot Thanks webide Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.