switch($_GET['b']){
case"1":
echo"
\n";
break;
case "2":
if($_POST['naam']==""||$_POST['voornaam']==""||$_POST['adres']==""||$_POST['gemeente']==""||$_POST['postcode']==""||!preg_match('/^[A-Za-z0-9._-]+@[A-Za-z0-9._-]+\.[A-Za-z]{2,6}$/', $_POST['mail'])){
echo"
\n";
}else{
$naam = $_POST['naam'];
$voornaam = $_POST['voornaam'];
$adres = $_POST['adres'];
$gemeente = $_POST['gemeente'];
$postcode = $_POST['postcode'];
$email = $_POST['mail'];
$tel = $_POST['tel'];
$target_path1="uploads/".basename( $_FILES['bestand1']['name']);
$target_path2="uploads/".basename( $_FILES['bestand2']['name']);
$target_path3="uploads/".basename( $_FILES['bestand3']['name']);
$target_path4="uploads/".basename( $_FILES['bestand4']['name']);
if(!empty($_FILES['bestand1']['name'])){
move_uploaded_file($_FILES['bestand1']['tmp_name'], $target_path1);
}
if(!empty($_FILES['bestand2']['name'])){
move_uploaded_file($_FILES['bestand2']['tmp_name'], $target_path2);
}
if(!empty($_FILES['bestand3']['name'])){
move_uploaded_file($_FILES['bestand3']['tmp_name'], $target_path3);
}
if(!empty($_FILES['bestand4']['name'])){
move_uploaded_file($_FILES['bestand4']['tmp_name'], $target_path4);
}
$htmlbody ="\n";
$htmlbody .="\n";
$htmlbody .="
offerteaanvraag t-shirts.be\n";
$htmlbody .="\n";
$htmlbody .="
\n
";
$htmlbody .="\n";
$htmlbody .="
klantgegevens\n";
$htmlbody .=$voornaam." ".$naam."
\n";
$htmlbody .=$adres."
\n";
$htmlbody .=$postcode." ".$gemeente."
\n";
$htmlbody .=$email."
\n";
if($tel==""){$htmlbody .="geen telefoonnummer ingegeven
";}else{$htmlbody .=$tel."
\n";}
$htmlbody .="
offerteaanvraag\n";
$i=0;
while($i<=$_SESSION['obestellingcounter']){
if($_SESSION['oactive'][$i]=="yes"){
$active[$i]="yes";
}
$i++;
}
$i=0;
$supersom=0;
while($i<=$_SESSION['obestellingcounter']){
if($active[$i]=="yes"){
$som=0;
//product
$rproduct=mysql_query("SELECT * FROM product WHERE pNr='".$_SESSION['op'][$i]."'");
while($product=mysql_fetch_array($rproduct)){
$productnr= $product[0];
$productnaam= $product[1];
$productcodelev= $product[2];
$productcodefab= $product[3];
$productcategorie= $product[4];
$productmerk= $product[5];
$productleverancier= $product[6];
$productgeslacht= $product[7];
$productdrukgroep= $product[8];
$productdrukkleur= $product[9];
$productKoffer= $product[10];
$productinfo= $product[11];
}
//merk
$rmerk=mysql_query("SELECT * FROM merk WHERE mNr='".$productmerk."'");
while($merk=mysql_fetch_array($rmerk)){
$merknaam=$merk[1];
}
//kleur
$rkleur=mysql_query("SELECT * FROM kleuren ORDER BY kNr ASC");
$k=1;
while($kleur=mysql_fetch_array($rkleur)){
$kleurnr[$k]= $kleur[0];
$kleurnaam[$k]= $kleur[1];
$k++;
}
//maatnaam+aantalstuks
$rmaat=mysql_query("SELECT * FROM maten");
$m=1;
while($maat=mysql_fetch_array($rmaat)){
$maatnaam[$m]=$maat[1];
$m++;
}
$htmlbody .="
".$productnaam."
\n";
$htmlbody .="bestelcode: ".$productcodelev."
\n";
$htmlbody .="merk: ".$merknaam."
\n";
$htmlbody .="
\n";
$k=1;
while($k<$_SESSION['omvc'][$i]){
if(isset($_SESSION['ok'.$k][$i])){
$htmlbody .="".$kleurnaam[$_SESSION['ok'.$k][$i]].": | \n";
$l=0;
while($l<$_SESSION['okc'.$k][$i]){
if(isset($_SESSION['omv'.$k.'_'.$l][$i])){
$htmlbody .="";
$rrealmaatnaam=mysql_query("SELECT * FROM maten WHERE maNr='".$_SESSION['omv'.$k.'_'.$l][$i]."'");
while($realmaatnaam=mysql_fetch_assoc($rrealmaatnaam)){
$htmlbody .=$realmaatnaam['maNaam'];
}
$htmlbody .=":".$_SESSION['oma'.$k.'_'.$l][$i]." stuks | ";
}
$l++;
}
$htmlbody .="
|
\n";
}
$k++;
}
$htmlbody .="
";
$rbedrukking=mysql_query("SELECT * FROM bedrukking");
$b=1;
while($bedrukking=mysql_fetch_array($rbedrukking)){
$bedrukkingnaam[$b]=$bedrukking[1];
$b++;
}
$htmlbody .="
";
$b=0;
while($b<$_SESSION['obpc'][$i]){
if($_SESSION['obk'.$b][$i]>0){
$htmlbody .= "".$bedrukkingnaam[$_SESSION['obp'.$b][$i]].": | ". $_SESSION['obk'.$b][$i]." kleuren |
";
}else{
$htmlbody .= "".$bedrukkingnaam[$_SESSION['obp'.$b][$i]].": | geen bedrukking |
\n";
}
$b++;
}
$htmlbody .="
";
$htmlbody .="prijs: ".komma($_SESSION['opx'][$i])." EUR";
$supersom=$supersom + $_SESSION['opx'][$i];
}
$_SESSION['oactive'][$i]="no";
$i++;
}
$htmlbody .="
prijs website: €".komma($supersom+($_SESSION['oinstelkost']*1.21))."
\n";
$htmlbody .="
";
$htmlbody2 = $htmlbody;
$htmlbody2 .="
t-shirts.be
";
$htmlbody .="\n";
$htmlbody .="\n";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: ".$voornaam." ".$naam."<".$email.">\r\n";
$headers2 = "MIME-Version: 1.0\r\n";
$headers2 .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers2 .= "From: t-shirts.be
\r\n";
echo"\n";
if (mail("info@t-shirts.be", "offerteaanvraag t-shirts.be", $htmlbody, $headers)){
if(mail($email, "uw offerteaanvraag bij t-shirts.be", $htmlbody2, $headers2)){
// Als de email is verzonden geven we dit netjes aan.
echo "Uw offerteaanvraag is succesvol verzonden, bedankt!\n";
session_destroy();
session_start();
}
}else{
echo "Er is een fout opgetreden met het verzenden van de mail.";
}
echo"
\n";
}
break;
}
?>