include("header.inc");
$_SESSION['winkelwagen']['activate'] = 0;
function valid_mail($email){
$email_host = explode("@", $email);
$email_host = $email_host[1];
$email_resolved = gethostbyname($email_host);
if ($email_resolved == $email_host) {
return false;
}
else{
return true;
}
}
function showcart()
{
//Code om de winkelwagen te laten zien
$totaal = "";
foreach($_SESSION['winkelwagen'] as $prodID => $at){
if (file_exists("BESTANDEN/" . $prodID . "_n")){
$totaal = $totaal + $at;
}
}
echo "
";
echo '';
if ($totaal == "1"){
$hv = "artikel";
}
else{
$hv = "artikelen";
}
echo "
U heeft op dit moment " . $totaal . " " . $hv . " in uw winkelwagen.";
echo "
";
if (!$totaal == "0"){
//Laat de tabel met artikelen zien...
?>
Product | Prijs per stuk | Aantal | Bedrag |
Waarvan BTW 19 %"; echo " | € | ";
echo "" . number_format($btw, 2, ",", ".") . " | |||
Verzendkosten binnen Nederland"; echo " | € | ";
$file = fopen("config.php", "r");
$string = fgets($file, 1024);
list($q, $webshopnaam, $mail, $verzend, $gebruiker, $wachtwoord, $q) = split(",", $string);
fclose($file);
echo "" . number_format($verzend, 2, ",", ".") . " | |||
Totaal "; echo " | "; echo " | "; echo " | "; echo " | € | ";
echo "" . number_format($prijs, 2, ",", ".") . " |
![]() | Bestelling afhandelen |
![]() | Winkelwagen leegmaken |
![]() | Pagina afdrukken |
Er is een fout opgetreden, er bestaat geen product met artikelnummer "; echo $_GET['prodID']; echo ".
"; } else{ $_SESSION['winkelwagen'][$_GET['prodID']] = $_GET['aantal']; showcart(); } } if($_GET['q'] == "del"){ $_SESSION['winkelwagen'][$_GET['prodID']] = 0; showcart(); } if($_GET['q'] == "emp"){ //Winkelwagen leegmaken... foreach($_SESSION['winkelwagen'] as $prod => $aantal){ $_SESSION['winkelwagen'][$prod] = ""; } showcart(); } if($_GET['q'] == "shw"){ showcart(); } if($_GET['q'] == "bfr"){ echo 'Het formulier is niet correct ingevuld!
"; }else{ //Formulier goed ingevuld! echo "Controleer de onderstaande gegevens, zijn deze correct? Klik dan op 'Bestellen'.
"; echo "";
echo "Uw naam: " . stripslashes($_GET['naam']) . "
";
echo "Uw e-mailadres: " . stripslashes($_GET['mail']) . "
";
echo "Uw adres: " . stripslashes($_GET['adres']) . "
";
echo "Uw postcode: " . stripslashes($_GET['post']) . "
";
echo "Uw woonplaats: " . stripslashes($_GET['wnpl']) . "
";
echo "Uw bestelling:
";
$totaal = "";
foreach($_SESSION['winkelwagen'] as $prodID => $aantal){
if (!$aantal == "0"){
$file = fopen("BESTANDEN/" . $prodID . "_n", "r");
$q = "";
while (!feof($file)){
$q .= fgets($file, 1024);
}
fclose($file);
$file = fopen("BESTANDEN/" . $prodID . "_p", "r");
$p = "";
while (!feof($file)){
$p .= fgets($file, 1024);
}
fclose($file);
$p = $aantal * $p;
$totaal = $totaal + $p;
echo $aantal . " x " . stripslashes($q) . " = € " . number_format($p, 2, ",", ".") . "
";
}}
echo "Waarvan BTW 19% = ";
echo "€ ";
$btw = $totaal * 0.19;
echo number_format($btw, 2, ",", ".") . "
";
echo "Verzendkosten = ";
echo "€ ";
$file = fopen("config.php", "r");
$string = fgets($file, 1024);
list($q, $webshopnaam, $mail, $verzend, $gebruiker, $wachtwoord, $q) = split(",", $string);
fclose($file);
echo number_format($verzend, 2, ",", ".") . "
";
$totaal = $totaal + $verzend;
echo "Totaal: € " . number_format($totaal, 2, ",", ".") . "";
echo "
De bestelling kon niet worden verzonden!
Probeer het opnieuw
Uw bestelling is met succes verstuurd!";
echo "
Uw winkelwagen is automatisch leeg gemaakt!