<% require_once "backroom/config.txt"; $gooddata = 1; require_once($store[backroom_dir]."/validate_email.php"); require($store[backroom_dir]."/stripslashes.php"); function get_order_num () { global $store; $ordernum_file = $store[backroom_dir]."/ordernum.txt"; if (!file_exists($ordernum_file)) return 1000; $fd = fopen ($ordernum_file, "r"); $maxorder = fgets($fd, 4096); fclose ($fd); return ($maxorder + 1); } function make_order_file() { $date = date("Ymd"); $ordernum = get_order_num(); $filename = sprintf("%06d-%8d.txt",$ordernum,$date); return $filename; } function getIDS () { global $input, $IDS; $quantity_array = preg_grep("/^quantity\:/",array_keys($input)); $IDS = array(); foreach ($quantity_array as $val) { $key = preg_replace("/^quantity\:/","",$val); if ($input[$val] > 0) { array_push($IDS,$key); } } } function write_order ($secure=false,$order_url="") { global $input, $IDS, $total, $store, $shipping, $order_number; $date = date("M d, Y"); $time = date("h:i a T"); require_once($store[backroom_dir]."/wraptext.php"); if (!empty($order_number)) $content = "Order: $order_number\n"; $content = "$date at $time\n"; if (!empty($order_url)) { $content .= "\nSecure Order: $order_url\n"; } $content .= " *** Contact Information *** Name: $input[name] Address: $input[address] City: $input[city] State: $input[state] Zip Code: $input[zip] Phone: $input[phone] Email: $input[email] Comments: "; $comments = wraptext($input[comments],72); for ($i=0; $i 1) { for ($line=1;$line<=sizeof($name);$line++) { $content .= sprintf ("|%10s| %-30s | |%10s|%10s|\n", '',$name[$line],'',''); } } $content .= sprintf ("|%10s| %-30s | |%10s|%10s|\n",'','','',''); } $content .= "$divider\n"; if (in_array($input[state],$store[states_to_tax])) { $content .= sprintf ("|%58s |%1s%5.2f |\n",'Sub-total',$currency,$total); $tax = $total * $store[tax]/100; $total += $tax; $tax_string = sprintf("%.2f",$store[tax]); $content .= sprintf ("|%58s |%1s%5.2f |\n", $tax_string.'% State Tax',$currency,$tax); } $ship_per_total = 0; $ship_overall_total = 0; foreach ($IDS as $ID) { $ship_per_total += $input['quantity:'.$ID] * $input['shipping:'.$ID]; } if ($ship_per_total > 0) { $content .= sprintf ("|%58s |%1s%5.2f |\n","Per Item Shipping Costs", $store[currency], $ship_per_total); } if (isset($input[shipmethod])) { $ship_overall_total = $shipping[amount][$input[shipmethod]]; $content .= sprintf ("|%58s |%1s%5.2f |\n",$shipping[name][$input[shipmethod]], $store[currency], $ship_overall_total); } $total += $ship_per_total + $ship_overall_total; $content .= sprintf ("|%58s |%1s%5.2f |\n",'TOTAL',$store[currency],$total); $content .= "$divider\n"; return $content; } if (isset($confirm)) { getIDS(); require_once($store[backroom_dir]."/ccval.php"); if ( empty($input[name]) || empty($input[address]) || empty($input[city]) || empty($input[state]) || empty($input[country]) || empty($input[zip]) || !validate_email($input[email]) || !CCVal($input[ccnum],$input[cctype]) || empty($IDS) ) { $gooddata = 0; unset($confirm); } } if (isset($sendorder)) { getIDS(); require($store[backroom_dir]."/n_mail.php"); $order_number = get_order_num(); $email_subject = $store[email_subject]." - Order $order_number"; $content = write_order(true); $order_filename = make_order_file(); $order_path_file = $store[order_dir]."/".$order_filename; $fp = fopen($order_path_file,"w"); fwrite($fp,$content); fclose($fp); $order_url = $store[backroom_url]."?V=".$order_number; $order_counter = $store[backroom_dir]."/ordernum.txt"; $fp = fopen($order_counter,"w"); fwrite($fp,$order_number); fclose($fp); $message = write_order(false, $order_url); // email shop n_mail($input[email], $store[email], $email_subject, $message, "Content-type: text/plain\nMime-Version: 1.0"); $message = write_order(false); // email buyer n_mail($store[email], $input[email], $email_subject, $message, "Content-type: text/plain\nMime-Version: 1.0"); } %> <%echo $store[page_title]%> <% include $_SERVER['DOCUMENT_ROOT']."/includes/metas.txt"; %> <% include $_SERVER['DOCUMENT_ROOT']."/includes/header.inc"; %> <% if (!isset($confirm) && !isset($sendorder)) { %>

<%echo $store[page_title]%>

<% if ($gooddata == 0) { %>

Some required information is missing or incorrect. Please see the notes marked in red below.

<% } %>

Feel free to contact us at <%echo $store[phone]%> with questions regarding this order form. Required fields are marked with a red asterisk (*). We only accept checks and money orders in US Dollars. After you place your order, you will be provided with information about where to mail your payment.

<% if ($gooddata == 0 && empty($IDS)) { print "\n"; } %>
Quantity Item Price +S&H = Total
Please enter a quantity for the products you wish to order.
"> Original Portfolio &
Supplements I - V
$ 79.95 free $ 79.95
"> Original Portfolio $ 17.50 free $ 17.50
"> Supplement I $ 6.50 free $ 6.50
"> Supplement II $ 12.95 free $ 12.95
"> Supplement III $ 19.50 free $ 19.50
"> Supplement IV $ 12.95 free $ 12.95
"> Supplement V $ 12.95 free $ 12.95
"> Documentary Video $ 49.95 $ 3.00 $ 52.95

Purchaser/Shipping Information

*Your Name: <% if ($gooddata == 0 && empty($input[name])) print "Please enter your name.
\n"; %>
*Address: <% if ($gooddata == 0 && empty($input[address])) print "Please enter your shipping address.
\n"; %>
*City: <% if ($gooddata == 0 && empty($input[city])) print "Please enter your city.
\n"; %>
*State: <% if ($gooddata == 0 && empty($input[state])) print "Please enter your state.
\n"; %>
*Zip Code: <% if ($gooddata == 0 && empty($input[zip])) print "Please enter your postal zip code.
\n"; %>
*Country: <% if ($gooddata == 0 && empty($input[country])) print "Please enter your country.
\n"; %>
*Phone Number: <% if ($gooddata == 0 && empty($input[phone])) print "Please enter your phone number.
\n"; %>
*Email Address: <% if ($gooddata == 0 && !validate_email($input[email])) print "Please enter a valid email address.
\n"; %>
Comments or Requests:

<% } else if (isset($confirm)) { %>

<%$store[title]%> Order Confirmation

Please review your contact, payment and order information below. Click on "Place Order!" to complete your order.

<% foreach ($input as $key => $value) { print "\t\n"; } %>


<% $content = write_order(); print "
\n".$content."
\n"; } else if (isset($sendorder)) { %>

Order Sent

Order Number: <%echo $order_number%>

Your order has been accepted for processing. An email was sent to <%echo $input[email]%> with a copy of the order information.

<% print "We accept checks and money orders only. Please mail payment in full to the address below.

$store[company]
$store[address1]
$store[city], $store[state] $store[zip]

\n"; %>

<% } %> <% include $_SERVER['DOCUMENT_ROOT']."/includes/footer.inc"; %>