WHERE productID = ' . (int) $k; db_query($sql); } } if (CONF_UPDATE_GCV == '1') { update_psCount(1); } Redirect(_getUrlToSubmit()); } else { if (isset($_GET['terminate'])) { //delete product if (CONF_BACKEND_SAFEMODE) { //this action is forbidden when SAFE MODE is ON Redirect(_getUrlToSubmit() . '&safemode = yes'); } if (DeleteProduct($_GET['terminate'])) { Redirect(_getUrlToSubmit()); } else { Redirect(_getUrlToSubmit() . '&couldntToDelete = 1'); } } } } } if (isset($_POST['update_gc_value'])) { //update button pressed @set_time_limit(60 * 4); update_psCount(1); Redirect(ADMIN_FILE . '?dpt = catalog&sub = products_categories&categoryID = ' . (int) $_POST['categoryID']); } //calculate how many products are there in root category
// evaluate method switch ($method) { case 'PUT': UpdateProduct(); break; case 'POST': SaveProduct(); break; case 'GET': GetProducts(); break; case 'HEAD': echo "HEAD"; break; case 'DELETE': DeleteProduct(); break; case 'OPTIONS': echo "OPTIONS"; break; default: echo "{$method}"; break; } //// DB //// REST Functions // GET: /Usuario/uuser function GetProducts() { // session_start();
$error = 'დააფიქსირეთ პროდუქტის ფასი!'; } else { AddProd($user_id, $object_id, GetTransactionId($object_id), $prod_id, $prod_quantity, $s_price, $price); } } else { $error = GetProductionInfo($object_id, $prod_id); } } } } break; case 'delete_prod': $trans_det_id = $_REQUEST['trans_id']; $object_id = $_REQUEST['obj_id']; DeleteLog($trans_det_id); DeleteProduct($trans_det_id); if (CheckTransStatus($object_id)) { DeleteTransaction($object_id); } break; case 'save_transaction': $object_id = $_REQUEST['obj_id']; $car_number = $_REQUEST['car_number']; $status = CheckObjectStatus($object_id); if (!$status) { $error = 'პროდუქციის სია ცარიელია!'; } else { SaveTransaction($object_id, $car_number); } break; case 'abort_transaction':
} return $paging; } } /*########################################################### Section : Main ###########################################################*/ $user->AuthenticationAdmin(); if (empty($pf)) { ShowAllProducts(); ShowFormAllProducts(); } elseif ($pf == 'browse') { ShowAllProducts(); ShowFormAllProducts(); } elseif ($pf == 'add') { GetPaymentCurrency(); if ($process == 'add') { AddProduct(); } else { ShowFormAddProducts(); } } elseif ($pf == 'detail') { GetPaymentCurrency(); ShowDetailProduct(); ShowFormDetailProduct(); } elseif ($pf == 'delete') { DeleteProduct($_REQUEST['delete']); } elseif ($pf == 'search') { ShowSearchResultProducts(); ShowFormSearchResultProducts(); }
<?php /** * Created by PhpStorm. * User: Hoan * Date: 10/29/2015 * Time: 4:00 PM */ //Khởi động session session_start(); //Kiểm tra nếu chưa đăng nhập thì quay về trang đăng nhập if (!isset($_SESSION['user'])) { header('location:../user/login.php'); } //Require các file cần thiết require '../../configs/config.php'; require '../../libraries/connect.php'; require '../../models/product.php'; //Lấy product_id từ URL $product_id = $_GET['product_id']; //Xóa DeleteProduct($product_id); //Quay về trang danh sách sản phẩm header('location:list.php');
} // Inputs // Remarks // Returns if (isset($_GET["delete"])) { if (isset($_GET["productID"])) { $mpost = $_GET["productID"]; $q = db_query("select categoryID from " . PRODUCTS_TABLE . " where productID=" . (int) $mpost); $r = db_fetch_row($q); $categoryID = $r["categoryID"]; } if (CONF_BACKEND_SAFEMODE) { //this action is forbidden when SAFE MODE is ON Redirect(ADMIN_FILE . "?safemode=yes&productID=" . $_GET["productID"] . "&eaction=prod"); } DeleteProduct($_GET["productID"]); Redirect(ADMIN_FILE . "?dpt=catalog&sub=products_categories&categoryID=" . $categoryID . "&expandCat=" . $categoryID); } if (!isset($_GET["productID"])) { $_GET["productID"] = 0; } $productID = $_GET["productID"]; if (!isset($_POST["eproduct_available_days"])) { $_POST["eproduct_available_days"] = 7; } if (!isset($_POST["eproduct_download_times"])) { $_POST["eproduct_download_times"] = 5; } if (isset($_POST["eproduct_download_times"])) { $_POST["eproduct_download_times"] = (int) $_POST["eproduct_download_times"]; }
function DeleteAllProductsOfThisCategory($categoryID) { $q = db_query("select productID from " . PRODUCTS_TABLE . " where categoryID=" . (int) $categoryID); $res = true; while ($r = db_fetch_row($q)) { if (!DeleteProduct($r["productID"], 0)) { $res = false; } } if (CONF_UPDATE_GCV == '1') { update_psCount(1); } return $res; }