<?php
$fehler ="";
$nz = chr(13);
$who = $_POST['who'];
$customer= $_POST['customer'];
$company = $_POST['company'];
$company_extra = $_POST['company_extra'];
$name= $_POST['name'];
$number= $_POST['number'];
$phone= $_POST['phone'];
$fax= $_POST['fax'];
$mail= $_POST['mail'];
$bill_street= $_POST['bill_street'];
$bill_city= $_POST['bill_city'];
$bill_add= $_POST['bill_add'];
$bill_country= $_POST['bill_country'];
$bill_zip= $_POST['bill_zip'];
$ship_street= $_POST['ship_street'];
$ship_city= $_POST['ship_city'];
$ship_add= $_POST['ship_add'];
$ship_country= $_POST['ship_country'];
$ship_zip= $_POST['ship_zip'];
$vat= $_POST['vat'];
$cc= $_POST['cc'];
$currency= $_POST['currency'];
$deliverer= $_POST['deliverer'];
$other= $_POST['other'];
$account= $_POST['account'];
$units= $_POST['units'];
$article= $_POST['article'];
$note= $_POST['note'];
$message= $_POST['message'];
$pay= $_POST['pay'];
$shipping= $_POST['shipping'];
$what= $_POST['what'];
$newsletter= $_POST['newsletter'];
$condition= $_POST['condition'];
if (empty($who)) $fehler .= "<li>Please, fill if you are a private person or a company. </li>";
if (empty($customer)) $fehler .= "<li>Please, check if you have already ordered from us.</li>";
if (empty($name)) $fehler .= "<li>Please, fill in your name. </li>";
if (empty($phone)) $fehler .= "<li>Please, fill in your phone number. </li>";
if (empty($mail)) $fehler .= "<li>Please, fill in your mail adress. </li>";
if (empty($message)) $fehler .= "<li>Please, tell us how we can help you. The Messagebox is empty. </li>";
if (empty($what)) $fehler .= "<li>Please, tell us if this is a order or a request. </li>";
if (empty($condition)) $fehler .= "<li>Please, read our conditions and check the box. </li>";
if (empty($fehler)) {
if(is_array($_POST['units'])){
$units = "";
for($i=0; $i<count($_POST['units']); $i++){
$units .= "- " . $_POST['units'][$i] . " Einheiten " . $_POST['article'][$i] . " (" . $_POST['note'][$i] . ")<br />";
}
}else{
$units= "- " . $_POST['units'] . " Einheiten " . $_POST['article'] . " (" . $_POST['note'] . ")";
}
$an = "name@xyz.com";
$an_news = "newsletter@xyzcom";
$betreff = "Subject: " .$what .", " .$company ." " .$name;
$betreff_news = "Subscribe Newsletter";
$from = "From: " .$company ." " .$name ."<" .$mail .">\n";
$from .= "Reply-To: " .$mail ."\n";
$from .= "Content-Type: text/html\n";
$datum = "Datum: ".date("j.n.Y");
$zeit = "Zeit: ".date("H:i").$nz;
$von = "Von: ".$name."<".$mail.">".$nz;
$bill_adress = "<td><b>Billing Adress:</b><p>" .$bill_street ." </p><p>" .bill_add ." </p><p>" .$bill_city ." </p><p>" .$bill_country ." </p><p>" .$bill_zip ."</p></td>";
$ship_adress = "<td><b>Shipping Adress:</b><p>" .$ship_street ." </p><p>" .ship_add ." </p><p>".$ship_city ." </p><p>" .$ship_country ." </p><p>" .$ship_zip ."</p></td>";
$message = "<p><b>Message:</b> " .$message ."</p>";
$what = "<p><b>Order or Request:</b> " .$what ."</p>";
$condition = "<p><b>Condition:</b> " .$condition ."</p>";
$personal = "<td><b>Company or Privat: </b>" .$who ."</td> <td><b>Already customer?</b> ".$customer ."</td></tr><tr><td><b>Customer Number:</b> " .$number ."</td></tr><tr><td><b>Company: </b>" .$company ." (" .$company_extra .")" ."</td><td><b>Name:</b> " .$name ."</td></tr><tr><td><b>Mail:</b> " .$mail ."</td> <td><b>Phone:</b> " .$phone ."</tr><tr></td> <td><b>Fax:</b> " .$fax ."</td></tr><tr>" .$bill_adress .$ship_adress ;
$order = "<b>Order:</b> <p>" .$units ."</p>";
$text='<!DOCTYPE html PUBLIC "-//W3C//DTD html 4.01 Transitional//EN">';
$text.='<html>';
$text.='<head>';
$text.="<style> body { font-family: Verdana, Georgia, Arial, Helvetica, sans-serif; font-size: 1em; text-align:left; line-height:140%}
p {margin:0px}
table {
font-size: 1em; margin-top:10px}
table tr {margin-top: 10px}
table td { width:400px}
</style>";
$text.='</head>';
$text.='<body>';
$text.= "<p><td>$datum, $zeit </p>";
$text.= "<table><tr>$personal</tr>";
$text.= "<tr><td><b>VAT: </b>$vat</td></tr>";
$text.= "<tr><td><b>Payment: </b>$pay</td><td><b>Creditcard: </b>$cc</td></tr>";
$text.= "<tr><td><b>Currency: </b>$currency</td></tr>";
$text.= "<tr><td><b>Deliverer: </b>$deliverer </td><td> $other</td></tr>";
$text.= "<tr><td><b>Account Number: </b>$account </td></tr>";
$text.= "<tr><td colspan=\"2\">$message <td></tr>";
$text.= "<tr><td> $order </td></tr>";
$text.= "<tr><td> <b>Newsletter:</b> $newsletter </td></tr>";
$text.= "</table>";
$text.='</body>';
$text.='</html>';
$titel = "Thank you for your Mail. You will get a confirmation within the next days.";
mail($an,$betreff,$text,$from);
mail($mail,$betreff,$text,$from);
} else $titel = "Sorry, but there is a mistake.";
if($_POST["newsletter"] == "accept" )
{
mail($an_news,$betreff_news,$mail,$from);
}echo $titel = "Sorry, you didn't accept the newsletter.";
?>
<?php
?>
<html>
<style type="text/css">
body {
font-family: Verdana, Georgia, Arial, Helvetica, sans-serif;
font-size: 0.85em;
text-align:left;
line-height:140%}
p {margin:0px}
table {
font-size: 1em; margin-top:10px}
table tr {margin-top: 10px}
table td { width:400px}
</style>
<head>
<title><?=$titel?></title>
</head>
<body>
<?php
if (empty($fehler)) {
$text = strip_tags($text);
$text = htmlentities($text);
$text = str_replace($nz,"<br>",$text);
echo "<p><b>Thank you for your Mail. You will get a confirmation within the next days.</b></p>";
echo "<p><td>$datum, $zeit </p>";
echo "<table><tr>$personal</tr>";
echo "<tr><td><b>VAT: </b>$vat</td></tr>";
echo "<tr><td><b>Payment: </b>$pay</td><td><b>Creditcard: </b>$cc</td></tr>";
echo "<tr><td><b>Currency: </b>$currency</td></tr>";
echo "<tr><td><b>Deliverer: </b>$deliverer </td><td> $other</td></tr>";
echo "<tr><td><b>Account Number: </b>$account </td></tr>";
echo "<tr><td colspan=\"2\">$message <td></tr>";
echo "<tr><td> $order </td></tr>";
echo "<tr><td> <b>Newsletter:</b> $newsletter </td></tr>";
echo "</table>";
} else {
echo "<p>Sorry, your message could not be send:";
echo "<ul>$fehler</ul>";
echo "</p>";
}
?>
</body>
</html>