function onEndTag($parser, $name) { global $attr, $attrVal, $offer, $offersCount, $offerCategories, $pictNum, $foundIDs, $stop; if ($attr) { if (is_string($attr) && $attr == 'cat') { $offerCategories[] = $attrVal; } else { if (is_string($attr) && substr($attr, 0, 5) == 'image') { $_FILES[$attr] = array('type' => 'url', 'name' => $attrVal); } else { if ($attr[0] == 'manufacturer_id') { $attrVal = getManufacturerID($attrVal); } foreach ($attr as $field) { $offer[$field] = $attrVal; } } } $attr = false; $attrVal = ''; } if ($name == 'OFFER') { $pictNum = 0; ++$offersCount; $id = addProduct($offer, $offerCategories); if ($id) { $foundIDs[$id] = true; } if ($offersCount > 4) { $stop = true; } } }
redirect(''); } else { // include needed database functions include_once $BASE_PATH . 'database/products.php'; $name = strip_tags($_POST['name']); $price = strip_tags($_POST['price']); $quantity = strip_tags($_POST['quantity']); $brandid = strip_tags($_POST['brandid']); $description = strip_tags($_POST['description']); $image = ""; if (($_FILES["image"]["type"] == "image/jpeg" || $_FILES["image"]["type"] == "image/jpg") && $_FILES["image"]["size"] < $maxfilesize) { $image = base64_encode(file_get_contents($_FILES['image']['tmp_name'])); } if (!empty($name) && !empty($price) && isset($quantity) && !empty($brandid)) { if ($brandid == 'other') { $newbrand = strip_tags($_POST['newbrand']); if (!empty($newbrand)) { include_once $BASE_PATH . 'database/brands.php'; $brandid = addBrand($newbrand); } else { echo "Fill new brand name"; die; } } addProduct($name, $price, $quantity, $brandid, $description, $image); } else { echo "Fill all fields"; die; } redirect('pages/manager/products/list_products.php'); }
case "add": // for 1.6 task='add' instead 'new' as in 1.5 editBook($option, 0); break; case "edit": editBook($option, array_pop($bid)); break; case "show_all": unsetCatId(); break; case "Delproduct": delProduct($bid); showBooks($option); break; case "Addproduct": addProduct($bid, $option); break; case "refetchInfos": refetchInfo($option, $bid); break; case "apply": case "save": saveBook($option, $task); break; case "remove": removeBooks($bid, $option); break; case "publish": publishBooks($bid, 1, $option); break; case "unpublish":
function Products_Spider_Catalog() { global $wpdb; require_once "products.php"; require_once "Products.html.php"; if (!function_exists('print_html_nav')) { require_once "nav_function/nav_html_func.php"; } if (isset($_GET['id'])) { $id = $_GET['id']; } else { $id = 0; } if (isset($_GET['task'])) { $task = $_GET['task']; } else { $task = ""; } switch ($task) { case 'edit_prad': editProduct($id); break; case 'add_prad': addProduct(); break; case 'apply': if ($id) { check_admin_referer('nonce_sp_cat', 'nonce_sp_cat'); update_prad_cat($id); } else { check_admin_referer('nonce_sp_cat', 'nonce_sp_cat'); save_prad_cat(); $id = $wpdb->get_var("SELECT MAX(id) FROM " . $wpdb->prefix . "spidercatalog_products"); } editProduct($id); break; case 'save': if ($id) { check_admin_referer('nonce_sp_cat', 'nonce_sp_cat'); update_prad_cat($id); } else { check_admin_referer('nonce_sp_cat', 'nonce_sp_cat'); save_prad_cat(); } showProducts(); break; case 'saveorder': break; case 'publish': check_admin_referer('nonce_sp_cat', 'nonce_sp_cat'); publish_all(TRUE); showProducts(); break; case 'unpublish': check_admin_referer('nonce_sp_cat', 'nonce_sp_cat'); publish_all(FALSE); showProducts(); break; case 'delete': check_admin_referer('nonce_sp_cat', 'nonce_sp_cat'); delete_all(); showProducts(); break; case 'unpublish_prad': $nonce_sp_cat = $_REQUEST['_wpnonce']; if (!wp_verify_nonce($nonce_sp_cat, 'nonce_sp_cat')) { die("Are you sure you want to do this?"); } change_prod($id); showProducts(); break; case 'unpublish_prad': $nonce_sp_cat = $_REQUEST['_wpnonce']; if (!wp_verify_nonce($nonce_sp_cat, 'nonce_sp_cat')) { die("Are you sure you want to do this?"); } change_prod($id); showProducts(); break; case 'remove_prod': $nonce_sp_cat = $_REQUEST['_wpnonce']; if (!wp_verify_nonce($nonce_sp_cat, 'nonce_sp_cat')) { die("Are you sure you want to do this?"); } removeProduct($id); showProducts(); break; case 'edit_reviews': spider_cat_prod_rev($id); break; case 'delete_reviews': check_admin_referer('nonce_sp_cat', 'nonce_sp_cat'); delete_rev($id); spider_cat_prod_rev($id); break; case 'delete_review': $nonce_sp_cat = $_REQUEST['_wpnonce']; if (!wp_verify_nonce($nonce_sp_cat, 'nonce_sp_cat')) { die("Are you sure you want to do this?"); } delete_single_review($id); spider_cat_prod_rev($id); break; case 'edit_rating': spider_cat_prod_rating($id); break; case 'delete_ratings': check_admin_referer('nonce_sp_cat', 'nonce_sp_cat'); delete_ratings($id); spider_cat_prod_rating($id); break; case 'delete_rating': $nonce_sp_cat = $_REQUEST['_wpnonce']; if (!wp_verify_nonce($nonce_sp_cat, 'nonce_sp_cat')) { die("Are you sure you want to do this?"); } delete_single_rating($id); spider_cat_prod_rating($id); break; case 's_p_apply_rating': check_admin_referer('nonce_sp_cat', 'nonce_sp_cat'); update_s_c_rating($id); spider_cat_prod_rating($id); break; case 's_p_save_rating': check_admin_referer('nonce_sp_cat', 'nonce_sp_cat'); update_s_c_rating($id); editProduct($id); break; default: showProducts(); break; } }
getCategoryList($r); break; case 'changeCategory': changeCategory($q[1]); break; case 'removeCategory': removeCategory($r); break; case 'getCategory': getCategory(intval($r), $s); break; case 'getProduct': getProduct(intval($r), $s); break; case 'addProduct': addProduct(intval($r)); break; case 'removeProduct': removeProduct(intval($r)); break; case 'addDosage': addDosage(intval($r)); break; case 'removeDosage': removeDosage(intval($r)); break; case 'updateCategory': updateCategory(intval($r), $s); break; case 'updateProduct': updateProduct(intval($r), $s, $t);
<?php require_once '../../library/config.php'; require_once '../library/functions.php'; checkUser(); $action = isset($_GET['action']) ? $_GET['action'] : ''; switch ($action) { case 'addProduct': addProduct(); break; case 'modifyProduct': modifyProduct(); break; case 'deleteProduct': deleteProduct(); break; case 'deleteImage': deleteImage(); break; default: // if action is not defined or unknown // move to main product page header('Location: index.php'); } function addProduct() { $catId = $_POST['cboCategory']; $name = $_POST['txtName']; $description = $_POST['mtxDescription']; $price = str_replace(',', '', (double) $_POST['txtPrice']); $qty = (int) $_POST['txtQty'];
$price = strip_tags($_POST['price']); if (isset($_POST['$taxable'])) { $taxable = 1; } else { $taxable = 0; } if (!empty($id) && !empty($quantity) && !empty($genre) && !empty($platform) && !empty($name) && !empty($image) && !empty($description) && !empty($price)) { require_once 'maintain_products.php'; $result = viewProduct($id); $rows = mysql_num_rows($result); if ($rows > 0) { // This product exists, therefore you need to update. updateProduct($id, $quantity, $genre, $platform, $name, $image, $description, $price, $taxable); } else { // This is a new product. addProduct($quantity, $genre, $platform, $name, $image, $description, $price, $taxable); } } else { echo 'Please go back and make sure to fill out all the fields.'; } echo '<br /><br /><a href="addUpdateProducts.php">Go back</a>'; } else { echo "You do not have the permissions to do that."; } } else { echo 'Please <a href="index.html">login</a>.'; } ?> </div> </body>
require_once "lib.inc.php"; $GLOBAL_SESSION = returnsession(); header('Content-Type:text/xml;charset=GB2312'); $action = $_GET["action"]; //获取操作 $productId = $_GET["productId"]; //获取产品编号 $rowid = $_GET["rowid"]; //主表ID $tablename = $_GET["tablename"]; //表名 $disable = ""; $id = $_GET["id"]; //当前记录ID if ($action == "add") { addProduct($_GET['oldproductid'], $_GET['supplyid']); //增加新产品 } else { if ($action == "empty") { clearProduct($rowid); //清空列表 } else { if ($action == "del") { delProduct($id); //删除产品 } else { if ($action == "updatePrice") { $price = $_GET["price"]; updateProductPrice($id, $price); //更新产品价格 } else {
$productName = $_POST['productName']; $factoryID = $_POST['idfactory']; $productDetail = $_POST['detail_order']; $difference_amount = $_POST['difference_amount']; $bigestPriceResult = $_POST['bigestPriceResult'] . str_replace(",", ""); //ส่งข้อมูล หน่วยสินค้า มาหน้านี้ $units = $_SESSION["unit"]; //สิ้นสุดกลุ่มรับค่า // //กลุ่มคำสั่งทำอะไร //if (!checkcode($productCode)) { //echo checkDuplicateProduct($productName, $factoryID); if (isset($_SESSION["unit"])) { //ถามว่า$_SESSION["unit"]ถูกสร้างหรือยัง if (!checkDuplicateProduct($productName, $factoryID)) { $idproduct = addProduct($factoryID, $productName, $productDetail, $difference_amount); //idproductของระบบ echo "idproduct=" . $idproduct; if ($idproduct > 0) { $idUnit[1] = addUnit($idproduct, 0, $units[1]['AmountPerUnit'], $units[1]['NameUnit'], $units[1]['price'], $units[1]['type']); for ($i = 2; $i <= count($units); $i++) { $under_unit = $units[$i]['under_unit']; $underIdUnit = $idUnit[$under_unit]; $idUnit[$i] = addUnit($idproduct, $underIdUnit, $units[$i]['AmountPerUnit'], $units[$i]['NameUnit'], $units[$i]['price'], $units[$i]['type']); } unset($_SESSION["unit"]); unset($_SESSION["countUnit"]); header("location: ../product.php?p=product&action=addCompleted"); // echo "finished"; } else { unset($_SESSION["unit"]);
<?php include_once '/var/www/html/cloud/models/db/dbLib.php'; include_once '/var/www/html/cloud/models/db/session.php'; include_once '/var/www/html/cloud/models/inventory/addProduct.php'; extract($_REQUEST); $res = addProduct($name, $brand, $desc, $tags, $size, $madeIn, $condition, $num, $sku, 'pending', $estVal, $pic1, $pic2, $pic3, $pic4);
<?php chdir("../../database"); require_once "store_backoffice.php"; if (isset($_GET["storeId"]) and isset($_GET["name"]) and strlen($_GET["name"]) > 0 and isset($_GET["description"]) and strlen($_GET["description"]) > 0 and isset($_GET["base_cost"]) and strlen($_GET["base_cost"]) > 0 and isset($_GET["stock"]) and strlen($_GET["stock"]) > 0) { $categoryId = checkCategory("no category", $_GET["storeId"]); $categoryId = $categoryId[0]["id"]; if (isset($_GET["category"]) and strlen($_GET["category"]) > 0) { $checkExists = checkCategory($_GET["category"], $_GET["storeId"]); if (isset($checkExists[0]["id"])) { $categoryId = $checkExists[0]["id"]; } } $imageId = getFileByName("no image"); $imageId = $imageId[0]["id"]; addProduct($_GET["name"], $_GET["description"], $_GET["base_cost"], $_GET["stock"], $categoryId, $imageId); echo json_encode(array("result" => "ok")); } else { echo json_encode(array("result" => "missingParams")); }
<?php include_once __DIR__ . '/templates/_libAdmin.php'; include_once __DIR__ . '/templates/_header.php'; include_once __DIR__ . '/templates/_top_menu.php'; echo "<div class='wr_cont'>"; if (isset($_GET['item_act'])) { if (isset($_GET['item_id'])) { $t_id = $_GET['item_id']; } switch ($_GET['item_act']) { case 'edit': editProduct($t_id, $connection); echo "Товар с id='" . $t_id . "' успешно изменён<br/><br/>"; break; case 'del': deleteProduct($t_id, $connection); echo "Товар с id='" . $t_id . "' успешно удалён<br/><br/>"; break; case 'add': addProduct($connection); echo "Товар успешно добавлен<br/><br/>"; break; } } //вывод таблицы товаров на странице редактирования товаров showTableProducts($connection); echo "</div>"; include_once __DIR__ . '/templates/_footer.php';
$smarty->config_dir = '../configs/'; $smarty->cache_dir = '../cache/'; //start the program code unserialCesta(); //assign the user to a var so we can use it easier $user = $_SESSION['username']; $smarty->assign('user', $user); //if user wants to log out, we redirect to login page if (isset($_POST['logout'])) { header("Location: ./login.php"); } //if user wants to add a product if (isset($_POST['add'])) { $prod_name = filter_input(INPUT_POST, 'nombre_corto'); $prod_pvp = filter_input(INPUT_POST, 'PVP'); addProduct($prod_name, $prod_pvp); } //when user wants to drop the cart if (isset($_POST['clear'])) { unset($_SESSION['cesta']); } //if user wants to purchase if (isset($_POST['buy'])) { header("Location: ./comprar.php"); } $smarty->assign('products', listProduct()); //prepare the cart to be shown foreach ($_SESSION['cesta'] as $key => $value) { $cart[$key] = $value->getProd(); $fullPrice += $value->getPrice(); }
<?php include $_SERVER['DOCUMENT_ROOT'] . "/CD-Genius/config.php"; include "functions.php"; session_start(); if (!$_SESSION['admin'] == 1) { header("location: {$base_url}/views/home.php"); } $query = "SELECT products.product_id, products.name, products.price, artists.artist_name, genres.genre_name , labels.label_name\n FROM products \n JOIN artists ON products.artist_id = artists.artist_id\n JOIN genres ON products.genre_id = genres.genre_id\n JOIN labels ON products.label_id = labels.label_id"; $result = mysqli_query($db, $query); if (!$result) { die('Invalid query: ' . mysqli_error($db)); } if (isset($_POST['add-product-button'])) { addProduct($db); header("Refresh:0"); } if (isset($_POST['delete-product-button'])) { deleteProduct($db); header("Refresh:0"); } if (isset($_POST['add-artist-button'])) { addArtist($db); header("Refresh:0"); } if (isset($_POST['add-label-button'])) { addLabel($db); header("Refresh:0"); } if (isset($_POST['add-genre-button'])) { addGenre($db);
include_once $_SERVER['DOCUMENT_ROOT'] . '/src/database/dbFunctions.inc'; $action = filter_input(INPUT_GET, "action", FILTER_SANITIZE_STRING); $jtSorting = filter_input(INPUT_GET, "jtSorting", FILTER_SANITIZE_STRING); $jTableResult = array(); switch ($action) { case "productsList": if (!empty($jtSorting)) { $rows = productsListOrderBy($jtSorting); } else { $rows = productsList(); } $jTableResult['Result'] = "OK"; $jTableResult['Records'] = $rows; break; case "addProduct": $res = addProduct(filter_input(INPUT_POST, "nombre", FILTER_SANITIZE_STRING), filter_input(INPUT_POST, "precio", FILTER_SANITIZE_STRING)); //Return result to jTable if ($res) { $jTableResult['Result'] = "OK"; $jTableResult['Record'] = productsList(); } else { $jTableResult['Result'] = "ERROR"; } break; case "modifyProduct": $res = modifyProduct(filter_input(INPUT_POST, "IDP", FILTER_SANITIZE_STRING), filter_input(INPUT_POST, "nombre", FILTER_SANITIZE_STRING), filter_input(INPUT_POST, "precio", FILTER_SANITIZE_STRING)); //Return result to jTable if ($res) { $jTableResult['Result'] = "OK"; } else { $jTableResult['Result'] = "ERROR";
$storeid = returntablefield("sellplanmain", "billid", $_GET['rowid'], "storeid"); } } } } } } } $id = $_GET["id"]; //当前记录ID if ($action == "add") { $im = $_GET["im"]; //输入方式 1=搜索,2=条码,3=选择 $addnum = $_GET["addnum"]; //条码输入时,增加的数量 addProduct($productId, $im, $addnum); //增加新产品 } else { if ($action == "empty") { clearProduct($rowid); //清空列表 } else { if ($action == "del") { delProduct($id); //删除产品 } else { if ($action == "updatePrice") { $price = $_GET["price"]; updateProductPrice($id, $price); //更新产品价格 } else {
?> " method="post"> <h3>Produkt hinzufügen</h3> <label>Produkte:</label> <p><input type="text" name="productAdd"> </p> <input type="submit" value="Hinzufügen"> <?php if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["productAdd"])) { $productAdd = filterfunktion($_POST["productAdd"]); if ($_POST["productAdd"] != "") { try { addProduct($productAdd); //TO DO leere.php ersetzen mit Auflistung der eingegebenen Daten //header('Location: leere.php'); } catch (Exception $e) { echo "Fehler beim Datenbankzugriff. Bitte dem Administrator Bescheid geben."; } } else { echo "TEST"; } } ?> </form> </div> </div> <?php
function controller_insertProduct() { view_insertProduct(); if (!empty($_POST['nameProduct'])) { $nameProduct = $_POST['nameProduct']; $price = $_POST['price']; $res = mysqli_query(connect(), "SELECT id FROM products WHERE name = '{$nameProduct}'"); $row = mysqli_fetch_row($res); $count = $row[0]; close_bd(); if (!preg_match("/^[a-zA-Z0-9]+\$/", $_POST['nameProduct'])) { echo "Название может состоять только из букв английского алфавита и цифр"; } elseif (!preg_match("/^[0-9]+\$/", $_POST['price'])) { echo "Цена может состоять только цифр<br>"; } elseif (strlen($_POST['nameProduct']) < 3 or strlen($_POST['nameProduct']) > 30) { echo "Название должно быть не меньше 3-х символов и не больше 30"; } elseif (!empty($count)) { echo "Продукт с таким названием уже существует, придумайте другое"; } else { addProduct(); } } }
} } echo $products; } } function getToken() { if (isset($_COOKIE['token'])) { return $_COOKIE['token']; } else { header('location:login.php'); } } if (isset($_POST['add'])) { $id = $_POST['id']; addProduct($dbh, $id); } if (isset($_POST['delete'])) { $id = $_POST['id']; deleteProduct($dbh, $id); } ?> <!DOCTYPE html> <head> <title>New York Apartments</title> <link rel="stylesheet" type="text/css" href="styleSheet.css"> </head>
} else { array_push($backoffice['status'], 'No results found for ' . $_REQUEST['searchProduct_upc']); } } } else { array_push($backoffice['status'], 'batchProducts_result==0, allProducts_result error (' . mysql_error($link) . ')'); } } } } else { // TODO - Maybe still try to search products table? array_push($backoffice['status'], 'batchProducts_result error(' . mysql_error($link) . ')'); } } else { if (isset($_REQUEST['a']) && $_REQUEST['a'] == 'addProduct') { addProduct(&$backoffice); } } } require_once $_SERVER["DOCUMENT_ROOT"] . '/lib/materialized_batch.php'; $batchInfo_result = get_batchInfo(&$backoffice, $_REQUEST['id']); $batchInfo_row = mysql_fetch_assoc($batchInfo_result); $batchProducts_result = get_batchProducts(&$backoffice, $_REQUEST['id']); $html = '<!DOCTYPE HTML> <html> <head>'; $html .= head(); $html .= ' <link href="batch.css" media="screen" rel="stylesheet" type="text/css"/> <script src="batch.js" type="text/javascript"></script> <title>IS4C - Sale Batches</title>