Example #1
0
include "models/function.php";
if (isset($_POST["go"])) {
    $objImg = new UploadImg();
    $name_img = $objImg->upload($_FILES, $_POST["photo_now"]);
    $objAttr = new AttrValue();
    $data_attr = $objAttr->conbine($_POST["attr"], $_POST["val"]);
    if (isset($_POST["related"]) and $_POST["related"]) {
        $related = array_slice($_POST["related"], 0, 4);
        $data_related = serialize($related);
    } else {
        $data_related = "";
    }
    require_once "classes/Product.php";
    $obj = new Product();
    if ($_POST["go"] == "save") {
        $fff = $obj->insert($obj->insertSql(), trimStr($_POST["section"]), trimStr($_POST["name"]), trimStr($_POST["nomer"]), trimStr($_POST["brand"]), trimStr($_POST["viscous"]), trimStr($_POST["type"]), trimStr($_POST["volume"]), trimStr($_POST["kol"]), trimStr($_POST["price"]), trimStr($_POST["text"]), $data_related, $data_attr, trimStr($_POST["title"]), trimStr($_POST["description"]), trimStr($_POST["keywords"]), $name_img, trimStr($_POST["img_title"]), trimStr($_POST["img_alt"]));
        header("Location: production.php?id=" . $_POST["section"]);
    } else {
        $obj->update($obj->updateSql(), trimStr($_POST["section"]), trimStr($_POST["name"]), trimStr($_POST["nomer"]), trimStr($_POST["brand"]), trimStr($_POST["viscous"]), trimStr($_POST["type"]), trimStr($_POST["volume"]), trimStr($_POST["kol"]), trimStr($_POST["price"]), trimStr($_POST["text"]), $data_related, $data_attr, trimStr($_POST["title"]), trimStr($_POST["description"]), trimStr($_POST["keywords"]), $name_img, trimStr($_POST["img_title"]), trimStr($_POST["img_alt"]), $_POST['go']);
        header("Location: production.php?id=" . $_POST["section"]);
    }
}
if (isset($_GET["delete"])) {
    $delete = new Delete();
    $delete->del($_GET["title"], $_GET["delete"]);
    header("Location: production.php?id=" . $_GET["delete"]);
}
require_once "classes/Catalog.php";
$section = new Catalog();
require_once "classes/Product.php";
$objEdit = new Product();