예제 #1
0
파일: pieces.php 프로젝트: Jasabd/Plumms
     }
 }
 if ($_FILES['hookImg']['error'] == 0) {
     $hookImg = uploadPrdImage($_FILES['hookImg']['tmp_name'], $_FILES['hookImg']['name'], $_FILES['hookImg']['error']);
     if (strpos($hookImg, 'ERROR') !== false) {
         $error .= "Image upload error";
     }
 }
 //TBD: Validations
 if (count($pccolors) > 0 && count($pcdesign) > 0) {
     $newcartesianArr = cartesian(array($pccolors, $pcdesign));
     $cartesianArr = compareArr($cartesianArr, $newcartesianArr);
     foreach ($cartesianArr as $ind => &$product) {
         $filename = $product['color'] . "_" . $product['design'];
         if ($_FILES[$filename]['error'] == 0) {
             $newfile = uploadPrdImage($_FILES[$filename]['tmp_name'], $_FILES[$filename]['name'], $_FILES[$filename]['error']);
             if (strpos($newfile, 'ERROR') !== false) {
                 $error .= "Image upload error";
             } else {
                 $product['imagefile'] = $newfile;
             }
         }
     }
 }
 if (empty($error)) {
     if ($pcmode == "new") {
         //insert into database all product values
         $query = "INSERT INTO `pieces` (`carouselImg`,`imgheight`, `imgwidth`,`bodypart`, `centerx`, `centery`, `toppoints`,  `topX`, `topY`,`bottompoints`,  `botX`, `botY`,`color`, `texture`,`material`,`style`, `admintags`, `price`, `name`, `quantity`, `priority`, `hookImg`, `complist`, `compquantity`) VALUES (?, ?, ?, ?, ?, ?,?,?, ?,?, ?, ?,?,?,?,?,?, ?,?,?,?, ?,?,?)";
         $ins_stmt = $dbcon->prepare($query);
         if (!$ins_stmt) {
             die('Prepare Error : (' . $dbcon->errno . ') ' . $dbcon->error . ' query= ' . $query);
예제 #2
0
파일: products.php 프로젝트: Jasabd/Plumms
 }
 if ($mode != "new") {
     $mi = prepare_input($_POST['mi']);
     $ai1 = prepare_input($_POST['ai1']);
     $ai2 = prepare_input($_POST['ai2']);
     $pcustomized = prepare_input($_POST['pcustomized']);
     if (isset($_POST['designerPick'])) {
         $designerPick = $_POST["designerPick"];
     }
 }
 if ($pname == "" || $sdesc == "" || $pprice == "" || $pdesc == "" || $pquantity == "" || $addinfo == "" || $pcategory == "" || $pitem == "" || $pstatus == "" || $featured == "") {
     $error .= "Form Error.. some input is empty.";
 }
 $mainimage = uploadPrdImage($_FILES['mainfile']['tmp_name'], $_FILES['mainfile']['name'], $_FILES['mainfile']['error']);
 $alt1image = uploadPrdImage($_FILES['alt1file']['tmp_name'], $_FILES['alt1file']['name'], $_FILES['alt1file']['error']);
 $alt2image = uploadPrdImage($_FILES['alt2file']['tmp_name'], $_FILES['alt2file']['name'], $_FILES['alt2file']['error']);
 if (strpos($mainimage, 'ERROR') !== false && $mode == "new") {
     $error .= "Form Error.. main image uploads failed." . $_FILES['mainfile']['error'];
 }
 if (strpos($mainimage, 'ERROR') === false) {
     $mi = $mainimage;
 }
 if (strpos($alt1image, 'ERROR') === false) {
     $ai1 = $alt1image;
 }
 if (strpos($alt2image, 'ERROR') === false) {
     $ai2 = $alt2image;
 }
 if ($error == "") {
     if ($mode == "new") {
         $curr_userID = getCurrentUserID();