Esempio n. 1
0
function validateOrderForm($arr)
{
    extract($arr);
    if (!$name || !$address || !preg_match("/^[ABCEGHJKLMNPRSTVXY]\\d[ABCEGHJKLMNPRSTVWXYZ]( )?\\d[ABCEGHJKLMNPRSTVWXYZ]\\d\$/i", $postalCode) || !$city || !$province || !preg_match("/^\\(?([0-9]{3})\\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})\$/", $telephone) || !preg_match("/^([\\w-]+(?:\\.[\\w-]+)*)@((?:[\\w-]+\\.)*\\w[\\w-]{0,66})\\.([a-z]{2,6}(?:\\.[a-z]{2})?)\$/i", $emailAdress) || !$sizeOptions || !$crustTypeOptions || !$toppingsOptions) {
        return FALSE;
    } else {
        saveOrder($_POST);
        return TRUE;
    }
}
Esempio n. 2
0
 function saveOrder($ids, $level = 1)
 {
     $arrIDs = explode('[' . $level . ']', $ids);
     foreach ($arrIDs as $o => $id) {
         $GLOBALS['db']->update('menu_items', 'o = ' . $o, 'id = ' . (int) $id);
         if (is_int(strpos($id, '[' . ($level + 1) . ']'))) {
             $rest = substr($id, strlen((string) (int) $id) + strlen('[' . ($level + 1) . ']'));
             saveOrder($rest, $level + 1);
         }
     }
 }
Esempio n. 3
0
        orderContacts($cid[0], -1);
        break;
    case 'orderdown':
        orderContacts($cid[0], 1);
        break;
    case 'accesspublic':
        changeAccess($cid[0], 0);
        break;
    case 'accessregistered':
        changeAccess($cid[0], 1);
        break;
    case 'accessspecial':
        changeAccess($cid[0], 2);
        break;
    case 'saveorder':
        saveOrder($cid);
        break;
    case 'cancel':
        cancelContact();
        break;
    default:
        showContacts($option);
        break;
}
/**
* List the records
* @param string The current GET/POST option
*/
function showContacts($option)
{
    global $mainframe;
Esempio n. 4
0
        break;
    case 'publish':
    case 'unpublish':
        publishModule($cid, $task == 'publish', $option, $client);
        break;
    case 'orderup':
    case 'orderdown':
        orderModule(intval($cid[0]), $task == 'orderup' ? -1 : 1, $option);
        break;
    case 'accesspublic':
    case 'accessregistered':
    case 'accessspecial':
        accessMenu(intval($cid[0]), $task, $option, $client);
        break;
    case 'saveorder':
        saveOrder($cid, $client);
        break;
    default:
        viewModules($option, $client);
        break;
}
/**
* Compiles a list of installed or defined modules
*/
function viewModules($option, $client)
{
    global $database, $my, $mainframe, $mosConfig_list_limit, $mosConfig_absolute_path;
    $filter_position = $mainframe->getUserStateFromRequest("filter_position{$option}{$client}", 'filter_position', 0);
    $filter_type = $mainframe->getUserStateFromRequest("filter_type{$option}{$client}", 'filter_type', 0);
    $limit = intval($mainframe->getUserStateFromRequest("viewlistlimit", 'limit', $mosConfig_list_limit));
    $limitstart = intval($mainframe->getUserStateFromRequest("view{$option}limitstart", 'limitstart', 0));
Esempio n. 5
0
        orderCategory($cid[0], -1);
        break;
    case 'orderdown':
        orderCategory($cid[0], 1);
        break;
    case 'accesspublic':
        accessMenu($cid[0], 0, $section);
        break;
    case 'accessregistered':
        accessMenu($cid[0], 1, $section);
        break;
    case 'accessspecial':
        accessMenu($cid[0], 2, $section);
        break;
    case 'saveorder':
        saveOrder($cid, $section);
        break;
    default:
        showCategories($section, $option);
        break;
}
/**
* Compiles a list of categories for a section
* @param string The name of the category section
*/
function showCategories($section, $option)
{
    global $mainframe;
    $db =& JFactory::getDBO();
    $filter_order = $mainframe->getUserStateFromRequest($option . '.filter_order', 'filter_order', 'c.ordering', 'cmd');
    $filter_order_Dir = $mainframe->getUserStateFromRequest($option . '.filter_order_Dir', 'filter_order_Dir', '', 'word');
Esempio n. 6
0
<?php

if (is_ajax()) {
    if (isset($_POST["action"]) && !empty($_POST["action"])) {
        //Checks if action value exists
        $action = $_POST["action"];
        switch ($action) {
            //Switch case for value of action
            case "saveorder":
                saveOrder();
                break;
            case "register_order":
                register_order();
                break;
        }
    }
}
//Function to check if the request is an AJAX request
function is_ajax()
{
    return isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest';
}
function register_order()
{
    include '../config.php';
    $registration_data = $_POST['registration_data'];
    $next_id_sql = "SELECT Auto_increment FROM information_schema.tables WHERE table_name='tbluser'";
    $query = mysqli_query($conn, $next_id_sql);
    $result = mysqli_fetch_row($query);
    $user_id = $result[0];
    $usertypeid = 2;
Esempio n. 7
0
<?php 
session_start();
include "lib/lib.inc.php";
//підключення бібліотеки
include "constants.php";
//костанти для підключення до сервева MySQL
if (isset($_POST['buy'])) {
    $customer = clearStr($_POST['customer']);
    $email = clearStr($_POST['email']);
    $phone = clearStr($_POST['phone']);
    $address = clearStr($_POST['address']);
    $oid = $basket['orderid'];
    $dt = time();
    if (empty($customer) || empty($email) || empty($phone) || empty($address)) {
        $_SESSION['error_enter'] = 1;
        //якщо хоча б одне поле пусте
        header("Location: {$_SERVER['HTTP_REFERER']}");
    } else {
        $order = "{$customer}|{$email}|{$phone}|{$address}|{$oid}|{$dt}\n";
        file_put_contents('orders/' . ORDERS_LOG, $order, FILE_APPEND);
        saveOrder($dt);
        //$dt в базі час заказу також будемо зберігати*/
        header("Location: index.php?id=success_order");
    }
}
Esempio n. 8
0
<?php

require "inc/lib.inc.php";
require "inc/db.inc.php";
$name = add_cliar($_POST['name']);
$email = add_cliar($_POST['email']);
$phone = add_cliar($_POST['phone']);
$address = add_cliar($_POST['address']);
$time = time();
$oredeId = $basket['orderid'];
$str = $name . ' | ' . $email . ' | ' . $phone . ' | ' . $address . ' | ' . $oredeId . ' | ' . $time . "\n";
if (false === file_put_contents('admin/' . ORDERS_LOG, $str, FILE_APPEND)) {
    die('error  file');
}
saveOrder($time);
?>
<html>
<head>
	<title>Сохранение данных заказа</title>
	<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
</head>
<body>
	<p>Ваш заказ принят.</p>
	<p><a href="catalog.php">Вернуться в каталог товаров</a></p>
</body>
</html>
Esempio n. 9
0
        break;
    case 'movemenusave':
        moveMenuSave($option, $cid, $menu, $menutype);
        break;
    case 'copymenu':
        copyMenu($option, $cid, $menutype);
        break;
    case 'copymenusave':
        copyMenuSave($option, $cid, $menu, $menutype);
        break;
    case 'cancelcopymenu':
    case 'cancelmovemenu':
        viewMenuItems($menutype, $option);
        break;
    case 'saveorder':
        saveOrder($cid, $menutype);
        break;
    default:
        $type = trim(mosGetParam($_REQUEST, 'type', null));
        if ($type) {
            // adding a new item - type selection form
            require $path . $type . '/' . $type . '.menu.php';
        } else {
            viewMenuItems($menutype, $option);
        }
        break;
}
/**
* Shows a list of items for a menu
*/
function viewMenuItems($menutype, $option)
function savePluginOrder(&$cid, $option)
{
    global $_CB_framework, $_CB_database;
    $row = new moscomprofilerPlugin($_CB_database);
    $msg = saveOrder($cid, $row, "\$condition = \"type='\$row->type' AND ordering > -10000 AND ordering < 10000 \";");
    cbRedirect($_CB_framework->backendUrl("index.php?option={$option}&task=showPlugins"), $msg);
}
     break;
 case 'function_edit':
     editFunction(true);
     break;
 case 'function_save':
 case 'function_apply':
     saveFunction();
     break;
 case 'function_orderup':
     orderItem('#__community_acl_functions', 'group_id', $cid[0], -1);
     break;
 case 'function_orderdown':
     orderItem('#__community_acl_functions', 'group_id', $cid[0], 1);
     break;
 case 'function_saveorder':
     saveOrder($cid, '#__community_acl_functions', 'group_id');
     break;
 case 'function_publish':
     publishItem('#__community_acl_functions', $cid, 1);
     break;
 case 'function_unpublish':
     publishItem('#__community_acl_functions', $cid, 0);
     break;
 case 'function_delete':
     deleteItem('#__community_acl_functions', $cid);
     break;
 case 'function_sync':
     changeItem('#__community_acl_functions', $cid, 1);
     break;
 case 'function_unsync':
     changeItem('#__community_acl_functions', $cid, 0);
Esempio n. 12
0
function checkAndSaveOrder()
{
    if (!getSession('USER')) {
        if (!isset($_POST['USER'])) {
            return false;
        }
        setSession('USER', array('name' => $_POST['USER']['name'], 'phone' => $_POST['USER']['phone'], 'email' => $_POST['USER']['email'], 'address' => $_POST['USER']['address']));
    }
    $orders = getSession('basket');
    foreach ($orders as $order) {
        saveOrder($order);
        /*if(!saveOrder($order));
          return false;*/
    }
    return true;
}
Esempio n. 13
0
    // so checkout is not allowed
    header('Location: cart.php');
} else {
    if (isset($_GET['step']) && (int) $_GET['step'] > 0 && (int) $_GET['step'] <= 3) {
        $step = (int) $_GET['step'];
        $includeFile = '';
        if ($step == 1) {
            $includeFile = 'shippingAndPaymentInfo.php';
            $pageTitle = 'Checkout - Step 1 of 2';
        } else {
            if ($step == 2) {
                $includeFile = 'checkoutConfirmation.php';
                $pageTitle = 'Checkout - Step 2 of 2';
            } else {
                if ($step == 3) {
                    $orderId = saveOrder();
                    $orderAmount = getOrderAmount($orderId);
                    $_SESSION['orderId'] = $orderId;
                    // our next action depends on the payment method
                    // if the payment method is COD then show the
                    // success page but when paypal is selected
                    // send the order details to paypal
                    if ($_POST['hidPaymentMethod'] == 'cod') {
                        header('Location: success.php');
                        exit;
                    } else {
                        $includeFile = 'paypal/payment.php';
                    }
                }
            }
        }
Esempio n. 14
0
     $phone = clearStr($_POST['phone']);
     $price = clearInt($_POST['price']);
     //адресс доставки
     if ($_POST['delivery'] === 'on' and !empty($_POST['address'])) {
         $delivery_type = "Курьерская доставка";
         $address = clearStr($_POST['address']);
     } elseif (empty($_POST['address']) and !empty($_POST['delivery'])) {
         $delivery_type = "Самовывоз";
         $address = clearStr($_POST['delivery']);
     } else {
         return false;
     }
     //конец адреса
     regUser($name = "", $login, $password = "", $email, $phone, $role = "inactive");
     if (empty($error_reg)) {
         saveOrder($bucket, $price, $user_id, $delivery_type, $address);
         header("Location: success.php?not");
         exit;
     } else {
         header("Location:" . $_SERVER['HTTP_REFERER'] . "?error_reg={$error_reg}");
         exit;
     }
 } elseif (isset($_POST['logIn'])) {
     //авторизация
     $login = clearStr($_POST['login']);
     $password = clearStr($_POST['pass']);
     authUser($login, $password);
     if ($arr['isAuth'] === 1) {
         $_SESSION['login'] = $login;
         $_SESSION['auth'] = 1;
     } elseif ($arr['isAuth'] === 2) {
Esempio n. 15
0
     editSlide(0, $option, $fpss_config);
     break;
 case "edit":
     editSlide($cid[0], $option, $fpss_config);
     break;
 case "save":
     saveSlide($option);
     break;
 case "orderup":
     orderSlide($cid[0], -1, $option);
     break;
 case "orderdown":
     orderSlide($cid[0], 1, $option);
     break;
 case "saveorder":
     saveOrder($cid, $option);
     break;
 case "publish":
     publishImages($cid, 1, $option);
     break;
 case "unpublish":
     publishImages($cid, 0, $option);
     break;
 case "deleteslides":
     deleteSlides($option);
     break;
 case 'accesspublic':
     accessMenu(intval($cid[0]), 0, $option, $task);
     break;
 case 'accessregistered':
     accessMenu(intval($cid[0]), 1, $option, $task);
Esempio n. 16
0
$username = "******";
$password = "";
$dbname = "test";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    header('Access-Control-Allow-Origin: *');
    return $_POST;
    $action = $_POST['ACTION'];
    switch ($action) {
        case 'save_order':
            saveOrder($_POST);
            break;
        default:
            break;
    }
}
function saveOrder($POST_PARAMS)
{
    $sql = "INSERT INTO pizza_orders (id, cust_name, cust_tel, cust_email, pizza_size, pizza_topping, delivery_time, delivery_instructions)\n\tVALUES ('John', 'Doe', '*****@*****.**')";
    if ($conn->query($sql) === TRUE) {
        echo "New record created successfully";
    } else {
        echo "Error: " . $sql . "<br>" . $conn->error;
    }
    $conn->close();
}