\n"); $od = & $_SESSION["od"]; $od = array(); $od = set_order_data_from_get(); global $sc; // first call from cart.php gets us here. $check_result = check_input($od); $input_ok = $check_result['totalcheck']; $input_broken_fields = $check_result['broken']; if ($input_ok != 1) { # print("\n"); // $inputok contains a list of broken fields // edit_input_form displays the data entered again // and allows to resubmit data. foreach ($input_broken_fields as $f) { if ($sc["lang"] == "de") { print("
Bitte korrigieren/ergänzen Sie das Feld ". $f."

\n"); } else { print("
Please correct/fill the field ". $f."

\n"); } } edit_input_form($od, $input_broken_fields); } else { // print("\n"); confirm_send($od); } } // is set if user presses edit order in order confirmation if (isset($_GET["EDITORDER"])) { // if we edit we read all the data from the respective $_GET variables again. $od = & $_SESSION["od"]; # $od = set_order_data_from_get(); edit_input_form($od, $broken_fields); } // is set after input is checked and user pressed order confirmation if (isset($_GET["SENDOK"])) { $od = & $_SESSION["od"]; # print("\n"); send_order($od); order_finished(); } // END OF ORDER PROCESSING. // ---------------------------------------- function confirm_send($od) { global $sc; global $cart; if ($sc["lang"] == "de") { $order_table = "Bitte bestätigen Sie die folgende Bestellung:

\n"; $order_table .= "\n". "\n". "\n". "\n". "\n". "\n". ""; foreach ($cart->items as $product_id => $count) { $cd = new cdInfo; $cd->start($product_id); $order_table .= "\n". "\n". "\n". "\n". "\n". "\n"; } $order_table .= ''. '\n". '\n". '\n". '\n". '\n". '\n". '\n". '\n"; $order_table .= "
AnzahlIDInterpretTitel
".$count."".$cd->get_vertriebs_id()."".$cd->get_interpret()."".$cd->get_titel()."
Bestellung von:
Nachname'. $od["order_lastname"]."
Vorname'. $od["order_firstname"]."
Strasse'. $od["order_street"]."
PLZ'. $od["order_zipcode"]."
Stadt'. $od["order_city"]."
Land'. $od["order_country"]."
Telefon'. $od["order_fone"]."
Email'. $od["order_email"]."
\n"; } else { $order_table = "Please confirm the following order:

\n"; $order_table .= "\n". "\n". "\n". " \n". "\n". "\n". ""; foreach ($cart->items as $product_id => $count) { $cd = new cdInfo; $cd->start($product_id); $order_table .= "\n". "\n". "\n". "\n". "\n". "\n"; } $order_table .= ''. '\n". '\n". '\n". '\n". '\n". '\n". '\n". '\n"; $order_table .= "
CountIDArtistTitle
".$count."".$cd->get_vertriebs_id()."".$cd->get_interpret()."".$cd->get_titel()."
Order by:
Last Name'. $od["order_lastname"]."
First Name'. $od["order_firstname"]."
Street'. $od["order_street"]."
ZIP Code'. $od["order_zipcode"]."
City'. $od["order_city"]."
Country'. $od["order_country"]."
Telefone'. $od["order_fone"]."
Email'. $od["order_email"]."
\n"; } print($order_table); if ($sc["lang"] == "de") { $send_str = "Abschicken"; $edit_str = "Veraendern"; } else { $send_str = "Submit"; $edit_str = "Change"; } ?>
empty_cart(); unset($_SESSION["od"]); } function check_input($od) { global $sc; $broken = array(); $check_keys = array("order_lastname", "order_firstname", "order_street", "order_zipcode", "order_city", "order_country"); foreach ($check_keys as $key) { if (!array_key_exists($key, $od) or $od[$key] == "") { #print("\n"); array_push($broken, $key); } else { # print("\n"); } } // ATT: only works if we're online! Checks the actual entries made. if (check_email_mx($od["order_email"])) { $emailok = 1; // print("\n"); } else { // print("\n"); $emailok = 0; array_push($broken, "order_email"); } if (count($broken)==0 && $emailok ==1) { $totalcheck = 1; // print("\n"); } else { // print("\n"); $totalcheck = 0; } $check_result = array ( "totalcheck" => $totalcheck, "broken" => $broken ); return ($check_result); } // -------------------- function create_mail($od, $target) { global $cart; global $sc; // generates the email text for the customer and for JHM // needs the order data ($od hash) and a target. Must be JHM or customer if ($sc["lang"] == "de") { if ($target == "customer") { print("\n"); $ordermail = "Sehr geehrte/r Kunde/in,\n". "anbei finden Sie eine Kopie der Daten, die an JazzHausMusik ". "uebermittelt werden.\n". "Wir setzen uns zur Bestaetigung der Bestellung mit Ihnen in den ". "naechsten Tagen in Verbindung.\n". "Mit freundlichen Gruessen,\n". "Ihr JHM-Team.\n\n"; ## $ordermail .= ## "HINWEIS: JHM macht Ferien und ist ab dem 11.7.2008 wieder fuer Sie da. Ihre Bestellung wird dann sofort bearbeitet."; } else { $ordermail = ""; } $ordermail .= "Bestellungen ueber die Website von JHM.\n"; $ordermail .= "Datum: ".$od["mday"].".".$od["mon"].".".$od["year"]."\n"; $ordermail .= "Uhrzeit: ".$od["hours"].":".$od["minutes"]."\n\n"; $ordermail .= "BESTELLUNGEN:\n"; foreach ($cart->items as $product_id => $count) { $cd = new cdInfo; $cd->start($product_id); $ordermail .= "Anzahl:\t\tCD:\n\n". $count . "\t" . $cd->get_vertriebs_id() . "\t". $cd->get_interpret() . "\t". $cd->get_titel()."\n\n"; } $ordermail .= "Bestellung von:\n". "Nachname:\t". $od["order_lastname"] ."\n". "Vorname:\t". $od["order_firstname"] ."\n". "Strasse:\t". $od["order_street"] ."\n". "PLZ: \t". $od["order_zipcode"] ."\n". "Stadt: \t". $od["order_city"] ."\n". "Land: \t". $od["order_country"]."\n". "Telefon:\t". $od["order_fone"] . "\n". "Email:\t". $od["order_email"] ."\n\n"; if ($target == "JHM") { $ordermail .= "Client-IP:\t".$od["client_ip"]."\n" . "Client-host:\t".$od["client_host"]."\n\n"; } } else { if ($target == "customer") { $ordermail = "Dear Customer,\n". "this is a copy of the data that are transmitted to JazzHausMusik.\n". "We'll send you a confirmation of your order within the next days.\n". "Kind regards,\n". "the JHM-Team.\n\n"; ## $ordermail .= ## "Notice: JHM is on holidays and will continue operation on July 11th. Your order will be processed then."; } else { $ordermail = ""; } $ordermail .= "Orders on the JHM website.\n"; $ordermail .= "Date: ".$od["mday"].".".$od["mon"].".".$od["year"]."\n"; $ordermail .= "Time: ".$od["hours"].":".$od["minutes"]."\n\n"; $ordermail .= "ORDERS:\n"; foreach ($cart->items as $product_id => $count) { $cd = new cdInfo; $cd->start($product_id); $ordermail .= "Anzahl:\t\tCD:\n\n". $count . "\t" . $cd->get_vertriebs_id() . "\t". $cd->get_interpret() . "\t". $cd->get_titel()."\n\n"; } $ordermail .= "Order by:\n". "Last Name:\t". $od["order_lastname"] ."\n". "First Name:\t". $od["order_firstname"] ."\n". "Street:\t". $od["order_street"] ."\n". "ZIP: \t". $od["order_zipcode"] ."\n". "City: \t". $od["order_city"] ."\n". "Country: \t". $od["order_country"]."\n". "Telefone:\t". $od["order_fone"] . "\n". "Email:\t". $od["order_email"] ."\n\n"; if ($target == "JHM") { $ordermail .= "Client-IP:\t".$od["client_ip"]."\n" . "Client-host:\t".$od["client_host"]."\n\n"; } } return($ordermail); } function order_finished() { global $sc; if ($sc["lang"] == "de") { print "

Vielen Dank für Ihre Bestellung.



". "In den nächsten Minuten erhalten Sie eine Email mit der Kopie ". "Ihrer Bestellung bei JazzHausMusik.

". "Sollten Sie Fragen bezüglich Ihrer Bestellung haben, wenden Sie ". "sich bitte an ". "jhm@jazzhausmusik.de oder Rufen Sie uns an unter ". "(+49)221-952994-50.
"; ## print "Bitte beachten Sie, dass wir momentan Ferien machen und erst ab dem 11.7.2008 wieder für Sie da sind.
"; } else { print "

Thank you for your order.



". "You'll receive a copy of your order at JazzHausMusik via email in the next few minutes.

". "If you have any questions concerning your order please ". "write to ". "jhm@jazzhausmusik.de or call us on ". "(+49)221-952994-50.
"; ## print "Please notice that we're on holidays and that we will continue operation on July 11th, 2008.
"; } } function set_order_data_from_get() { # print("\n"); $od["order_lastname"] = stripslashes ( htmlspecialchars( $_GET["lastname"])); $od["order_firstname"] = stripslashes ( htmlspecialchars( $_GET["firstname"])); $od["order_street"] = stripslashes ( htmlspecialchars( $_GET["street"])); $od["order_zipcode"] = stripslashes ( htmlspecialchars( $_GET["zipcode"])); $od["order_city"] = stripslashes ( htmlspecialchars( $_GET["city"])); $od["order_country"] = stripslashes ( htmlspecialchars( $_GET["country"])); $od["order_fone"] = stripslashes ( htmlspecialchars( $_GET["telefone"])); $od["order_email"] = stripslashes ( htmlspecialchars( $_GET["email"])); // time of ordering $od["order_time"] = getdate(); $od["mday"] = $od["order_time"]["mday"]; $od["mon"] = $od["order_time"]["mon"]; $od["year"] = $od["order_time"]["year"]; $od["hours"] = $od["order_time"]["hours"]; $od["minutes"] = $od["order_time"]["minutes"]; if (strlen($od["minutes"])==1) { $od["minutes"] = "0".$od["minutes"]; } $od["client_ip"] = getIP(); // in site_code.inc # print("\n"); $od["client_host"] = gethostbyaddr($od["client_ip"]); // $od["client_host"] = "test.test.de"; # print("\n"); return($od); } function edit_input_form($od) { $od = & $_SESSION["od"]; $fill_form = 1; include("order_template.inc"); } ?>