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("WSFILES/" . $prodID . "_n")){ $totaal = $totaal + $at; } } echo "
U heeft op dit moment " . $totaal . " " . $hv . " in uw winkelwagen.";
echo "
";
if (!$totaal == "0"){
//Laat de tabel met artikelen zien...
?>
Procuct | Prijs per stuk | Aantal | Bedrag | ||
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 formuler is niet correct ingevuld!
"; }else{ //Formulier goed ingevuld! echo "Controleer de onderstaande gegevens, zijn deze correct? Klik dan op 'Bestellen'.
"; echo "";
echo "Uw naam: " . $_GET['naam'] . "
";
echo "Uw e-mailadres: " . $_GET['mail'] . "
";
echo "Uw adres: " . $_GET['adres'] . "
";
echo "Uw postcode: " . $_GET['post'] . "
";
echo "Uw woonplaats: " . $_GET['wnpl'] . "
";
echo "Uw bestelling:
";
$totaal = "";
foreach($_SESSION['winkelwagen'] as $prodID => $aantal){
if (!$aantal == "0"){
$file = fopen("WSFILES/" . $prodID . "_n", "r");
$q = "";
while (!feof($file)){
$q .= fgets($file, 1024);
}
fclose($file);
$file = fopen("WSFILES/" . $prodID . "_p", "r");
$p = "";
while (!feof($file)){
$p .= fgets($file, 1024);
}
fclose($file);
$p = $aantal * $p;
$totaal = $totaal + $p;
echo $aantal . " x " . $q . " = € " . number_format($p, 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!
"; } else{ foreach($_SESSION['winkelwagen'] as $x => $q){ $_SESSION['winkelwagen'][$x] = "0"; } echo "Uw bestelling is met succes verstuurd!";
echo "
Uw winkelwagen is automatisch leeg gemaakt!