<?php
// Your e-mail adress:
$mailto = "info@topautoparts.nl";
# Maximum size of attachment in bytes:
$max_attach_size = 500000;
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Contact</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body><?php
/*if (empty($_POST['form_submitted']))
{
?></font><p><font color="#4682B4 ">Please fill out the form:</font></p>
<font color="#4682B4 "><?php
}
*/
if (isset($_POST["form_submitted"])) {
$name = $_POST['name'];
$email = $_POST['email'];
$subject = $_POST['subject'];
$text = $_POST['text'];
$merk = $_POST['merk'];
$type = $_POST['type'];
$bouwjaar = $_POST['bouwjaar'];
$motorinhoud = $_POST['motorinhoud'];
$kentekennummer = $_POST['kenteken nummer'];
if ($email != "" and
!preg_match("/^[^@]+@.+\.\D{2,5}$/", $email)) $errors[] = "e-mail address lijkt incorrect"; if ($text == "") $errors[] = "Geen bericht geplaatst";
if ($_FILES['probe']['size'] > $max_attach_size) $errors[] = "Bijlage is te groot(".number_format($_FILES['probe']['size']/1000,0,",","")." KB) - maximum size: ".number_format($max_attach_size/1000,0,",","")." KB";
{
if ($name != "") $mail_name=$name; else $mail_name="Unknown";
if ($subject != "") $mail_subject = $subject; else $mail_subject = "No subject";
if ($email != "") $mail_email = $email; else $mail_email = "email@unknown.xyz";
if ($merk != "") $merk_merk=$merk; else $mail_merk="Unknown";
if ($type != "") $type_type=$type; else $mail_type="Unknown";
if ($bouwjaar != "") $bouwjaar_bouwjaar=$bouwjaar; else $mail_bouwjaar="Unknown";
$ip = $_SERVER["REMOTE_ADDR"];
// if attachment, MIME-Mail:
if (isset($_FILES['probe']['name']) && trim($_FILES['probe']['name']) != "") {
// read and encode file:
$datei_content = fread(fopen($_FILES['probe']['tmp_name'],"r"),filesize($_FILES['probe']['tmp_name'])); // Boundary:
// Mail-Header:
$mail_header = "From: ".$mail_name." <".$mail_email.">\n";
$mail_header .= "X-Sender-IP: ".$ip."\n";
$mail_header .= "MIME-Version: 1.0\n";
$mail_header .= "Content-Type: multipart/mixed; boundary=\"".$boundary."\"\n";
$mail_header .= "This is a multi-part message in MIME format.\n";
// Mail-Text:
$mail_header .= "--".$boundary;
$mail_header .= "\nContent-Type: text/plain";
$mail_header .= "\nContent-Transfer-Encoding: 8bit";
$mail_header .= "\n\n".$text;
// Attachment:
$mail_header .= "\n--".$boundary;
$mail_header .= "\nContent-Type: ".$_FILES['probe']['type']."; name=\"".$_FILES['probe']['name']."\"";
$mail_header .= "\nContent-Transfer-Encoding: base64";
$mail_header .= "\nContent-Disposition: attachment; filename=\"".$_FILES['probe']['name']."\"";
$mail_header .= "\n\n".$datei_content;
// End:
$mail_header .= "\n--".$boundary."--";
// Sende E-Mail und gebe Fehler bzw. Bestaetigung aus
if (@mail($mailto,$mail_subject,"",$mail_header)) $sent = true; else $errors[] = "no connection to the mailserver - please try again later"; }
// no attachment, normal E-mail:
else
{
$mail_header = "From: ".$mail_name." <".$mail_email.">\n";
$mail_header .= "X-Sender-IP: $ip\n";
$mail_header .= "Content-Type: text/plain";
if (@mail($mailto,$mail_subject,$text,$mail_header)) $sent = true; else $errors[] = "no connection to the mailserver - please try again later"; }
// copy to sender:
if (isset($sent) && isset($email) && $email != "" && isset($_POST['copy'])) {
if (isset($_FILES['probe']['name']) && trim($_FILES['probe']['name']) != "") $copy_mail_text = "Copy of the e-mail:\n\n".$text."\n\nAttachment: ".$_FILES['probe']['name']; else $copy_mail_text = "Copy of the e-mail:\n\n".$text; $header= "From: ".$mailto."\n";
$header .= "X-Sender-IP: ".$ip."\n";
$header .= "Content-Type: text/plain";
@mail($email, $mail_subject, $copy_mail_text, $header); }
}
}
{
{
?></font><p class="caution"><font color="#4682B4 ">Error:</font></p><ul>
<font color="#4682B4 "><?php foreach($errors as $f) { ?></font><li>
<font color="#4682B4 ">
<?php echo $f; ?></li>
<?php } ?></font></ul>
<font color="#4682B4 "><br /><?php
}
?></font><form method="post" action="
<?php echo basename($_SERVER["PHP_SELF"]); ?>" enctype="multipart/form-data"><div>
<p><font color="#4682B4 "><span class="style2"><font face="Verdana" size="2">
Naam</font></span><font face="Verdana" size="2"><span class="style2">:</span><br />
</font>
</font><font color="#4682B4 ">
<font face="Verdana" size="2">
<br />
<span class="style2">E-mail:</span><br />
</font>
</font><font color="#4682B4 ">
<font face="Verdana" size="2">
<br />
<span class="style2">Onderwerp:</span><br />
</font>
</font><font color="#4682B4 ">
<input name="subject" value="
<?php if (isset($subject)) echo htmlentities(stripslashes($subject)); else echo ""; ?>" size="25" style="font-family: Verdana; border: 1px dashed #000000" />
<font face="Verdana" size="2">
<br />
<span class="style2">Bericht:</span><br />
</font>
</font><font color="#4682B4 ">
</textarea>
<font face="Verdana" size="2">
<br><br><font color="#4682B4 "><strong>Aanvraag uitlaat of katalysator</strong></font><br>
<br />
<span class="style2">Merk:</span><br />
</font>
</font><font color="#4682B4 ">
<font face="Verdana" size="2">
<br />
<span class="style2">type:</span><br />
</font>
</font><font color="#4682B4 ">
<font face="Verdana" size="2">
<br />
<span class="style2">bouwjaar:</span><br />
</font>
</font><font color="#4682B4 ">
<input name="bouwjaar" value="
<?php if (isset($bouwjaar)) echo htmlentities(stripslashes($email)); else echo ""; ?>" size="25" style="font-family: Verdana; border: 1px dashed #000000" />
<font face="Verdana" size="2">
<br />
<span class="style2">Motor inhoud:</span><br />
</font>
</font><font color="#4682B4 ">
<input name="bouwjaar" value="
<?php if (isset($motorinhoud)) echo htmlentities(stripslashes($email)); else echo ""; ?>" size="25" style="font-family: Verdana; border: 1px dashed #000000" />
<font face="Verdana" size="2">
<br />
<span class="style2">Kenteken nummer:</span><br />
</font>
</font><font color="#4682B4 ">
<input name="bouwjaar" value="
<?php if (isset($kentekennummer)) echo htmlentities(stripslashes($email)); else echo ""; ?>" size="25" style="font-family: Verdana; border: 1px dashed #000000" />
<font face="Verdana" size="2"><br><br>
<span class="style2">Bijlagen:</span><br />
</font>
</font><font color="#4682B4 ">
<input type="file" name="probe" value="
<?php if (isset($_POST['probe'])) echo htmlentities(stripslashes($_POST['probe'])); else echo ""; ?>" size="16" style="font-family: Verdana; border: 1px dashed #000000"/>
</font>
<p><font color="#4682B4 ">Heeft u een auto, maar weet niet welke uitlaat hieronder past?<br>
Upload een afbeelding, en wij zoeken voor u een gepaste uitlaat.</font></p>
</p>
</p>
<p><font face="Verdana"><font color="#4682B4 "><input type="checkbox" name="copy" value="true" /></font><font size="2" color="#4682B4 ">
<span class="style2">Kopie naar jezelf sturen?</span> </font></font>
<font color="#4682B4 ">
<input type="submit" name="form_submitted" value="OK - Verzenden" style="font-family: Verdana; border: 1px dashed #000000" /></font><font face="Verdana" size="2" color="#4682B4 ">
</font> </p>
</div>
</form><font color="#4682B4 "><?php
}
else
{
if (empty($email)) { ?></font></font><font color="#4682B4 "> </font>
<p><font color="#4682B4 "><b><font face="Verdana" size="1">Bedankt</font></b><font size="1" face="Verdana"><b>!</b><br />
Je mail is verzonden alleen kan ik je niet terug mailen omdat je geen e-mail
adres hebt ingevuld! </font></font></p>
<font face="Verdana" size="1"><font color="#4682B4 "><?php }
else { ?></font></font><font color="#4682B4 "> </font>
<p><font color="#4682B4 "><b><font face="Verdana" size="1">Bedankt</font></b><font size="1" face="Verdana"><b>!</b><br />
Je bericht is met succes verzonden ik zal zo spoedig mogelijk terug mailen. </font>
</font></p>
<font face="Verdana" size="1" color="#4682B4 "><?php }
}
?>