$login = ConfigSites::sessionId(); $data = DB::selectSql("SELECT\n\t\t\t\t\tcart.id as id,\n\t\t\t\t\tprice.id as price_id,\n\t\t\t\t\tprice.name as name,\n\t\t\t\t\tprice.price as price,\n\t\t\t\t\tcart.size as size,\n\t\t\t\t\tcart.kol as kol,\n\t\t\t\t\tprice_photo.src as src,\n\t\t\t\t\tcolors.rgb as color\n\t\t\t\t\tFROM cart\n\t\t\t\t\tLEFT JOIN price ON price.id=cart.price_id\n\t\t\t\t\tLEFT JOIN colors ON colors.id=cart.color\n\t\t\t\t\tLEFT JOIN price_photo ON price_photo.price_id=cart.price_id AND price_photo.color=cart.color\n\t\t\t\t\tWHERE login='******'"); echo json_encode($data); break; case 'add_card': $now = ConfigSites::today(); $login = ConfigSites::sessionId(); $array = array('price_id' => $_POST['id'], 'login' => $login, 'size' => $_POST['size'], 'color' => $_POST['color'], 'kol' => $_POST['kol'], 'date' => $now); $lastId = DB::insert(DB::insertSql("cart", $array), $array); return $lastId; break; case 'card_count_minus': DB::updatePM("UPDATE `cart` SET `kol` = `kol`-1 WHERE id =" . $_POST['id']); break; case 'card_count_plus': DB::updatePM("UPDATE `cart` SET `kol` = `kol`+1 WHERE id =" . $_POST['id']); break; case 'delete_card': DB::deleteCart($_POST['id']); break; case 'oformzakaz': $headers = "Content-type: text/html; charset=utf-8 \r\n"; $headers .= "From: GLZN <*****@*****.**>\r\n"; $td1_style = "border: 1px solid #000; max-width: 140px; padding: 5px 10px; font-weight: bold; background-color: #e8e8e8;"; $td2_style = "border: 1px solid #000; max-width: 460px; min-width: 300px; padding: 5px 10px;"; $now = ConfigSites::today(); $maillist = explode("|", ConfigSites::$emailsArr); $array = array("date" => $now, "sun" => $_POST['sumzakaz'], "sun_dost" => $_POST['sumdost'], "name" => $_POST['name'], "phone" => $_POST['phone'], "email" => $_POST['email'], "region" => $_POST['address_state'], "city" => $_POST['city'], "index" => $_POST['cityindex'], "street" => $_POST['street'], "house" => $_POST['house'], "comment" => $_POST['comment'], "delivery" => $_POST['delivery'], "type_payment" => $_POST['payment'], "payment" => "false"); $lastId = DB::insert(DB::insertSql("count_zakaz", $array), $array); $msg_admin = "\n <html>\n <body>\n <table style=\"border-collapse: collapse;\">\n <tr>\n <td style=\"{$td1_style}\">Имя</td>\n <td style=\"{$td2_style}\">" . $_POST['name'] . "</td>\n </tr>\n <tr>\n <td style=\"{$td1_style}\">Номер телефона</td>\n <td style=\"{$td2_style}\">" . $_POST['phone'] . "</td>\n </tr>\n <tr>\n <td style=\"{$td1_style}\">Email</td>\n <td style=\"{$td2_style}\">" . $_POST['email'] . "</td>\n </tr>\n <tr>\n <td style=\"{$td1_style}\">Номер заказа</td>\n <td style=\"{$td2_style}\">" . $lastId . "</td>\n </tr>\n </table>\n </body>\n </html>"; $subject_admin = "Новый заказ с сайта GLZN №" . $lastId;
foreach ($readbleArray as $k => $v) { $array = array("nn" => $a, "parent" => $readbleArray[$k]["parentID"]); DB::update(DB::updateSql($table, $array), $array, $readbleArray[$k]["id"]); $a++; } break; case 'savesortprice': $data = $_POST["array"]; $prices = json_decode($data, true); foreach ($prices as $price) { $array = array("nn" => $price["nn"]); DB::update(DB::updateSql("price", $array), $array, $price["id"]); } break; case 'editDefStatus': DB::updatePM("UPDATE `status-zakaz` SET `default`='0'"); $array = array("default" => 1); $res = DB::update(DB::updateSql("status-zakaz", $array), $array, $_POST['id']); echo json_encode($res); break; case 'sizes': $array = array("height" => $_POST['height'], "width" => $_POST['width']); $result = DB::insert(DB::insertSql($_POST['table'], $array), $array); echo json_encode($result); break; case 'delete': if (isset($_POST['arr_data'])) { $arr_sizes = json_decode($_POST['arr_data']); foreach ($arr_sizes as $key => $id) { $result = DB::del($_POST['table'], $id); }
<?php include "models/function.php"; $id_lessons = $_GET['id_lessons']; $id_clients = $_GET['id_clients']; DB::updatePM("UPDATE answer set view=1 WHERE id_lessons={$id_lessons} and id_clients={$id_clients}"); if (isset($_POST['go'])) { $today = DB::today(); $array = array("id_lessons" => $_POST['id_lessons'], "id_clients" => $_POST['id_clients'], "text" => $_POST['text'], "date" => $today, "piple" => "admin", "src" => ""); DB::insert(DB::insertSql("answer", $array), $array); header("Location: answer_view.php?id_lessons=" . $_POST['id_lessons'] . "&id_clients=" . $_POST['id_clients'] . "#chat"); } $dz = DB::selectParam("homework", "id_lessons", $id_lessons); $answer = DB::selectSql("SELECT * FROM answer WHERE id_lessons={$id_lessons} AND (id_clients={$id_clients} OR id_clients=0)"); require_once 'view/tpl_top.php'; ?> <div class="app app-header-fixed"> <?php include "view/tpl_popup_events.php"; include "view/header.php"; $active_g = "class=\"active\""; include "view/nav.php"; ?> <!-- content --> <div id="content" class="app-content" role="main"> <div class="app-content-body "> <div class="hbox hbox-auto-xs hbox-auto-sm"> <div class="col"> <div class="bg-light lter b-b wrapper-md wrapper-md__i"> <h1 class="m-n font-thin h3 inline">Материалы к уроку: <?php echo $less[0]['name'];
<?php include "models/function.php"; $param = "price"; if (isset($_POST['go'])) { DB::updatePM("UPDATE price SET kol='0'"); $results = Price::importPrice($_FILES); foreach ($results as $result) { $res_tmp = DB::selectParam($param, "nomer", $result['nomer']); if (!$res_tmp) { $search[] = array("nomer" => $result['nomer']); } $arrUpdate = DB::updatePM("UPDATE price SET kol='{$result['kol']}' WHERE nomer = '{$result['nomer']}'"); } } require_once 'view/tpl_top.php'; ?> <div class="app app-header-fixed "> <?php include "view/header.php"; $active_d = "class=\"active\""; include "view/nav.php"; ?> <!-- content --> <div id="content" class="app-content" role="main"> <div class="app-content-body "> <div class="hbox hbox-auto-xs hbox-auto-sm"> <div class="col"> <div class="bg-light lter b-b wrapper-md wrapper-md__i"> <h1 class="m-n font-thin h3 inline">Обновление прайс листа</h1> </div>
$id = $_POST['id']; $result = DB::selectSql(" SELECT cost, old_cost FROM cart WHERE id = '$id' "); echo json_encode($result); break; case 'kol': $id = $_POST['id']; $kol = $_POST['kol']; $summ = $_POST['summ']; $old_sum = $_POST['sum_old']; $result = DB::updatePM(" UPDATE cart SET kol = $kol , summ = $summ , old_sum = $old_sum WHERE id = $id "); echo json_encode($result); break; case 'delCart': DB::deleteCart($_POST['id']); break; case 'search': // echo json_encode("sadsadsa"); $search = json_decode($_POST['array']); //echo json_encode($search); if (isset($_POST['limit'])) { $idx = $_POST['limit'];
include "models/function.php"; IncludeClass::inc(array("Catalog")); $param = "catalog"; $record = false; if (isset($_GET['top'])) { $id_prod = $_GET['top']; $sql = "UPDATE price SET nn = 0 WHERE id = {$id_prod}"; DB::updatePM($sql); } if (isset($_GET['down'])) { $id = $_GET['id']; $sql_count = "SELECT count(nn)as amount FROM price WHERE section={$id}"; $count = DB::selectSql($sql_count); $id_prod = $_GET['down']; $sql = "UPDATE price SET nn =" . $count[0]['amount'] . " WHERE id = {$id_prod}"; DB::updatePM($sql); } if (isset($_POST["go"])) { $table = $_POST["table"]; if ($table == "catalog") { if (!$_POST["name_en"]) { $_POST["name_en"] = Rename::replace($_POST["name_ru"]); } else { $_POST["name_en"] = Rename::replace($_POST["name_en"]); } $array = array("name_ru" => $_POST['name_ru'], "name_en" => $_POST['name_en'], "parent" => $_POST['parent'], "title" => $_POST['title'], "desc" => $_POST['desc'], "keywords" => $_POST['keywords']); } else { $array = array("name_ru" => $_POST['name_ru'], "title" => $_POST['title'], "text" => $_POST['text'], "parent" => 0); $src = DB::filesUpload($_FILES['photo'], $_POST["table"]); if ($src != false) { $array += array("src" => $src);
} break; case 'card': $login = ConfigSites::sessionId(); $result = DB::selectSql("SELECT cart.id as id, cart.kol as kol, price.name as name, price.nomer as nomer, price.price as price, price.price_old as price_old, price_photo.src as src FROM cart LEFT JOIN price ON price.id=cart.price_id LEFT JOIN price_photo ON price_photo.price_id=cart.price_id WHERE cart.login='******' GROUP BY cart.id"); echo json_encode($result); break; case 'kol': if ($_POST['kol'] == "plus") { DB::updatePM("UPDATE `cart` SET `kol` = `kol`+1 WHERE id =" . $_POST['id']); } else { DB::updatePM("UPDATE `cart` SET `kol` = `kol`-1 WHERE id =" . $_POST['id']); } break; case 'prepay': DB::updatePM("UPDATE `cart` SET `percent` = " . $_POST['percent'] . " WHERE id =" . $_POST['id']); break; case 'delCart': DB::deleteCart($_POST['id']); break; case 'promo': if (isset($_POST['promocode'])) { $promocode = trim($_POST['promocode']); $promo = DB::selectSql("SELECT * FROM promo"); $promo = unserialize($promo[0]["promocode"]); foreach ($promo as $key => $val) { if ($key == $_POST['promocode']) { $result = array('promocode' => $key, 'percent' => $val); break; } else { $result = false;