echo 'invalid image type'; exit; } $rand = rand(10000, 99999); $pics = strstr($picname, '.', true) . date("YmdHis") . $rand . 'thumbnail' . $type; $pic_path = "public_html/img/productImg/" . $pics; move_uploaded_file($_FILES['edit_thumbnail_photo_input']['tmp_name'], $pic_path); $thumbnail_exist = $photoMgr->checkThumbnail($product_id); if ($thumbnail_exist == false) { $photoMgr->AddPhoto($product_id, "thumbnail", $pic_path); } else { $photoMgr->updatePhoto($product_id, "thumbnail", "thumbnail", $pic_path); unlink($existingPhotoList['thumbnail']); } } $originalColorStr = $productMgr->getColor($product_id); $colorArr = explode(",", $originalColorStr); $photo_name_arr = ['edit_1_photo_input', 'edit_2_photo_input', 'edit_3_photo_input', 'edit_4_photo_input']; $imgColor = ""; $imgOriginalColor = ""; foreach ($photo_name_arr as $photo_name) { $picname = $_FILES[$photo_name]['name']; $picsize = $_FILES[$photo_name]['size']; if ($picname != "") { if ($picsize > 5120000) { echo 'image size cannot exceed 5m'; exit; } $type = strstr($picname, '.'); if ($type != ".gif" && $type != ".jpg" && $type != ".png") { echo 'invalid image type';
} $selected_product_id = addslashes(filter_input(INPUT_GET, 'selected_product_id')); $selected_product_color = addslashes(filter_input(INPUT_GET, 'color')); $product_selected = $productMgr->getProduct($selected_product_id); $selected_product_name = $product_selected['product_name']; $selected_product_description = $product_selected['description']; $selected_product_price = $product_selected['price']; $selected_product_stock = $product_selected['stock']; $selected_product_qty_id = $selected_product_id . 'qty'; $selected_qty_msg_id = $selected_product_id . 'msg'; $selected_add_btn_id = $selected_product_id . 'btn'; //if the customer is not logged in, the default quantity of product in the cart is 0 $selected_product_in_cart = 0; //if customer is logged in, check if the product is in the cart $selected_product_photoList = $photoMgr->getPhotos($selected_product_id); $selected_product_colorStr = $productMgr->getColor($selected_product_id); $selected_product_colorList = explode(",", $selected_product_colorStr); $color = !empty($selected_product_color) ? $selected_product_color : $selected_product_colorList[0]; if (!empty($userid)) { $selected_product_in_cart = $productMgr->retrieveItemQtyInShoppingCart($userid, $selected_product_id, $color); } ?> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="./public_html/css/bootstrap.min.css"> <link rel="stylesheet" href="./public_html/font-awesome-4.1.0/css/font-awesome.min.css"> <link rel="stylesheet" href="./public_html/css/main.css"> <link rel="stylesheet" href="./public_html/css/webShop.css"> <script src="./public_html/js/jquery-1.11.0.js"></script> <script src="./public_html/js/bootstrap.min.js"></script>