if ($_GET["orderby"] == "hit_count") { $url_orderBy = "hit_count"; } else { $url_orderBy = "PUB_DATE"; } } else { $url_orderBy = "PUB_DATE"; } //category if (isset($_GET["category"])) { $arr = array("少年", "動作", "愛情", "科幻", "驚嚇", "搞笑", "限制"); if (in_array($_GET["category"], $arr)) { $url_category = $_GET["category"]; } else { $url_category = "all"; } } else { $url_category = "all"; } //page if (isset($_GET["page"])) { if (lib_int_validate($_GET["page"])) { $url_page = $_GET["page"]; } else { $url_page = 1; } } else { $url_page = 1; } header("Location:../category.php?search_word={$url_keyword}&category={$url_category}&page=1&orderby={$url_orderBy}&form={$url_display}"); exit;
<?php include_once '../lib/glob.php'; include_once '../lib/lib.php'; if (!isset($_POST["cart_row_0"]) or !isset($_SESSION["id"])) { die("ERROR ON PAGE!"); } else { $cartObj3 = new cartDisplayer($_SESSION["id"]); $arr = array(); //check security for ($i = 0; $i < count($cartObj3->itemArr); $i++) { $arr[$i] = checkQTY3($_POST["pid_{$i}"], $_POST["cart_row_{$i}"]); if (!lib_int_validate($_POST["cart_row_{$i}"])) { die("ERROR ON PAGE"); } } for ($row = 0; $row < count($arr); $row++) { $cartObj3->changeItemQuantity($row, $arr[$row]); } setAlertMsg("更改已被保存!"); header("Location:../cart.php"); }
public function changeItemQuantity($row, $quan) { if (!lib_int_validate($quan)) { die("ERROR ON PAGE"); } else { $i = lib_parseInteger($row); if ($this->itemArr[$i]["quantity"] == $quan) { return; } else { if ($quan == 0) { $this->deleteItem($this->itemArr[$i]["cid"]); return; } else { if ($quan > 0) { $this->changeQuantity($this->itemArr[$i]["cid"], $quan); } } } } }