$QUERY_STRING

");*/ $query = sub($QUERY_STRING, "%20"," "); $query = sub($query, "%7C", "_"); $query_array = split($query, "="); $account_no = (int)$query_array[0]; $cust_id = $query_array[1]; $last_name = $query_array[2]; $last_name = tr($last_name,"a-z","A-Z"); $number = #$query_array; $total = sub($query_array[3],"total=",""); /*$total = sub($total,"$","");*/ /*$total = $query_array[3];*/ $dollarsign = "\$"; /*echo("$total");*/ if ($total == "0") { system("echo Total problem for $cust_id $last_name $account_no Total= $total | mail -s'Total Error' brad@austbiz.com.au"); } if(exists($account_no)) { $banner = (text)$account_no + ".jpg"; } else { echo(""); } echo("

"); echo("
"); echo("
"); echo("The current time is:
"); echo("

"); echo("Taking orders for pickup at:

"); echo("


"); echo("Order Total:
$dollarsign"); echo(""); echo("
"); echo("
"); echo("
"); echo("
"); $sock = msqlConnect(); if ($sock < 0) { fatal("Error : $ERRMSG\n"); } if (msqlSelectDB($sock,"take-away") < 0) { fatal("Error : $ERRMSG\n"); } if (msqlQuery($sock,"select cust_id, first_name, last_name, stno_name, city_suburb, state, postcode, phone_no, mobile_no from take_away_customers where cust_id='$cust_id' and last_name='$last_name'") <0) { fatal("Error : $ERRMSG\n"); } $res1 = msqlStoreResult(); $num_rows = msqlNumRows($res1); $row = msqlFetchRow($res1); if ($num_rows < 1) { echo("

The customer i.d. $cust_id or Last Name $last_name you entered is not correct.

"); echo("

Click your browser's back button to go back and correct.

"); echo("

or

"); echo("

Click here to register.

"); } else { $stno_name = $row[3]; $city_suburb = $row[4]; $state = $row[5]; $postcode = $row[6]; $phone_no = $row[7]; $mobile_no = $row[8]; if($phone_no == "") { $phone_no = $mobile_no; } msqlFreeResult($res1); if (msqlQuery($sock, "select sms_no, postcode, $day_open, $day_close, open_overide_flag, announcement, delay, deliver_flag, delivery_range_klms, delivery_charge, docket_length, ccflag, cc_surcharge, business_name, discount from take_away_account where account_no=$account_no") < 0) { fatal("Error : $ERRMSG\n"); } $res2 = msqlStoreResult(); $row = msqlFetchRow($res2); $num_rows = msqlNumRows($res2); if ($num_rows <> 1) { echo("

MAJOR PROBLEM! CONTACT TECHNICAL HELP ON 0405104934 A.S.A.P.
$query

"); } else { $f_sms_no = $row[0]; $f_postcode = $row[1]; $f_opentime = $row[2]; $f_closedtime = $row[3]; $f_deliver_flag = $row[7]; echo(""); $f_delivery_range_klms = $row[8]; $f_delivery_charge = $row[9]; $docket_length = $row[10]; $ccflag = $row[11]; $cc_surcharge = $row[12]; $business_name = $row[13]; $discount = $row[14]; if($f_opentime == "no") { echo("

MAJOR PROBLEM! CONTACT TECHNICAL HELP ON 0405104934 A.S.A.P. Shop Closed

"); } else { $closed_array = split($f_closedtime,":"); $closed_minutes = ((int)$closed_array[0] * 60) + ((int)$closed_array[1]); echo(""); } } msqlFreeResult($res2); $text_file = (text)$account_no + "_delay.txt"; if(test("f","/usr/local/apache2.2/htdocs/take-away/notifications/$text_file")==1) { $fd = open("/usr/local/apache2.2/htdocs/take-away/notifications/$text_file", "<"); if ($fd < 0) { echo("Error: $ERRMSG\n"); } else { $delay = readln($fd); close($fd); /* echo("$delay");*/ echo(""); } } else { echo(""); } echo(""); echo(""); $len = 0; $array_flag = "N"; while($counter < $number) { $line_array = split($query_array[$counter], ":"); $no_of_fields = #$line_array -1; $field_counter = 0; while($field_counter <= $no_of_fields) { $m_extras = ""; if($field_counter == 0) { echo(""); } if($field_counter == 1) { echo(""); } if ($field_counter > 1 && $field_counter < $no_of_fields) { echo(""); } if($field_counter == $no_of_fields) { if($no_of_fields == 2) { echo(""); } echo(""); } $field_counter++; } $counter++; } $discount = (int)$discount; if ($discount > 0) { $discount_amnt = ((real)$discount / 100) * (money)$total; $discount_amnt = (money)$discount_amnt; $total = (money)$total - (money)$discount_amnt; echo(""); } else { $discount_amnt = 0; echo(""); } echo("
Qty.Item NameInstructionsPrice
"); while($field_counter < $no_of_fields) { $m_extras = $m_extras + $line_array[$field_counter] + ", "; $len = $len + #$line_array[$field_counter] + 2; $field_counter++; $array_flag = "Y"; } echo(""); echo("
__________________________________________________________________________________________________________________________
Discount %$discount = $discount_amnt Total$
Total$
"); echo("
"); echo("

Please check your order carefully to ensure it is correct.

"); echo("
Click the Go Back and change my order button to change your order.

"); echo("
You order will be ready for pickup/delivery at the time given above

"); echo("
unless you wish to order ahead. If so use the arrows to change the pickup time.

"); echo("
"); echo("
 

"); echo("
:

"); echo("

 

"); if($f_deliver_flag == "Y") { if($f_postcode == $postcode) { echo("
You must choose either Pickup or Delivery.

"); echo("
I will be coming in to pick up.
"); echo("
Please Deliver to this address.

"); echo("


Contact phone number at this address                           
"); } else { if (msqlQuery($sock,"select distance_klms from distance where from_postcode='$f_postcode' and to_postcode='$postcode'") <0) { fatal("Error : $ERRMSG\n"); } $res3 = msqlStoreResult(); $num_rows = msqlNumRows($res3); $row = msqlFetchRow($res3); if ($num_rows < 1) { echo(""); } else { if($row[0] <= $f_delivery_range_klms) { echo("
You must choose either Pickup or Delivery.
"); echo("
I will be coming in to pick up.
"); echo("
Please Deliver to this address.

"); echo("


Contact phone number at this address                           
"); } else { echo(""); } } msqlFreeResult($res3); } } else { echo(""); } echo("
*Please note that pickup time may vary slightly in busy times.

"); echo("

When you are sure your order is correct click one of the buttons below to

"); echo("

"); if($ccflag == "Y") { echo("
Pay now with PayPal or Credit Card
"); } echo(""); } echo("
"); echo("
"); echo(""); echo(""); echo("
"); msqlClose($sock); >