function if_cust_not_login_then_redirect() { //query for url set $url_set = get_server_value("url_set"); // check if logged in if (check_cust_login() === false) { if ($url_set == 1 || $url_set == 2) { $location = "login.php"; } elseif ($url_set == 3) { $location = "https://www.nayadathai.com/login.php"; } redirect($location); } elseif (get_server_value("login") != 1) { clear_cart(); if ($url_set == 1 || $url_set == 2) { $location = "login.php?action=logout"; } elseif ($url_set == 3) { $location = "https://www.nayadathai.com/login.php?action=logout"; } redirect($location); } else { return true; } }
if ($restaurant_closed === 1 || $restaurant_closed === 2) { // Unset all orders left in the cart after the restaurant is closed clear_cart(); if ($restaurant_closed === 1) { echo '<p class="notice">We\'re sorry but it has already passed the last call</p>'; } elseif ($restaurant_closed === 2) { echo '<p class="notice">We\'re sorry but the restaurant is closed</p>'; } echo '</div>'; include "_includes/bottomBar.php"; require_once "_includes/bottom_bar_jquery_script.php"; exit; } // end if the restaurant is closed //Querying server status if (get_server_value("online_ordering_available") == 0) { clear_cart(); echo '<p class="notice">We\'re sorry, online ordering is temporarily seized by the management team</p>'; echo '</div>'; include "_includes/bottomBar.php"; require_once "_includes/bottom_bar_jquery_script.php"; exit; } //End Querying server status ?> <?php if (isset($alert)) { echo "<p class='notice'>" . $alert . "</p>"; } ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <?php include "_includes/global_header_addon.php"; require_once "_includes/_functions/process_input_functions.php"; require_once "_includes/_functions/global_functions.php"; require_once "_connections/connection_start.php"; $title = "Please Login or <a href='https://www.nayadathai.com/register.php'>Register</a>"; // query for url set $url_set = get_server_value("url_set"); if (isset($_GET)) { if (isset($_GET["action"])) { // ============================= Logging out ============================== if (clean_input($_GET["action"]) === "logout") { if (isset($_SESSION["cust_email"])) { $cust_email = clean_input($_SESSION["cust_email"]); logout($cust_email); if (isset($_SESSION["cust_login"])) { unset($_SESSION["cust_login"]); } if (isset($_SESSION["cust_email"])) { unset($_SESSION["cust_email"]); } if (isset($_SESSION["cust_name_first"])) { unset($_SESSION["cust_name_first"]); } clear_cart(); if (isset($_SESSION)) { unset($_SESSION); }
if ($url_set == 1 || $url_set == 2) { echo '<a class="button" href="login.php?action=logout">Logout</a>'; } elseif ($url_set == 3) { echo '<a class="button" href="https://www.nayadathai.com/login.php?action=logout">Logout</a>'; } } } elseif ($restaurant_closed === 0 && $server_online_ordering_available != 0) { if ($url_set == 1 || $url_set == 2) { echo '<a class="button" href="login.php">Order Now</a>'; } elseif ($url_set == 3) { echo '<a class="button" href="https://www.nayadathai.com/login.php">Order Now</a>'; } } // end elseif /////////////////////////// WARN IF TEST MODE IS ON ///////////////////////////// if (get_server_value("paypal_sandbox_flag") != 0 || get_server_value("anet_sandbox_flag") != 0 || get_server_value("url_set") != 3 || get_server_value("show_session_var") != 0 || get_server_value("restaurant_always_open") != 0) { echo "<br />WARNING : THIS IS TEST MODE<br />YOUR ORDER AND PAYMENT WILL NOT BE PROCESSED"; } ?> </div> <div class="top_bar_small"> <img class="logo_thumb" src="_images/logo_thumb.png" /> <?php if (check_cust_login() === true) { if ($_SESSION["cust_login"] === true) { if ($url_set == 1 || $url_set == 2) { echo '<a href="login.php?action=logout"><img title="Logout" class="logout_icon" src="_images/logout.png" /></a>'; } elseif ($url_set == 3) { echo '<a href="https://www.nayadathai.com/login.php?action=logout"><img title="Logout" class="logout_icon" src="_images/logout.png" /></a>'; } }
function send_pickup_slip_to_restaurant($cust_invoice_number) { require_once "global_functions.php"; require_once "mysql_functions.php"; global $restaurant_email_username; global $restaurant_email_password; global $email_endpoint; //////////// QUERY FOR ALL NECCESSARY INFO //////////// $bill_info = get_bill_info_by_invoice_number($cust_invoice_number); $cust_info = get_cust_info_by_id($bill_info["placed_by_cust_id"]); $order_info = get_order_info_by_invoice_number($cust_invoice_number); //////////// SETTING UP VARIABLES ////////////// date_default_timezone_set('America/Los_Angeles'); $subtotal = $bill_info["subtotal"]; $tax = $bill_info["tax"]; $tip = $bill_info["tip"]; if ($tip == 0) { $tip = "No Tip"; } $order_time = date("g:i a", $bill_info["time_placed"]); $order_date = date("l. F jS, Y", $bill_info["time_placed"]); $cust_phone = "(" . substr($cust_info["phone"], 0, 3) . ")" . substr($cust_info["phone"], 3, 3) . "-" . substr($cust_info["phone"], 6, 4); if (!empty($cust_info["alt_phone"])) { $cust_alt_phone = "(" . substr($cust_info["alt_phone"], 0, 3) . ") " . substr($cust_info["alt_phone"], 3, 3) . "-" . substr($cust_info["alt_phone"], 6, 4); } else { $cust_alt_phone = NULL; } //////////// CHECK IF THERE'S ANY ADDITIONAL WAIT TIME ///////////// $temp_order_info = $order_info; $item_that_needs_preparation_time = 0; while ($temp_order_info) { $temp_single_order_info = array_shift($temp_order_info); $temp_food_id = $temp_single_order_info["food_id"]; if (get_food_single_info($temp_food_id, "need_time_to_prepare") == 1) { $item_that_needs_preparation_time++; } } // end while if ($item_that_needs_preparation_time > get_server_value("additional_wait_time_treshold")) { $additional_wait_time = ($item_that_needs_preparation_time - get_server_value("additional_wait_time_treshold")) * get_server_value("additional_wait_time_increment"); } else { $additional_wait_time = 0; $additional_wait_time_en = 0; $additional_wait_time_th = 0; } //////////// ESTIMATE THE PICK-UP TIME //////////// $estimated_pickup_time = $bill_info["time_placed"] + ($bill_info["wait_time"] + $additional_wait_time) * 60; $estimated_pickup_time = date("g:i a", $estimated_pickup_time); //////////// FORMAT THE ADDITIONAL WAIT TIME //////////////// if ($additional_wait_time != 0) { $additional_wait_time_en = "+ " . $additional_wait_time . " minutes due to the size of the order"; } $mail = new PHPMailer(); $mail->CharSet = 'UTF-8'; // Set charset $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = 'smtp.live.com'; // Specify main and backup SMTP servers $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = $restaurant_email_username; // SMTP username $mail->Password = $restaurant_email_password; // SMTP password $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted $mail->Port = 587; // TCP port to connect to $mail->From = $restaurant_email_username; $mail->FromName = 'Nayada Thai Cuisine'; $mail->addAddress($email_endpoint, "Nayada Thai Cuisine"); // Add a recipient //$mail->addBCC($restaurant_email_username); //$mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments $mail->isHTML(true); // Set email format to HTML $mail->Subject = 'Pick-up Slip (' . $cust_invoice_number . ')'; ///////////////////////////// PICK-UP SLIP BODY ////////////////////////////// $mail->Body = '<p style="text-align: center; width: 900px; background-color: #000; color: #FFF; font-size: 120%; margin: 0 0 20px 0; padding: 5px 0 5px 0;"><strong>Pick-up Slip - Order # ' . $cust_invoice_number . '</strong></p>'; // FOOD LIST AREA $mail->Body .= ' <p style="font-size: 70%; margin: 0;">Payment Method : ' . $bill_info["payment_method"] . '</p> <p style="font-size: 70%; margin: 0;">Transaction ID : ' . $bill_info["transaction_id"] . '</p> <p style="font-size: 70%; margin: 0;">Transaction Type : ' . $bill_info["transaction_type"] . '</p> <p style="font-size: 70%; margin: 0;">Subtotal : ' . $bill_info["subtotal"] . '</p> <p style="font-size: 70%; margin: 0;">Tax (' . $bill_info["tax_rate"] . ' %) : $ ' . $tax . '</p> <p style="font-size: 70%; margin: 0;">Tip : $ ' . $tip . '</p> <p style="margin: 0;">Amount Charged : $ ' . $bill_info["amount_charged"] . '</p> <p style="font-size: 70%; margin: 0;">Order Date : ' . $order_date . '</p> <p style="font-size: 70%; margin: 0;">Order Time : ' . $order_time . '</p> <p style="font-size: 70%; margin: 0;">Wait Time : ' . $bill_info["wait_time"] . '</p> <p style="font-size: 70%; margin: 0;">Additional Wait Time : ' . $additional_wait_time_en . '</p> <p style="margin: 0;">Estimated Pick-up Time : ' . $estimated_pickup_time . '</p> <p style="margin: 0; text-align: center;">---------------------------------------------</p> <p style="margin: 0;">Customer ID : ' . $bill_info["placed_by_cust_id"] . '</p> <p style="margin: 0;">' . $cust_phone . ' ( primary # )</p>'; if (!empty($cust_alt_phone)) { $mail->Body .= '<p style="margin: 0;">' . $cust_alt_phone . ' ( alternate # )</p>'; } $mail->Body .= '<p style="margin: 0; text-align: center;">---------------------------------------------</p> <p style="font-size: 90%; text-align: center; margin-bottom: 300px;">I certify that I have received<br />all item(s) from order #' . $cust_invoice_number . '</p> <p> </p> <p style="text-align: center; margin: 0;">__________________________</p> <p style="margin: 0; font-size: 90%; text-align: center;">' . $cust_info["name_first"] . ' ' . $cust_info["name_last"] . '</p> <p style="text-align: center;">THANK YOU</p>'; // if test mode is on if ($bill_info["transaction_mode"] === "test_mode") { $mail->Body .= '<p style="text-align: center; width: 900px; background-color: #000; color: #FFF; font-size: 150%; margin: 50px 0 0 0; padding: 5px 0 5px 0;"><strong>TEST MODE</strong></p>'; } // end if test mode $mail->AltBody = ''; if (!$mail->send()) { // echo 'Message could not be sent.'; // echo 'Mailer Error: ' . $mail->ErrorInfo; return false; } else { // echo 'Message has been sent'; return true; } }
// indicate that the page header should display success $time_placed = time(); $placed_by_cust_id = get_cust_id($_SESSION["cust_email"]); $transaction_id = $tresponse->getTransId(); $transaction_id = database_prep($transaction_id); $auth_code = $tresponse->getAuthCode(); $card_type = $tresponse->getAccountType(); $card_number = clean_input($cc_info_array['number']); $card_number = substr($card_number, -4); $card_name_first = clean_input($cc_info_array['name_first']); $card_name_first = database_prep($card_name_first); $card_name_last = clean_input($cc_info_array['name_last']); $card_name_last = database_prep($card_name_last); $item_that_needs_preparation_time = count_item_that_needs_time($_SESSION); if ($item_that_needs_preparation_time > get_server_value("additional_wait_time_treshold")) { $additional_wait_time = ($item_that_needs_preparation_time - get_server_value("additional_wait_time_treshold")) * get_server_value("additional_wait_time_increment"); } else { $additional_wait_time = 0; } ////////////////////////////////////////////////////////////////////// ////////////////// CREATE RECORD IN THE history_bill TABLE /////////// ////////////////////////////////////////////////////////////////////// $cart_subtotal = clean_input($_SESSION["subtotal"]); $cart_tip = clean_input($_SESSION["cart_tip"]); $amount_charged = clean_input($_SESSION["Payment_Amount"]); $transaction_mode = $anet_sandbox_flag === true ? "test_mode" : "live_mode"; $cust_invoice_number = create_new_bill_entry($cart_subtotal, $cart_tip, $amount_charged, $time_placed, $placed_by_cust_id, "card", "authCaptureTransaction", $transaction_id, $auth_code, $card_type, $card_number, $cc_info_array['exp_mo'], $cc_info_array['exp_yr'], $card_name_first, $card_name_last, "not_set", "not_set", $transaction_mode); ////////////////////////////////////////////////////////////////////// //////////// CREATE RECORD IN THE history_order TABLE TOO //////////// ////////////////////////////////////////////////////////////////////// $cart_max_item = get_cart_max_item();
include "_includes/bottomBar.php"; require_once "_includes/bottom_bar_jquery_script.php"; exit; } //End Querying server status ?> <?php if (count_item_that_needs_time($_SESSION) > get_server_value("additional_wait_time_treshold")) { ?> <p class="notice">You have <?php echo count_item_that_needs_time($_SESSION); ?> items that require preparation time in your order.<br />This might incur an additinal <?php echo (count_item_that_needs_time($_SESSION) - get_server_value("additional_wait_time_treshold")) * get_server_value("additional_wait_time_increment"); ?> minutes to process.</p> <?php } ?> <div class="controlPanel"> <h3>Order Summary</h3> <?php $cart_max_item = get_cart_max_item(); $var_count = 1; $item_count = 0; $grand_total_array = array(); while ($var_count <= $cart_max_item) { if (!empty($_SESSION["item_{$var_count}"])) {