function sendOrder() { $oid = getorderID(); mysql_query("UPDATE orders SET status = 1, comment = '" . $_POST['comment'] . "' WHERE id = '" . $oid . "'"); $querys = mysql_query("SELECT * FROM cart WHERE order_id = '" . $oid . "'"); while ($do = mysql_fetch_array($querys)) { mysql_query("UPDATE products SET rest = (rest - '" . $do['quantity'] . "') WHERE id = '" . $do['product_id'] . "'"); } $user = getUser(); $zagolovok = 'Поступил новый заказ'; $text = "\n <table>\n <tr>\n <td>\n Номер заказа:\n </td>\n <td>\n " . $oid . "\n </td>\n </tr>\n <tr>\n <td>\n Компания:\n </td>\n <td>\n " . $user['company'] . "\n </td>\n </tr>\n <tr>\n <td>\n E-Mail:\n </td>\n <td>\n " . $user['email'] . "\n </td>\n </tr>\n <tr>\n <td>\n Телефон:\n </td>\n <td>\n " . $user['phone'] . "\n </td>\n </tr>"; $from = '*****@*****.**'; $headers = 'Content-type: text/html; charset=utf-8' . "\r\n"; $headers .= 'From: buelo@mail.ru' . "\r\n" . 'Reply-To: buelo@mail.ru' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); $to = '*****@*****.**'; mail($to, '=?UTF-8?B?' . base64_encode($zagolovok) . '?=', $text, $headers); header('Location: /load.php?p=cart&act=successsent'); }
function getItemExpect() { $query = mysql_query("SELECT cart.id, cart.price, cart.quantity, products.article, products.title, products.rest FROM cart LEFT JOIN products ON cart.product_id = products.id LEFT JOIN categories ON products.category_id = categories.id WHERE cart.order_id = '" . getorderID() . "' AND categories.expected"); return $query; }
<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/Config/db.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/Actions/cart.php'; if (!isLogined()) { header('Location: /products.php'); return; } if (isset($_GET['act']) && $_GET['act'] == 'sendorder') { $oid = getorderID(); mysql_query("UPDATE orders SET status = 1, comment = '" . $_POST['comment'] . "' WHERE id = '" . $oid . "'"); $querys = mysql_query("SELECT * FROM cart WHERE order_id = '" . $oid . "'"); while ($do = mysql_fetch_array($querys)) { mysql_query("UPDATE products SET rest = (rest - '" . $do['quantity'] . "') WHERE id = '" . $do['product_id'] . "'"); } $user = getUser(); $zagolovok = 'Поступил новый заказ'; $text = "\n <table>\n <tr>\n <td>\n Номер заказа:\n </td>\n <td>\n " . $oid . "\n </td>\n </tr>\n <tr>\n <td>\n Компания:\n </td>\n <td>\n " . $user['company'] . "\n </td>\n </tr>\n <tr>\n <td>\n E-Mail:\n </td>\n <td>\n " . $user['email'] . "\n </td>\n </tr>\n <tr>\n <td>\n Телефон:\n </td>\n <td>\n " . $user['phone'] . "\n </td>\n </tr>"; $from = '*****@*****.**'; $headers = 'Content-type: text/html; charset=utf-8' . "\r\n"; $headers .= 'From: sales@rostimport.md' . "\r\n" . 'Reply-To: sales@rostimport.md' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); $to = '*****@*****.**'; mail($to, '=?UTF-8?B?' . base64_encode($zagolovok) . '?=', $text, $headers); ?> <script> window.location = './?l=p&p=cart&act=successsent' </script><?php } ?> <style> #rightpanel table td { border-bottom: 1px solid #eee; padding: 5px 10px;